OcttKB Cross-Repo Sync (HTML to Raw)

This commit is contained in:
2023-03-24 11:58:33 +00:00
parent e0528394e6
commit dc21b3c71c
1537 changed files with 93 additions and 1028 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 "";
};
})();