Last active
May 30, 2020 19:28
-
-
Save cecekpawon/6ed11fd7315180ce1e5d261e07025418 to your computer and use it in GitHub Desktop.
Apple support download ez nav
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name KBDL | |
// @namespace https://cecekpawon.github.io/ | |
// @version 0.2 | |
// @description Apple support download ez nav | |
// @author cecekpawon | |
// @match https://support.apple.com/kb/DL* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var | |
main = document.getElementById('main')/*, | |
errorbox = document.getElementById('errorbox')*/; | |
if ((main != null) /*&& (errorbox == null)*/) { | |
var | |
style = '.ywrap { padding: 20px 0; text-align: left; }' + | |
'.ywrap > * { color: white; border-radius: 5px; display: inline-block; font-weight: bold; line-height: 17px; }' + | |
'.ynav { background-color: black; cursor: pointer; font-size: 13px; position: relative; }' + | |
'.ynavl { padding: 5px 10px 5px 5px; }' + | |
'.yinfo { z-index: 1; position: relative; font-size: 22px; background-color: red; padding: 7px 10px; margin-left: -5px; border: solid 2px white; top: 10px; }' + | |
'.ynavr { margin-left: -5px; padding: 5px 5px 5px 10px; top: 20px; }', | |
kburl = 'https://support.apple.com/kb/DL', | |
css = document.createElement('style'), | |
id = parseInt(document.URL.match(/\/DL(\d+)/i)[1]), | |
wrap = document.createElement("div"), | |
div1 = document.createElement("div"), | |
div2 = document.createElement("div"), | |
div3 = document.createElement("div"); | |
css.type = 'text/css'; | |
if (css.styleSheet) css.styleSheet.cssText = style; | |
else css.appendChild(document.createTextNode(style)); | |
document.getElementsByTagName('head')[0].appendChild(css); | |
wrap.className = "ywrap"; | |
div1.className = "ywrapc ynav ynavl"; | |
div2.className = "ywrapc yinfo"; | |
div3.className = "ywrapc ynav ynavr"; | |
div1.appendChild(document.createTextNode("<")); | |
div2.appendChild(document.createTextNode(id)); | |
div3.appendChild(document.createTextNode(">")); | |
div1.onclick = function(e) { document.location = kburl + (id - 1).toString(); }; | |
div3.onclick = function(e) { document.location = kburl + (id + 1).toString(); }; | |
wrap.appendChild(div1); | |
wrap.appendChild(div2); | |
wrap.appendChild(div3); | |
//main.appendChild(wrap); | |
main.insertBefore(wrap, main.firstChild); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment