summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-08-28 16:52:12 +0200
committerMorris Jobke <morris.jobke@gmail.com>2013-08-28 16:52:12 +0200
commited2fa06a26ad1f43dcf750133cd658638a0e9481 (patch)
tree5f73ac859d550f466b002d7cf1416c43e42e719d
parent4a00b26029647b5f86d42654f1da99032b1fdf47 (diff)
downloadnextcloud-server-ed2fa06a26ad1f43dcf750133cd658638a0e9481.tar.gz
nextcloud-server-ed2fa06a26ad1f43dcf750133cd658638a0e9481.zip
reviewers comments
-rw-r--r--core/js/placeholder.js (renamed from core/js/visualize.js)20
1 files changed, 14 insertions, 6 deletions
diff --git a/core/js/visualize.js b/core/js/placeholder.js
index d6891085ce2..6a1c653b587 100644
--- a/core/js/visualize.js
+++ b/core/js/placeholder.js
@@ -30,7 +30,7 @@
*
* And call this from Javascript:
*
- * $('#albumart').visualize('The Album Title');
+ * $('#albumart').placeholder('The Album Title');
*
* Which will result in:
*
@@ -39,14 +39,22 @@
*/
(function ($) {
- $.fn.visualize = function(seed) {
+ $.fn.placeholder = function(seed) {
var hash = md5(seed),
maxRange = parseInt('ffffffffff', 16),
red = parseInt(hash.substr(0,10), 16) / maxRange * 256,
green = parseInt(hash.substr(10,10), 16) / maxRange * 256,
- blue = parseInt(hash.substr(20,10), 16) / maxRange * 256;
- rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)];
+ blue = parseInt(hash.substr(20,10), 16) / maxRange * 256,
+ rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)];
this.css('background-color', 'rgb(' + rgb.join(',') + ')');
- this.html(seed[0].toUpperCase());
+
+ // CSS rules
+ this.css('color', 'rgb(255, 255, 255)');
+ this.css('font-weight', 'bold');
+ this.css('text-align', 'center');
+
+ if(seed !== null && seed.length) {
+ this.html(seed[0].toUpperCase());
+ }
};
-}(jQuery)); \ No newline at end of file
+}(jQuery));