Advertisement
Guest User

Chouaddon

a guest
Oct 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Chouaddon
  3. // @namespace   choualbox.com
  4. // @description Addon qui améliore la navigation sur Choualbox
  5. // @author      Appineos - http://choualbox.com/blog/appineos (Benji)
  6. // @editor  CatShadow - http://choualbox.com/blog/catshadow
  7. // @editor  Divi - https://choualbox.com/blog/divi - https://choualbox.com/gZwkw#comid4154429
  8. // @include     http://choualbox.com/*
  9. // @include     https://choualbox.com/*
  10. // @exclude     http://choualbox.com/blog/*
  11. // @exclude     https://choualbox.com/blog/*
  12. // @version     4.1.2
  13. // @grant       GM_getValue
  14. // @grant       GM_setValue
  15. // @grant       GM_log
  16. // @require     http://code.jquery.com/jquery-2.0.3.min.js
  17. // @updateURL   https://github.com/BenjiCB/Chouaddon/raw/master/Chouaddon.user.js
  18. // @downloadURL https://github.com/BenjiCB/Chouaddon/raw/master/Chouaddon.user.js
  19. // ==/UserScript==
  20.  
  21. regPseudo = /blog\/(.*)/;
  22. mediaBox = [];
  23. regSeries = /([^\t]+?)\.*#[0-9]+.*$/;
  24.  
  25. try {
  26.     if (GM_getValue.toString().indexOf("not supported") != -1) {
  27.         this.GM_getValue=function (key,def) {
  28.             return localStorage[key] || def;
  29.         };
  30.         this.GM_setValue=function (key,value) {
  31.             localStorage[key]=value;
  32.         };
  33.         this.GM_deleteValue=function (key) {
  34.             return delete localStorage[key];
  35.         };
  36.     }
  37. }
  38. catch (e) {
  39.     console.log(e);
  40. }
  41. this.GM_getBoolValue = function (key, def) {
  42.     return (this.GM_getValue(key, def) === true || this.GM_getValue(key, def) == "true");
  43. };
  44.  
  45. function boucle() {
  46.     boxs = document.getElementsByClassName('pa2 bb b--black-10 bg-white box_itemboucle');
  47.     ignoreList=document.getElementById("ignoreList").value.split(",");
  48.     for (var i = 0; i < boxs.length; i++) {
  49.         temp=boxs[i];
  50.         auteur=boxs[i].getElementsByClassName('spf-link link gray fs12 b')[0].innerText;
  51.         if(ignoreList.indexOf(auteur) != -1){
  52.             temp.style.display='none';
  53.         }
  54.     }
  55. }
  56.  
  57. function ajoutIgnoreList(obj) {
  58.     id = obj.className;
  59.     regPseudo = /ignoreNickname-(.*)/;
  60.     if ((regPseudo.test(id)) && (pseudo = regPseudo.exec(id)[1]) && (!ignoreList.hasOwnProperty(pseudo)) && (ignoreList.indexOf(pseudo) == -1)) {
  61.         ignoreList = GM_getValue('ignoreList', "").split(", ");
  62.         if ("" === GM_getValue('ignoreList', "")) GM_setValue('ignoreList', pseudo);
  63.         else {
  64.             ignoreList.push(pseudo);
  65.             GM_setValue('ignoreList', ignoreList.join(", "));
  66.             document.getElementById('ignoreList').value = GM_getValue('ignoreList', "");
  67.         }
  68.     }
  69.     obj.innerHTML = "Ignoré";
  70. }
  71.  
  72. function ajouterOptionMenu(label, nomInterne, type, parent, def) {
  73.     option = document.createElement("div");
  74.     option.style.marginBottom = "5px";
  75.     if (type == "textarea") optionInput = document.createElement(type);
  76.     else {
  77.         optionInput = document.createElement("input");
  78.         optionInput.type = type;
  79.     }
  80.     if (type == "checkbox"){
  81.         optionInput.onclick = function () { optionChange(this); };
  82.         optionInput.checked = GM_getBoolValue(nomInterne, def);
  83.     }
  84.     else {
  85.         optionInput.onblur = function () { optionChange(this); };
  86.         optionInput.value = GM_getValue(nomInterne, def);
  87.     }
  88.     optionInput.id = nomInterne;
  89.     optionInput.style.height = "auto";
  90.     optionInput.style.width = "auto";
  91.     optionInput.style.marginRight = "5px";
  92.  
  93.     optionLabel = document.createElement("label");
  94.     optionLabel.htmlFor = nomInterne;
  95.     optionLabel.innerHTML = label;
  96.     optionLabel.style.display = "inline";
  97.     optionLabel.style.fontWeight = "normal";
  98.     if (type == "textarea") {
  99.         option.appendChild(optionLabel);
  100.         option.appendChild(document.createElement('br'));
  101.         optionInput.style.width = "100%";
  102.         option.appendChild(optionInput);
  103.     }
  104.     else {
  105.         option.appendChild(optionInput);
  106.         option.appendChild(optionLabel);
  107.         if (type == "color") {
  108.             optionInput.style.width = "38px";
  109.             optionInput.style.height = "26px";
  110.         }
  111.     }
  112.     parent.appendChild(option);
  113. }
  114.  
  115. function optionChange(optionInput) {
  116.     if (optionInput.type == "checkbox") val = optionInput.checked;
  117.     else val = optionInput.value;
  118.     GM_setValue(optionInput.id, val);
  119. }
  120. gCGW = document.createElement('div');
  121. gCGW.classList.add('dropdown-menu');
  122. gCGW.style.width = "250px";
  123. gCGW.style.padding = "5px";
  124. titregCGW = document.createElement('h1');
  125. titregCGW.innerHTML = "Chouaddon v5.0 - Configuration";
  126. gCGW.appendChild(titregCGW);
  127.  
  128.  
  129. ajouterOptionMenu('Utilisateurs ignorés : (Séparés par des virgules, ouvrir une nouvelle page pour confirmer)', 'ignoreList', "textarea", gCGW, "");
  130.  
  131. // Menu de config
  132. elementMenu = document.createElement('li');
  133. elementMenu.className = 'with-icon tooltip-bottom';
  134. elementMenu.attributes.style = "position:relative;";
  135.  
  136. filtreElementMenu = document.createElement('i');
  137. filtreElementMenu.className = 'glyphicon glyphicon-plus';
  138. filtreElementMenu.style.cursor = "pointer";
  139.  
  140. lienElementMenu = document.createElement('a');
  141. lienElementMenu.style.paddingTop = "15px";
  142. lienElementMenu.style.paddingLeft = "0px";
  143. lienElementMenu.style.paddingRight = "0px";
  144. lienElementMenu.style.paddingBottom = "0px";
  145. lienElementMenu.onclick = function() {
  146.     gCGW.style.display = (gCGW.style.display == "none" || gCGW.style.display === "") ? "block" : "none";
  147.     filtreElementMenu.className = (gCGW.style.display == "none" || gCGW.style.display === "") ? 'glyphicon glyphicon-plus' : 'glyphicon glyphicon-minus';
  148. };
  149.  
  150. lienElementMenu.appendChild(filtreElementMenu);
  151. elementMenu.appendChild(lienElementMenu);
  152. elementMenu.appendChild(gCGW);
  153. document.getElementById('coldroite').appendChild(elementMenu);
  154.  
  155. //Sidebar
  156. elementMenu2 = document.createElement('li');
  157. elementMenu2.className = 'with-icon tooltip-bottom';
  158. elementMenu2.attributes.style = "position:relative;";
  159.  
  160. sidebarElementMenu = document.createElement('i');
  161. sidebarElementMenu.className = GM_getBoolValue('rmSidebar', false) ? 'glyphicon glyphicon-align-left' : ' glyphicon glyphicon-indent-right';
  162. sidebarElementMenu.style.cursor = "pointer";
  163.  
  164. lienElementMenu2 = document.createElement('a');
  165. lienElementMenu2.style.paddingTop = "15px";
  166. lienElementMenu2.style.paddingLeft = "0px";
  167. lienElementMenu2.style.paddingRight = "0px";
  168. lienElementMenu2.style.paddingBottom = "0px";
  169. lienElementMenu2.style.marginLeft = '10px';
  170. lienElementMenu2.onclick = function() {
  171.     GM_setValue('rmSidebar', !GM_getBoolValue('rmSidebar', false));
  172.     sidebarElementMenu.className = GM_getBoolValue('rmSidebar', false) ? 'glyphicon glyphicon-align-left' : ' glyphicon glyphicon-indent-right';
  173.  
  174.     if (document.getElementById('sidebar') !== null) { toggleSidebar(document.getElementById('sidebar')); }
  175.     if (document.getElementsByClassName('col-xs-4').length > 0) { toggleSidebar(document.getElementsByClassName('col-xs-4')[0]); }
  176. };
  177.  
  178. lienElementMenu2.appendChild(sidebarElementMenu);
  179. elementMenu2.appendChild(lienElementMenu2);
  180.  
  181. document.getElementById('coldroite').appendChild(elementMenu2);
  182.  
  183.  
  184. document.getElementById("ignoreList").style.resize = "vertical";
  185. document.getElementById("ignoreList").style.maxHeight = "400px";
  186.  
  187.  
  188. ignoreList = GM_getValue('ignoreList', "").split(", ");
  189. if (document.getElementsByClassName('box_itemboucle').length > 0) { boucle(); setInterval(boucle, 3000); }
  190. if (document.getElementsByClassName('commentaires').length > 0 && GM_getBoolValue('affichageImagesCommentaires', false)) { afficherImagesCommentaires(); }
  191. if (document.getElementById('sidebar') !== null && GM_getBoolValue('rmSidebar', false)) { toggleSidebar(document.getElementById('sidebar')); }
  192. if (document.getElementsByClassName('col-xs-4').length > 0 && GM_getBoolValue('rmSidebar', false)) { toggleSidebar(document.getElementsByClassName('col-xs-4')[0]); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement