m (timestamp) |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
/* |
/* |
||
− | * |
+ | * 19:19, May 11, 2014 (UTC) |
* http://dev.wikia.com/wiki/MessageWallUserTags |
* http://dev.wikia.com/wiki/MessageWallUserTags |
||
* User tags for names on MessageWall posts |
* User tags for names on MessageWall posts |
||
Line 11: | Line 11: | ||
//<syntaxhighlight lang=jQuery> |
//<syntaxhighlight lang=jQuery> |
||
⚫ | |||
− | var messageWallTagColor = window.messageWallTagColor || 'red'; |
||
+ | //Setup configuration options, internal variables, and default values: |
||
+ | var tagColor = config.tagColor || 'red', |
||
+ | glow = config.glow || true, //Text-shadow effect: true/false |
||
+ | glowColor = '#f77', |
||
+ | glowSize = config.glowSize || '20px', //Text-shadow size in pixels |
||
+ | users = config.users || {}, //List of users to tag and what the tag will say |
||
+ | txtShadow = ''; //Internal text shadow variable — nothing by default |
||
+ | //Set the size and color of the text shadow if it's enabled |
||
⚫ | |||
− | + | if (glow === true) { |
|
+ | txtShadow = '0 0 ' + glowSize + ' ' + glowColor; |
||
− | $('a.subtle[href$="Message_Wall:' + name + '"]').after('<span style="color:' + messageWallTagColor + ';margin-left:-2px;font-family:arial;font-size:10px;text-shadow:0 0 20px;vertical-align:top;">(' + messageWallUserTags[name] + ')</span>'); |
||
} |
} |
||
+ | |||
− | }(jQuery)); |
||
+ | //Main function |
||
+ | function init() { |
||
+ | for (var name in users) { |
||
+ | $('a.subtle[href$="Message_Wall:' + name + '"]') |
||
+ | .after('<span class="MessageWallUserTag">(' + users[name] + ')</span>'); |
||
+ | $('.MessageWallUserTag').css({ |
||
+ | color: tagColor, |
||
+ | marginLeft: '-2px', |
||
+ | fontFamily: 'arial', |
||
+ | fontSize: '10px', |
||
+ | textShadow: txtShadow, |
||
+ | verticalAlign: 'top' |
||
+ | }); |
||
+ | } |
||
+ | } |
||
+ | init(); |
||
+ | }(jQuery, window.MessageWallUserTags)); |
||
//</syntaxhighlight> |
//</syntaxhighlight> |
Revision as of 19:19, 11 May 2014
/*
* 19:19, May 11, 2014 (UTC)
* http://dev.wikia.com/wiki/MessageWallUserTags
* User tags for names on MessageWall posts
* @author: RyaNayR (http://dev.wikia.com/wiki/User:RyaNayR)
*
* This script is OpenSource —
* It is completely free for anyone to use or modify in any way.
* All modifications and improvements are welcome and appreciated.
*/
//<syntaxhighlight lang=jQuery>
(function($, config) {
//Setup configuration options, internal variables, and default values:
var tagColor = config.tagColor || 'red',
glow = config.glow || true, //Text-shadow effect: true/false
glowColor = '#f77',
glowSize = config.glowSize || '20px', //Text-shadow size in pixels
users = config.users || {}, //List of users to tag and what the tag will say
txtShadow = ''; //Internal text shadow variable — nothing by default
//Set the size and color of the text shadow if it's enabled
if (glow === true) {
txtShadow = '0 0 ' + glowSize + ' ' + glowColor;
}
//Main function
function init() {
for (var name in users) {
$('a.subtle[href$="Message_Wall:' + name + '"]')
.after('<span class="MessageWallUserTag">(' + users[name] + ')</span>');
$('.MessageWallUserTag').css({
color: tagColor,
marginLeft: '-2px',
fontFamily: 'arial',
fontSize: '10px',
textShadow: txtShadow,
verticalAlign: 'top'
});
}
}
init();
}(jQuery, window.MessageWallUserTags));
//</syntaxhighlight>