Javascript.RU

Создать новую тему Ответ
 
Опции темы Искать в теме
  #11 (permalink)  
Старый 19.04.2018, 20:14
Интересующийся
Отправить личное сообщение для Nik123 Посмотреть профиль Найти все сообщения от Nik123
 
Регистрация: 14.08.2017
Сообщений: 12

Мой доработанный скрипт.
Вот немного доработанный мной вариант скрипта. Ссылки на каждом сайте будут подчеркиваться новым цветом!

// ==UserScript==
// @name         Underline_links
// @namespace    [url]http://tampermonkey.net/[/url]
// @version      0.1
// @description  try to take over the world!
// @author       You
// @include      [url]https://*[/url]
// @include      [url]http://*[/url]
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var i = Math.floor(Math.random()*8);
    var elem = document.createElement('style');
    switch (i) {
        case 0:
            elem.innerHTML ='a {line-height: 1 !important;display: inline-block !important;cursor: pointer;} a:after {display: block !important;position: relative !important;content: "" !important;height: 2px !important;width: 0% !important;background-color: red !important; transition: all .3s ease-in-out !important;left: 50% !important;} a:hover:after, a:focus:after {width: 100% !important;left:0% !important;} a:hover{text-decoration: none !important;}';
            break;
        case 1:
            elem.innerHTML ='a {line-height: 1 !important;display: inline-block !important;cursor: pointer;} a:after {display: block !important;position: relative !important;content: "" !important;height: 2px !important;width: 0% !important;background-color: orangered !important; transition: all .3s ease-in-out !important;left: 50% !important;} a:hover:after, a:focus:after {width: 100% !important;left:0% !important;} a:hover{text-decoration: none !important;}';
            break;
        case 2:
            elem.innerHTML ='a {line-height: 1 !important;display: inline-block !important;cursor: pointer;} a:after {display: block !important;position: relative !important;content: "" !important;height: 2px !important;width: 0% !important;background-color: yellowgreen !important; transition: all .3s ease-in-out !important;left: 50% !important;} a:hover:after, a:focus:after {width: 100% !important;left:0% !important;} a:hover{text-decoration: none !important;}';
            break;
        case 3:
            elem.innerHTML ='a {line-height: 1 !important;display: inline-block !important;cursor: pointer;} a:after {display: block !important;position: relative !important;content: "" !important;height: 2px !important;width: 0% !important;background-color: green !important; transition: all .3s ease-in-out !important;left: 50% !important;} a:hover:after, a:focus:after {width: 100% !important;left:0% !important;} a:hover{text-decoration: none !important;}';
            break;
        case 4:
            elem.innerHTML ='a {line-height: 1 !important;display: inline-block !important;cursor: pointer;} a:after {display: block !important;position: relative !important;content: "" !important;height: 2px !important;width: 0% !important;background-color: teal !important; transition: all .3s ease-in-out !important;left: 50% !important;} a:hover:after, a:focus:after {width: 100% !important;left:0% !important;} a:hover{text-decoration: none !important;}';
            break;
        case 5:
            elem.innerHTML ='a {line-height: 1 !important;display: inline-block !important;cursor: pointer;} a:after {display: block !important;position: relative !important;content: "" !important;height: 2px !important;width: 0% !important;background-color: aqua !important; transition: all .3s ease-in-out !important;left: 50% !important;} a:hover:after, a:focus:after {width: 100% !important;left:0% !important;} a:hover{text-decoration: none !important;}';
            break;
        case 6:
            elem.innerHTML ='a {line-height: 1 !important;display: inline-block !important;cursor: pointer;} a:after {display: block !important;position: relative !important;content: "" !important;height: 2px !important;width: 0% !important;background-color: deepskyblue !important; transition: all .3s ease-in-out !important;left: 50% !important;} a:hover:after, a:focus:after {width: 100% !important;left:0% !important;} a:hover{text-decoration: none !important;}';
            break;
        case 7:
            elem.innerHTML ='a {line-height: 1 !important;display: inline-block !important;cursor: pointer;} a:after {display: block !important;position: relative !important;content: "" !important;height: 2px !important;width: 0% !important;background-color: fuchsia !important; transition: all .3s ease-in-out !important;left: 50% !important;} a:hover:after, a:focus:after {width: 100% !important;left:0% !important;} a:hover{text-decoration: none !important;}';
    };
    document.head.appendChild(elem);
})();
Ответить с цитированием
  #12 (permalink)  
Старый 19.04.2018, 20:18
Аватар для j0hnik
Профессор
Отправить личное сообщение для j0hnik Посмотреть профиль Найти все сообщения от j0hnik
 
Регистрация: 01.12.2016
Сообщений: 3,650

Вам бы про циклы почитать и циклические методы работы с массивами.
Ответить с цитированием
Ответ



Опции темы Искать в теме
Искать в теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Скрытие блока ссылок с помощью OnClick N1rvana Общие вопросы Javascript 0 02.04.2017 18:03
Масовое отображение одного блока разных ссылок scotch91 Общие вопросы Javascript 1 19.12.2015 13:08
Блок ссылок с полосой прокрутки sergofedor06 (X)HTML/CSS 22 22.11.2015 07:06
Плавное сворачивание/разворачивание ссылок Vitaliy21 jQuery 3 01.05.2013 00:11
формирование ссылок на все каталоги пути данного HTML документа vitaxa3581 Общие вопросы Javascript 2 15.12.2012 01:06