MediaWiki:Common.js:修订间差异

来自LoveLive Wiki
跳到导航 跳到搜索
无编辑摘要
(恢复渡边曜讨论)的编辑至缪斯的最后版本)
第14行: 第14行:
links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown);
links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown);
               // OP
               // OP
        if(!window.localStorage) links.click();
              links.click();
        else {
        var storage = window.localStorage;
        if(!storage["sidebar"] || storage["sidebar"] == "close") {
        links.click();
        }
        }
};
};


Accordion.prototype.dropdown = function(e) {
Accordion.prototype.dropdown = function(e) {
if(window.localStorage) {
var storage = window.localStorage;
if(storage["sidebar"] == "open") storage["sidebar"] = "close";
else storage["sidebar"] = "open";
}
var $el = e.data.el;
var $el = e.data.el;
$this = $(this),
$this = $(this),

2016年7月15日 (五) 15:34的版本

// add Wiki plus, refer from https://zh.moegirl.org/User:%E5%A6%B9%E7%A9%BA%E9%85%B1/Wikiplus
mw.loader.load('https://wikiplus-app.smartgslb.com/Main.min.js');

//shulan_desu 用于侧边栏的控制
$(function() {
	var Accordion = function(el, multiple) {
		this.el = el || {};
		this.multiple = multiple || false;

		// Variables privadas
		var links = this.el.find('.portal h3');
		// Evento
		links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown);
               // OP
               links.click();
	};

	Accordion.prototype.dropdown = function(e) {
		var $el = e.data.el;
			$this = $(this),
			$next = $this.next();

		$next.slideToggle();
		$this.parent().toggleClass('open');

		if (!e.data.multiple) {
			$el.find('#mw-panel .portal h3 .body ul').not($next).slideUp().parent().removeClass('open');
		}
	};	

	var accordion = new Accordion($('#mw-panel'), false);
});