From 787e3b3e781d5f6da3d96deaaad6238af7110659 Mon Sep 17 00:00:00 2001 From: 4yx Date: Sat, 3 Sep 2022 01:16:47 +0300 Subject: [PATCH] Release 2.0.2 Allow disabling certain features of AlterVP. --- altervp/README.md | 5 +- altervp/altervp.js | 63 +++++++++++++-------- altervp/altervp.min.js | 11 ++-- change-language-link-text-changer/readme.md | 2 +- change-password-link-text-changer/readme.md | 2 +- cpanel-logo-to-copyright/readme.md | 2 +- dropdown-bug-fix/README.md | 2 +- responsive-domain-search/README.md | 2 +- tutorial-link-changer/readme.md | 2 +- 9 files changed, 53 insertions(+), 38 deletions(-) diff --git a/altervp/README.md b/altervp/README.md index 638e17e..58fa862 100644 --- a/altervp/README.md +++ b/altervp/README.md @@ -32,7 +32,7 @@ const AlterVP = { } }; ``` -Replace the values inside with the ones you want for your panel. +Replace the values inside with the ones you want for your panel. You can comment out the lines of the features you do not wish to use. Afterwards, create a script tag with `src` pointing to `altervp.js` or `altervp.min.js` for the minified version. @@ -57,7 +57,7 @@ const AlterVP = { } }; - + ``` Alternatively, you can use our CDN: ```html @@ -83,3 +83,4 @@ Feel free to remove the comment line symbol (``//``) that explains the type of t * Modified on 14 September 2018 by [woxly](https://github.com/woxly) * Lost in time * Recreated on 30 August 2022 by [Anyx](https://github.com/4yx) +* Last modified on 3 September 2022 by [Anyx](https://github.com/4yx) diff --git a/altervp/altervp.js b/altervp/altervp.js index 385bb8a..4ce460e 100644 --- a/altervp/altervp.js +++ b/altervp/altervp.js @@ -1,40 +1,53 @@ /* * Created on 14 September 2018 by woxly * Recreated on 30 August 2022 by Anyx +* Modified on 3 September 2022 by Anyx * DO NOT REMOVE CREDITS! */ document.addEventListener("DOMContentLoaded", function() { // Title - document.title = AlterVP.title; + if (AlterVP.title !== undefined) { + document.title = AlterVP.title; + } // Protocol - if (window.location.protocol.replace(/:/g,'') !== AlterVP.protocol) { - location.protocol = AlterVP.protocol; + if (AlterVP.protocol !== undefined) { + if (window.location.protocol.replace(/:/g,'') !== AlterVP.protocol) { + location.protocol = AlterVP.protocol; + } } // Logo - document.getElementById("imgLogo").src = AlterVP.logo; + if (AlterVP.logo !== undefined) { + document.getElementById("imgLogo").src = AlterVP.logo; + } // Themes - if (AlterVP.category !== "lightspace") { - themeURL = ['https://vpt.cdn.wybenetwork.com', AlterVP.theme, 'styles.css'].join("/"); - if (AlterVP.category == "normal") { - iconURL = ['https://vpt.cdn.wybenetwork.com', AlterVP.theme, 'icon_spritemap.css'].join("/"); - icon = document.createElement('link'); - icon.type = 'text/css'; - icon.rel = 'stylesheet'; - icon.href = iconURL; - document.head.appendChild(icon); + if (AlterVP.theme !== undefined && AlterVP.category !== undefined) { + if (AlterVP.category !== "lightspace") { + themeURL = ['https://vpt.cdn.wybenetwork.com', AlterVP.theme, 'styles.css'].join("/"); + if (AlterVP.category == "normal") { + iconURL = ['https://vpt.cdn.wybenetwork.com', AlterVP.theme, 'icon_spritemap.css'].join("/"); + icon = document.createElement('link'); + icon.type = 'text/css'; + icon.rel = 'stylesheet'; + icon.href = iconURL; + document.head.appendChild(icon); + } + } else { + themeURL = ['https://vpt.cdn.wybenetwork.com', AlterVP.theme, 'panel.css'].join("/"); } - } else { - themeURL = ['https://vpt.cdn.wybenetwork.com', AlterVP.theme, 'panel.css'].join("/"); + theme = document.createElement('link'); + theme.type = 'text/css'; + theme.rel = 'stylesheet'; + theme.href = themeURL; + document.head.appendChild(theme); } - theme = document.createElement('link'); - theme.type = 'text/css'; - theme.rel = 'stylesheet'; - theme.href = themeURL; - document.head.appendChild(theme); // Credits - script = document.createElement('script') - script.setAttribute('type', 'text/javascript') - script.innerHTML = "window.addEventListener('load',function(){document.getElementById('imgPoweredByCpanel').src=AlterVP.credits.logo})" - document.body.appendChild(script) - document.getElementById("txtCpanelVersion").innerHTML = AlterVP.credits.desc; + if (AlterVP.credits.logo !== undefined) { + script = document.createElement('script') + script.setAttribute('type', 'text/javascript') + script.innerHTML = "window.addEventListener('load',function(){document.getElementById('imgPoweredByCpanel').src=AlterVP.credits.logo,document.getElementById('txtCpanelVersion').innerHTML=AlterVP.credits.desc})" + document.body.appendChild(script) + } + if (AlterVP.credits.desc !== undefined) { + document.getElementById("txtCpanelVersion").innerHTML = AlterVP.credits.desc; + } }); \ No newline at end of file diff --git a/altervp/altervp.min.js b/altervp/altervp.min.js index 998030a..d3b865e 100644 --- a/altervp/altervp.min.js +++ b/altervp/altervp.min.js @@ -1,16 +1,17 @@ /* * Created on 14 September 2018 by woxly * Recreated on 30 August 2022 by Anyx +* Modified on 3 September 2022 by Anyx * DO NOT REMOVE CREDITS! */ document.addEventListener("DOMContentLoaded",function(){ // Title -document.title=AlterVP.title, +void 0!==AlterVP.title&&(document.title=AlterVP.title), // Protocol -window.location.protocol.replace(/:/g,"")!==AlterVP.protocol&&(location.protocol=AlterVP.protocol), +void 0!==AlterVP.protocol&&window.location.protocol.replace(/:/g,"")!==AlterVP.protocol&&(location.protocol=AlterVP.protocol), // Logo -document.getElementById("imgLogo").src=AlterVP.logo, +void 0!==AlterVP.logo&&(document.getElementById("imgLogo").src=AlterVP.logo), // Themes -"lightspace"!==AlterVP.category?(themeURL=["https://vpt.cdn.wybenetwork.com",AlterVP.theme,"styles.css"].join("/"),"normal"==AlterVP.category&&(iconURL=["https://vpt.cdn.wybenetwork.com",AlterVP.theme,"icon_spritemap.css"].join("/"),icon=document.createElement("link"),icon.type="text/css",icon.rel="stylesheet",icon.href=iconURL,document.head.appendChild(icon))):themeURL=["https://vpt.cdn.wybenetwork.com",AlterVP.theme,"panel.css"].join("/"),theme=document.createElement("link"),theme.type="text/css",theme.rel="stylesheet",theme.href=themeURL,document.head.appendChild(theme), +void 0!==AlterVP.theme&&void 0!==AlterVP.category&&("lightspace"!==AlterVP.category?(themeURL=["https://vpt.cdn.wybenetwork.com",AlterVP.theme,"styles.css"].join("/"),"normal"==AlterVP.category&&(iconURL=["https://vpt.cdn.wybenetwork.com",AlterVP.theme,"icon_spritemap.css"].join("/"),icon=document.createElement("link"),icon.type="text/css",icon.rel="stylesheet",icon.href=iconURL,document.head.appendChild(icon))):themeURL=["https://vpt.cdn.wybenetwork.com",AlterVP.theme,"panel.css"].join("/"),theme=document.createElement("link"),theme.type="text/css",theme.rel="stylesheet",theme.href=themeURL,document.head.appendChild(theme)), // Credits -script=document.createElement("script"),script.setAttribute("type","text/javascript"),script.innerHTML="window.addEventListener('load',function(){document.getElementById('imgPoweredByCpanel').src=AlterVP.credits.logo})",document.body.appendChild(script),document.getElementById("txtCpanelVersion").innerHTML=AlterVP.credits.desc}); \ No newline at end of file +void 0!==AlterVP.credits.logo&&(script=document.createElement("script"),script.setAttribute("type","text/javascript"),script.innerHTML="window.addEventListener('load',function(){document.getElementById('imgPoweredByCpanel').src=AlterVP.credits.logo,document.getElementById('txtCpanelVersion').innerHTML=AlterVP.credits.desc})",document.body.appendChild(script)),void 0!==AlterVP.credits.desc&&(document.getElementById("txtCpanelVersion").innerHTML=AlterVP.credits.desc)}); \ No newline at end of file diff --git a/change-language-link-text-changer/readme.md b/change-language-link-text-changer/readme.md index 0b5616c..8a82f5b 100644 --- a/change-language-link-text-changer/readme.md +++ b/change-language-link-text-changer/readme.md @@ -27,7 +27,7 @@ The full code, using jsDelivr: var change_language_link = "your_website_url", change_language_text = "your_text"; - + ``` Alternatively, you can use our CDN: ```html diff --git a/change-password-link-text-changer/readme.md b/change-password-link-text-changer/readme.md index aa1ae87..f143c75 100644 --- a/change-password-link-text-changer/readme.md +++ b/change-password-link-text-changer/readme.md @@ -26,7 +26,7 @@ The full code, using jsDelivr: var change_password_link = "your_website_url", change_password_text = "your_text"; - + ``` Alternatively, you can use our CDN: ```html diff --git a/cpanel-logo-to-copyright/readme.md b/cpanel-logo-to-copyright/readme.md index fcc4b1f..6f4ff64 100644 --- a/cpanel-logo-to-copyright/readme.md +++ b/cpanel-logo-to-copyright/readme.md @@ -46,7 +46,7 @@ The full code, using jsDelivr: } - + ``` Alternatively, you can use our CDN: ```html diff --git a/dropdown-bug-fix/README.md b/dropdown-bug-fix/README.md index 64d4010..6450949 100644 --- a/dropdown-bug-fix/README.md +++ b/dropdown-bug-fix/README.md @@ -18,7 +18,7 @@ To solve this, we need an external service which adds the correct type, like jsD The full code, using jsDelivr: ```html - + ``` Alternatively, you can use our CDN: ```html diff --git a/responsive-domain-search/README.md b/responsive-domain-search/README.md index 413aa7e..156c19c 100644 --- a/responsive-domain-search/README.md +++ b/responsive-domain-search/README.md @@ -32,7 +32,7 @@ The full code, using jsDelivr: affCode = "AFFILIATE_CODE_HERE"; */ - + ``` Alternatively, you can use our CDN: ```html diff --git a/tutorial-link-changer/readme.md b/tutorial-link-changer/readme.md index ff21187..9ff3238 100644 --- a/tutorial-link-changer/readme.md +++ b/tutorial-link-changer/readme.md @@ -37,7 +37,7 @@ The full code, using jsDelivr: tutorial : "YOUR TUTORIAL LINK WITH HTTP(S) PROTOCOL", } - + ``` Alternatively, you can use our CDN: ```html