1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-06 10:06:19 +00:00
TiddlyWiki5/core/modules/upgraders/system.js

40 lines
1.0 KiB
JavaScript
Raw Normal View History

2014-07-12 08:09:36 +00:00
/*\
title: $:/core/modules/upgraders/system.js
type: application/javascript
module-type: upgrader
Upgrader module that suppresses certain system tiddlers that shouldn't be imported
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var DONT_IMPORT_LIST = ["$:/StoryList","$:/HistoryList"],
DONT_IMPORT_PREFIX_LIST = ["$:/temp/","$:/state/"];
2014-07-12 08:09:36 +00:00
exports.upgrade = function(wiki,titles,tiddlers) {
var self = this,
messages = {};
// Check for tiddlers on our list
$tw.utils.each(titles,function(title) {
if(DONT_IMPORT_LIST.indexOf(title) !== -1) {
tiddlers[title] = Object.create(null);
messages[title] = $tw.language.getString("Import/Upgrader/System/Suppressed");
} else {
for(var t=0; t<DONT_IMPORT_PREFIX_LIST.length; t++) {
var prefix = DONT_IMPORT_PREFIX_LIST[t];
if(title.substr(0,prefix.length) === prefix) {
tiddlers[title] = Object.create(null);
messages[title] = $tw.language.getString("Import/Upgrader/State/Suppressed");
}
}
2014-07-12 08:09:36 +00:00
}
});
return messages;
};
})();