-
Notifications
You must be signed in to change notification settings - Fork 0
/
loadExternal.js
31 lines (31 loc) · 1.11 KB
/
loadExternal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
old_load_plugins = window.loadPlugins;
window.loadPlugins=function()
{
old_load_plugins.apply(this,arguments);
loadExternalScripts.apply(this,arguments);
};
function loadExternalScripts(){
if (!store.isTiddler("ExternalScripts")) {
alert('Tiddler ExternalScripts not found!');
return;
}
var originalPath = document.location.toString();
var localPath = getLocalPath(originalPath);
var backSlash = true;
var dirPathPos = localPath.lastIndexOf("\\");
if(dirPathPos == -1) {
dirPathPos = localPath.lastIndexOf("/");
backSlash = false;
}
var scriptPath = localPath.substr(0,dirPathPos) + (backSlash ? "\\" : "/");
var scripts = store.getTiddlerText("ExternalScripts").readBracketedList();
for (var i=0; i<scripts.length;i++)
{
eval(loadFile(scriptPath+scripts[i]));
// alert(scriptPath+scripts[i]);
}
};
TiddlyWiki.prototype.isTiddler= function (title)
{
return store.tiddlerExists(title) || store.isShadowTiddler(title);
};