לדלג לתוכן

מדיה ויקי:Gadget-FlowDeluxeLocal.js: הבדלים בין גרסאות בדף

מתוך צפונות ויקי
אין תקציר עריכה
אין תקציר עריכה
שורה 30: שורה 30:
elements[i].style.fontSize= "13px";
elements[i].style.fontSize= "13px";
var sections = elements[i].getElementsByTagName( "section" );
var sections = $(elements[i]).find('section');
for(var j=0; j<sections.length; j++)
for(var j=0; j<sections.length; j++)
sections[j].style.display="inline";
sections[j].style.display="inline";


var li = elements[i].getElementsByTagName( "li" );
var li = $(elements[i]).find('li');
for(j=0; j<li.length; j++) {
for(j=0; j<li.length; j++) {
li[j].style.display="inline";
li[j].style.display="inline";
li[j].getElementsByTagName("a")[0].style.paddingLeft="10px";
$(li[j]).find('a')[0].style.paddingLeft="10px";
li[j].getElementsByTagName("a")[0].style.paddingRight="0";
$(li[j]).find('a')[0].style.paddingRight="0";
}
}

גרסה מ־11:40, 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 flowDeluxeButtonsInline = typeof window.flowDeluxeButtonsInline !== 'undefined' ?
		window.flowDeluxeButtonsInline : true;
	
	function indentPostWithColors() {
		var posts = $('.flow-post-main');
		var colored = true;
		
		for (var i=0, len=posts.length; i<len; i++) {
			if (colored)
				$(posts[[i]]).addClass('flow-color-indent');
			else
				$(posts[[i]]).removeClass('flow-color-indent');
			colored = !colored;
		}
	}
	
	function buttonsInline() {
	   var elements = $('.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]).find('section');
				for(var j=0; j<sections.length; j++)
					sections[j].style.display="inline";

				var li = $(elements[i]).find('li');
				for(j=0; j<li.length; j++) {
					li[j].style.display="inline";
					$(li[j]).find('a')[0].style.paddingLeft="10px";
					$(li[j]).find('a')[0].style.paddingRight="0";
				}
				
				parentItem.remove();
		   }
	   }
	}
	
	function applyChanges() {
	   	indentPostWithColors();
	    if (flowDeluxeButtonsInline)
	    	buttonsInline();
	    setTimeout(applyChanges, 2000);
	}
	
	if ($('.flow-component').length)
	  applyChanges();
})();