Ticket #756: bakedoptions.patch
| File bakedoptions.patch, 8.6 KB (added by FND, 3 years ago) |
|---|
-
shadows/split.recipe
5 5 shadow: StyleSheetLayout.tiddler 6 6 shadow: StyleSheetLocale.tiddler 7 7 shadow: StyleSheetPrint.tiddler 8 shadow: SystemSettings.tiddler 8 9 shadow: PageTemplate.tiddler 9 10 shadow: ViewTemplate.tiddler 10 11 shadow: EditTemplate.tiddler -
shadows/SystemSettings.tiddler
1 <div title="SystemSettings"> 2 <pre>chkRegExpSearch: false 3 chkCaseSensitiveSearch: false 4 chkIncrementalSearch: true 5 chkAnimate_cookie: false 6 chkSaveBackups: true 7 chkAutoSave: false 8 chkGenerateAnRssFeed: false 9 chkSaveEmptyTemplate: false 10 chkOpenInNewWindow: true 11 chkToggleLinks: false 12 chkHttpReadOnly: true 13 chkForceMinorUpdate: false 14 chkConfirmDelete: true 15 chkInsertTabs: false 16 chkUsePreForStorage: true 17 chkDisplayInstrumentation: false 18 txtBackupFolder: 19 txtEditorFocus: text 20 txtMainTab_cookie: More 21 txtMoreTab_cookie: Missing 22 txtMaxEditRows: 30 23 txtFileSystemCharSet: UTF-8 24 txtTheme: 25 txtUserName: YourName 26 chkSliderOptionsPanel_cookie: true 27 chkBackstage_cookie: false 28 chkSideBarTabs_cookie: true 29 </pre> 30 </div> 31 No newline at end of file -
js/TiddlyWiki.js
151 151 return textOut.join(""); 152 152 }; 153 153 154 TiddlyWiki.prototype.slicesRE = /(?:^([\'\/]{0,2})~?([\.\w]+)\:\1 \s*([^\n]+)\s*$)|(?:^\|([\'\/]{0,2})~?([\.\w]+)\:?\4\|\s*([^\|\n]+)\s*\|$)/gm;154 TiddlyWiki.prototype.slicesRE = /(?:^([\'\/]{0,2})~?([\.\w]+)\:\1[\t\x20]*([^\n]*)[\t\x20]*$)|(?:^\|([\'\/]{0,2})~?([\.\w]+)\:?\4\|[\t\x20]*([^\|\n]*)[\t\x20]*\|$)/gm; 155 155 156 156 // @internal 157 157 TiddlyWiki.prototype.calcAllSlices = function(title) -
js/main.js
33 33 story = new Story("tiddlerDisplay","tiddler"); 34 34 addEvent(document,"click",Popup.onDocumentClick); 35 35 saveTest(); 36 loadOptionsCookie();37 36 for(var s=0; s<config.notifyTiddlers.length; s++) 38 37 store.addNotification(config.notifyTiddlers[s].name,config.notifyTiddlers[s].notify); 39 38 t1 = new Date(); 40 39 loadShadowTiddlers(); 41 40 t2 = new Date(); 42 41 store.loadFromDiv("storeArea","store",true); 42 loadOptionsCookie(); 43 43 t3 = new Date(); 44 44 invokeParamifier(params,"onload"); 45 45 t4 = new Date(); -
js/Options.js
4 4 5 5 config.optionHandlers = { 6 6 'txt': { 7 get: function(name) {return encodeCookie(config.options[name].toString());},8 set: function(name,value) {config.options[name] = decodeCookie(value);}7 get: function(name) {return config.options[name].toString();}, 8 set: function(name,value) {config.options[name] = value;} 9 9 }, 10 10 'chk': { 11 11 get: function(name) {return config.options[name] ? "true" : "false";}, … … 13 13 } 14 14 }; 15 15 16 function loadOptionsCookie() 16 //# Loads up config.options from cookies and SystemSettings 17 function initialiseOptions() 17 18 { 18 19 if(safeMode) 19 20 return; 21 loadSystemSettings(); 22 loadCookies(); 23 } 24 // Deprecated name for backwards compatibility 25 var loadOptionsCookie = initialiseOptions; 26 27 function loadCookies() 28 { 29 var cookies = {}; 20 30 var cookies = document.cookie.split(";"); 21 31 for(var c=0; c<cookies.length; c++) { 22 32 var p = cookies[c].indexOf("="); … … 24 34 var name = cookies[c].substr(0,p).trim(); 25 35 var value = cookies[c].substr(p+1).trim(); 26 36 var optType = name.substr(0,3); 27 if(config.option Handlers[optType] && config.optionHandlers[optType].set)28 config.optionHandlers[optType].set(name, value);37 if(config.optionSource[name] == 'cookie' && config.optionHandlers[optType] && config.optionHandlers[optType].set) 38 config.optionHandlers[optType].set(name,decodeCookie(value)); 29 39 } 30 40 } 31 41 } 32 42 33 function saveOptionCookie(name)43 function loadSystemSettings() 34 44 { 45 var settings = store.calcAllSlices("SystemSettings"); 46 for(var key in settings) { 47 var splitPos = key.indexOf('_'); 48 var name = key; 49 var source = "setting"; 50 if(splitPos !== -1) { 51 source = key.substr(splitPos+1); 52 name = key.substr(0,splitPos); 53 } 54 optType = name.substr(0,3); 55 if(config.optionHandlers[optType] && config.optionHandlers[optType].set) { 56 config.optionHandlers[optType].set(name,settings[key]); 57 } 58 config.optionSource[name] = source; 59 } 60 } 61 62 function onSystemSettingsChange() 63 { 64 if(!startingUp) { 65 loadSystemSettings(); 66 } 67 } 68 69 // Saves the named option in a cookie or SystemSettings as appropriate 70 function saveOption(name) 71 { 35 72 if(safeMode) 36 73 return; 74 if(config.optionSource[name] == 'cookie') 75 saveCookie(name); 76 else 77 saveSystemSetting(name); 78 } 79 // Deprecated names for backwards compatibility 80 var saveOptionCookie = saveOption; 81 82 function saveCookie(name) 83 { 37 84 var c = name + "="; 38 85 var optType = name.substr(0,3); 39 86 if(config.optionHandlers[optType] && config.optionHandlers[optType].get) 40 c += config.optionHandlers[optType].get(name);87 c += encodeCookie(config.optionHandlers[optType].get(name)); 41 88 c += "; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/"; 42 89 document.cookie = c; 43 90 } 44 91 92 function saveSystemSetting(name) 93 { 94 var s = ""; 95 for(var key in config.options) { 96 s += key; 97 if(config.optionSource[key] && config.optionSource[key] != "setting") { 98 s += "_" + config.optionSource[key]; 99 } 100 var optType = key.substr(0,3); 101 var value = ""; 102 if(config.optionHandlers[optType] && config.optionHandlers[optType].get) 103 value = config.optionHandlers[optType].get(key); 104 s += ": " + value + "\n"; 105 } 106 store.saveTiddler("SystemSettings","SystemSettings",s,"System",new Date()); 107 autoSaveChanges(); 108 } 109 110 //# Flatten cookies to ANSI character set by substituting html character entities for non-ANSI characters 45 111 function encodeCookie(s) 46 112 { 47 113 return escape(convertUnicodeToHtmlEntities(s)); 48 114 } 49 115 116 //# Decode any html character entities to their unicode equivalent 50 117 function decodeCookie(s) 51 118 { 52 119 s = unescape(s); -
js/Config.js
63 63 }; 64 64 config.optionsDesc = {}; 65 65 66 //# config.optionSource["chkAnimate"] can be: 67 //# cookie: the option gets stored in a cookie, with the default value coming from SystemSettings 68 //# volatile: the option isn't persisted at all, and reverts to the default specified in SystemSettings when the document is reloaded 69 //# setting: the option is stored in the SystemSettings tiddler 70 //# The default is "setting" 71 config.optionSource = {}; 72 66 73 // Default tiddler templates 67 74 var DEFAULT_VIEW_TEMPLATE = 1; 68 75 var DEFAULT_EDIT_TEMPLATE = 2; -
js/Lingo.js
462 462 StyleSheetLayout: "This shadow tiddler contains CSS definitions related to the layout of page elements. ''DO NOT EDIT THIS TIDDLER'', instead make your changes in the StyleSheet shadow tiddler", 463 463 StyleSheetLocale: "This shadow tiddler contains CSS definitions related to the translation locale", 464 464 StyleSheetPrint: "This shadow tiddler contains CSS definitions for printing", 465 SystemSettings: "This tiddler is used to store configuration options for this TiddlyWiki document", 465 466 TabAll: "This shadow tiddler contains the contents of the 'All' tab in the right-hand sidebar", 466 467 TabMore: "This shadow tiddler contains the contents of the 'More' tab in the right-hand sidebar", 467 468 TabMoreMissing: "This shadow tiddler contains the contents of the 'Missing' tab in the right-hand sidebar", … … 472 473 ToolbarCommands: "This shadow tiddler determines which commands are shown in tiddler toolbars", 473 474 ViewTemplate: "The HTML template in this shadow tiddler determines how tiddlers look" 474 475 }); 475 -
js/Refresh.js
4 4 5 5 //# List of notification functions to be called when certain tiddlers are changed or deleted 6 6 config.notifyTiddlers = [ 7 {name: "SystemSettings", notify: onSystemSettingsChange}, 7 8 {name: "StyleSheetLayout", notify: refreshStyles}, 8 9 {name: "StyleSheetColors", notify: refreshStyles}, 9 10 {name: "StyleSheet", notify: refreshStyles},
