|
|
| خط ۱: |
خط ۱: |
| /* =====================================================
| |
|
| |
|
| MediaWiki Common.js
| |
|
| |
| Optimized for Vector 2010
| |
|
| |
| ===================================================== */
| |
|
| |
| mw.loader.using([‘mediawiki.util’,‘jquery’], function () {
| |
|
| |
| $(function () {
| |
|
| |
| /* ---------- External links open in new tab ---------- */
| |
|
| |
| $(‘#mw-content-text a.external’).attr(‘target’,‘_blank’);
| |
|
| |
| /* ---------- Confirm page delete ---------- */
| |
|
| |
| $(‘#ca-delete a’).on(‘click’, function(){
| |
|
| |
| return confirm(‘آیا مطمئن هستید که میخواهید این صفحه حذف شود؟’);
| |
|
| |
| });
| |
|
| |
| /* ---------- Back to top button ---------- */
| |
|
| |
| var backTop = $(‘<div id=“backToTop”>▲</div>’);
| |
|
| |
| $(‘body’).append(backTop);
| |
|
| |
| $(‘#backToTop’).css({
| |
|
| |
| position:‘fixed’,
| |
|
| |
| bottom:‘30px’,
| |
|
| |
| right:‘25px’,
| |
|
| |
| width:‘40px’,
| |
|
| |
| height:‘40px’,
| |
|
| |
| ‘line-height’:‘40px’,
| |
|
| |
| ‘text-align’:‘center’,
| |
|
| |
| background:‘#3366cc’,
| |
|
| |
| color:‘#fff’,
| |
|
| |
| cursor:‘pointer’,
| |
|
| |
| ‘border-radius’:‘4px’,
| |
|
| |
| ‘font-size’:‘18px’,
| |
|
| |
| display:‘none’,
| |
|
| |
| ‘z-index’:‘999’
| |
|
| |
| });
| |
|
| |
| $(window).scroll(function(){
| |
|
| |
| if($(this).scrollTop()>200){
| |
|
| |
| $(‘#backToTop’).fadeIn();
| |
|
| |
| } else{
| |
|
| |
| $(‘#backToTop’).fadeOut();
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| $(‘#backToTop’).click(function(){
| |
|
| |
| $(‘html, body’).animate({scrollTop:0},500);
| |
|
| |
| });
| |
|
| |
| /* ---------- Close site notice ---------- */
| |
|
| |
| if($(‘#siteNotice’).length){
| |
|
| |
| var closeBtn = $(‘<span id=“closeNotice”>✖</span>’);
| |
|
| |
| $(‘#siteNotice’).css(‘position’,‘relative’);
| |
|
| |
| $(‘#closeNotice’).css({
| |
|
| |
| position:‘absolute’,
| |
|
| |
| top:‘5px’,
| |
|
| |
| left:‘10px’,
| |
|
| |
| cursor:‘pointer’,
| |
|
| |
| ‘font-size’:‘16px’
| |
|
| |
| });
| |
|
| |
| $(‘#siteNotice’).append(closeBtn);
| |
|
| |
| $(‘#closeNotice’).click(function(){
| |
|
| |
| $(‘#siteNotice’).fadeOut();
| |
|
| |
| });
| |
|
| |
| }
| |
|
| |
| /* ---------- Improve sortable tables ---------- */
| |
|
| |
| $(‘.sortable th’).css(‘cursor’,‘pointer’);
| |
|
| |
| /* ---------- Copy link to heading ---------- */
| |
|
| |
| $(‘.mw-headline’).each(function(){
| |
|
| |
| var id=$(this).attr(‘id’);
| |
|
| |
| if(id){
| |
|
| |
| var link=$(‘<a class=“headerCopy”> 🔗</a>’);
| |
|
| |
| link.attr(‘href’,‘#’+id);
| |
|
| |
| link.css({
| |
|
| |
| ‘font-size’:‘12px’,
| |
|
| |
| ‘margin-right’:‘6px’,
| |
|
| |
| ‘text-decoration’:‘none’,
| |
|
| |
| ‘opacity’:‘0.5’
| |
|
| |
| });
| |
|
| |
| $(this).append(link);
| |
|
| |
| }
| |
|
| |
| });
| |
|
| |
| });
| |
|
| |
| });
| |
|
| |
| :::
| |