OcttKB Cross-Repo Sync (HTML to Raw)

This commit is contained in:
2023-07-23 13:33:31 +00:00
parent 0cfc51da4e
commit 49c7acc7f3
971 changed files with 50 additions and 29 deletions

View File

@ -0,0 +1,34 @@
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
enables js via <<script>> and disables with <<script 0>>
Modified from original to add ability to exec scripts with a script="" param
*/
exports.name = "script";
exports.params = [
{name: "run"},
{name: "script"},
];
/*
Run the macro
*/
exports.run = function(run, script) {
var off = run ? run.toLowerCase() : false;
if(off && ["0","no","off","false"].indexOf(off) > -1) {
$tw.config.htmlUnsafeElements = ["script"];
} else {
$tw.config.htmlUnsafeElements = [];
if (script) {
eval(script);
}
}
return "";
};
})();