Advertisement
Guest User

Untitled

a guest
Apr 30th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. // ==UserScript==
  2. // @name moderator_options
  3. // @namespace MPC
  4. // @include http://www.mpcforum.pl/*
  5. // @version 0.0.1
  6. // @grant unsafeWindow
  7. // @run-at document-start
  8. // @require http://code.jquery.com/jquery-1.11.3.min.js
  9. // @noframes
  10. // ==/UserScript==
  11.  
  12. /*------------------------*/
  13. /* */
  14. /* zmienne globalne */
  15. /* */
  16. /*------------------------*/
  17.  
  18. var adres_strony = location.href;
  19. var ilosc_postow_w_temacie,autor_tematu,autor_tematu_id,status_tematu,user_name,user_id,id_tematu;
  20.  
  21. $(document).ready(function() {
  22.  
  23. if(adres_strony.indexOf('.pl/topic/') > 0){
  24. /* id tematu */ id_tematu = adres_strony.substring(adres_strony.indexOf('.pl/topic/')+10,adres_strony.indexOf('-'));
  25.  
  26. /* ilosc postów w temacie*/ ilosc_postow_w_temacie = $('.post_wrap').length;
  27.  
  28. /* autor tematu - id */ autor_tematu_id = $('.ipbfs_titlebox > .ipsBox_withphoto > div.desc > span > a').attr('hovercard-id');
  29.  
  30. /* autor tematu - nazwa */ autor_tematu = $('.ipbfs_titlebox > .ipsBox_withphoto > div.desc > span > a > span').text();
  31.  
  32. /* 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"}
  33. }
  34.  
  35. /* nazwa użytkownika przeglądającego forum */ user_name = $('#user_navigation > .ipsList_inline > li:eq(2) > a ').text().slice(0,-2);
  36.  
  37. /* 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('-'));
  38.  
  39. /* link do forum nadrzędnego */ link_forum_up = $('#breadcrumb > li:eq('+($("#breadcrumb > li").length-1)+') > a').attr('href');
  40.  
  41. /*------------------------*/
  42. /* */
  43. /* Skrypt */
  44. /* */
  45. /*------------------------*/
  46. 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;}
  47.  
  48.  
  49. $('#community_app_menu').prepend('<li style="display: inherit;" class="right"><a href="http://www.mpcforum.pl/index.php?app=forums&module=extras&section=stats&do=leaders">Moderatorzy</a></li>');
  50.  
  51. if(adres_strony.indexOf('.pl/user/') > 0 && adres_strony.substring(adres_strony.indexOf('.pl/user/')+9, adres_strony.indexOf('-')) != user_id){
  52. $('#user_utility_links > li:last-child').before('<li><a class="ipsButton_secondary" href="http://mpcforum.pl/index.php?app=members&module=profile&section=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" />&nbsp;&nbsp;Przeglądaj ostrzeżenia</a></li>');
  53. }
  54. if(adres_strony.indexOf('.pl/topic/') > 0){
  55. for (i=1;i<=ilosc_postow_w_temacie;i++){
  56. var takietam = ".post_wrap:eq("+(i-1)+") > h3 > .post_username > .author > a";
  57. var takietam2 = ".post_wrap:eq("+(i-1)+") > h3 > span.blend_links";
  58. var id_usera = $(takietam).attr("hovercard-id");
  59. $(takietam2).prepend('<a href="http://mpcforum.pl/index.php?app=members&module=profile&section=warnings&member='+id_usera+'&from_app=members">Przeglądaj ostrzeżenia</a> &nbsp;');
  60. }
  61. }
  62. /*mentorzy*/
  63. if(id_tematu==1467273){
  64. $('#fast_reply_controls').prepend('<input id="mentor_dodaj_tekst" class="input_submit alt" style="width:102px;" type="button" value="Dodaj szablon"></input>&nbsp;');
  65. $(document).on('click', '#mentor_dodaj_tekst', function() {
  66. $('.cke_editor iframe').contents().find('body').append('<p>[b]Aktualizacja:[/b]&nbsp;'+getDate_()+'</p> <p>[b]Nazwa działu:[/b]&nbsp; </p><p>[b]Rekrutacja:[/b]&nbsp; </p><p>[b]Przed zmianą:[/b]&nbsp;</p><p>[spoiler]</p><p>&nbsp;</p><p>[/spoiler]</p><p>[b]Obecna wersja:[/b]&nbsp;</p><p>[spoiler]</p><p>&nbsp;</p><p>[/spoiler]</p><p>&nbsp;</p><p>&nbsp;</p>');
  67. });
  68. }
  69. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement