User:AuFCL/common.js/jsleader.js
< User:AuFCL | common.js
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
For details and instructions about other browsers, see Wikipedia:Bypass your cache.
Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the central discussion page, Scriptorium. The code will be executed when previewing this page under some skins, including Monobook. You can in the interim if you wish to refresh the content sooner under another skin. |
Documentation for this script can be added at User:AuFCL/common.js/jsleader. |
// <nowiki>
//This code is not linked to from anywhere and is simply being maintained for
//the historical horror it represents.
function jsleader(){
var AllTags=document.getElementsByTagName('*');
for(var S=0;S<AllTags.length;S++){
if(AllTags[S].hasAttributes('class')){
if(/JavaScriptTagDotTestLeaderPrototype/.test(AllTags[S].getAttribute('class'))){
var leaderProto=AllTags[S].innerHTML;
AllTags[S].innerHTML="";
AllTags[S].setAttribute("style",AllTags[S].getAttribute("style")+"display:inline-block;word-wrap:break-word;word-break:break-all;");
var container=AllTags[S].parentNode,
baseHeight=container.clientHeight;
while(container && !baseHeight){
container=container.parentNode;
baseHeight=container.clientHeight;
}
if(container){
var leaderFill="",
guard=0;
while((guard<500) && (container.clientHeight==baseHeight)){
guard++;
AllTags[S].innerHTML=leaderFill+leaderProto;
if(container.clientHeight==baseHeight){
leaderFill=AllTags[S].innerHTML;
}
}
AllTags[S].innerHTML=leaderFill;
}
}
}
};
for(var S=AllTags.length-1;S>=0;S--){
if(AllTags[S].hasAttributes('class')){
if(/JavaScriptTagDotTestLeaderPrototype/.test(AllTags[S].getAttribute('class'))){
var container=AllTags[S].parentNode,
baseHeight=container.clientHeight;
while(container && !baseHeight){
container=container.parentNode;
baseHeight=container.clientHeight;
}
if(container){
var guard=0,
maxFill=0,
leaderFill=AllTags[S].innerHTML;
while((guard<1000) && (container.clientHeight==baseHeight)){
guard++;
AllTags[S].innerHTML=leaderFill+
"<span style='display:inline-block;margin:0 0 0 0;padding:0 0 0 0;test-indent:0;width:"+
parseInt(guard)+"px;'> </span>";
if(container.clientHeight==baseHeight){
maxFill=guard;
}
}
AllTags[S].innerHTML=leaderFill+
(maxFill?
"<span style='display:inline-block;margin:0 0 0 0;padding:0 0 0 0;test-indent:0;width:"+
parseInt(maxFill)+"px;'> </span>":
"");
}
}
}
};
}
$(jsleader);
// </nowiki>