Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name moderator_options
- // @namespace MPC
- // @include http://www.mpcforum.pl/*
- // @version 0.0.1
- // @grant unsafeWindow
- // @run-at document-start
- // @require http://code.jquery.com/jquery-1.11.3.min.js
- // @noframes
- // ==/UserScript==
- /*------------------------*/
- /* */
- /* zmienne globalne */
- /* */
- /*------------------------*/
- var adres_strony = location.href;
- var ilosc_postow_w_temacie,autor_tematu,autor_tematu_id,status_tematu,user_name,user_id,id_tematu;
- $(document).ready(function() {
- if(adres_strony.indexOf('.pl/topic/') > 0){
- /* id tematu */ id_tematu = adres_strony.substring(adres_strony.indexOf('.pl/topic/')+10,adres_strony.indexOf('-'));
- /* ilosc postów w temacie*/ ilosc_postow_w_temacie = $('.post_wrap').length;
- /* autor tematu - id */ autor_tematu_id = $('.ipbfs_titlebox > .ipsBox_withphoto > div.desc > span > a').attr('hovercard-id');
- /* autor tematu - nazwa */ autor_tematu = $('.ipbfs_titlebox > .ipsBox_withphoto > div.desc > span > a > span').text();
- /* temat otwarty / zamkniety */ if( $('.topic_controls > .topic_buttons > .disabled').length > 0 ) {status_tematu = "disabled"} else if( $('.topic_controls > .topic_buttons > .important').length > 0 ) {status_tematu = "close"} else {status_tematu = "open"}
- }
- /* nazwa użytkownika przeglądającego forum */ user_name = $('#user_navigation > .ipsList_inline > li:eq(2) > a ').text().slice(0,-2);
- /* id użytkownika przeglądającego forum */ user_id = $('#user_navigation > .ipsList_inline > li:eq(1) > a ').attr('href').substring($('#user_navigation > .ipsList_inline > li:eq(1) > a ').attr('href').indexOf('.pl/user/')+9, $('#user_navigation > .ipsList_inline > li:eq(1) > a ').attr('href').indexOf('-'));
- /* link do forum nadrzędnego */ link_forum_up = $('#breadcrumb > li:eq('+($("#breadcrumb > li").length-1)+') > a').attr('href');
- /*------------------------*/
- /* */
- /* Skrypt */
- /* */
- /*------------------------*/
- function getDate_(){var today = new Date();var dd = today.getDate();var mm = today.getMonth()+1;var yyyy = today.getFullYear();if(dd<10){dd='0'+dd;} if(mm<10){mm='0'+mm;}return dd+'.'+mm+'.'+yyyy;}
- $('#community_app_menu').prepend('<li style="display: inherit;" class="right"><a href="http://www.mpcforum.pl/index.php?app=forums&module=extras§ion=stats&do=leaders">Moderatorzy</a></li>');
- if(adres_strony.indexOf('.pl/user/') > 0 && adres_strony.substring(adres_strony.indexOf('.pl/user/')+9, adres_strony.indexOf('-')) != user_id){
- $('#user_utility_links > li:last-child').before('<li><a class="ipsButton_secondary" href="http://mpcforum.pl/index.php?app=members&module=profile§ion=warnings&member='+adres_strony.substring(adres_strony.indexOf('.pl/user/')+9, adres_strony.indexOf('-'))+'&from_app=members"><img src="http://www.mpcforum.pl/uploads/images/694731446890474904952.png" /> Przeglądaj ostrzeżenia</a></li>');
- }
- if(adres_strony.indexOf('.pl/topic/') > 0){
- for (i=1;i<=ilosc_postow_w_temacie;i++){
- var takietam = ".post_wrap:eq("+(i-1)+") > h3 > .post_username > .author > a";
- var takietam2 = ".post_wrap:eq("+(i-1)+") > h3 > span.blend_links";
- var id_usera = $(takietam).attr("hovercard-id");
- $(takietam2).prepend('<a href="http://mpcforum.pl/index.php?app=members&module=profile§ion=warnings&member='+id_usera+'&from_app=members">Przeglądaj ostrzeżenia</a> ');
- }
- }
- /*mentorzy*/
- if(id_tematu==1467273){
- $('#fast_reply_controls').prepend('<input id="mentor_dodaj_tekst" class="input_submit alt" style="width:102px;" type="button" value="Dodaj szablon"></input> ');
- $(document).on('click', '#mentor_dodaj_tekst', function() {
- $('.cke_editor iframe').contents().find('body').append('<p>[b]Aktualizacja:[/b] '+getDate_()+'</p> <p>[b]Nazwa działu:[/b] </p><p>[b]Rekrutacja:[/b] </p><p>[b]Przed zmianą:[/b] </p><p>[spoiler]</p><p> </p><p>[/spoiler]</p><p>[b]Obecna wersja:[/b] </p><p>[spoiler]</p><p> </p><p>[/spoiler]</p><p> </p><p> </p>');
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement