Add tags for librejs compatibility on application/console pages and in embedded javascript

This commit is contained in:
hankhill19580
2020-09-20 05:05:57 +00:00
parent c4a5d111e7
commit 8fa3e45e47
23 changed files with 129 additions and 1 deletions

View File

@ -1,3 +1,5 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
function initDelete() function initDelete()
{ {
var main = document.getElementById("mainsection"); var main = document.getElementById("mainsection");
@ -21,3 +23,5 @@ function initDelete()
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initDelete(); initDelete();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,5 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
const setupbuttons=()=>{ const setupbuttons=()=>{
let sp = document.forms[0].savepri; let sp = document.forms[0].savepri;
if ( sp ) updatesetallbuttons(), sp.disabled = true, sp.className = 'disabled'; if ( sp ) updatesetallbuttons(), sp.disabled = true, sp.className = 'disabled';
@ -115,3 +117,5 @@ function addClickHandler(elem)
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
setupbuttons(); setupbuttons();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,9 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
function requestAjax1() { function requestAjax1() {
var url = ".ajax/xhr1.html"; var url = ".ajax/xhr1.html";
var query = window.location.search; var query = window.location.search;
@ -13,3 +19,5 @@ function initAjax() {
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initAjax(); initAjax();
}, true); }, true);
/* #license-end */

View File

@ -1,3 +1,5 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
function initDelete() function initDelete()
{ {
var buttons = document.getElementsByClassName("delete"); var buttons = document.getElementsByClassName("delete");
@ -21,3 +23,5 @@ function addClickHandler(elem)
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initDelete(); initDelete();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,5 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
function initTables() { function initTables() {
var hideableTables = document.querySelectorAll("table.tunnelConfig th"); var hideableTables = document.querySelectorAll("table.tunnelConfig th");
@ -75,3 +77,5 @@ hideableTables.forEach(function(configTable) {
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initTables(); initTables();
}, true); }, true);
/* @license-end */

View File

@ -27,6 +27,8 @@
<script src="/js/iframed.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script> <script src="/js/iframed.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script>
<%@include file="summaryajax.jsi" %> <%@include file="summaryajax.jsi" %>
<script nonce="<%=cspNonce%>" type="text/javascript"> <script nonce="<%=cspNonce%>" type="text/javascript">
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
function setupFrame() { function setupFrame() {
f = document.getElementById("susidnsframe"); f = document.getElementById("susidnsframe");
f.addEventListener("load", function() { f.addEventListener("load", function() {
@ -34,6 +36,8 @@
resizeFrame(f); resizeFrame(f);
}, true); }, true);
} }
/* @license-end */
</script> </script>
</head><body> </head><body>
<%@include file="summary.jsi" %> <%@include file="summary.jsi" %>

View File

@ -27,6 +27,8 @@
<script src="/js/iframed.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script> <script src="/js/iframed.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script>
<%@include file="summaryajax.jsi" %> <%@include file="summaryajax.jsi" %>
<script nonce="<%=cspNonce%>" type="text/javascript"> <script nonce="<%=cspNonce%>" type="text/javascript">
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
function injectClassSpecific(f) { function injectClassSpecific(f) {
var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document; var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document;
if (doc.getElementsByClassName == undefined) { if (doc.getElementsByClassName == undefined) {
@ -56,6 +58,8 @@
resizeFrame(f); resizeFrame(f);
}, true); }, true);
} }
/* @license-end */
</script> </script>
</head><body> </head><body>

View File

@ -1,3 +1,9 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
var fails = 0; var fails = 0;
function ajax(url, target, refresh) { function ajax(url, target, refresh) {
@ -48,3 +54,5 @@ function ajaxDone(url, target, refresh) {
setTimeout(function() {ajax(url, target, refresh);}, refresh); setTimeout(function() {ajax(url, target, refresh);}, refresh);
} }
} }
/* @license-end */

View File

@ -1,3 +1,9 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
function initConfigClients() function initConfigClients()
{ {
var buttons = document.getElementsByClassName("delete"); var buttons = document.getElementsByClassName("delete");
@ -21,3 +27,5 @@ function addCCClickHandler(elem)
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initConfigClients(); initConfigClients();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,9 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
function initConfigStats() function initConfigStats()
{ {
checkAll = false; checkAll = false;
@ -66,3 +72,5 @@ function toggleAll(category)
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initConfigStats(); initConfigStats();
}, true); }, true);
/* @license-end */

View File

@ -1,8 +1,15 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
function injectClass(f) { function injectClass(f) {
f.className += ' iframed'; f.className += ' iframed';
var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document; var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document;
doc.body.className += ' iframed'; doc.body.className += ' iframed';
} }
function resizeFrame(f) { function resizeFrame(f) {
// offsetHeight returns the height of the visible area for an object, in pixels. // offsetHeight returns the height of the visible area for an object, in pixels.
// The value contains the height with the padding, scrollBar, and the border, // The value contains the height with the padding, scrollBar, and the border,
@ -39,3 +46,5 @@ function resizeFrame(f) {
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
setupFrame(); setupFrame();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,9 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
// refresh the sidebar mini graph every 15 seconds // refresh the sidebar mini graph every 15 seconds
function refreshGraph() { function refreshGraph() {
@ -5,4 +11,6 @@ function refreshGraph() {
setTimeout(refreshGraph, 15000); setTimeout(refreshGraph, 15000);
} }
refreshGraph(); refreshGraph();
/* @license-end */

View File

@ -1,3 +1,9 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
function initResetScroll() function initResetScroll()
{ {
var buttons = document.getElementsByClassName("resetScrollLeft"); var buttons = document.getElementsByClassName("resetScrollLeft");
@ -35,3 +41,5 @@ function resetScrollTop(element) {
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initResetScroll(); initResetScroll();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,9 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
function initStats() function initStats()
{ {
var buttons = document.getElementsByClassName("onchange"); var buttons = document.getElementsByClassName("onchange");
@ -18,3 +24,5 @@ function addSChangeHandler(elem)
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initStats(); initStats();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,9 @@
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
var fails = 0; var fails = 0;
function ajax(url, target, refresh) { function ajax(url, target, refresh) {
@ -62,3 +68,5 @@ function ajaxDone(url, target, refresh) {
setTimeout(function() {ajax(url, target, refresh);}, refresh); setTimeout(function() {ajax(url, target, refresh);}, refresh);
} }
} }
/* @license-end */

View File

@ -2,10 +2,14 @@
if (!intl.getDisableRefresh()) { if (!intl.getDisableRefresh()) {
%><script src="/js/ajax.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script> %><script src="/js/ajax.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script>
<script nonce="<%=cspNonce%>" type="text/javascript"> <script nonce="<%=cspNonce%>" type="text/javascript">
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
var failMessage = "<hr><b><%=intl._t("Router is down")%><\/b>"; var failMessage = "<hr><b><%=intl._t("Router is down")%><\/b>";
function requestAjax1() { ajax("/xhr1.jsp?requestURI=<%=request.getRequestURI()%>", "xhr", <%=intl.getRefresh()%>000); } function requestAjax1() { ajax("/xhr1.jsp?requestURI=<%=request.getRequestURI()%>", "xhr", <%=intl.getRefresh()%>000); }
function initAjax() { setTimeout(requestAjax1, <%=intl.getRefresh()%>000); } function initAjax() { setTimeout(requestAjax1, <%=intl.getRefresh()%>000); }
initAjax(); initAjax();
/* @license-end */
</script><% </script><%
} }
%> %>

View File

@ -28,6 +28,8 @@
<script src="/js/iframed.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script> <script src="/js/iframed.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script>
<%@include file="summaryajax.jsi" %> <%@include file="summaryajax.jsi" %>
<script nonce="<%=cspNonce%>" type="text/javascript"> <script nonce="<%=cspNonce%>" type="text/javascript">
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
function setupFrame() { function setupFrame() {
f = document.getElementById("i2psnarkframe"); f = document.getElementById("i2psnarkframe");
f.addEventListener("load", function() { f.addEventListener("load", function() {
@ -35,6 +37,8 @@
resizeFrame(f); resizeFrame(f);
}, true); }, true);
} }
/* @license-end */
</script> </script>
</head><body> </head><body>
<%@include file="summary.jsi" %> <%@include file="summary.jsi" %>

View File

@ -28,6 +28,8 @@
<script src="/js/iframed.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script> <script src="/js/iframed.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script>
<%@include file="summaryajax.jsi" %> <%@include file="summaryajax.jsi" %>
<script nonce="<%=cspNonce%>" type="text/javascript"> <script nonce="<%=cspNonce%>" type="text/javascript">
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
function setupFrame() { function setupFrame() {
f = document.getElementById("susimailframe"); f = document.getElementById("susimailframe");
f.addEventListener("load", function() { f.addEventListener("load", function() {
@ -35,6 +37,8 @@
resizeFrame(f); resizeFrame(f);
}, true); }, true);
} }
/* @license-end */
</script> </script>
</head><body> </head><body>
<%@include file="summary.jsi" %> <%@include file="summary.jsi" %>

View File

@ -68,6 +68,8 @@
%> %>
<script src="/js/welcomeajax.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script> <script src="/js/welcomeajax.js?<%=net.i2p.CoreVersion.VERSION%>" type="text/javascript"></script>
<script nonce="<%=cspNonce%>" type="text/javascript"> <script nonce="<%=cspNonce%>" type="text/javascript">
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
var failMessage = "<b><%=intl._t("Router is down")%><\/b>"; var failMessage = "<b><%=intl._t("Router is down")%><\/b>";
var progressMessage = "<b><%=intl._t("Bandwidth test in progress...")%><\/b>"; var progressMessage = "<b><%=intl._t("Bandwidth test in progress...")%><\/b>";
var doneMessage = "<b><%=intl._t("Bandwidth test is complete, click Next")%><\/b>"; var doneMessage = "<b><%=intl._t("Bandwidth test is complete, click Next")%><\/b>";
@ -79,6 +81,8 @@
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initAjax(); initAjax();
}, true); }, true);
/* @license-end */
</script> </script>
<% <%
} // ipg == 3 } // ipg == 3

View File

@ -1,3 +1,4 @@
/* #license http://www.jclark.com/xml/copying.txt Expat */
function HideMessages() { function HideMessages() {
var hideableMessages = document.getElementsByClassName("messages"); var hideableMessages = document.getElementsByClassName("messages");
@ -17,3 +18,5 @@ function HideMessages() {
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
document.body.addEventListener('click', HideMessages, true); document.body.addEventListener('click', HideMessages, true);
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,5 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
let beforePopup = true; let beforePopup = true;
window.addEventListener('beforeunload', (e)=>{if (beforePopup) e.returnValue=true;} ); window.addEventListener('beforeunload', (e)=>{if (beforePopup) e.returnValue=true;} );
@ -20,3 +22,5 @@ function addClickHandler5(elem)
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initPopup(); initPopup();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,5 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
function initButtons() { function initButtons() {
var buttons = document.getElementsByClassName("delete1"); var buttons = document.getElementsByClassName("delete1");
for(index = 0; index < buttons.length; index++) for(index = 0; index < buttons.length; index++)
@ -100,3 +102,5 @@ document.addEventListener("DOMContentLoaded", function() {
initButtons(); initButtons();
deleteboxclicked(); deleteboxclicked();
}, true); }, true);
/* @license-end */

View File

@ -1,3 +1,5 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
function initNotifications() { function initNotifications() {
var buttons = document.getElementsByClassName("notifications"); var buttons = document.getElementsByClassName("notifications");
for(index = 0; index < buttons.length; index++) for(index = 0; index < buttons.length; index++)
@ -17,3 +19,5 @@ function addClickHandler6(elem)
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
initNotifications(); initNotifications();
}, true); }, true);
/* @license-end */