Přeskočit na obsah

Wikipedista:OJJ/common.js

Z Wikipedie, otevřené encyklopedie

Poznámka: Po uložení musíte vyprázdnit mezipaměť vašeho prohlížeče, jinak změny neuvidíte.

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Svislítko',
                type: 'button',
                icon: '/media/wikipedia/commons/3/32/Toolbaricon_vertical_bar.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '|',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Odkaz',
                type: 'button',
                icon: '/media/wikipedia/commons/b/b7/Interlink_alt.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '[[',
                        peri: '',
                        post: ']]'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Pomlčka',
                type: 'button',
                icon: '/media/wikipedia/commons/b/b4/Toolbaricon_rule.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '−',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Uvozovky',
                type: 'button',
                icon: '/media/wikipedia/commons/6/65/Upper_apostrophe_toolbar_symbol.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '„',
                        peri: '',
                        post: '”'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Zakomentování',
                type: 'button',
                icon: '/media/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '<!--',
                        peri: '',
                        post: '-->'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Pevná mezera',
                type: 'button',
                icon: '/media/wikipedia/commons/5/55/Button_nbsp_1.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '&nbsp;',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Závěrečné sekce',
                type: 'button',
                icon: '/media/wikipedia/commons/c/cb/Button_wikipedia.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '== Odkazy ==\n=== Reference ===\n<references />\n=== Externí odkazy ===\n* {{Commonscat}}\n* {{Wikidruhy|taxon=}}\n{{Portály|',
                        peri: '',
                        post: '}}'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Pracuje se',
                type: 'button',
                icon: '/media/wikipedia/commons/0/0c/Button_P_template.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bpracuje se|',
                        peri: '',
                        post: '}}\n'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Kategorie',
                type: 'button',
                icon: '/media/wikipedia/commons/c/c6/Button_Kat.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '[[Kategorie:',
                        peri: '',
                        post: ']]'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Upravit',
                type: 'button',
                icon: '/media/wikipedia/commons/2/2e/Button_broom.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bUpravit}}\n',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Urgentně upravit',
                type: 'button',
                icon: '/media/wikipedia/commons/f/f3/Button_broom2.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Urgentně upravit}}\n',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Neověřeno',
                type: 'button',
                icon: '/media/wikipedia/commons/0/0b/Button_fuente.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bNeověřeno}}\n',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Urgentně ověřit',
                type: 'button',
                icon: '/media/wikipedia/commons/b/b8/Bouton_Faut_sourcer.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Urgentně ověřit}}\n',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Významnost',
                type: 'button',
                icon: '/media/wikipedia/commons/5/50/Button_tidyman.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Významnost}}\n',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Subpahýl',
                type: 'button',
                icon: '/media/wikipedia/commons/a/a5/Button_STUB.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Subpahýl}}\n',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Přeložit',
                type: 'button',
                icon: '/media/wikipedia/commons/8/8b/Button_portail.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Přeložit}}\n',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Fakt?',
                type: 'button',
                icon: '/media/wikipedia/commons/9/94/Button_zdroj.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Fakt}}',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Copyvio',
                type: 'button',
                icon: '/media/wikipedia/commons/5/58/Button_black_copyright.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bcopyvio|zdroj=',
                        peri: '',
                        post: '}}'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Dlouhodobě polozamčeno',
                type: 'button',
                icon: '/media/wikipedia/commons/8/83/Button_encrypted.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bDlouhodobě polozamčeno}}\n',
                        peri: '',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Vyřízeno',
                type: 'button',
                icon: '/media/wikipedia/commons/a/a0/Button_keep.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: ': \x7b\x7bWikipedie:Nástěnka správců/Vyřešeno}}, ',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Zamítnuto',
                type: 'button',
                icon: '/media/wikipedia/commons/1/13/Button_delete.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: ': \x7b\x7bWikipedie:Nástěnka správců/Nevyřešeno}}, ',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Spam',
                type: 'button',
                icon: '/media/wikipedia/commons/0/00/Warncreate4.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:spam}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Selfpromo',
                type: 'button',
                icon: '/media/wikipedia/commons/0/09/Warncreate3.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:selfpromo}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Experimenty0',
                type: 'button',
                icon: '/media/wikipedia/commons/3/3d/EXPBT0.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Experimenty0}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Experimenty',
                type: 'button',
                icon: '/media/wikipedia/commons/b/b0/EXPBT1.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Experimenty}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Experimenty2',
                type: 'button',
                icon: '/media/wikipedia/commons/a/ae/EXPBT2.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Experimenty2}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Experimenty3',
                type: 'button',
                icon: '/media/wikipedia/commons/e/e5/EXPBT3.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Experimenty3}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Experimenty2o',
                type: 'button',
                icon: '/media/wikipedia/commons/3/3a/EXPBT2-o.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Experimenty2o}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Experimenty3o',
                type: 'button',
                icon: '/media/wikipedia/commons/c/ca/EXPBT3-o.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Experimenty3o}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Nevýznamná osoba',
                type: 'button',
                icon: '/media/wikipedia/commons/8/83/Button_biocitas.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Nevýznamná osoba}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Vítejte',
                type: 'button',
                icon: '/media/wikipedia/commons/a/a9/Button_tournesol.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Vítejte|',
                        peri: '',
                        post: '}}, --\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Shrnutí',
                type: 'button',
                icon: '/media/wikipedia/commons/4/48/Deletewarn1.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Shrnutí',
                        peri: '',
                        post: '}}--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Náhled',
                type: 'button',
                icon: '/media/wikipedia/commons/b/bb/Seealso.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:Náhled',
                        peri: '',
                        post: '}}--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Zdroje',
                type: 'button',
                icon: '/media/wikipedia/commons/f/fe/Button_refs.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:zdroje}}',
                        peri: '',
                        post: '--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Experimenty na uživatelské stránce',
                type: 'button',
                icon: '/media/wikipedia/commons/4/41/Button_userandarticle.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bsubst:ExperimentyUP|',
                        peri: '',
                        post: '}}--\x7E\x7E\x7E\x7E'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Ping',
                type: 'button',
                icon: '/media/wikipedia/commons/4/49/Button_talk.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '\x7b\x7bPing|',
                        peri: '',
                        post: '|skrýt=ano}}'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'Zajímavosti',
                type: 'button',
                icon: '/media/wikipedia/commons/f/fc/Button_no_license.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '[[File:',
                        peri: '',
                        post: '|100px|right]]\n* …\n* …\n* …\n* …'
                    }
                }
            }
        }
      	});
      });
    });
  }
});

function markBlocked( container ) {
	var contentLinks = container ?
		$( container ).find( 'a' ) :
		( mw.util.$content || $( '.mw-body' ) ).find( 'a' ).add( '#ca-nstab-user a' );
	
	if ( !markBlockedCSS ) {
		markBlockedCSS = mw.util.addCSS('\
			.mediawiki .user-blocked-partial {'  + ( window.mbPartialStyle || 'opacity: 0.5' ) + '}\
			.mediawiki .user-blocked-temp {'   + ( window.mbTempStyle || 'opacity: 0.7; text-decoration: line-through' ) + '}\
			.mediawiki .user-blocked-indef {'  + ( window.mbIndefStyle || 'opacity: 0.4; font-style: italic; text-decoration: line-through' ) + '}\
			.mediawiki .user-blocked-tipbox {' + ( window.mbTipBoxStyle || 'font-size:85%; background:#FFFFF0; border:1px solid #FEA; padding:0 0.3em; color:#AAA' ) + '}\
		');
	}
	var mbTooltip =  window.mbTooltip || ';$1 zablokoval na $2 redaktor $3 z dôvodu „$4” (pred $5)';

	//get all aliases for user: & user_talk:
	var userNS = [];
	for ( var ns in mw.config.get( 'wgNamespaceIds' ) ) {
		if ( mw.config.get( 'wgNamespaceIds' )[ ns ] == 2 || mw.config.get( 'wgNamespaceIds' )[ ns ] == 3 ) {
			userNS.push( ns.replace( /_/g, ' ' ) + ':' );
		}
	}

	//RegExp  for all titles that are  User: | User_talk: | Special:Contributions/ (localized) | Special:Contributions/ (for userscripts)
	var userTitleRX = new RegExp( '^'
		+ '(' + userNS.join( '|' )
		+ '|Служебная:Вклад\\/|Special:Contributions\\/'
		+ ')'
		+ '([^\\/#]+)$', 'i' );

	//RegExp for links
	var articleRX = new RegExp(
		'^(?:' + mw.config.get( 'wgServer' ) + ')?' +
		mw.config.get( 'wgArticlePath' ).replace( '$1', '' ) + '([^#]+)'
	);
	var scriptRX = new RegExp(
		'^(?:' + mw.config.get( 'wgServer' ) + ')?' +
		mw.config.get( 'wgScript' ) + '\\?title=([^#&]+)'
	);

	var userLinks = {};
	var url, ma, pgTitle;


	//find all "user" links and save them in userLinks : { 'users': [<link1>, <link2>, ...], 'user2': [<link3>, <link3>, ...], ... }
	contentLinks.each( function( i, lnk ) {
		url = $( lnk ).attr( 'href' );
		if ( !url || url.charAt( 0 ) !== '/' ) {
			return;
		}
		if ( ma = articleRX.exec( url ) ) {
			pgTitle = ma[ 1 ];
		} else if ( ma = scriptRX.exec( url ) ) {
			pgTitle = ma[ 1 ];
		} else {
			return;
		}
		pgTitle = decodeURIComponent( pgTitle ).replace( /_/g, ' ' );
		user = userTitleRX.exec( pgTitle );
		if ( !user ) {
			return;
		}
		user = user[ 2 ];
		if ( user === 'К удалению' ) {
			return;
		}
		$( lnk ).addClass( 'userlink' );
		if ( !userLinks[ user ] ) {
			userLinks[ user ] = [];
		}
		userLinks[ user ].push (lnk );
	} );


	//convert users into array
	var users = [];
	for ( var u in userLinks ) {
		users.push( u );
	}
	if ( users.length === 0 ) {
		return;
	}

	//API request
	var serverTime,
		apiRequests = 0;
	var waitingCSS = mw.util.addCSS( 'a.userlink {opacity:' + ( window.mbLoadingOpacity || 0.85 ) + '}' );	
	while ( users.length > 0 ) {
		apiRequests++;
		$.post( 
			mw.util.wikiScript( 'api' ) + '?format=json&action=query',
			{
				list: 'blocks',
				bklimit: 100,
				bkusers: users.splice( 0, 50 ).join( '|' ),
				bkprop: 'user|by|timestamp|expiry|reason|flags'
				//no need for 'id'
			},
			markLinks
		);
	}

	return; //the end


	//callback: receive data and mark links
	function markLinks( resp, status, xhr ) {

		serverTime = new Date( xhr.getResponseHeader('Date') );
		var list, blk, tip, links, lnk;
		var blPartial = '';
		if ( !resp || !( list = resp.query ) || !( list = list.blocks ) ) {
			return;
		}

		for ( var i = 0; i < list.length; i++ ) {
			blk = list[ i ];
			if ( /^in/.test( blk.expiry ) ) {
				clss = 'user-blocked-indef';
				blTime = blk.expiry;
			} else {
				clss = 'user-blocked-temp';
				blTime = inHours ( parseTS( blk.expiry ) - parseTS( blk.timestamp ) );
			}
			if ('partial' in blk) {
				clss = 'user-blocked-partial';
				blPartial = ' partial';
			} 
			tip = mbTooltip.replace( '$1', blPartial )
				.replace( '$2', blTime )
				.replace( '$3', blk.by )
				.replace( '$4', blk.reason )
				.replace( '$5', inHours ( serverTime - parseTS( blk.timestamp ) ) );
			links = userLinks[ blk.user ];
			for ( var k = 0; k < links.length; k++ ) {
				lnk = $( links[ k ] ).addClass( clss );
				if ( window.mbTipBox ) {
					$( '<span class=user-blocked-tipbox>#</span>' ).attr( 'title', tip ).insertBefore( lnk );
				} else {
					lnk.attr( 'title', lnk.attr( 'title' ) + tip );
				}
			}
		}

		if ( --apiRequests === 0 ) { //last response
			waitingCSS.disabled = true;
			$( '#ca-showblocks' ).parent().remove(); // remove added portlet link
		}

	}

	//--------AUX functions

	//20081226220605 or 2008-01-26T06:34:19Z -> date
	function parseTS( ts ) {
		var m = ts.replace( /\D/g, '' ).match( /(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/ );
		return new Date ( Date.UTC( m[ 1 ], m[ 2 ] - 1, m[ 3 ], m[ 4 ], m[ 5 ], m[ 6 ] ) );
	}

	function inHours( ms ) { //milliseconds -> "2:30" or 5,06d or 21d
		var mm = Math.floor( ms / 60000 );
		if ( !mm ) {
			return Math.floor( ms / 1000 ) + 's';
		}
		var hh = Math.floor( mm / 60 );
		mm = mm % 60;
		var dd = Math.floor( hh / 24 );
		hh = hh % 24;
		if ( dd ) {
			return dd + ( dd < 10 ? '.' + zz( hh ) : '' ) + 'd';
		}
		return hh + ':' + zz( mm );
	}

	function zz( v ) { // 6 -> '06'
		if ( v <= 9 ) {
			v = '0' + v;
		}
		return v;
	}
}// -- end of main function

// FIXME: a global variable
var markBlockedCSS;


//start on some pages
switch ( mw.config.get( 'wgAction' ) ) {
	case 'edit':
	case 'submit':
	case 'delete':	
		break;
	case 'view':
		if ( $.inArray( mw.config.get( 'wgNamespaceNumber' ), [ 0, 10 ] ) !== -1 ) {
			break;
		}
		// otherwise continue with default
	default: // 'history', 'purge'
		// In case if the gadget is loaded directly by URL
		mw.loader.using( 'mediawiki.util' ).done( function () {
			if ( window.mbNoAutoStart ) {
				mw.util.addPortletLink( 'p-cactions', 'javascript:markBlocked()', 'XX', 'ca-showblocks' );
			} else {
				mw.hook( 'wikipage.content' ).add( function () {
					markBlocked();
		  		} );
			}
		} );
}