מדיה ויקי:Gadget-FlowDeluxeLocal.js: הבדלים בין גרסאות בדף
מראה
אין תקציר עריכה |
אין תקציר עריכה |
||
| שורה 1: | שורה 1: | ||
/ | // Created by User:FlowDeluxe from frwiki and localized here. | ||
Created by User:FlowDeluxe from frwiki and localized here. | // Documentation complète : https://www.mediawiki.org/wiki/Help:Structured_Discussions/FlowDeluxe | ||
$(function() { | |||
var flowDeluxeIndentationColors = typeof window.flowDeluxeIndentationColors !== 'undefined' ? | |||
window.flowDeluxeIndentationColors : true; | |||
var flowDeluxeButtonsInline = typeof window.flowDeluxeButtonsInline !== 'undefined' ? | |||
window.flowDeluxeButtonsInline : true; | |||
function switchColor(color) { | |||
if (color == '#e8f4ff') | |||
Documentation complète : https://www.mediawiki.org/wiki/Help:Structured_Discussions/FlowDeluxe | return 'white'; | ||
else | |||
return '#e8f4ff'; | |||
var flowDeluxeIndentationColors = typeof window.flowDeluxeIndentationColors !== 'undefined' ? | |||
var flowDeluxeButtonsInline = typeof window.flowDeluxeButtonsInline !== 'undefined' ? | |||
} | } | ||
function indentPostWithColors() { | |||
function | var posts = $('.flow-post-main'); | ||
var color; | |||
for(var i=0, len=posts.length; i<len; i++) { | |||
color = switchColor(color); | |||
posts[[i]].style.backgroundColor = color; | |||
} | } | ||
} | } | ||
function buttonsInline() { | |||
var elements = document.getElementsByClassName('flow-list'); | |||
for(var i=0, len=elements.length; i<len-1; i++) { | |||
if(elements[i].className.indexOf("moved-flow-list") < 0 && | |||
elements[i].innerHTML.indexOf("flow-ui-summarize-topic-link") > 0 ) { | |||
var parentItem = elements[i].parentElement; | |||
var grandParentItem = parentItem.parentElement; | |||
grandParentItem.insertBefore(elements[i],null); | |||
elements[i].className = elements[i].className + " moved-flow-list"; | |||
elements[i].style.fontSize= "13px"; | |||
var sections = elements[i].getElementsByTagName( "section" ); | |||
for(var j=0; j<sections.length; j++) { | |||
sections[j].style.display="inline"; | |||
} | |||
var li = elements[i].getElementsByTagName( "li" ); | |||
for(j=0; j<li.length; j++) { | |||
li[j].style.display="inline"; | |||
li[j].getElementsByTagName("a")[0].style.paddingLeft="10px"; | |||
li[j].getElementsByTagName("a")[0].style.paddingRight="0"; | |||
} | |||
parentItem.remove(); | |||
} | |||
} | |||
} | |||
function applyChanges() { | |||
if(flowDeluxeIndentationColors) | |||
indentPostWithColors(); | |||
if(flowDeluxeButtonsInline) | |||
buttonsInline(); | |||
function | setTimeout(applyChanges,2000); | ||
} | } | ||
if (document.getElementsByClassName('flow-component').length) { | |||
applyChanges(); | |||
} | } | ||
} | })(); | ||
גרסה מ־15:33, 22 בפברואר 2018
// Created by User:FlowDeluxe from frwiki and localized here.
// Documentation complète : https://www.mediawiki.org/wiki/Help:Structured_Discussions/FlowDeluxe
$(function() {
var flowDeluxeIndentationColors = typeof window.flowDeluxeIndentationColors !== 'undefined' ?
window.flowDeluxeIndentationColors : true;
var flowDeluxeButtonsInline = typeof window.flowDeluxeButtonsInline !== 'undefined' ?
window.flowDeluxeButtonsInline : true;
function switchColor(color) {
if (color == '#e8f4ff')
return 'white';
else
return '#e8f4ff';
}
function indentPostWithColors() {
var posts = $('.flow-post-main');
var color;
for(var i=0, len=posts.length; i<len; i++) {
color = switchColor(color);
posts[[i]].style.backgroundColor = color;
}
}
function buttonsInline() {
var elements = document.getElementsByClassName('flow-list');
for(var i=0, len=elements.length; i<len-1; i++) {
if(elements[i].className.indexOf("moved-flow-list") < 0 &&
elements[i].innerHTML.indexOf("flow-ui-summarize-topic-link") > 0 ) {
var parentItem = elements[i].parentElement;
var grandParentItem = parentItem.parentElement;
grandParentItem.insertBefore(elements[i],null);
elements[i].className = elements[i].className + " moved-flow-list";
elements[i].style.fontSize= "13px";
var sections = elements[i].getElementsByTagName( "section" );
for(var j=0; j<sections.length; j++) {
sections[j].style.display="inline";
}
var li = elements[i].getElementsByTagName( "li" );
for(j=0; j<li.length; j++) {
li[j].style.display="inline";
li[j].getElementsByTagName("a")[0].style.paddingLeft="10px";
li[j].getElementsByTagName("a")[0].style.paddingRight="0";
}
parentItem.remove();
}
}
}
function applyChanges() {
if(flowDeluxeIndentationColors)
indentPostWithColors();
if(flowDeluxeButtonsInline)
buttonsInline();
setTimeout(applyChanges,2000);
}
if (document.getElementsByClassName('flow-component').length) {
applyChanges();
}
})();