| Name | TSHealth |
| Version | 0.2.3 |
| Description | Checks and informs you if you have overwritten core plugins |
(function($) {
var tshealth = function() {
if(!readOnly) {
this.init();
}
};
tshealth.prototype = {
init: function() {
var bags = ["system-plugins_public", "system", "tiddlyspace"];
$.ajax({
// assume no more than 100 core plugins
url: "/search?q=(bag:system-plugins_public OR bag:system OR bag:tiddlyspace) AND tag:systemConfig _limit:100",
dataType: "text",
success: function(r) {
var dirty = [];
var titles = r.split("\n");
for(var i = 0; i < titles.length; i++) {
var title = titles[i];
var tid = store.getTiddler(title);
if(tid && tid.fields) {
if(bags.indexOf(tid.fields['server.bag']) === -1) {
dirty.push(title);
}
}
}
if(dirty.length > 0) {
var msgArea = $('<div class="annotation" />').prependTo(document.body)[0];
var msg = [dirty.length, " tiddlers have been copied locally.",
" This copied tiddlers could cause problems with your wiki in future: ",
];
for(var i = 0; i < dirty.length; i++) {
msg.push("[[" + dirty[i] + "]]");
if(i !== dirty.length - 1) {
msg.push(", ");
} else {
msg.push(". ");
}
}
wikify(msg.join(""), msgArea);
$("<a class='button'>revert to originals</a>").data("dirty", dirty).click(function(ev) {
var dirty = $(ev.target).data("dirty");
var tids = [];
for(var i = 0; i < dirty.length; i++) {
tids.push(store.removeTiddler(dirty[i]));
}
autoSaveChanges(null, tids);
$(ev.target).parent().hide();
}).appendTo(msgArea);
$("<a class='button'>hide message</a>").click(function(ev) {
$(ev.target).parent().hide(1000);
}).appendTo(msgArea);
}
}
})
}
}
new tshealth();
})(jQuery);