Advertisement
Guest User

Meneame personal assistant

a guest
Jul 18th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name       Meneame personal assistant
  3. // @namespace  http://cuelgame.net
  4. // @author     @dsmatilla
  5. // @version    1.3.8
  6. // @description  Menú con varias funcionalidades para mejorar la experiencia de usuario en meneame.net
  7. // @include      http://*.meneame.net/*
  8. // @copyright  2013 Este script está protegido por la GFYL 1.00
  9. //  The Go Fuck Yourself Public License, version 1.00
  10. //
  11. //  Article 1
  12. //  You can go fuck yourself.
  13. //
  14. //  END OF ALL TERMS AND CONDITIONS
  15. // ==/UserScript==
  16.  
  17. function mhMenu() { // Build HTML structure
  18.     // Set div attributes
  19.     var button, div, html, chkd, x, i;
  20.  
  21.  
  22.    
  23.     // Menu title to open/close
  24.     button = document.createElement("div");
  25.     button.setAttribute("id", "mh_button");
  26.     button.className = "mh_button";
  27.     button.style.display = "block";
  28.     button.style.border = "0";
  29.     button.style.position = "absolute";
  30.     button.style.top = "0";
  31.     button.style.right = "300px";
  32.     button.style.height = "17px";
  33.     button.style.padding = "4px";
  34.     html = "<a id='mh_close' style='color: white; text-decoration: none;'>MNM Personal Assistant</a>";
  35.     button.innerHTML = html;
  36.     document.getElementById('header-top').appendChild(button);
  37.     document.getElementById("mh_close").addEventListener("click", mhSwitchVisibility, true);
  38.    
  39.    
  40.    
  41.    
  42.     // Menu
  43.     div = document.createElement("div");
  44.     div.setAttribute("id", "mh_menu");
  45.     div.className = "mh_menu";
  46.     div.style.display = "block";
  47.     div.style.border = "0";
  48.     div.style.position = "fixed";
  49.     div.style.top = "120px";
  50.     div.style.right = "20px";
  51.  
  52.     // Create inner html
  53.     html = "";
  54.     html += "<fieldset>";
  55.     html += "<label>MNM Personal Assistant</label>";
  56.     html += "<form id='mhForm'>";
  57.  
  58.     // Switch position
  59.     if(GM_getValue('mh_switchposition')) { chkd="checked"; } else { chkd=""; }
  60.         html += "<br /><input type='checkbox' id='mh_switchposition' " + chkd + "/> Switch position";
  61.  
  62.     // Hide blank
  63.     if(GM_getValue('mh_hideblank')) { chkd="checked"; } else { chkd=""; }
  64.         html += "<br /><input type='checkbox' id='mh_hideblank' " + chkd + "/> Hide blank comments";
  65.  
  66.     // Fixed top bar
  67.     if(GM_getValue('mh_fixedtopbar')) { chkd="checked"; } else { chkd=""; }
  68.         html += "<br /><input type='checkbox' id='mh_fixedtopbar' " + chkd + "/> Fixed top bar";
  69.  
  70.     // Neutral mode
  71.     if(GM_getValue('mh_neutralmode')) { chkd="checked"; } else { chkd=""; }
  72.         html += "<br /><input type='checkbox' id='mh_neutralmode' " + chkd + "/> Neutral mode";
  73.    
  74.     // Disable rounded avatars
  75.     if(GM_getValue('mh_roundedavatars')) { chkd="checked"; } else { chkd=""; }
  76.         html += "<br /><input type='checkbox' id='mh_roundedavatars' " + chkd + "/> Disable rounded avatars";
  77.  
  78.     html += "</form>";
  79.     html += "<br /><span style='float:right; font-size: 0.7em;'>Bugs & Suggestions - <a href='http://meneame.net/user/RickDeckard'>@RickDeckard</a></span>";
  80.     html += "<br /><span style='float:right; font-size: 0.7em;'><a target='_blank' href='http://twitter.com/dsmatilla'>@dsmatilla</a></span>";    
  81.     html += "</fieldset>";
  82.  
  83.     // Display div
  84.     div.innerHTML = html;
  85.     document.body.appendChild(div);
  86.    
  87.     // Add listener to each checkbox in mhForm
  88.     x=document.getElementById("mhForm");
  89.     for (i=0;i<x.length;i++) {
  90.         x.elements[i].addEventListener("click", mhActions, true);
  91.     }
  92.    
  93.    
  94.    
  95.     // Smiley bar
  96.     /*html = ""; AUN EN DESARROLLO
  97.     html += "<table>";
  98.     html += "<tr>";
  99.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/smiley.gif'></td>";
  100.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/wink.gif'></td>";
  101.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/cheesy.gif'></td>";
  102.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/grin.gif'></td>";
  103.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/angry.gif'></td>";
  104.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/sad.gif'></td>";
  105.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/shocked.gif'></td>";
  106.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/cool.gif'></td>";  
  107.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/huh.gif'></td>";
  108.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/rolleyes.gif'></td>";
  109.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/tongue.gif'></td>";
  110.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/embarassed.gif'></td>";    // oops
  111.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/lipsrsealed.gif'></td>"; // lipssealed
  112.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/undecided.gif'></td>";
  113.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/kiss.gif'></td>";
  114.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/cry.gif'></td>";    
  115.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/laugh.gif'></td>"; // lol
  116.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/confused.gif'></td>";
  117.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/blank.gif'></td>";
  118.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/palm.gif'></td>";  
  119.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/wow.gif'></td>";
  120.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/shame.gif'></td>";
  121.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/fu.gif'></td>"; // ffu
  122.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/goat.gif'></td>";   // goatse
  123.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/wall.gif'></td>";  
  124.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/trollface2.gif'></td>"; // trollface
  125.     html += "<td style='width: 60px; height: 30px; text-align: center;' colspan='2'><img src='http://mnmstatic.net/img/smileys/hug.gif'></td>";
  126.     html += "<td style='width: 30px; height: 30px; text-align: center;'><img src='http://mnmstatic.net/img/smileys/shit.gif'></td>";    // shift
  127.     html += "</tr>";
  128.     html += "</table>";
  129.     if(document.getElementById("comment"))
  130.         document.getElementById("comment").insertAdjacentHTML('beforebegin', html);*/
  131.  
  132.  
  133. }
  134.  
  135. function mhActions() { // Perform actions
  136.     var i, com, x;
  137.    
  138.     // Save form values
  139.     x=document.getElementById('mhForm');
  140.     for (i=0;i<x.length;i++) {
  141.         GM_setValue(x.elements[i].id, x.elements[i].checked);
  142.     }
  143.    
  144.     // Menu visibility
  145.     document.getElementById('mh_menu').style.display = GM_getValue('mh_menu_display');
  146.  
  147.     // Switch menu position
  148.     if(GM_getValue('mh_switchposition')) {
  149.         com = document.getElementById("mh_menu");
  150.         com.style.left = '';
  151.         com.style.right = '20px';
  152.     } else {
  153.         com = document.getElementById("mh_menu");
  154.         com.style.right = '';
  155.         com.style.left = '20px';
  156.     }
  157.    
  158.     // Hide blank
  159.     if(GM_getValue('mh_hideblank')) {
  160.         com = document.getElementsByClassName("hidden");
  161.         for (i=0; i<com.length; i++) { com[i].style.display = 'none'; }    
  162.     } else {
  163.         com = document.getElementsByClassName("hidden");
  164.         for (i=0; i<com.length; i++) { com[i].style.display = 'block'; }
  165.     }
  166.    
  167.     // fixed top bar
  168.     if(GM_getValue('mh_fixedtopbar')) {
  169.         com = document.getElementById("header");
  170.         com.style.position = 'fixed';
  171.         com.style.zIndex = 10;
  172.         com = document.getElementById("container");
  173.         com.style.marginTop = '105px';
  174.         document.getElementById("notifier").addEventListener("click", mhChangeNotifierPanel, true);
  175.     } else {
  176.         com = document.getElementById("header");
  177.         com.style.position = null;
  178.         com.style.zIndex = null;
  179.         com = document.getElementById("container");
  180.         com.style.marginTop = '0';
  181.         document.getElementById("notifier").removeEventListener("click", mhChangeNotifierPanel, true);
  182.     }
  183.    
  184.     // Neutral mode
  185.     if(GM_getValue('mh_neutralmode')) {
  186.         com = document.getElementsByClassName("comment-info");
  187.         for (i=0; i<com.length; i++) { com[i].style.display = 'none'; }    
  188.         com = document.getElementsByClassName("avatar");
  189.         for (i=0; i<com.length; i++) { com[i].style.display = 'none'; }  
  190.     } else {
  191.         com = document.getElementsByClassName("comment-info");
  192.         for (i=0; i<com.length; i++) { com[i].style.display = null; }
  193.         com = document.getElementsByClassName("avatar");
  194.         for (i=0; i<com.length; i++) { com[i].style.display = null; }
  195.     }
  196.    
  197.     // Disable rounded avatars
  198.     if(GM_getValue('mh_roundedavatars')) {
  199.         com = document.getElementsByClassName("avatar");
  200.         for (i=0; i<com.length; i++) { com[i].style.borderRadius = '0em'; }  
  201.         for (i=0; i<com.length; i++) { com[i].style.MozBorderRadius = '0em'; }
  202.         for (i=0; i<com.length; i++) { com[i].style.WebkitBorderRadius = '0em'; }        
  203.     } else {
  204.         com = document.getElementsByClassName("avatar");
  205.         for (i=0; i<com.length; i++) { com[i].style.borderRadius = '50%'; }  
  206.         for (i=0; i<com.length; i++) { com[i].style.MozBorderRadius = '50%'; }
  207.         for (i=0; i<com.length; i++) { com[i].style.WebkitBorderRadius = '50%'; }              
  208.     }
  209. }
  210.  
  211.  
  212. // Misc functions
  213. function mhSwitchVisibility() {
  214.     if(document.getElementById("mh_menu").style.display == 'none') {
  215.         document.getElementById("mh_menu").style.display = 'block';
  216.         GM_setValue("mh_menu_display", 'block');
  217.     } else {
  218.         document.getElementById('mh_menu').style.display = 'none';
  219.         GM_setValue('mh_menu_display', 'none');
  220.     }
  221. }
  222.  
  223. function mhChangeNotifierPanel() {
  224.     document.getElementById('notifier_panel').style.zIndex = 12;
  225.     document.getElementById('notifier_panel').style.position = 'fixed';
  226. }
  227.  
  228. // Display menu & others
  229. mhMenu();
  230.  
  231. // Perform actions
  232. mhActions();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement