summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-09-25 10:11:52 -0700
committerMorris Jobke <morris.jobke@gmail.com>2013-09-25 10:11:52 -0700
commit70dccd28ef2e2a374c0e5013d2569e4c3fc13852 (patch)
treee99338a88aefdf0cc5528b630165394dcea7885c /core
parent2feb753b8437998c073849499ff86b427de06e62 (diff)
parent5e7a7b3f6187365c60e63dfed8699e525be45a0b (diff)
downloadnextcloud-server-70dccd28ef2e2a374c0e5013d2569e4c3fc13852.tar.gz
nextcloud-server-70dccd28ef2e2a374c0e5013d2569e4c3fc13852.zip
Merge pull request #4987 from owncloud/different_color_placeholder
Make it possible to have a different color than the username for placeholder
Diffstat (limited to 'core')
-rw-r--r--core/js/placeholder.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/js/placeholder.js b/core/js/placeholder.js
index d63730547d7..ee2a8ce84c4 100644
--- a/core/js/placeholder.js
+++ b/core/js/placeholder.js
@@ -36,10 +36,21 @@
*
* <div id="albumart" style="background-color: hsl(123, 90%, 65%); ... ">T</div>
*
+ * You may also call it like this, to have a different background, than the seed:
+ *
+ * $('#albumart').placeholder('The Album Title', 'Album Title');
+ *
+ * Resulting in:
+ *
+ * <div id="albumart" style="background-color: hsl(123, 90%, 65%); ... ">A</div>
+ *
*/
(function ($) {
- $.fn.placeholder = function(seed) {
+ $.fn.placeholder = function(seed, text) {
+ // set optional argument "text" to value of "seed" if undefined
+ text = text || seed;
+
var hash = md5(seed),
maxRange = parseInt('ffffffffffffffffffffffffffffffff', 16),
hue = parseInt(hash, 16) / maxRange * 256,
@@ -56,7 +67,7 @@
this.css('font-size', (height * 0.55) + 'px');
if(seed !== null && seed.length) {
- this.html(seed[0].toUpperCase());
+ this.html(text[0].toUpperCase());
}
};
}(jQuery));