mirror of
https://gitlab.com/octtspacc/OcttKB
synced 2025-06-06 00:29:12 +02:00
[Manual] Add scripts and raw wiki
This commit is contained in:
34
Wiki/tiddlers/$__ThirdParty_tobibeer_script.js
Normal file
34
Wiki/tiddlers/$__ThirdParty_tobibeer_script.js
Normal 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 "";
|
||||
};
|
||||
})();
|
Reference in New Issue
Block a user