Advertisement
Eliaseeg

ChameColors

Jan 15th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         ChameColors
  3. // @namespace    https://atelier801.com/
  4. // @version      0.1
  5. // @description  Colorcitos personalizados pa chame
  6. // @author       Eliaseeg
  7. // @match        *://atelier801.com/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.  
  14.     // Edita los valores aquí
  15.     var colors = {
  16.         Lavanda: "#e6e6fa",
  17.         Cyan: "#00ffff",
  18.         Oro: "#ffd700",
  19.         Gris: "#808080",
  20.         Elias: "#000000",
  21.         Salmon: "#fa8072",
  22.         Ladrillo: "#b22222",
  23.         Plata: "#c0c0c0",
  24.         Cafe: "#8b4513",
  25.         Rosa: "#ffc0cb",
  26.         Turqueza: "#40e0d0",
  27.         Coral: "#ff7f50",
  28.         Tomate: "#ff6347",
  29.         Elias2: "#ffffff",
  30.         Vainilla: "#fff8dc",
  31.         Violeta: "#c71585",
  32.     };
  33.  
  34.     const itemsPerRow = 4 // puedes editar esto si quieres, esto te dice cuantos elementos se van a mostrar por fila.
  35.  
  36.     const newRow = "<tr>";
  37.     const endRow = "</td></tr>";
  38.     var divControl;
  39.     var divControlSujet;
  40.     var count = 0;
  41.     var colorDiv = document.createElement('div');
  42.     var fullDiv = newRow;
  43.  
  44.     for (var color in colors) {
  45.         count++;
  46.  
  47.         fullDiv += '<td class="cellule-dropdown"> <li><a class="element-menu-outils" onclick="ajouterBBCode('+"'message_reponse'" + ", '[color=" + colors[color] + "]', '[/color]', "+ 15 + ");"+'"><font color="' + colors[color] + '"/>'+color+'</a></li></td>';
  48.         if (count%4 == 0) {
  49.             fullDiv += newRow;
  50.         }
  51.     }
  52.  
  53.     colorDiv.setAttribute("class", "btn-group groupe-boutons-barre-outils");
  54.     colorDiv.innerHTML = '<button type="button" class="btn btn-reduit" onclick="ajouterBBCode('+"'message_reponse'"+"', '[color=]', '[/color]', 7);" + ' title="Colores"><img src="https://i.imgur.com/aPbjLMM.png"></button> <button class="btn btn-reduit dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> \ <ul class="dropdown-menu label-message"><table><tbody>' + fullDiv + '</tbody></table></ul> </div>';
  55.  
  56.     if (document.getElementById("outils_message_reponse")) {
  57.         divControl = document.getElementById("outils_message_reponse");
  58.         divControl.insertBefore(colorDiv, divControl.childNodes[19]);
  59.     }
  60.  
  61.     if (document.getElementById("outils_message_sujet")) {
  62.         divControlSujet = document.getElementById("outils_message_sujet");
  63.         divControlSujet.insertBefore(colorDiv, divControlSujet.childNodes[19]);
  64.     }
  65.  
  66. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement