<script type="text/javascript">$(document).ready(function() { $(table).DataTable();} );</script>
<script type="text/javascript">
alert("Hooray");
</script>
Note that script tags are allowed in text/html tiddlers because they are safely sandboxed in an iframe.
<script type="text/javascript">
alert("hooray!\n\n"
+ "Your username is '"
+ window.parent.$tw.wiki.getTiddlerText("$:/status/UserName") + "'\n\n" +
+ "And this wiki is called '"
+ window.parent.$tw.wiki.getTiddlerText("$:/SiteTitle")+"'");
</script>
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
Go to tiddlywiki.com
Create a New Tiddler
Paste this into the tiddler:
<script type="text/javascript">
alert("Hooray");
</script>
Set the type to "text/html"
It's not hard to find. If you search the source tree for "script" (including quotes) you'll see this in config.js...
exports.htmlUnsafeElements = "script".split(",");
but I think it would be better to include a couple of macros to switch scripting on and off:(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "enablescript";
exports.params = [
];
/*
Run the macro
*/
exports.run = function() {
$tw.config.htmlUnsafeElements = "";
return "";
};
})();
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
/*
Information about this macro
returns value of key in a data json tiddler
note that macros are not connected with the refresh mechanism -use with caution.
*/
exports.name = "disablescript";
exports.params = [
];
/*
Run the macro
*/
exports.run = function() {
$tw.config.htmlUnsafeElements = "script".split(",");
return "";
}
})();
I never actually looked at the core to find what disables script tags. I'd be curious to figure out how to enable them. Anyone wanting to mess with your data would do the same thing. I prefer to know myself how that's done.
Best wishes, Tobias.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
You can't put in any javascript after the wiki is loaded and have it take effect for safety reasons.
I regularly backup my wiki so I'd be interested to know if this is at all hackable.
I'm also somewhat confused about why we have javascript macros then, and what the difference is there.
Though at this point I should probably study the code a lot more so I know what I'm talking about. I'll be back!
I'm also somewhat confused about why we have javascript macros then, and what the difference is there.
Edge cases????
I can see that you might be able to do a lot with the wiki-text macros, but ... for anything complex they get pretty *unreadable pretty quickly!
And it's not like they use a language you might use somewhere else.
IMO, more, not less, use should be made of JS macros.
I'm just about to rework the lexer/parser you helped me with a few years ago into TW5 - but it'll stay in JS. I hope you'll be on standby once again :-)
On Monday, March 6, 2017 at 11:20:58 AM UTC+1, tejjyid wrote:Edge cases????
There are 11 js macros in the core and 860 macro \define statements in the UI and templates. ~200 of them are duplicated in the language editions. So macros are all over in the core, and we only had 11 exceptions, that where done in js. The rest it pure wikitext. ... IMO that's impressive.
I can see that you might be able to do a lot with the wiki-text macros, but ... for anything complex they get pretty *unreadable pretty quickly!
Readability is a problem, since whitespace matters. .... But many of the core macros could have better readability, without side-effects in the DOM.
And it's not like they use a language you might use somewhere else.
They use wikitext. ??
IMO, more, not less, use should be made of JS macros.
js macros can't be modified by most users. Standard macros can be modified by every user. That's a huge difference.
I'm just about to rework the lexer/parser you helped me with a few years ago into TW5 - but it'll stay in JS. I hope you'll be on standby once again :-)
If you want to implement stuff like this, you clearly have to go with javascript. ...
There is a big difference between TWc macros and TW5 macros. They are completely different things.
TW5 macros are simple text-substutions, with no built-in "refresh" mechanism. TWc macros are more like TW5 widgets now. .. parsing and rendering a domain specific language (DLC) is a complete different topic again, but doable. We have such plugins already.
eg:
railroad-plugin, markdown-plugin, katex-plugin, .. which may give you hints :)
have fun!
mario