Common.js | فراغیب
پرش به ناوبری
پرش به جستجو
Esfandiari (بحث | مشارکتها) بدون خلاصۀ ویرایش |
Esfandiari (بحث | مشارکتها) بدون خلاصۀ ویرایش |
||
| خط ۲۰: | خط ۲۰: | ||
document.body.classList.add("mobile-search-enhanced"); | document.body.classList.add("mobile-search-enhanced"); | ||
} | } | ||
// | |||
mw.loader.using('ext.wikiEditor').then(function () { | |||
$('#wpTextbox1').wikiEditor('addToToolbar', { | |||
sections: { | |||
advanced: { | |||
type: 'toolbar', | |||
label: 'ابزارهای پیشرفته' | |||
} | |||
}, | |||
groups: { | |||
templates: { | |||
label: 'الگوها' | |||
} | |||
}, | |||
tools: { | |||
infobox: { | |||
label: 'اینفوباکس', | |||
type: 'button', | |||
icon: 'https://upload.wikimedia.org/wikipedia/commons/5/5a/VisualEditor_-_Template.svg', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: '{{Infobox\n| نام = \n| تصویر = \n}}\n', | |||
post: '' | |||
} | |||
} | |||
}, | |||
ref: { | |||
label: 'منبع', | |||
type: 'button', | |||
icon: 'https://upload.wikimedia.org/wikipedia/commons/9/9c/OOjs_UI_icon_reference.svg', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: '<ref>', | |||
post: '</ref>' | |||
} | |||
} | |||
}, | |||
gallery: { | |||
label: 'گالری تصاویر', | |||
type: 'button', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: '<gallery>\nFile:Example.jpg|توضیح\n</gallery>', | |||
post: '' | |||
} | |||
} | |||
}, | |||
category: { | |||
label: 'دستهبندی', | |||
type: 'button', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: '[[رده:', | |||
post: ']]' | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
}); | |||
نسخهٔ ۲۱ مهٔ ۲۰۲۶، ساعت ۱۹:۰۳
// این باعث میشود تصاویر فقط وقتی کاربر اسکرول میکند لود شوند
document.addEventListener("DOMContentLoaded", function() {
const imgs = document.querySelectorAll("img");
imgs.forEach(img => {
img.setAttribute("loading","lazy");
});
});
// میتوانی جستجوی سریعتر فعال کنی:
if (window.innerWidth < 720) {
document.body.classList.add("mobile-search-enhanced");
}
//
mw.loader.using('ext.wikiEditor').then(function () {
$('#wpTextbox1').wikiEditor('addToToolbar', {
sections: {
advanced: {
type: 'toolbar',
label: 'ابزارهای پیشرفته'
}
},
groups: {
templates: {
label: 'الگوها'
}
},
tools: {
infobox: {
label: 'اینفوباکس',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/5/5a/VisualEditor_-_Template.svg',
action: {
type: 'encapsulate',
options: {
pre: '{{Infobox\n| نام = \n| تصویر = \n}}\n',
post: ''
}
}
},
ref: {
label: 'منبع',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/9/9c/OOjs_UI_icon_reference.svg',
action: {
type: 'encapsulate',
options: {
pre: '<ref>',
post: '</ref>'
}
}
},
gallery: {
label: 'گالری تصاویر',
type: 'button',
action: {
type: 'encapsulate',
options: {
pre: '<gallery>\nFile:Example.jpg|توضیح\n</gallery>',
post: ''
}
}
},
category: {
label: 'دستهبندی',
type: 'button',
action: {
type: 'encapsulate',
options: {
pre: '[[رده:',
post: ']]'
}
}
}
}
});
});