author | Madhusudan C.S <madhusudancs@gmail.com> |
Sat, 25 Jul 2009 01:09:46 +0530 | |
changeset 2679 | 0ede2f3adbc1 |
permissions | -rw-r--r-- |
2679
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
<head> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
<script id="versionArea" type="text/javascript"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
//<![CDATA[ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
var version = {title: "TiddlyWiki", major: 2, minor: 4, revision: 0, date: new Date("May 9, 2008"), extensions: {}}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
//]]> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8 |
</script> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
<meta name="copyright" content=" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
11 |
TiddlyWiki created by Jeremy Ruston, (jeremy [at] osmosoft [dot] com) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
13 |
Copyright (c) UnaMesa Association 2004-2008 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
14 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
15 |
Redistribution and use in source and binary forms, with or without modification, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
16 |
are permitted provided that the following conditions are met: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
17 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
18 |
Redistributions of source code must retain the above copyright notice, this |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
19 |
list of conditions and the following disclaimer. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
20 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
21 |
Redistributions in binary form must reproduce the above copyright notice, this |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
22 |
list of conditions and the following disclaimer in the documentation and/or other |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
23 |
materials provided with the distribution. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
24 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
25 |
Neither the name of the UnaMesa Association nor the names of its contributors may be |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
26 |
used to endorse or promote products derived from this software without specific |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
27 |
prior written permission. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
28 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
29 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
30 |
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
31 |
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
32 |
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
33 |
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
34 |
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
35 |
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
36 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
37 |
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
38 |
DAMAGE. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
39 |
" /> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
40 |
<!--PRE-HEAD-START--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
41 |
<!--{{{--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
42 |
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
43 |
<!--}}}--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
<!--PRE-HEAD-END--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
45 |
<title> Taggable - a portable mixin class for adding Tags to Google AppEngine Models </title> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
46 |
<style id="styleArea" type="text/css"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
47 |
#saveTest {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
48 |
#messageArea {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
49 |
#copyright {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
50 |
#storeArea {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
51 |
#storeArea div {padding:0.5em; margin:1em 0em 0em 0em; border-color:#fff #666 #444 #ddd; border-style:solid; border-width:2px; overflow:auto;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
52 |
#shadowArea {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
53 |
#javascriptWarning {width:100%; text-align:center; font-weight:bold; background-color:#dd1100; color:#fff; padding:1em 0em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
54 |
</style> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
55 |
<!--POST-HEAD-START--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
56 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
57 |
<!--POST-HEAD-END--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
58 |
</head> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
59 |
<body onload="main();" onunload="if(window.checkUnsavedChanges) checkUnsavedChanges(); if(window.scrubNodes) scrubNodes(document.body);"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
60 |
<!--PRE-BODY-START--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
61 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
62 |
<!--PRE-BODY-END--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
63 |
<div id="copyright"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
64 |
Welcome to TiddlyWiki created by Jeremy Ruston, Copyright © 2007 UnaMesa Association |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
65 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
66 |
<noscript> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
67 |
<div id="javascriptWarning">This page requires JavaScript to function properly.<br /><br />If you are using Microsoft Internet Explorer you may need to click on the yellow bar above and select 'Allow Blocked Content'. You must then click 'Yes' on the following security warning.</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
68 |
</noscript> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
69 |
<div id="saveTest"></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
70 |
<div id="backstageCloak"></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
71 |
<div id="backstageButton"></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
72 |
<div id="backstageArea"><div id="backstageToolbar"></div></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
73 |
<div id="backstage"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
74 |
<div id="backstagePanel"></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
75 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
76 |
<div id="contentWrapper"></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
77 |
<div id="contentStash"></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
78 |
<div id="shadowArea"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
79 |
<div title="MarkupPreHead"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
80 |
<pre><!--{{{--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
81 |
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
82 |
<!--}}}--></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
83 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
84 |
<div title="ColorPalette"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
85 |
<pre>Background: #fff |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
86 |
Foreground: #000 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
87 |
PrimaryPale: #8cf |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
88 |
PrimaryLight: #18f |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
89 |
PrimaryMid: #04b |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
90 |
PrimaryDark: #014 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
91 |
SecondaryPale: #ffc |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
92 |
SecondaryLight: #fe8 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
93 |
SecondaryMid: #db4 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
94 |
SecondaryDark: #841 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
95 |
TertiaryPale: #eee |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
96 |
TertiaryLight: #ccc |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
97 |
TertiaryMid: #999 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
98 |
TertiaryDark: #666 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
99 |
Error: #f88</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
100 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
101 |
<div title="StyleSheetColors"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
102 |
<pre>/*{{{*/ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
103 |
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
104 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
105 |
a {color:[[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
106 |
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
107 |
a img {border:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
108 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
109 |
h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
110 |
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
111 |
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
112 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
113 |
.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
114 |
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
115 |
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
116 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
117 |
.header {background:[[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
118 |
.headerShadow {color:[[ColorPalette::Foreground]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
119 |
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
120 |
.headerForeground {color:[[ColorPalette::Background]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
121 |
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
122 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
123 |
.tabSelected{color:[[ColorPalette::PrimaryDark]]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
124 |
background:[[ColorPalette::TertiaryPale]]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
125 |
border-left:1px solid [[ColorPalette::TertiaryLight]]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
126 |
border-top:1px solid [[ColorPalette::TertiaryLight]]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
127 |
border-right:1px solid [[ColorPalette::TertiaryLight]]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
128 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
129 |
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
130 |
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
131 |
.tabContents .button {border:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
132 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
133 |
#sidebar {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
134 |
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
135 |
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
136 |
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
137 |
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
138 |
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
139 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
140 |
.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
141 |
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
142 |
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
143 |
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
144 |
border:1px solid [[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
145 |
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
146 |
.wizardFooter {background:[[ColorPalette::PrimaryPale]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
147 |
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
148 |
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
149 |
border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
150 |
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
151 |
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
152 |
border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
153 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
154 |
#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
155 |
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
156 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
157 |
.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
158 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
159 |
.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
160 |
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
161 |
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
162 |
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
163 |
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
164 |
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
165 |
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
166 |
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
167 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
168 |
.tiddler .defaultCommand {font-weight:bold;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
169 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
170 |
.shadow .title {color:[[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
171 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
172 |
.title {color:[[ColorPalette::SecondaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
173 |
.subtitle {color:[[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
174 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
175 |
.toolbar {color:[[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
176 |
.toolbar a {color:[[ColorPalette::TertiaryLight]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
177 |
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
178 |
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
179 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
180 |
.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
181 |
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
182 |
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
183 |
.tagging .button, .tagged .button {border:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
184 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
185 |
.footer {color:[[ColorPalette::TertiaryLight]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
186 |
.selected .footer {color:[[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
187 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
188 |
.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
189 |
.sparktick {background:[[ColorPalette::PrimaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
190 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
191 |
.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
192 |
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
193 |
.lowlight {background:[[ColorPalette::TertiaryLight]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
194 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
195 |
.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
196 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
197 |
.imageLink, #displayArea .imageLink {background:transparent;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
198 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
199 |
.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
200 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
201 |
.viewer .listTitle {list-style-type:none; margin-left:-2em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
202 |
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
203 |
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
204 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
205 |
.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
206 |
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
207 |
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
208 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
209 |
.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
210 |
.viewer code {color:[[ColorPalette::SecondaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
211 |
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
212 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
213 |
.highlight, .marked {background:[[ColorPalette::SecondaryLight]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
214 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
215 |
.editor input {border:1px solid [[ColorPalette::PrimaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
216 |
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
217 |
.editorFooter {color:[[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
218 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
219 |
#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
220 |
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
221 |
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; } |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
222 |
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
223 |
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
224 |
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
225 |
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
226 |
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
227 |
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
228 |
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
229 |
/*}}}*/</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
230 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
231 |
<div title="StyleSheetLayout"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
232 |
<pre>/*{{{*/ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
233 |
* html .tiddler {height:1%;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
234 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
235 |
body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
236 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
237 |
h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
238 |
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
239 |
h4,h5,h6 {margin-top:1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
240 |
h1 {font-size:1.35em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
241 |
h2 {font-size:1.25em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
242 |
h3 {font-size:1.1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
243 |
h4 {font-size:1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
244 |
h5 {font-size:.9em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
245 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
246 |
hr {height:1px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
247 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
248 |
a {text-decoration:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
249 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
250 |
dt {font-weight:bold;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
251 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
252 |
ol {list-style-type:decimal;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
253 |
ol ol {list-style-type:lower-alpha;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
254 |
ol ol ol {list-style-type:lower-roman;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
255 |
ol ol ol ol {list-style-type:decimal;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
256 |
ol ol ol ol ol {list-style-type:lower-alpha;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
257 |
ol ol ol ol ol ol {list-style-type:lower-roman;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
258 |
ol ol ol ol ol ol ol {list-style-type:decimal;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
259 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
260 |
.txtOptionInput {width:11em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
261 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
262 |
#contentWrapper .chkOptionInput {border:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
263 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
264 |
.externalLink {text-decoration:underline;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
265 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
266 |
.indent {margin-left:3em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
267 |
.outdent {margin-left:3em; text-indent:-3em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
268 |
code.escaped {white-space:nowrap;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
269 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
270 |
.tiddlyLinkExisting {font-weight:bold;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
271 |
.tiddlyLinkNonExisting {font-style:italic;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
272 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
273 |
/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
274 |
a.tiddlyLinkNonExisting.shadow {font-weight:bold;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
275 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
276 |
#mainMenu .tiddlyLinkExisting, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
277 |
#mainMenu .tiddlyLinkNonExisting, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
278 |
#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
279 |
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
280 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
281 |
.header {position:relative;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
282 |
.header a:hover {background:transparent;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
283 |
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
284 |
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
285 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
286 |
.siteTitle {font-size:3em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
287 |
.siteSubtitle {font-size:1.2em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
288 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
289 |
#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
290 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
291 |
#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
292 |
#sidebarOptions {padding-top:0.3em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
293 |
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
294 |
#sidebarOptions input {margin:0.4em 0.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
295 |
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
296 |
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
297 |
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
298 |
#sidebarTabs .tabContents {width:15em; overflow:hidden;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
299 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
300 |
.wizard {padding:0.1em 1em 0em 2em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
301 |
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
302 |
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
303 |
.wizardStep {padding:1em 1em 1em 1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
304 |
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
305 |
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
306 |
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
307 |
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
308 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
309 |
#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
310 |
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
311 |
#messageArea a {text-decoration:underline;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
312 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
313 |
.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
314 |
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
315 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
316 |
.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
317 |
.popup .popupMessage {padding:0.4em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
318 |
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
319 |
.popup li.disabled {padding:0.4em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
320 |
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
321 |
.listBreak {font-size:1px; line-height:1px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
322 |
.listBreak div {margin:2px 0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
323 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
324 |
.tabset {padding:1em 0em 0em 0.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
325 |
.tab {margin:0em 0em 0em 0.25em; padding:2px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
326 |
.tabContents {padding:0.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
327 |
.tabContents ul, .tabContents ol {margin:0; padding:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
328 |
.txtMainTab .tabContents li {list-style:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
329 |
.tabContents li.listLink { margin-left:.75em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
330 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
331 |
#contentWrapper {display:block;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
332 |
#splashScreen {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
333 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
334 |
#displayArea {margin:1em 17em 0em 14em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
335 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
336 |
.toolbar {text-align:right; font-size:.9em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
337 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
338 |
.tiddler {padding:1em 1em 0em 1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
339 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
340 |
.missing .viewer,.missing .title {font-style:italic;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
341 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
342 |
.title {font-size:1.6em; font-weight:bold;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
343 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
344 |
.missing .subtitle {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
345 |
.subtitle {font-size:1.1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
346 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
347 |
.tiddler .button {padding:0.2em 0.4em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
348 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
349 |
.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
350 |
.isTag .tagging {display:block;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
351 |
.tagged {margin:0.5em; float:right;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
352 |
.tagging, .tagged {font-size:0.9em; padding:0.25em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
353 |
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
354 |
.tagClear {clear:both;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
355 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
356 |
.footer {font-size:.9em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
357 |
.footer li {display:inline;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
358 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
359 |
.annotation {padding:0.5em; margin:0.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
360 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
361 |
* html .viewer pre {width:99%; padding:0 0 1em 0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
362 |
.viewer {line-height:1.4em; padding-top:0.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
363 |
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
364 |
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
365 |
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
366 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
367 |
.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
368 |
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
369 |
table.listView {font-size:0.85em; margin:0.8em 1.0em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
370 |
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
371 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
372 |
.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
373 |
.viewer code {font-size:1.2em; line-height:1.4em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
374 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
375 |
.editor {font-size:1.1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
376 |
.editor input, .editor textarea {display:block; width:100%; font:inherit;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
377 |
.editorFooter {padding:0.25em 0em; font-size:.9em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
378 |
.editorFooter .button {padding-top:0px; padding-bottom:0px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
379 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
380 |
.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
381 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
382 |
.sparkline {line-height:1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
383 |
.sparktick {outline:0;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
384 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
385 |
.zoomer {font-size:1.1em; position:absolute; overflow:hidden;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
386 |
.zoomer div {padding:1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
387 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
388 |
* html #backstage {width:99%;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
389 |
* html #backstageArea {width:99%;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
390 |
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
391 |
#backstageToolbar {position:relative;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
392 |
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
393 |
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
394 |
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
395 |
#backstage {position:relative; width:100%; z-index:50;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
396 |
#backstagePanel {display:none; z-index:100; position:absolute; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
397 |
.backstagePanelFooter {padding-top:0.2em; float:right;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
398 |
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
399 |
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
400 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
401 |
.whenBackstage {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
402 |
.backstageVisible .whenBackstage {display:block;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
403 |
/*}}}*/</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
404 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
405 |
<div title="StyleSheetLocale"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
406 |
<pre>/*** |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
407 |
StyleSheet for use when a translation requires any css style changes. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
408 |
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
409 |
***/ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
410 |
/*{{{*/ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
411 |
body {font-size:0.8em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
412 |
#sidebarOptions {font-size:1.05em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
413 |
#sidebarOptions a {font-style:normal;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
414 |
#sidebarOptions .sliderPanel {font-size:0.95em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
415 |
.subtitle {font-size:0.8em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
416 |
.viewer table.listView {font-size:0.95em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
417 |
/*}}}*/</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
418 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
419 |
<div title="StyleSheetPrint"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
420 |
<pre>/*{{{*/ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
421 |
@media print { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
422 |
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
423 |
#displayArea {margin: 1em 1em 0em 1em;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
424 |
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
425 |
noscript {display:none;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
426 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
427 |
/*}}}*/</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
428 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
429 |
<div title="PageTemplate"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
430 |
<pre><!--{{{--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
431 |
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
432 |
<div class='headerShadow'> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
433 |
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
434 |
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
435 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
436 |
<div class='headerForeground'> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
437 |
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
438 |
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
439 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
440 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
441 |
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
442 |
<div id='sidebar'> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
443 |
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
444 |
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
445 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
446 |
<div id='displayArea'> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
447 |
<div id='messageArea'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
448 |
<div id='tiddlerDisplay'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
449 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
450 |
<!--}}}--></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
451 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
452 |
<div title="ViewTemplate"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
453 |
<pre><!--{{{--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
454 |
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
455 |
<div class='title' macro='view title'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
456 |
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
457 |
<div class='tagging' macro='tagging'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
458 |
<div class='tagged' macro='tags'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
459 |
<div class='viewer' macro='view text wikified'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
460 |
<div class='tagClear'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
461 |
<!--}}}--></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
462 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
463 |
<div title="EditTemplate"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
464 |
<pre><!--{{{--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
465 |
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
466 |
<div class='title' macro='view title'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
467 |
<div class='editor' macro='edit title'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
468 |
<div macro='annotations'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
469 |
<div class='editor' macro='edit text'></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
470 |
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
471 |
<!--}}}--></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
472 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
473 |
<div title="GettingStarted"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
474 |
<pre>To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
475 |
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
476 |
* MainMenu: The menu (usually on the left) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
477 |
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
478 |
You'll also need to enter your username for signing your edits: <<option txtUserName>></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
479 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
480 |
<div title="OptionsPanel"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
481 |
<pre>These InterfaceOptions for customising TiddlyWiki are saved in your browser |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
482 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
483 |
Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
484 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
485 |
<<option txtUserName>> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
486 |
<<option chkSaveBackups>> SaveBackups |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
487 |
<<option chkAutoSave>> AutoSave |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
488 |
<<option chkRegExpSearch>> RegExpSearch |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
489 |
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
490 |
<<option chkAnimate>> EnableAnimations |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
491 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
492 |
---- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
493 |
Also see AdvancedOptions</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
494 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
495 |
<div title="ImportTiddlers"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
496 |
<pre><<importTiddlers>></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
497 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
498 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
499 |
<!--POST-SHADOWAREA--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
500 |
<div id="storeArea"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
501 |
<div title="AdamCrossland" modifier="AdamCrossland" created="200805201949" modified="200805201951" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
502 |
<pre>Adam is the author of ''Taggable.'' To find out more about him and other software that he has created, visit http://www.adamcrossland.net. You can also visit his blog, http://blog.adamcrossland.net, to see the code in action; he created ''Taggable'' as part of the blogging software project the he wrote as a vehicle to learn about [[Google AppEngine]].</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
503 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
504 |
<div title="Apache 2.0 Open Source license" modifier="AdamCrossland" created="200805202001" modified="200805211430" changecount="5"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
505 |
<pre>{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
506 |
Copyright 2008 Adam A. Crossland |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
507 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
508 |
Licensed under the Apache License, Version 2.0 (the "License"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
509 |
you may not use this file except in compliance with the License. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
510 |
You may obtain a copy of the License at |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
511 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
512 |
http://www.apache.org/licenses/LICENSE-2.0 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
513 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
514 |
Unless required by applicable law or agreed to in writing, software |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
515 |
distributed under the License is distributed on an "AS IS" BASIS, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
516 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
517 |
See the License for the specific language governing permissions and |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
518 |
limitations under the License. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
519 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
520 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
521 |
<div title="ChangeLog" modifier="AdamCrossland" created="200812041728" modified="200812042045" changecount="9"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
522 |
<pre>''1.0'' |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
523 |
Initial release |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
524 |
---- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
525 |
''2.0'' |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
526 |
This release has major changes to both [[Tag|Tag Class]] and [[Taggable|Taggable Class]], reflecting significant and important lessons that [[the author|AdamCrossland]] learned about [[Google AppEngine]]. Specifically, this release's changes should substantially improve the performance of any code that uses tags. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
527 |
*[[Tag|Tag Class]] entities are now stored with a custom key_name that allows them to be much-more-quickly retrieved from the data store. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
528 |
*The [[Tag|Tag Class]] has been rewritten to breakdown Tag/Taggable interactions in to a series of simple, atomic transactions. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
529 |
*[[Tag|Tag Class]] has a new property, [[tagged_count|Tag tagged_count Property]], that records the number of Taggable entities in its [[tagged|Tag tagged Property]] property. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
530 |
*Two new methods, [[get_tags_by_frequency|Tag get_tags_by_frequency Method]] and [[popular_tags|Tag popular_tags Method]], provide access to lists of [[Tags|Tag Class]] based on the number of [[Taggable|Taggable Class]] entities to which they refer. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
531 |
*A new method, [[get_tags_by_name|Tag get_tags_by_name Method]], provides lists of tags in alphabetical order. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
532 |
*The [[Taggable|Taggable Class]] class has been greatly simplified. Multiple methods for getting and setting tags have been replaced with a single property, [[tags|Taggable tags Property]], that handles both getting and setting operations. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
533 |
*A full suite of automated unit tests for both classes has been created.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
534 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
535 |
<div title="Contact" modifier="AdamCrossland" created="200805211444" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
536 |
<pre>If you have any questions or suggestions about ''Taggable'', please feel free to contact the author, AdamCrossland, at adam@adamcrossland.net. Alternatively, you could post the question in <html><a href="http://groups.google.com/group/google-appengine/topics">the Google AppEngine Group.</a></html></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
537 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
538 |
<div title="Contribute" modifier="AdamCrossland" created="200805211441" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
539 |
<pre>If you are using ''Taggable'' and you have some changes, improvements or bug fixes that you'd like to contribute, please contact AdamCrossland at adam@adamcrossland.net.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
540 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
541 |
<div title="Converting from 1.0 to 2.0" modifier="AdamCrossland" created="200812051535" modified="200812051536" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
542 |
<pre>Because the Tag records are stored and queried slightly differently (yet much-more efficiently) in //Taggable-mixin 2.0//, an existing application will have to go through a process of converting all of its existing tags. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
543 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
544 |
For AdamCBlog, the application from which //Taggable-mixin// is extracted, I added a new RequestHandler called UpdateTag: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
545 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
546 |
class UpdateTag(RequestHandler): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
547 |
def get(self): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
548 |
from taggable import Tag |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
549 |
tag_name = self.request.get('tag') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
550 |
tag = db.Query(Tag).filter('tag =', tag_name).fetch(1)[0] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
551 |
if tag is not None: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
552 |
new_tag = Tag.get_or_create(tag_name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
553 |
for each_tagged in tag.tagged: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
554 |
new_tag.add_tagged(each_tagged) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
555 |
tag.delete() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
556 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
557 |
self.redirect('/') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
558 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
559 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
560 |
Then, I made the request /~UpdateTag?tag=//inserttaghere// for each Tag in the datastore. Yes, it is laborious. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
561 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
562 |
Why not just create a RequestHandler that cycled through all of the tags automatically, converting them as it went? I tried that, but there is too much processing involved; the request uses up its time quota and is killed before it can finish.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
563 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
564 |
<div title="DateTimeProperty" modifier="AdamCrossland" created="200812042027" tags="appengine" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
565 |
<pre>A [[Google AppEngine]] datastore property that holds a Python //datetime//. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
566 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
567 |
http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#DateTimeProperty</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
568 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
569 |
<div title="DefaultTiddlers" modifier="AdamCrossland" created="200805202104" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
570 |
<pre>[[Introduction]]</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
571 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
572 |
<div title="Google AppEngine" modifier="AdamCrossland" created="200805201811" modified="200805202010" changecount="3"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
573 |
<pre>Google ~AppEngine is Google's platform for developing web applications that run inside Google's computing cloud. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
574 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
575 |
Find out more about it at <html><a href="http://code.google.com/appengine/">The Google AppEngine website</a></html>. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
576 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
577 |
</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
578 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
579 |
<div title="IntegerProperty" modifier="AdamCrossland" created="200812041949" tags="appengine" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
580 |
<pre>A [[Google AppEngine]] datastore property that holds a Python //long//. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
581 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
582 |
http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#IntegerProperty</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
583 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
584 |
<div title="Introduction" modifier="AdamCrossland" created="200805201810" modified="200812051536" changecount="8"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
585 |
<pre>''Taggable'' is a <html><a href="http://www.linuxjournal.com/node/4540/print">mixin</a></html> class that AdamCrossland created in order to add [[tags|Tag Definition]] to his personal blog (http://blog.adamcrossland.net) which is built on [[Google AppEngine]]. The design seemed clean and portable, so he decided to share it with the greater [[AppEngine|Google AppEngine]] community. It is available under [[Apache 2.0 Open Source license]]. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
586 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
587 |
Users of taggable-mixin 1.0 should note that taggable-mixin 2.0 is not directly compatible with 1.0. While it is possible to upgrade, existing Tag entities will have to be [[converted|Converting from 1.0 to 2.0]].</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
588 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
589 |
<div title="Key Class" modifier="AdamCrossland" created="200812042055" tags="appengine" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
590 |
<pre>A [[Google AppEngine]] class that represents a unique key for a datastore entity. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
591 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
592 |
http://code.google.com/appengine/docs/datastore/keyclass.html</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
593 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
594 |
<div title="ListProperty" modifier="AdamCrossland" created="200812042030" tags="appengine" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
595 |
<pre>A [[Google AppEngine]] datastore property that represents a Python //list//. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
596 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
597 |
http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#ListProperty</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
598 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
599 |
<div title="MainMenu" modifier="AdamCrossland" created="200805201814" modified="200812041913" changecount="10"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
600 |
<pre>[[Introduction|Introduction]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
601 |
ChangeLog |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
602 |
StepByStep |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
603 |
<<tag api>> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
604 |
---- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
605 |
[[License|Apache 2.0 Open Source license]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
606 |
[[Contribute]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
607 |
[[Contact]]</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
608 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
609 |
<div title="RequestHandler" modifier="AdamCrossland" created="200805211437" modified="200805211438" changecount="4"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
610 |
<pre>A //~RequestHandler// is a Python class that inherits from //webapp.~RequestHandler//. It is used to answer HTTP requests that are received by your [[Google AppEngine]] application. For more information on this subject, please consult the <html><a href="http://code.google.com/appengine/docs/webapp/requesthandlers.html">documentation.</a></html> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
611 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
612 |
</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
613 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
614 |
<div title="SideBarOptions" modifier="AdamCrossland" created="200805211439" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
615 |
<pre><<search>><<closeAll>><<permaview>><<newTiddler>><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
616 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
617 |
<div title="SiteSubtitle" modifier="AdamCrossland" created="200805201806" modified="200805201807" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
618 |
<pre>a portable mixin class for adding Tags to Google ~AppEngine Models</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
619 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
620 |
<div title="SiteTitle" modifier="AdamCrossland" created="200805201805" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
621 |
<pre>Taggable</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
622 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
623 |
<div title="StepByStep" modifier="AdamCrossland" created="200805201831" modified="200812041926" tags="help examples code" changecount="14"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
624 |
<pre>Here's a step-by-step guide to adding ''Taggable'' to your [[Google AppEngine]] application. This presents the simplest, most straightforward path to integrating ''Taggable'' as as such, it does not cover all of the options that are available. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
625 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
626 |
All of the code examples are modified extracts from the blogging software for which I originally created ''Taggable.'' //''These examples do not represent what the author considers to be complete and secure code; please make sure that you are familiar with best practices for building secure web applications before creating a web application. The author of this document and the accompanying code bears no responsibility whatsoever for any losses or damages that you incur as a result of failing to take the appropriate steps to create a stable, secure, well-written web application.''// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
627 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
628 |
*Copy [[taggable.py]] to your application directory. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
629 |
*Import [[taggable.py]] into the python file that defines the Model that you want to make taggable: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
630 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
631 |
from taggable import Taggable |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
632 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
633 |
*Add //Taggable// to the list of classes from which your Model class inherits. Taggable -- and any other mixin classes -- should come before db.Model: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
634 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
635 |
class Post(Taggable, db.Model): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
636 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
637 |
*Add code to your Model's //init// method to call Taggable's //init// method. If your Model class does not already override //init//, it will have to, and you will have to explicitly call the //init// method of any other superclass -- such as db.Model: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
638 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
639 |
def __init__(self, parent=None, key_name=None, app=None, **entity_values): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
640 |
db.Model.__init__(self, parent, key_name, app, **entity_values) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
641 |
Taggable.__init__(self) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
642 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
643 |
*Add code to your template to express the tagging information: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
644 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
645 |
{% if post.tags %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
646 |
<div class="posttags">tags:&nbsp; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
647 |
{% for each_tag in post.tags %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
648 |
<a href="/searchbytag?tag={{ each_tag.tag|escape }}">{{ each_tag.tag }}</a>{% if forloop.last %}{% else %}, {% endif %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
649 |
{% endfor %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
650 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
651 |
{% endif %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
652 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
653 |
or |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
654 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
655 |
<tr> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
656 |
<td>Tags:</td> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
657 |
<td> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
658 |
<input type="TEXT" name="tags" size="106" value="{% if post %}{{ post.tags_string }}{% endif %}" /> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
659 |
</td> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
660 |
</tr> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
661 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
662 |
*In any RequestHandler method that updates a Model object that has tags associated with it, assign any new value to the ''Taggable'' object's [[tags|TaggableTagsProperty]]: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
663 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
664 |
class EditPost(SmartHandler.SmartHandler): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
665 |
def post(self): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
666 |
postid = self.request.get('id') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
667 |
post = Post.get(postid) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
668 |
post.title = self.request.get('title') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
669 |
post.body = self.request.get('body') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
670 |
post.edited = datetime.datetime.now() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
671 |
post.tags = self.request.get('tags') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
672 |
post.put() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
673 |
. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
674 |
. do whatever else you need to do in your handler... |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
675 |
. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
676 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
677 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
678 |
<div title="StringProperty" modifier="AdamCrossland" created="200812042024" tags="appengine" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
679 |
<pre>A [[Google AppEngine]] datastore property that holds a Python //string// of 500 characters or less. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
680 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
681 |
http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#StringProperty</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
682 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
683 |
<div title="Tag Class" modifier="AdamCrossland" created="200812041942" modified="200812050051" tags="api" changecount="6"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
684 |
<pre>The //Tag// class is the Model class that holds the data for an individual [[tag|Tag Definition]]. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
685 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
686 |
It has four properties: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
687 |
*[[tag|Tag tag Property]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
688 |
*[[added|Tag tag_added Property]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
689 |
*[[tagged|Tag tagged Property]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
690 |
*[[tagged_count|Tag tagged_count Property]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
691 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
692 |
and ten methods: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
693 |
*[[remove_tagged|Tag remove_tagged Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
694 |
*[[add_tagged|Tag add_tagged Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
695 |
*[[clear_tagged|Tag clear_tagged Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
696 |
*[[get_by_name|Tag get_by_name Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
697 |
*[[get_tags_for_key|Tag get_tags_for_key Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
698 |
*[[get_or_create|Tag get_or_create Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
699 |
*[[get_tags_by_frequency|Tag get_tags_by_frequency Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
700 |
*[[get_tags_by_name|Tag get_tags_by_name Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
701 |
*[[popular_tags|Tag popular_tags Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
702 |
*[[expire_cached_tags|Tag expire_cached_tags Method]]</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
703 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
704 |
<div title="Tag Definition" modifier="AdamCrossland" created="200812050049" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
705 |
<pre>A //Tag// is a word or short phrase that acts as metadata; it describes and increases the searchability and findability of data. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
706 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
707 |
http://en.wikipedia.org/wiki/Tag_(metadata)</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
708 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
709 |
<div title="Tag add_tagged Method" modifier="AdamCrossland" created="200812042059" modified="200812042332" tags="api" changecount="3"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
710 |
<pre>//tag_instance.add_tagged(key)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
711 |
* key - a [[Key|Key Class]] for a //Taggable// Model to mark with the [[Tag|Tag Class]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
712 |
Returns: nothing |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
713 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
714 |
The //add_tagged// method adds the [[Key|Key Class]] passed in to the Tag's [[tagged|Tag tagged Property]] collection and increments the [[tagged_count|Tag tagged_count Property]]. The operations are performed inside a transaction to ensure data intergity. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
715 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
716 |
Under most circumstances, the programmer will not need to call //add_tagged// directly; it is meant to be used internally by the [[Tagged Class]]. However, it is available for use by those who wish to customize the behavior of Taggable.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
717 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
718 |
<div title="Tag clear_tagged Method" modifier="AdamCrossland" created="200812042103" modified="200812042332" tags="api" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
719 |
<pre>//tag_instance.clear_tagged(key)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
720 |
* key - a [[Key|Key Class]] for a //Taggable// object. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
721 |
Returns: nothing |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
722 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
723 |
The //clear_tagged// method empties the Tag's [[tagged|Tag tagged Property]] collection and sets the [[tagged_count|Tag tagged_count Property]] to zero. The operations are performed inside a transaction to ensure data intergity. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
724 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
725 |
Under most circumstances, the programmer will not need to call //clear_tagged// directly; it is meant to be used internally by the [[Tagged Class]]. However, it is available for use by those who wish to customize the behavior of Taggable.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
726 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
727 |
<div title="Tag expire_cached_tags Method" modifier="AdamCrossland" created="200812050015" tags="api" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
728 |
<pre>//Tag.expire_cached_tags()// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
729 |
Returns: nothing |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
730 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
731 |
Comments: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
732 |
This method removes from memcache any objects that have been cached by other [[Tag|Tag Class]] methods. Usually, the programmer will not call this method directly, as it is used behind-the-scenes by code that affects the validity of the cached items. It is available, however, in case the programmer wishes to customize existing behavior.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
733 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
734 |
<div title="Tag get_by_name Method" modifier="AdamCrossland" created="200812042151" modified="200812042227" tags="api example" changecount="5"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
735 |
<pre>//Tag.get_by_name(tag_name)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
736 |
*tag_name - the tag, in text form |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
737 |
Returns: a [[Tag|Tag Class]] or //None// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
738 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
739 |
Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
740 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
741 |
class SearchByTag(RequestHandler): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
742 |
def get(self): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
743 |
from post import Post |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
744 |
from taggable import Tag |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
745 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
746 |
requested_tag = self.request.get('tag') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
747 |
if requested_tag is not None and len(requested_tag) > 0: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
748 |
tag = Tag.get_by_name(requested_tag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
749 |
posts = None |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
750 |
if tag is not None: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
751 |
posts = Post.get(tag.tagged) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
752 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
753 |
self.template_values['posts'] = posts |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
754 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
755 |
</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
756 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
757 |
<div title="Tag get_or_create Method" modifier="AdamCrossland" created="200812042332" modified="200812042334" tags="api" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
758 |
<pre>//Tag.get_or_create(tag_name)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
759 |
*tag_name - the name of the tag that is to be retrieved from or created in the datastore |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
760 |
Returns: a [[Tag|Tag Class]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
761 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
762 |
Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
763 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
764 |
for each_tag in tags: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
765 |
each_tag = string.strip(each_tag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
766 |
if len(each_tag) > 0 and each_tag not in self.__tags: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
767 |
# A tag that was not previously assigned to this entity |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
768 |
# is present in the list that is being assigned, so we |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
769 |
# associate this entity with the tag. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
770 |
tag = Tag.get_or_create(each_tag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
771 |
tag.add_tagged(self.key()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
772 |
self.__tags.append(tag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
773 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
774 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
775 |
<div title="Tag get_tags_by_frequency Method" modifier="AdamCrossland" created="200812042356" tags="api" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
776 |
<pre>//Tag.get_tags_by_frequency(limit=1000)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
777 |
*limit - the number of records to return; the maximum is 1000 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
778 |
Returns: a list of [[Tag|Tag Class]] objects, ordered by the number of //Taggable// objects assigned to it. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
779 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
780 |
Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
781 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
782 |
@classmethod |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
783 |
def popular_tags(cls, limit=5): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
784 |
from google.appengine.api import memcache |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
785 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
786 |
tags = memcache.get('popular_tags') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
787 |
if tags is None: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
788 |
tags = Tag.get_tags_by_frequency(limit) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
789 |
memcache.add('popular_tags', tags, 3600) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
790 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
791 |
return tags |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
792 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
793 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
794 |
<div title="Tag get_tags_by_name Method" modifier="AdamCrossland" created="200812050018" tags="api" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
795 |
<pre>//Tag.get_tags_by_name(tag_name)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
796 |
*tag_name - the string value of a [[Tag|Tag Class]] to be retrieved from the datastore |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
797 |
Returns: a [[Tag|Tag Class]] object or None if the given //tag_name// does not exist |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
798 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
799 |
Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
800 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
801 |
requested_tag = self.request.get('tag') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
802 |
if requested_tag is not None and len(requested_tag) > 0: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
803 |
tag = Tag.get_by_name(requested_tag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
804 |
posts = None |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
805 |
if tag is not None: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
806 |
posts = Post.get(tag.tagged) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
807 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
808 |
self.template_values['posts'] = posts |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
809 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
810 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
811 |
<div title="Tag get_tags_for_key Method" modifier="AdamCrossland" created="200812042318" modified="200812042355" tags="api example" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
812 |
<pre>//Tag.get_tags_for_key(key)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
813 |
*key - a [[Key|Key Class]] for a //Taggable// object. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
814 |
Returns: a //list// of [[Tag|Tag Class]] objects |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
815 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
816 |
Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
817 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
818 |
def __get_tags(self): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
819 |
"Get a List of Tag objects for all Tags that apply to this object." |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
820 |
if self.__tags is None or len(self.__tags) == 0: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
821 |
self.__tags = Tag.get_tags_for_key(self.key()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
822 |
return self.__tags |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
823 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
824 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
825 |
<div title="Tag popular_tags Method" modifier="AdamCrossland" created="200812050000" tags="api" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
826 |
<pre>//Tag.popular_tags(limit=5)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
827 |
*limit - the number of records to return; the default is 5 and the maximum is 1000 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
828 |
Returns: a list of [[Tag|Tag Class]] objects, ordered by the number of [[Taggable|Taggable Class]] objects assigned to it. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
829 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
830 |
Comments: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
831 |
This method is a thin wrapper around [[get_tags_by_frequency|Tag get_tags_by_frequency]] that caches the returned values. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
832 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
833 |
Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
834 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
835 |
self.template_values['popular_tags'] = Tag.popular_tags() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
836 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
837 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
838 |
<div title="Tag remove_tagged Method" modifier="AdamCrossland" created="200812042054" modified="200812042332" tags="api" changecount="5"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
839 |
<pre>//tag_instance.remove_tagged(key)// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
840 |
* key - a [[Key|Key Class]] for a //Taggable// object. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
841 |
Returns: nothing |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
842 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
843 |
The //remove_tagged// method removes the [[Key|Key Class]] passed in from the Tag's [[tagged|Tag tagged Property]] collection and decrements the [[tagged_count|Tag tagged_count Property]]. The operations are performed inside a transaction to ensure data intergity. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
844 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
845 |
Under most circumstances, the programmer will not need to call //remove_tagged// directly; it is meant to be used internally by the [[Tagged Class]]. However, it is available for use by those who wish to customize the behavior of Taggable.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
846 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
847 |
<div title="Tag tag Property" modifier="AdamCrossland" created="200812042022" tags="api" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
848 |
<pre>A StringProperty that holds the name or value of the tag.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
849 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
850 |
<div title="Tag tag_added Property" modifier="AdamCrossland" created="200812042025" modified="200812042026" tags="api" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
851 |
<pre>The DateTimeProperty that records that date and time that the [[Tag|TagClass]] was first added.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
852 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
853 |
<div title="Tag tagged Property" modifier="AdamCrossland" created="200812042028" tags="api" changecount="1"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
854 |
<pre>A ListProperty that holds the Keys of all of the entities that have the given [[Tag|TagClass]] assigned to them.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
855 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
856 |
<div title="Tag tagged_count Property" modifier="AdamCrossland" created="200812041947" modified="200812042018" tags="api" changecount="3"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
857 |
<pre>An IntegerProperty that holds the number of items that have the Tag assigned to them.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
858 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
859 |
<div title="Taggable Class" modifier="AdamCrossland" created="200812050054" modified="200812051431" tags="api" changecount="8"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
860 |
<pre>The //Taggable// class can be mixed-in to any other Python class that inherits from //db.Model// in order to associate [[Tags|Tag Definition]] with that model. For instance, if you were creating blogging software, one of your fundamental objects would be a //Post// that would comprise all of the information about an individual entry in your blog. Usually, a Post can have [[Tags|Tag Definition]] added to it in order to provide easily-digested information to the reader about the content. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
861 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
862 |
It has two properties: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
863 |
*[[tags|Taggable tags Property]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
864 |
*[[tag_separator|Taggable tag_separator Property]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
865 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
866 |
and one method: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
867 |
*[[tags_string|Taggable tags_string Method]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
868 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
869 |
Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
870 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
871 |
class Post(Taggable, db.Model): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
872 |
index = db.IntegerProperty(required=True, default=0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
873 |
body = db.TextProperty(required = True) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
874 |
title = db.StringProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
875 |
added = db.DateTimeProperty(auto_now_add=True) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
876 |
added_month = db.IntegerProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
877 |
added_year = db.IntegerProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
878 |
edited = db.DateTimeProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
879 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
880 |
def __init__(self, parent=None, key_name=None, app=None, **entity_values): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
881 |
db.Model.__init__(self, parent, key_name, app, **entity_values) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
882 |
Taggable.__init__(self) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
883 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
884 |
Notes: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
885 |
*Notice that [[Taggable|Taggable Class]] is placed before db.Model in the inheritance list. While this is not strictly required for //Taggable-mixin// to function correctly, it //is// required for other mixin classes, and it is generally a good practice. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
886 |
*It //is// required that the [[Taggable|Taggable Class]] //init// method is explicitly called, so it should be placed in the inherting class's //init// method. If the class would not otherwise have one, it should be created, and the db.Model //init// must be called as well, as shown.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
887 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
888 |
<div title="Taggable tag_separator Property" modifier="AdamCrossland" created="200805201936" modified="200812042033" tags="api" changecount="6"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
889 |
<pre>The //tag_separator// property is the string that is used to separate individual tags in a string representation of a list of tags. It is used by the [[tags property|TaggableTagsProperty]] to parse a string that may contain one or more tags to be applied to a [[Taggable|TaggableClass]] object. It is also used by the [[tags_string|TaggableTagsStringMethod]] method to construct a string representation of the tags for a [[Taggable|TaggableClass]] object. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
890 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
891 |
*By default, it is set to a comma (','), but it can be programatically-set to whatever value the developer desires |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
892 |
*It is probably best to avoid using whitespace characters, as that would prevent users from entering multi-word tags |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
893 |
*Custom separator values can be set at different levels. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
894 |
**To set one value for all [[Taggable|TaggableClass]] objects, modify the //init// method in the //Taggable// class in the taggable.py file: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
895 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
896 |
class Taggable: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
897 |
def __init__(self): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
898 |
self.tag_separator = ";" # Made it semi-colon instead of comma |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
899 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
900 |
**To set one value for all instances of a particular [[Taggable|TaggableClass]] class, modify the //init// method of that class: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
901 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
902 |
class Post(Taggable, db.Model): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
903 |
body = db.TextProperty(required = True) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
904 |
title = db.StringProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
905 |
added = db.DateTimeProperty(auto_now_add=True) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
906 |
edited = db.DateTimeProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
907 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
908 |
def __init__(self, parent=None, key_name=None, app=None, **entity_values): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
909 |
db.Model.__init__(self, parent, key_name, app, **entity_values) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
910 |
Taggable.__init__(self) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
911 |
self.tag_separator = ";" # Made it semi-colon instead of comma |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
912 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
913 |
**To set a value for one particular instance of a [[Taggable|TaggableClass]] class, set the value after creating the instance: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
914 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
915 |
newpost = Post(title = self.request.get('title'), body = self.request.get('body')) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
916 |
newpost.tag_separator = ";" # Made it semi-colon instead of comma |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
917 |
newpost.set_tags_from_string("foo; bar; bletch; this is a tag; tags rule" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
918 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
919 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
920 |
<div title="Taggable tags Property" modifier="AdamCrossland" created="200812051447" modified="200812051516" tags="api" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
921 |
<pre>The a [[Taggable|Taggable Class]] class's //tags// property is used to assign [[Tags|Tag Class]] to the [[Taggable|Taggable Class]] instance or retrieve a //list// of those already assigned. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
922 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
923 |
Assignment Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
924 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
925 |
class Post(Taggable, db.Model): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
926 |
index = db.IntegerProperty(required=True, default=0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
927 |
body = db.TextProperty(required = True) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
928 |
title = db.StringProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
929 |
added = db.DateTimeProperty(auto_now_add=True) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
930 |
added_month = db.IntegerProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
931 |
added_year = db.IntegerProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
932 |
edited = db.DateTimeProperty() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
933 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
934 |
def __init__(self, parent=None, key_name=None, app=None, **entity_values): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
935 |
db.Model.__init__(self, parent, key_name, app, **entity_values) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
936 |
Taggable.__init__(self) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
937 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
938 |
@classmethod |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
939 |
def new_post(cls, new_title=None, new_body=None, new_tags=[]): |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
940 |
if new_title is not None and new_body is not None: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
941 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
942 |
new_post = Post(title = new_title, body = new_body) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
943 |
new_post.put() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
944 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
945 |
new_post.tags = new_tags |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
946 |
new_post.save() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
947 |
else: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
948 |
raise Exception("Must supply both new_title and new_body when creating a new Post.") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
949 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
950 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
951 |
Retrieval Example: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
952 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
953 |
{% if post.tags %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
954 |
<div class="posttags">tags:&nbsp; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
955 |
{% for each_tag in post.tags %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
956 |
<a href="/searchbytag?tag={{ each_tag.tag|escape }}">{{ each_tag.tag }}</a>{% if forloop.last %}{% else %}, {% endif %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
957 |
{% endfor %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
958 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
959 |
{% endif %} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
960 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
961 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
962 |
<div title="Taggable tags_string Method" modifier="AdamCrossland" created="200812051441" modified="200812051441" tags="api" changecount="3"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
963 |
<pre>//taggable_instance.tags_string()// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
964 |
Returns: a string representation of the tags assigned to the [[Taggable|Taggable Class]] instance. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
965 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
966 |
This method simply joins the string versions of each [[Tag|Tag Class]] in the [[Taggable|Taggable Class]] class's //list//, placing the value stored in [[tag_separator|Taggable tag_separator Property]] inbetween each element.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
967 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
968 |
<div title="TaggableAPI" modifier="AdamCrossland" created="200805201953" modified="200805201956" changecount="6"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
969 |
<pre><<tagging api>></pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
970 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
971 |
<div title="get_tags_as_string" modifier="AdamCrossland" created="200805201952" modified="200812041913" tags="obsolete" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
972 |
<pre>The //get_tags_as_string// method creates a string representation of all of the tags that apply to a ''Taggable'' object.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
973 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
974 |
<div title="set_tags" modifier="AdamCrossland" created="200805201919" modified="200812041848" tags="obsolete" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
975 |
<pre>The //set_tags// method sets the tags for a ''Taggable'' object from a list of strings: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
976 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
977 |
tag_list = ["foo", "bar", "bletch","this is a tag", "tags rule"] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
978 |
my_taggable_object.set_tags(tag_list) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
979 |
}}}</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
980 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
981 |
<div title="set_tags_from_string" modifier="AdamCrossland" created="200805201926" modified="200812041848" tags="obsolete" changecount="3"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
982 |
<pre>The //set_tags_from_string method// sets the tags for a Taggable object from a string that contains one or more tags separated by the character or characters in //self.tag_seperator//: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
983 |
{{{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
984 |
tag_list = "foo, bar, bletch, this is a tag, tags rule" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
985 |
my_taggable_object.set_tags_from_string(tag_list) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
986 |
}}} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
987 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
988 |
By default, [[tag_separator|tag_separator]] is set to a comma (','), but it can be anything that the programmer wants.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
989 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
990 |
<div title="taggable.py" modifier="AdamCrossland" created="200805201904" modified="200805201946" changecount="2"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
991 |
<pre>All of the code for the ''Taggable'' mixin class lives in the file taggable.py. Simply copy this file in to your Google ~AppEngine main directory, and it should be available to your code.</pre> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
992 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
993 |
</div> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
994 |
<!--POST-STOREAREA--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
995 |
<!--POST-BODY-START--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
996 |
<!--POST-BODY-END--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
997 |
<script id="jsArea" type="text/javascript"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
998 |
//<![CDATA[ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
999 |
// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1000 |
// Please note: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1001 |
// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1002 |
// * This code is designed to be readable but for compactness it only includes brief comments. You can see fuller comments |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1003 |
// in the project Subversion repository at http://svn.tiddlywiki.org/Trunk/core/ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1004 |
// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1005 |
// * You should never need to modify this source code directly. TiddlyWiki is carefully designed to allow deep customisation |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1006 |
// without changing the core code. Please consult the development group at http://groups.google.com/group/TiddlyWikiDev |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1007 |
// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1008 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1009 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1010 |
//-- Configuration repository |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1011 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1012 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1013 |
// Miscellaneous options |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1014 |
var config = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1015 |
numRssItems: 20, // Number of items in the RSS feed |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1016 |
animDuration: 400, // Duration of UI animations in milliseconds |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1017 |
cascadeFast: 20, // Speed for cascade animations (higher == slower) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1018 |
cascadeSlow: 60, // Speed for EasterEgg cascade animations |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1019 |
cascadeDepth: 5, // Depth of cascade animation |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1020 |
locale: "en" // W3C language tag |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1021 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1022 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1023 |
// Hashmap of alternative parsers for the wikifier |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1024 |
config.parsers = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1025 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1026 |
// Adaptors |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1027 |
config.adaptors = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1028 |
config.defaultAdaptor = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1029 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1030 |
// Backstage tasks |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1031 |
config.tasks = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1032 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1033 |
// Annotations |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1034 |
config.annotations = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1035 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1036 |
// Custom fields to be automatically added to new tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1037 |
config.defaultCustomFields = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1038 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1039 |
// Messages |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1040 |
config.messages = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1041 |
messageClose: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1042 |
dates: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1043 |
tiddlerPopup: {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1044 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1045 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1046 |
// Options that can be set in the options panel and/or cookies |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1047 |
config.options = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1048 |
chkRegExpSearch: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1049 |
chkCaseSensitiveSearch: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1050 |
chkIncrementalSearch: true, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1051 |
chkAnimate: true, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1052 |
chkSaveBackups: true, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1053 |
chkAutoSave: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1054 |
chkGenerateAnRssFeed: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1055 |
chkSaveEmptyTemplate: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1056 |
chkOpenInNewWindow: true, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1057 |
chkToggleLinks: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1058 |
chkHttpReadOnly: true, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1059 |
chkForceMinorUpdate: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1060 |
chkConfirmDelete: true, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1061 |
chkInsertTabs: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1062 |
chkUsePreForStorage: true, // Whether to use <pre> format for storage |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1063 |
chkDisplayInstrumentation: false, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1064 |
txtBackupFolder: "", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1065 |
txtEditorFocus: "text", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1066 |
txtMainTab: "tabTimeline", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1067 |
txtMoreTab: "moreTabAll", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1068 |
txtMaxEditRows: "30", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1069 |
txtFileSystemCharSet: "UTF-8", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1070 |
txtTheme: "" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1071 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1072 |
config.optionsDesc = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1073 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1074 |
// List of notification functions to be called when certain tiddlers are changed or deleted |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1075 |
config.notifyTiddlers = [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1076 |
{name: "StyleSheetLayout", notify: refreshStyles}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1077 |
{name: "StyleSheetColors", notify: refreshStyles}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1078 |
{name: "StyleSheet", notify: refreshStyles}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1079 |
{name: "StyleSheetPrint", notify: refreshStyles}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1080 |
{name: "PageTemplate", notify: refreshPageTemplate}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1081 |
{name: "SiteTitle", notify: refreshPageTitle}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1082 |
{name: "SiteSubtitle", notify: refreshPageTitle}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1083 |
{name: "ColorPalette", notify: refreshColorPalette}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1084 |
{name: null, notify: refreshDisplay} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1085 |
]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1086 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1087 |
// Default tiddler templates |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1088 |
var DEFAULT_VIEW_TEMPLATE = 1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1089 |
var DEFAULT_EDIT_TEMPLATE = 2; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1090 |
config.tiddlerTemplates = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1091 |
1: "ViewTemplate", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1092 |
2: "EditTemplate" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1093 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1094 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1095 |
// More messages (rather a legacy layout that shouldn't really be like this) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1096 |
config.views = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1097 |
wikified: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1098 |
tag: {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1099 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1100 |
editor: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1101 |
tagChooser: {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1102 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1103 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1104 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1105 |
// Backstage tasks |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1106 |
config.backstageTasks = ["save","sync","importTask","tweak","upgrade","plugins"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1107 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1108 |
// Macros; each has a 'handler' member that is inserted later |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1109 |
config.macros = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1110 |
today: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1111 |
version: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1112 |
search: {sizeTextbox: 15}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1113 |
tiddler: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1114 |
tag: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1115 |
tags: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1116 |
tagging: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1117 |
timeline: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1118 |
allTags: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1119 |
list: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1120 |
all: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1121 |
missing: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1122 |
orphans: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1123 |
shadowed: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1124 |
touched: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1125 |
filter: {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1126 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1127 |
closeAll: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1128 |
permaview: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1129 |
saveChanges: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1130 |
slider: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1131 |
option: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1132 |
options: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1133 |
newTiddler: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1134 |
newJournal: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1135 |
tabs: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1136 |
gradient: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1137 |
message: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1138 |
view: {defaultView: "text"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1139 |
edit: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1140 |
tagChooser: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1141 |
toolbar: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1142 |
plugins: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1143 |
refreshDisplay: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1144 |
importTiddlers: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1145 |
upgrade: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1146 |
source: "http://www.tiddlywiki.com/upgrade/", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1147 |
backupExtension: "pre.core.upgrade" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1148 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1149 |
sync: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1150 |
annotations: {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1151 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1152 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1153 |
// Commands supported by the toolbar macro |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1154 |
config.commands = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1155 |
closeTiddler: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1156 |
closeOthers: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1157 |
editTiddler: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1158 |
saveTiddler: {hideReadOnly: true}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1159 |
cancelTiddler: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1160 |
deleteTiddler: {hideReadOnly: true}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1161 |
permalink: {}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1162 |
references: {type: "popup"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1163 |
jump: {type: "popup"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1164 |
syncing: {type: "popup"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1165 |
fields: {type: "popup"} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1166 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1167 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1168 |
// Browser detection... In a very few places, there's nothing else for it but to know what browser we're using. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1169 |
config.userAgent = navigator.userAgent.toLowerCase(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1170 |
config.browser = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1171 |
isIE: config.userAgent.indexOf("msie") != -1 && config.userAgent.indexOf("opera") == -1, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1172 |
isGecko: config.userAgent.indexOf("gecko") != -1, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1173 |
ieVersion: /MSIE (\d.\d)/i.exec(config.userAgent), // config.browser.ieVersion[1], if it exists, will be the IE version string, eg "6.0" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1174 |
isSafari: config.userAgent.indexOf("applewebkit") != -1, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1175 |
isBadSafari: !((new RegExp("[\u0150\u0170]","g")).test("\u0150")), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1176 |
firefoxDate: /gecko\/(\d{8})/i.exec(config.userAgent), // config.browser.firefoxDate[1], if it exists, will be Firefox release date as "YYYYMMDD" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1177 |
isOpera: config.userAgent.indexOf("opera") != -1, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1178 |
isLinux: config.userAgent.indexOf("linux") != -1, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1179 |
isUnix: config.userAgent.indexOf("x11") != -1, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1180 |
isMac: config.userAgent.indexOf("mac") != -1, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1181 |
isWindows: config.userAgent.indexOf("win") != -1 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1182 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1183 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1184 |
// Basic regular expressions |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1185 |
config.textPrimitives = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1186 |
upperLetter: "[A-Z\u00c0-\u00de\u0150\u0170]", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1187 |
lowerLetter: "[a-z0-9_\\-\u00df-\u00ff\u0151\u0171]", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1188 |
anyLetter: "[A-Za-z0-9_\\-\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1189 |
anyLetterStrict: "[A-Za-z0-9\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1190 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1191 |
if(config.browser.isBadSafari) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1192 |
config.textPrimitives = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1193 |
upperLetter: "[A-Z\u00c0-\u00de]", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1194 |
lowerLetter: "[a-z0-9_\\-\u00df-\u00ff]", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1195 |
anyLetter: "[A-Za-z0-9_\\-\u00c0-\u00de\u00df-\u00ff]", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1196 |
anyLetterStrict: "[A-Za-z0-9\u00c0-\u00de\u00df-\u00ff]" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1197 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1198 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1199 |
config.textPrimitives.sliceSeparator = "::"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1200 |
config.textPrimitives.sectionSeparator = "##"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1201 |
config.textPrimitives.urlPattern = "(?:file|http|https|mailto|ftp|irc|news|data):[^\\s'\"]+(?:/|\\b)"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1202 |
config.textPrimitives.unWikiLink = "~"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1203 |
config.textPrimitives.wikiLink = "(?:(?:" + config.textPrimitives.upperLetter + "+" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1204 |
config.textPrimitives.lowerLetter + "+" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1205 |
config.textPrimitives.upperLetter + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1206 |
config.textPrimitives.anyLetter + "*)|(?:" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1207 |
config.textPrimitives.upperLetter + "{2,}" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1208 |
config.textPrimitives.lowerLetter + "+))"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1209 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1210 |
config.textPrimitives.cssLookahead = "(?:(" + config.textPrimitives.anyLetter + "+)\\(([^\\)\\|\\n]+)(?:\\):))|(?:(" + config.textPrimitives.anyLetter + "+):([^;\\|\\n]+);)"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1211 |
config.textPrimitives.cssLookaheadRegExp = new RegExp(config.textPrimitives.cssLookahead,"mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1212 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1213 |
config.textPrimitives.brackettedLink = "\\[\\[([^\\]]+)\\]\\]"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1214 |
config.textPrimitives.titledBrackettedLink = "\\[\\[([^\\[\\]\\|]+)\\|([^\\[\\]\\|]+)\\]\\]"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1215 |
config.textPrimitives.tiddlerForcedLinkRegExp = new RegExp("(?:" + config.textPrimitives.titledBrackettedLink + ")|(?:" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1216 |
config.textPrimitives.brackettedLink + ")|(?:" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1217 |
config.textPrimitives.urlPattern + ")","mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1218 |
config.textPrimitives.tiddlerAnyLinkRegExp = new RegExp("("+ config.textPrimitives.wikiLink + ")|(?:" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1219 |
config.textPrimitives.titledBrackettedLink + ")|(?:" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1220 |
config.textPrimitives.brackettedLink + ")|(?:" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1221 |
config.textPrimitives.urlPattern + ")","mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1222 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1223 |
config.glyphs = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1224 |
browsers: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1225 |
function() {return config.browser.isIE;}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1226 |
function() {return true;} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1227 |
], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1228 |
currBrowser: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1229 |
codes: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1230 |
downTriangle: ["\u25BC","\u25BE"], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1231 |
downArrow: ["\u2193","\u2193"], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1232 |
bentArrowLeft: ["\u2190","\u21A9"], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1233 |
bentArrowRight: ["\u2192","\u21AA"] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1234 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1235 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1236 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1237 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1238 |
//-- Shadow tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1239 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1240 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1241 |
config.shadowTiddlers = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1242 |
StyleSheet: "", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1243 |
MarkupPreHead: "", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1244 |
MarkupPostHead: "", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1245 |
MarkupPreBody: "", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1246 |
MarkupPostBody: "", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1247 |
TabTimeline: '<<timeline>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1248 |
TabAll: '<<list all>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1249 |
TabTags: '<<allTags excludeLists>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1250 |
TabMoreMissing: '<<list missing>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1251 |
TabMoreOrphans: '<<list orphans>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1252 |
TabMoreShadowed: '<<list shadowed>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1253 |
AdvancedOptions: '<<options>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1254 |
PluginManager: '<<plugins>>' |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1255 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1256 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1257 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1258 |
//-- Translateable strings |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1259 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1260 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1261 |
// Strings in "double quotes" should be translated; strings in 'single quotes' should be left alone |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1262 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1263 |
merge(config.options,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1264 |
txtUserName: "YourName"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1265 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1266 |
merge(config.tasks,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1267 |
save: {text: "save", tooltip: "Save your changes to this TiddlyWiki", action: saveChanges}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1268 |
sync: {text: "sync", tooltip: "Synchronise changes with other TiddlyWiki files and servers", content: '<<sync>>'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1269 |
importTask: {text: "import", tooltip: "Import tiddlers and plugins from other TiddlyWiki files and servers", content: '<<importTiddlers>>'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1270 |
tweak: {text: "tweak", tooltip: "Tweak the appearance and behaviour of TiddlyWiki", content: '<<options>>'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1271 |
upgrade: {text: "upgrade", tooltip: "Upgrade TiddlyWiki core code", content: '<<upgrade>>'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1272 |
plugins: {text: "plugins", tooltip: "Manage installed plugins", content: '<<plugins>>'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1273 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1274 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1275 |
// Options that can be set in the options panel and/or cookies |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1276 |
merge(config.optionsDesc,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1277 |
txtUserName: "Username for signing your edits", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1278 |
chkRegExpSearch: "Enable regular expressions for searches", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1279 |
chkCaseSensitiveSearch: "Case-sensitive searching", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1280 |
chkIncrementalSearch: "Incremental key-by-key searching", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1281 |
chkAnimate: "Enable animations", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1282 |
chkSaveBackups: "Keep backup file when saving changes", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1283 |
chkAutoSave: "Automatically save changes", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1284 |
chkGenerateAnRssFeed: "Generate an RSS feed when saving changes", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1285 |
chkSaveEmptyTemplate: "Generate an empty template when saving changes", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1286 |
chkOpenInNewWindow: "Open external links in a new window", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1287 |
chkToggleLinks: "Clicking on links to open tiddlers causes them to close", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1288 |
chkHttpReadOnly: "Hide editing features when viewed over HTTP", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1289 |
chkForceMinorUpdate: "Don't update modifier username and date when editing tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1290 |
chkConfirmDelete: "Require confirmation before deleting tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1291 |
chkInsertTabs: "Use the tab key to insert tab characters instead of moving between fields", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1292 |
txtBackupFolder: "Name of folder to use for backups", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1293 |
txtMaxEditRows: "Maximum number of rows in edit boxes", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1294 |
txtFileSystemCharSet: "Default character set for saving changes (Firefox/Mozilla only)"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1295 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1296 |
merge(config.messages,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1297 |
customConfigError: "Problems were encountered loading plugins. See PluginManager for details", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1298 |
pluginError: "Error: %0", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1299 |
pluginDisabled: "Not executed because disabled via 'systemConfigDisable' tag", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1300 |
pluginForced: "Executed because forced via 'systemConfigForce' tag", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1301 |
pluginVersionError: "Not executed because this plugin needs a newer version of TiddlyWiki", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1302 |
nothingSelected: "Nothing is selected. You must select one or more items first", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1303 |
savedSnapshotError: "It appears that this TiddlyWiki has been incorrectly saved. Please see http://www.tiddlywiki.com/#DownloadSoftware for details", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1304 |
subtitleUnknown: "(unknown)", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1305 |
undefinedTiddlerToolTip: "The tiddler '%0' doesn't yet exist", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1306 |
shadowedTiddlerToolTip: "The tiddler '%0' doesn't yet exist, but has a pre-defined shadow value", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1307 |
tiddlerLinkTooltip: "%0 - %1, %2", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1308 |
externalLinkTooltip: "External link to %0", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1309 |
noTags: "There are no tagged tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1310 |
notFileUrlError: "You need to save this TiddlyWiki to a file before you can save changes", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1311 |
cantSaveError: "It's not possible to save changes. Possible reasons include:\n- your browser doesn't support saving (Firefox, Internet Explorer, Safari and Opera all work if properly configured)\n- the pathname to your TiddlyWiki file contains illegal characters\n- the TiddlyWiki HTML file has been moved or renamed", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1312 |
invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1313 |
backupSaved: "Backup saved", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1314 |
backupFailed: "Failed to save backup file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1315 |
rssSaved: "RSS feed saved", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1316 |
rssFailed: "Failed to save RSS feed file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1317 |
emptySaved: "Empty template saved", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1318 |
emptyFailed: "Failed to save empty template file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1319 |
mainSaved: "Main TiddlyWiki file saved", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1320 |
mainFailed: "Failed to save main TiddlyWiki file. Your changes have not been saved", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1321 |
macroError: "Error in macro <<\%0>>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1322 |
macroErrorDetails: "Error while executing macro <<\%0>>:\n%1", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1323 |
missingMacro: "No such macro", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1324 |
overwriteWarning: "A tiddler named '%0' already exists. Choose OK to overwrite it", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1325 |
unsavedChangesWarning: "WARNING! There are unsaved changes in TiddlyWiki\n\nChoose OK to save\nChoose CANCEL to discard", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1326 |
confirmExit: "--------------------------------\n\nThere are unsaved changes in TiddlyWiki. If you continue you will lose those changes\n\n--------------------------------", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1327 |
saveInstructions: "SaveChanges", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1328 |
unsupportedTWFormat: "Unsupported TiddlyWiki format '%0'", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1329 |
tiddlerSaveError: "Error when saving tiddler '%0'", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1330 |
tiddlerLoadError: "Error when loading tiddler '%0'", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1331 |
wrongSaveFormat: "Cannot save with storage format '%0'. Using standard format for save.", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1332 |
invalidFieldName: "Invalid field name %0", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1333 |
fieldCannotBeChanged: "Field '%0' cannot be changed", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1334 |
loadingMissingTiddler: "Attempting to retrieve the tiddler '%0' from the '%1' server at:\n\n'%2' in the workspace '%3'", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1335 |
upgradeDone: "The upgrade to version %0 is now complete\n\nClick 'OK' to reload the newly upgraded TiddlyWiki"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1336 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1337 |
merge(config.messages.messageClose,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1338 |
text: "close", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1339 |
tooltip: "close this message area"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1340 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1341 |
config.messages.backstage = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1342 |
open: {text: "backstage", tooltip: "Open the backstage area to perform authoring and editing tasks"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1343 |
close: {text: "close", tooltip: "Close the backstage area"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1344 |
prompt: "backstage: ", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1345 |
decal: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1346 |
edit: {text: "edit", tooltip: "Edit the tiddler '%0'"} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1347 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1348 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1349 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1350 |
config.messages.listView = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1351 |
tiddlerTooltip: "Click for the full text of this tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1352 |
previewUnavailable: "(preview not available)" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1353 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1354 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1355 |
config.messages.dates.months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November","December"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1356 |
config.messages.dates.days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1357 |
config.messages.dates.shortMonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1358 |
config.messages.dates.shortDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1359 |
// suffixes for dates, eg "1st","2nd","3rd"..."30th","31st" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1360 |
config.messages.dates.daySuffixes = ["st","nd","rd","th","th","th","th","th","th","th", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1361 |
"th","th","th","th","th","th","th","th","th","th", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1362 |
"st","nd","rd","th","th","th","th","th","th","th", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1363 |
"st"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1364 |
config.messages.dates.am = "am"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1365 |
config.messages.dates.pm = "pm"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1366 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1367 |
merge(config.messages.tiddlerPopup,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1368 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1369 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1370 |
merge(config.views.wikified.tag,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1371 |
labelNoTags: "no tags", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1372 |
labelTags: "tags: ", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1373 |
openTag: "Open tag '%0'", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1374 |
tooltip: "Show tiddlers tagged with '%0'", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1375 |
openAllText: "Open all", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1376 |
openAllTooltip: "Open all of these tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1377 |
popupNone: "No other tiddlers tagged with '%0'"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1378 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1379 |
merge(config.views.wikified,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1380 |
defaultText: "The tiddler '%0' doesn't yet exist. Double-click to create it", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1381 |
defaultModifier: "(missing)", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1382 |
shadowModifier: "(built-in shadow tiddler)", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1383 |
dateFormat: "DD MMM YYYY", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1384 |
createdPrompt: "created"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1385 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1386 |
merge(config.views.editor,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1387 |
tagPrompt: "Type tags separated with spaces, [[use double square brackets]] if necessary, or add existing", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1388 |
defaultText: "Type the text for '%0'"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1389 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1390 |
merge(config.views.editor.tagChooser,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1391 |
text: "tags", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1392 |
tooltip: "Choose existing tags to add to this tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1393 |
popupNone: "There are no tags defined", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1394 |
tagTooltip: "Add the tag '%0'"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1395 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1396 |
merge(config.messages,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1397 |
sizeTemplates: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1398 |
[ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1399 |
{unit: 1024*1024*1024, template: "%0\u00a0GB"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1400 |
{unit: 1024*1024, template: "%0\u00a0MB"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1401 |
{unit: 1024, template: "%0\u00a0KB"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1402 |
{unit: 1, template: "%0\u00a0B"} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1403 |
]}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1404 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1405 |
merge(config.macros.search,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1406 |
label: "search", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1407 |
prompt: "Search this TiddlyWiki", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1408 |
accessKey: "F", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1409 |
successMsg: "%0 tiddlers found matching %1", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1410 |
failureMsg: "No tiddlers found matching %0"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1411 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1412 |
merge(config.macros.tagging,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1413 |
label: "tagging: ", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1414 |
labelNotTag: "not tagging", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1415 |
tooltip: "List of tiddlers tagged with '%0'"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1416 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1417 |
merge(config.macros.timeline,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1418 |
dateFormat: "DD MMM YYYY"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1419 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1420 |
merge(config.macros.allTags,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1421 |
tooltip: "Show tiddlers tagged with '%0'", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1422 |
noTags: "There are no tagged tiddlers"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1423 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1424 |
config.macros.list.all.prompt = "All tiddlers in alphabetical order"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1425 |
config.macros.list.missing.prompt = "Tiddlers that have links to them but are not defined"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1426 |
config.macros.list.orphans.prompt = "Tiddlers that are not linked to from any other tiddlers"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1427 |
config.macros.list.shadowed.prompt = "Tiddlers shadowed with default contents"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1428 |
config.macros.list.touched.prompt = "Tiddlers that have been modified locally"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1429 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1430 |
merge(config.macros.closeAll,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1431 |
label: "close all", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1432 |
prompt: "Close all displayed tiddlers (except any that are being edited)"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1433 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1434 |
merge(config.macros.permaview,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1435 |
label: "permaview", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1436 |
prompt: "Link to an URL that retrieves all the currently displayed tiddlers"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1437 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1438 |
merge(config.macros.saveChanges,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1439 |
label: "save changes", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1440 |
prompt: "Save all tiddlers to create a new TiddlyWiki", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1441 |
accessKey: "S"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1442 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1443 |
merge(config.macros.newTiddler,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1444 |
label: "new tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1445 |
prompt: "Create a new tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1446 |
title: "New Tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1447 |
accessKey: "N"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1448 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1449 |
merge(config.macros.newJournal,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1450 |
label: "new journal", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1451 |
prompt: "Create a new tiddler from the current date and time", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1452 |
accessKey: "J"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1453 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1454 |
merge(config.macros.options,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1455 |
wizardTitle: "Tweak advanced options", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1456 |
step1Title: "These options are saved in cookies in your browser", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1457 |
step1Html: "<input type='hidden' name='markList'></input><br><input type='checkbox' checked='false' name='chkUnknown'>Show unknown options</input>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1458 |
unknownDescription: "//(unknown)//", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1459 |
listViewTemplate: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1460 |
columns: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1461 |
{name: 'Option', field: 'option', title: "Option", type: 'String'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1462 |
{name: 'Description', field: 'description', title: "Description", type: 'WikiText'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1463 |
{name: 'Name', field: 'name', title: "Name", type: 'String'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1464 |
], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1465 |
rowClasses: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1466 |
{className: 'lowlight', field: 'lowlight'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1467 |
]} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1468 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1469 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1470 |
merge(config.macros.plugins,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1471 |
wizardTitle: "Manage plugins", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1472 |
step1Title: "Currently loaded plugins", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1473 |
step1Html: "<input type='hidden' name='markList'></input>", // DO NOT TRANSLATE |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1474 |
skippedText: "(This plugin has not been executed because it was added since startup)", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1475 |
noPluginText: "There are no plugins installed", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1476 |
confirmDeleteText: "Are you sure you want to delete these plugins:\n\n%0", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1477 |
removeLabel: "remove systemConfig tag", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1478 |
removePrompt: "Remove systemConfig tag", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1479 |
deleteLabel: "delete", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1480 |
deletePrompt: "Delete these tiddlers forever", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1481 |
listViewTemplate: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1482 |
columns: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1483 |
{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1484 |
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1485 |
{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1486 |
{name: 'Forced', field: 'forced', title: "Forced", tag: 'systemConfigForce', type: 'TagCheckbox'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1487 |
{name: 'Disabled', field: 'disabled', title: "Disabled", tag: 'systemConfigDisable', type: 'TagCheckbox'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1488 |
{name: 'Executed', field: 'executed', title: "Loaded", type: 'Boolean', trueText: "Yes", falseText: "No"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1489 |
{name: 'Startup Time', field: 'startupTime', title: "Startup Time", type: 'String'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1490 |
{name: 'Error', field: 'error', title: "Status", type: 'Boolean', trueText: "Error", falseText: "OK"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1491 |
{name: 'Log', field: 'log', title: "Log", type: 'StringList'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1492 |
], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1493 |
rowClasses: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1494 |
{className: 'error', field: 'error'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1495 |
{className: 'warning', field: 'warning'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1496 |
]} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1497 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1498 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1499 |
merge(config.macros.toolbar,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1500 |
moreLabel: "more", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1501 |
morePrompt: "Reveal further commands" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1502 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1503 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1504 |
merge(config.macros.refreshDisplay,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1505 |
label: "refresh", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1506 |
prompt: "Redraw the entire TiddlyWiki display" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1507 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1508 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1509 |
merge(config.macros.importTiddlers,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1510 |
readOnlyWarning: "You cannot import into a read-only TiddlyWiki file. Try opening it from a file:// URL", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1511 |
wizardTitle: "Import tiddlers from another file or server", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1512 |
step1Title: "Step 1: Locate the server or TiddlyWiki file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1513 |
step1Html: "Specify the type of the server: <select name='selTypes'><option value=''>Choose...</option></select><br>Enter the URL or pathname here: <input type='text' size=50 name='txtPath'><br>...or browse for a file: <input type='file' size=50 name='txtBrowse'><br><hr>...or select a pre-defined feed: <select name='selFeeds'><option value=''>Choose...</option></select>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1514 |
openLabel: "open", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1515 |
openPrompt: "Open the connection to this file or server", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1516 |
openError: "There were problems fetching the tiddlywiki file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1517 |
statusOpenHost: "Opening the host", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1518 |
statusGetWorkspaceList: "Getting the list of available workspaces", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1519 |
step2Title: "Step 2: Choose the workspace", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1520 |
step2Html: "Enter a workspace name: <input type='text' size=50 name='txtWorkspace'><br>...or select a workspace: <select name='selWorkspace'><option value=''>Choose...</option></select>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1521 |
cancelLabel: "cancel", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1522 |
cancelPrompt: "Cancel this import", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1523 |
statusOpenWorkspace: "Opening the workspace", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1524 |
statusGetTiddlerList: "Getting the list of available tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1525 |
errorGettingTiddlerList: "Error getting list of tiddlers, click Cancel to try again", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1526 |
step3Title: "Step 3: Choose the tiddlers to import", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1527 |
step3Html: "<input type='hidden' name='markList'></input><br><input type='checkbox' checked='true' name='chkSync'>Keep these tiddlers linked to this server so that you can synchronise subsequent changes</input><br><input type='checkbox' name='chkSave'>Save the details of this server in a 'systemServer' tiddler called:</input> <input type='text' size=25 name='txtSaveTiddler'>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1528 |
importLabel: "import", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1529 |
importPrompt: "Import these tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1530 |
confirmOverwriteText: "Are you sure you want to overwrite these tiddlers:\n\n%0", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1531 |
step4Title: "Step 4: Importing %0 tiddler(s)", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1532 |
step4Html: "<input type='hidden' name='markReport'></input>", // DO NOT TRANSLATE |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1533 |
doneLabel: "done", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1534 |
donePrompt: "Close this wizard", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1535 |
statusDoingImport: "Importing tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1536 |
statusDoneImport: "All tiddlers imported", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1537 |
systemServerNamePattern: "%2 on %1", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1538 |
systemServerNamePatternNoWorkspace: "%1", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1539 |
confirmOverwriteSaveTiddler: "The tiddler '%0' already exists. Click 'OK' to overwrite it with the details of this server, or 'Cancel' to leave it unchanged", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1540 |
serverSaveTemplate: "|''Type:''|%0|\n|''URL:''|%1|\n|''Workspace:''|%2|\n\nThis tiddler was automatically created to record the details of this server", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1541 |
serverSaveModifier: "(System)", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1542 |
listViewTemplate: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1543 |
columns: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1544 |
{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1545 |
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1546 |
{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1547 |
{name: 'Tags', field: 'tags', title: "Tags", type: 'Tags'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1548 |
], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1549 |
rowClasses: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1550 |
]} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1551 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1552 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1553 |
merge(config.macros.upgrade,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1554 |
wizardTitle: "Upgrade TiddlyWiki core code", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1555 |
step1Title: "Update or repair this TiddlyWiki to the latest release", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1556 |
step1Html: "You are about to upgrade to the latest release of the TiddlyWiki core code (from <a href='%0' class='externalLink' target='_blank'>%1</a>). Your content will be preserved across the upgrade.<br><br>Note that core upgrades have been known to interfere with older plugins. If you run into problems with the upgraded file, see <a href='http://www.tiddlywiki.org/wiki/CoreUpgrades' class='externalLink' target='_blank'>http://www.tiddlywiki.org/wiki/CoreUpgrades</a>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1557 |
errorCantUpgrade: "Unable to upgrade this TiddlyWiki. You can only perform upgrades on TiddlyWiki files stored locally", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1558 |
errorNotSaved: "You must save changes before you can perform an upgrade", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1559 |
step2Title: "Confirm the upgrade details", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1560 |
step2Html_downgrade: "You are about to downgrade to TiddlyWiki version %0 from %1.<br><br>Downgrading to an earlier version of the core code is not recommended", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1561 |
step2Html_restore: "This TiddlyWiki appears to be already using the latest version of the core code (%0).<br><br>You can continue to upgrade anyway to ensure that the core code hasn't been corrupted or damaged", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1562 |
step2Html_upgrade: "You are about to upgrade to TiddlyWiki version %0 from %1", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1563 |
upgradeLabel: "upgrade", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1564 |
upgradePrompt: "Prepare for the upgrade process", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1565 |
statusPreparingBackup: "Preparing backup", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1566 |
statusSavingBackup: "Saving backup file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1567 |
errorSavingBackup: "There was a problem saving the backup file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1568 |
statusLoadingCore: "Loading core code", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1569 |
errorLoadingCore: "Error loading the core code", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1570 |
errorCoreFormat: "Error with the new core code", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1571 |
statusSavingCore: "Saving the new core code", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1572 |
statusReloadingCore: "Reloading the new core code", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1573 |
startLabel: "start", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1574 |
startPrompt: "Start the upgrade process", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1575 |
cancelLabel: "cancel", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1576 |
cancelPrompt: "Cancel the upgrade process", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1577 |
step3Title: "Upgrade cancelled", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1578 |
step3Html: "You have cancelled the upgrade process" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1579 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1580 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1581 |
merge(config.macros.sync,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1582 |
listViewTemplate: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1583 |
columns: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1584 |
{name: 'Selected', field: 'selected', rowName: 'title', type: 'Selector'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1585 |
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1586 |
{name: 'Server Type', field: 'serverType', title: "Server type", type: 'String'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1587 |
{name: 'Server Host', field: 'serverHost', title: "Server host", type: 'String'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1588 |
{name: 'Server Workspace', field: 'serverWorkspace', title: "Server workspace", type: 'String'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1589 |
{name: 'Status', field: 'status', title: "Synchronisation status", type: 'String'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1590 |
{name: 'Server URL', field: 'serverUrl', title: "Server URL", text: "View", type: 'Link'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1591 |
], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1592 |
rowClasses: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1593 |
], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1594 |
buttons: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1595 |
{caption: "Sync these tiddlers", name: 'sync'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1596 |
]}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1597 |
wizardTitle: "Synchronize with external servers and files", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1598 |
step1Title: "Choose the tiddlers you want to synchronize", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1599 |
step1Html: "<input type='hidden' name='markList'></input>", // DO NOT TRANSLATE |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1600 |
syncLabel: "sync", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1601 |
syncPrompt: "Sync these tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1602 |
hasChanged: "Changed while unplugged", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1603 |
hasNotChanged: "Unchanged while unplugged", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1604 |
syncStatusList: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1605 |
none: {text: "...", color: "transparent"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1606 |
changedServer: {text: "Changed on server", color: '#80ff80'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1607 |
changedLocally: {text: "Changed while unplugged", color: '#80ff80'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1608 |
changedBoth: {text: "Changed while unplugged and on server", color: '#ff8080'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1609 |
notFound: {text: "Not found on server", color: '#ffff80'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1610 |
putToServer: {text: "Saved update on server", color: '#ff80ff'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1611 |
gotFromServer: {text: "Retrieved update from server", color: '#80ffff'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1612 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1613 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1614 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1615 |
merge(config.macros.annotations,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1616 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1617 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1618 |
merge(config.commands.closeTiddler,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1619 |
text: "close", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1620 |
tooltip: "Close this tiddler"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1621 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1622 |
merge(config.commands.closeOthers,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1623 |
text: "close others", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1624 |
tooltip: "Close all other tiddlers"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1625 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1626 |
merge(config.commands.editTiddler,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1627 |
text: "edit", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1628 |
tooltip: "Edit this tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1629 |
readOnlyText: "view", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1630 |
readOnlyTooltip: "View the source of this tiddler"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1631 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1632 |
merge(config.commands.saveTiddler,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1633 |
text: "done", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1634 |
tooltip: "Save changes to this tiddler"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1635 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1636 |
merge(config.commands.cancelTiddler,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1637 |
text: "cancel", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1638 |
tooltip: "Undo changes to this tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1639 |
warning: "Are you sure you want to abandon your changes to '%0'?", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1640 |
readOnlyText: "done", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1641 |
readOnlyTooltip: "View this tiddler normally"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1642 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1643 |
merge(config.commands.deleteTiddler,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1644 |
text: "delete", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1645 |
tooltip: "Delete this tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1646 |
warning: "Are you sure you want to delete '%0'?"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1647 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1648 |
merge(config.commands.permalink,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1649 |
text: "permalink", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1650 |
tooltip: "Permalink for this tiddler"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1651 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1652 |
merge(config.commands.references,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1653 |
text: "references", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1654 |
tooltip: "Show tiddlers that link to this one", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1655 |
popupNone: "No references"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1656 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1657 |
merge(config.commands.jump,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1658 |
text: "jump", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1659 |
tooltip: "Jump to another open tiddler"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1660 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1661 |
merge(config.commands.syncing,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1662 |
text: "syncing", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1663 |
tooltip: "Control synchronisation of this tiddler with a server or external file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1664 |
currentlySyncing: "<div>Currently syncing via <span class='popupHighlight'>'%0'</span> to:</"+"div><div>host: <span class='popupHighlight'>%1</span></"+"div><div>workspace: <span class='popupHighlight'>%2</span></"+"div>", // Note escaping of closing <div> tag |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1665 |
notCurrentlySyncing: "Not currently syncing", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1666 |
captionUnSync: "Stop synchronising this tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1667 |
chooseServer: "Synchronise this tiddler with another server:", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1668 |
currServerMarker: "\u25cf ", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1669 |
notCurrServerMarker: " "}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1670 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1671 |
merge(config.commands.fields,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1672 |
text: "fields", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1673 |
tooltip: "Show the extended fields of this tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1674 |
emptyText: "There are no extended fields for this tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1675 |
listViewTemplate: { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1676 |
columns: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1677 |
{name: 'Field', field: 'field', title: "Field", type: 'String'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1678 |
{name: 'Value', field: 'value', title: "Value", type: 'String'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1679 |
], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1680 |
rowClasses: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1681 |
], |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1682 |
buttons: [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1683 |
]}}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1684 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1685 |
merge(config.shadowTiddlers,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1686 |
DefaultTiddlers: "GettingStarted", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1687 |
MainMenu: "GettingStarted", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1688 |
SiteTitle: "My TiddlyWiki", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1689 |
SiteSubtitle: "a reusable non-linear personal web notebook", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1690 |
SiteUrl: "http://www.tiddlywiki.com/", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1691 |
SideBarOptions: '<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "options \u00bb" "Change TiddlyWiki advanced options">>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1692 |
SideBarTabs: '<<tabs txtMainTab "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1693 |
TabMore: '<<tabs txtMoreTab "Missing" "Missing tiddlers" TabMoreMissing "Orphans" "Orphaned tiddlers" TabMoreOrphans "Shadowed" "Shadowed tiddlers" TabMoreShadowed>>', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1694 |
ToolbarCommands: "|~ViewToolbar|closeTiddler closeOthers +editTiddler > fields syncing permalink references jump|\n|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|"}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1695 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1696 |
merge(config.annotations,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1697 |
AdvancedOptions: "This shadow tiddler provides access to several advanced options", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1698 |
ColorPalette: "These values in this shadow tiddler determine the colour scheme of the ~TiddlyWiki user interface", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1699 |
DefaultTiddlers: "The tiddlers listed in this shadow tiddler will be automatically displayed when ~TiddlyWiki starts up", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1700 |
EditTemplate: "The HTML template in this shadow tiddler determines how tiddlers look while they are being edited", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1701 |
GettingStarted: "This shadow tiddler provides basic usage instructions", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1702 |
ImportTiddlers: "This shadow tiddler provides access to importing tiddlers", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1703 |
MainMenu: "This shadow tiddler is used as the contents of the main menu in the left-hand column of the screen", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1704 |
MarkupPreHead: "This tiddler is inserted at the top of the <head> section of the TiddlyWiki HTML file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1705 |
MarkupPostHead: "This tiddler is inserted at the bottom of the <head> section of the TiddlyWiki HTML file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1706 |
MarkupPreBody: "This tiddler is inserted at the top of the <body> section of the TiddlyWiki HTML file", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1707 |
MarkupPostBody: "This tiddler is inserted at the end of the <body> section of the TiddlyWiki HTML file immediately after the script block", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1708 |
OptionsPanel: "This shadow tiddler is used as the contents of the options panel slider in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1709 |
PageTemplate: "The HTML template in this shadow tiddler determines the overall ~TiddlyWiki layout", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1710 |
PluginManager: "This shadow tiddler provides access to the plugin manager", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1711 |
SideBarOptions: "This shadow tiddler is used as the contents of the option panel in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1712 |
SideBarTabs: "This shadow tiddler is used as the contents of the tabs panel in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1713 |
SiteSubtitle: "This shadow tiddler is used as the second part of the page title", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1714 |
SiteTitle: "This shadow tiddler is used as the first part of the page title", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1715 |
SiteUrl: "This shadow tiddler should be set to the full target URL for publication", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1716 |
StyleSheetColors: "This shadow tiddler contains CSS definitions related to the color of page elements. ''DO NOT EDIT THIS TIDDLER'', instead make your changes in the StyleSheet shadow tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1717 |
StyleSheet: "This tiddler can contain custom CSS definitions", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1718 |
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", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1719 |
StyleSheetLocale: "This shadow tiddler contains CSS definitions related to the translation locale", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1720 |
StyleSheetPrint: "This shadow tiddler contains CSS definitions for printing", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1721 |
TabAll: "This shadow tiddler contains the contents of the 'All' tab in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1722 |
TabMore: "This shadow tiddler contains the contents of the 'More' tab in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1723 |
TabMoreMissing: "This shadow tiddler contains the contents of the 'Missing' tab in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1724 |
TabMoreOrphans: "This shadow tiddler contains the contents of the 'Orphans' tab in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1725 |
TabMoreShadowed: "This shadow tiddler contains the contents of the 'Shadowed' tab in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1726 |
TabTags: "This shadow tiddler contains the contents of the 'Tags' tab in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1727 |
TabTimeline: "This shadow tiddler contains the contents of the 'Timeline' tab in the right-hand sidebar", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1728 |
ToolbarCommands: "This shadow tiddler determines which commands are shown in tiddler toolbars", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1729 |
ViewTemplate: "The HTML template in this shadow tiddler determines how tiddlers look" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1730 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1731 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1732 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1733 |
//-- Main |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1734 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1735 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1736 |
var params = null; // Command line parameters |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1737 |
var store = null; // TiddlyWiki storage |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1738 |
var story = null; // Main story |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1739 |
var formatter = null; // Default formatters for the wikifier |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1740 |
var anim = typeof Animator == "function" ? new Animator() : null; // Animation engine |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1741 |
var readOnly = false; // Whether we're in readonly mode |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1742 |
var highlightHack = null; // Embarrassing hack department... |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1743 |
var hadConfirmExit = false; // Don't warn more than once |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1744 |
var safeMode = false; // Disable all plugins and cookies |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1745 |
var showBackstage; // Whether to include the backstage area |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1746 |
var installedPlugins = []; // Information filled in when plugins are executed |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1747 |
var startingUp = false; // Whether we're in the process of starting up |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1748 |
var pluginInfo,tiddler; // Used to pass information to plugins in loadPlugins() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1749 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1750 |
// Whether to use the JavaSaver applet |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1751 |
var useJavaSaver = (config.browser.isSafari || config.browser.isOpera) && (document.location.toString().substr(0,4) != "http"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1752 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1753 |
// Starting up |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1754 |
function main() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1755 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1756 |
var t10,t9,t8,t7,t6,t5,t4,t3,t2,t1,t0 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1757 |
startingUp = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1758 |
window.onbeforeunload = function(e) {if(window.confirmExit) return confirmExit();}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1759 |
params = getParameters(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1760 |
if(params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1761 |
params = params.parseParams("open",null,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1762 |
store = new TiddlyWiki(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1763 |
invokeParamifier(params,"oninit"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1764 |
story = new Story("tiddlerDisplay","tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1765 |
addEvent(document,"click",Popup.onDocumentClick); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1766 |
saveTest(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1767 |
loadOptionsCookie(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1768 |
for(var s=0; s<config.notifyTiddlers.length; s++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1769 |
store.addNotification(config.notifyTiddlers[s].name,config.notifyTiddlers[s].notify); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1770 |
t1 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1771 |
loadShadowTiddlers(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1772 |
t2 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1773 |
store.loadFromDiv("storeArea","store",true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1774 |
t3 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1775 |
invokeParamifier(params,"onload"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1776 |
t4 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1777 |
readOnly = (window.location.protocol == "file:") ? false : config.options.chkHttpReadOnly; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1778 |
showBackstage = !readOnly; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1779 |
var pluginProblem = loadPlugins(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1780 |
t5 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1781 |
formatter = new Formatter(config.formatters); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1782 |
story.switchTheme(config.options.txtTheme); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1783 |
invokeParamifier(params,"onconfig"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1784 |
t6 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1785 |
store.notifyAll(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1786 |
t7 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1787 |
restart(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1788 |
refreshDisplay(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1789 |
t8 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1790 |
if(pluginProblem) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1791 |
story.displayTiddler(null,"PluginManager"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1792 |
displayMessage(config.messages.customConfigError); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1793 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1794 |
for(var m in config.macros) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1795 |
if(config.macros[m].init) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1796 |
config.macros[m].init(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1797 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1798 |
t9 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1799 |
if(showBackstage) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1800 |
backstage.init(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1801 |
t10 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1802 |
if(config.options.chkDisplayInstrumentation) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1803 |
displayMessage("LoadShadows " + (t2-t1) + " ms"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1804 |
displayMessage("LoadFromDiv " + (t3-t2) + " ms"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1805 |
displayMessage("LoadPlugins " + (t5-t4) + " ms"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1806 |
displayMessage("Notify " + (t7-t6) + " ms"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1807 |
displayMessage("Restart " + (t8-t7) + " ms"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1808 |
displayMessage("Macro init " + (t9-t8) + " ms"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1809 |
displayMessage("Total: " + (t10-t0) + " ms"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1810 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1811 |
startingUp = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1812 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1813 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1814 |
// Restarting |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1815 |
function restart() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1816 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1817 |
invokeParamifier(params,"onstart"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1818 |
if(story.isEmpty()) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1819 |
var tiddlers = store.filterTiddlers(store.getTiddlerText("DefaultTiddlers")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1820 |
story.displayTiddlers(null,tiddlers); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1821 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1822 |
window.scrollTo(0,0); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1823 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1824 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1825 |
function saveTest() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1826 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1827 |
var s = document.getElementById("saveTest"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1828 |
if(s.hasChildNodes()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1829 |
alert(config.messages.savedSnapshotError); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1830 |
s.appendChild(document.createTextNode("savetest")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1831 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1832 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1833 |
function loadShadowTiddlers() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1834 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1835 |
var shadows = new TiddlyWiki(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1836 |
shadows.loadFromDiv("shadowArea","shadows",true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1837 |
shadows.forEachTiddler(function(title,tiddler){config.shadowTiddlers[title] = tiddler.text;}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1838 |
delete shadows; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1839 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1840 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1841 |
function loadPlugins() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1842 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1843 |
if(safeMode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1844 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1845 |
var tiddlers = store.getTaggedTiddlers("systemConfig"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1846 |
var toLoad = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1847 |
var nLoaded = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1848 |
var map = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1849 |
var nPlugins = tiddlers.length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1850 |
installedPlugins = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1851 |
for(var i=0; i<nPlugins; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1852 |
var p = getPluginInfo(tiddlers[i]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1853 |
installedPlugins[i] = p; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1854 |
var n = p.Name; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1855 |
if(n) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1856 |
map[n] = p; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1857 |
n = p.Source; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1858 |
if(n) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1859 |
map[n] = p; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1860 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1861 |
var visit = function(p) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1862 |
if(!p || p.done) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1863 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1864 |
p.done = 1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1865 |
var reqs = p.Requires; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1866 |
if(reqs) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1867 |
reqs = reqs.readBracketedList(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1868 |
for(var i=0; i<reqs.length; i++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1869 |
visit(map[reqs[i]]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1870 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1871 |
toLoad.push(p); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1872 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1873 |
for(i=0; i<nPlugins; i++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1874 |
visit(installedPlugins[i]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1875 |
for(i=0; i<toLoad.length; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1876 |
p = toLoad[i]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1877 |
pluginInfo = p; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1878 |
tiddler = p.tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1879 |
if(isPluginExecutable(p)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1880 |
if(isPluginEnabled(p)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1881 |
p.executed = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1882 |
var startTime = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1883 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1884 |
if(tiddler.text) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1885 |
window.eval(tiddler.text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1886 |
nLoaded++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1887 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1888 |
p.log.push(config.messages.pluginError.format([exceptionText(ex)])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1889 |
p.error = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1890 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1891 |
pluginInfo.startupTime = String((new Date()) - startTime) + "ms"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1892 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1893 |
nPlugins--; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1894 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1895 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1896 |
p.warning = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1897 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1898 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1899 |
return nLoaded != nPlugins; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1900 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1901 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1902 |
function getPluginInfo(tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1903 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1904 |
var p = store.getTiddlerSlices(tiddler.title,["Name","Description","Version","Requires","CoreVersion","Date","Source","Author","License","Browsers"]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1905 |
p.tiddler = tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1906 |
p.title = tiddler.title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1907 |
p.log = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1908 |
return p; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1909 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1910 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1911 |
// Check that a particular plugin is valid for execution |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1912 |
function isPluginExecutable(plugin) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1913 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1914 |
if(plugin.tiddler.isTagged("systemConfigForce")) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1915 |
return verifyTail(plugin,true,config.messages.pluginForced); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1916 |
if(plugin["CoreVersion"]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1917 |
var coreVersion = plugin["CoreVersion"].split("."); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1918 |
var w = parseInt(coreVersion[0]) - version.major; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1919 |
if(w == 0 && coreVersion[1]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1920 |
w = parseInt(coreVersion[1]) - version.minor; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1921 |
if(w == 0 && coreVersion[2]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1922 |
w = parseInt(coreVersion[2]) - version.revision; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1923 |
if(w > 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1924 |
return verifyTail(plugin,false,config.messages.pluginVersionError); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1925 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1926 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1927 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1928 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1929 |
function isPluginEnabled(plugin) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1930 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1931 |
if(plugin.tiddler.isTagged("systemConfigDisable")) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1932 |
return verifyTail(plugin,false,config.messages.pluginDisabled); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1933 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1934 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1935 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1936 |
function verifyTail(plugin,result,message) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1937 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1938 |
plugin.log.push(message); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1939 |
return result; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1940 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1941 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1942 |
function invokeMacro(place,macro,params,wikifier,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1943 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1944 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1945 |
var m = config.macros[macro]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1946 |
if(m && m.handler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1947 |
m.handler(place,macro,params.readMacroParams(),wikifier,params,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1948 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1949 |
createTiddlyError(place,config.messages.macroError.format([macro]),config.messages.macroErrorDetails.format([macro,config.messages.missingMacro])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1950 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1951 |
createTiddlyError(place,config.messages.macroError.format([macro]),config.messages.macroErrorDetails.format([macro,ex.toString()])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1952 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1953 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1954 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1955 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1956 |
//-- Paramifiers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1957 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1958 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1959 |
function getParameters() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1960 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1961 |
var p = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1962 |
if(window.location.hash) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1963 |
p = decodeURIComponent(window.location.hash.substr(1)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1964 |
if(config.browser.firefoxDate != null && config.browser.firefoxDate[1] < "20051111") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1965 |
p = convertUTF8ToUnicode(p); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1966 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1967 |
return p; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1968 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1969 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1970 |
function invokeParamifier(params,handler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1971 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1972 |
if(!params || params.length == undefined || params.length <= 1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1973 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1974 |
for(var t=1; t<params.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1975 |
var p = config.paramifiers[params[t].name]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1976 |
if(p && p[handler] instanceof Function) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1977 |
p[handler](params[t].value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1978 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1979 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1980 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1981 |
config.paramifiers = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1982 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1983 |
config.paramifiers.start = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1984 |
oninit: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1985 |
safeMode = v.toLowerCase() == "safe"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1986 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1987 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1988 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1989 |
config.paramifiers.open = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1990 |
onstart: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1991 |
if(!readOnly || store.tiddlerExists(v) || store.isShadowTiddler(v)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1992 |
story.displayTiddler("bottom",v,null,false,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1993 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1994 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1995 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1996 |
config.paramifiers.story = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1997 |
onstart: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1998 |
var list = store.getTiddlerText(v,"").parseParams("open",null,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1999 |
invokeParamifier(list,"onstart"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2000 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2001 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2002 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2003 |
config.paramifiers.search = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2004 |
onstart: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2005 |
story.search(v,false,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2006 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2007 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2008 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2009 |
config.paramifiers.searchRegExp = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2010 |
onstart: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2011 |
story.prototype.search(v,false,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2012 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2013 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2014 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2015 |
config.paramifiers.tag = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2016 |
onstart: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2017 |
var tagged = store.getTaggedTiddlers(v,"title"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2018 |
story.displayTiddlers(null,tagged,null,false,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2019 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2020 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2021 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2022 |
config.paramifiers.newTiddler = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2023 |
onstart: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2024 |
if(!readOnly) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2025 |
story.displayTiddler(null,v,DEFAULT_EDIT_TEMPLATE); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2026 |
story.focusTiddler(v,"text"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2027 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2028 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2029 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2030 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2031 |
config.paramifiers.newJournal = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2032 |
onstart: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2033 |
if(!readOnly) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2034 |
var now = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2035 |
var title = now.formatString(v.trim()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2036 |
story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2037 |
story.focusTiddler(title,"text"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2038 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2039 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2040 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2041 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2042 |
config.paramifiers.readOnly = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2043 |
onconfig: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2044 |
var p = v.toLowerCase(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2045 |
readOnly = p == "yes" ? true : (p == "no" ? false : readOnly); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2046 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2047 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2048 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2049 |
config.paramifiers.theme = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2050 |
onconfig: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2051 |
story.switchTheme(v); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2052 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2053 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2054 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2055 |
config.paramifiers.upgrade = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2056 |
onstart: function(v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2057 |
upgradeFrom(v); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2058 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2059 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2060 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2061 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2062 |
//-- Formatter helpers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2063 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2064 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2065 |
function Formatter(formatters) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2066 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2067 |
this.formatters = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2068 |
var pattern = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2069 |
for(var n=0; n<formatters.length; n++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2070 |
pattern.push("(" + formatters[n].match + ")"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2071 |
this.formatters.push(formatters[n]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2072 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2073 |
this.formatterRegExp = new RegExp(pattern.join("|"),"mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2074 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2075 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2076 |
config.formatterHelpers = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2077 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2078 |
createElementAndWikify: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2079 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2080 |
w.subWikifyTerm(createTiddlyElement(w.output,this.element),this.termRegExp); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2081 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2082 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2083 |
inlineCssHelper: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2084 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2085 |
var styles = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2086 |
config.textPrimitives.cssLookaheadRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2087 |
var lookaheadMatch = config.textPrimitives.cssLookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2088 |
while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2089 |
var s,v; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2090 |
if(lookaheadMatch[1]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2091 |
s = lookaheadMatch[1].unDash(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2092 |
v = lookaheadMatch[2]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2093 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2094 |
s = lookaheadMatch[3].unDash(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2095 |
v = lookaheadMatch[4]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2096 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2097 |
if(s=="bgcolor") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2098 |
s = "backgroundColor"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2099 |
styles.push({style: s, value: v}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2100 |
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2101 |
config.textPrimitives.cssLookaheadRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2102 |
lookaheadMatch = config.textPrimitives.cssLookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2103 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2104 |
return styles; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2105 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2106 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2107 |
applyCssHelper: function(e,styles) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2108 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2109 |
for(var t=0; t< styles.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2110 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2111 |
e.style[styles[t].style] = styles[t].value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2112 |
} catch (ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2113 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2114 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2115 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2116 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2117 |
enclosedTextHelper: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2118 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2119 |
this.lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2120 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2121 |
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2122 |
var text = lookaheadMatch[1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2123 |
if(config.browser.isIE) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2124 |
text = text.replace(/\n/g,"\r"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2125 |
createTiddlyElement(w.output,this.element,null,null,text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2126 |
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2127 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2128 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2129 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2130 |
isExternalLink: function(link) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2131 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2132 |
if(store.tiddlerExists(link) || store.isShadowTiddler(link)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2133 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2134 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2135 |
var urlRegExp = new RegExp(config.textPrimitives.urlPattern,"mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2136 |
if(urlRegExp.exec(link)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2137 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2138 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2139 |
if(link.indexOf(".")!=-1 || link.indexOf("\\")!=-1 || link.indexOf("/")!=-1 || link.indexOf("#")!=-1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2140 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2141 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2142 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2143 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2144 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2145 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2146 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2147 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2148 |
//-- Standard formatters |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2149 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2150 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2151 |
config.formatters = [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2152 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2153 |
name: "table", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2154 |
match: "^\\|(?:[^\\n]*)\\|(?:[fhck]?)$", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2155 |
lookaheadRegExp: /^\|([^\n]*)\|([fhck]?)$/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2156 |
rowTermRegExp: /(\|(?:[fhck]?)$\n?)/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2157 |
cellRegExp: /(?:\|([^\n\|]*)\|)|(\|[fhck]?$\n?)/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2158 |
cellTermRegExp: /((?:\x20*)\|)/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2159 |
rowTypes: {"c":"caption", "h":"thead", "":"tbody", "f":"tfoot"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2160 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2161 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2162 |
var table = createTiddlyElement(w.output,"table",null,"twtable"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2163 |
var prevColumns = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2164 |
var currRowType = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2165 |
var rowContainer; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2166 |
var rowCount = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2167 |
w.nextMatch = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2168 |
this.lookaheadRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2169 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2170 |
while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2171 |
var nextRowType = lookaheadMatch[2]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2172 |
if(nextRowType == "k") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2173 |
table.className = lookaheadMatch[1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2174 |
w.nextMatch += lookaheadMatch[0].length+1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2175 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2176 |
if(nextRowType != currRowType) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2177 |
rowContainer = createTiddlyElement(table,this.rowTypes[nextRowType]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2178 |
currRowType = nextRowType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2179 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2180 |
if(currRowType == "c") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2181 |
// Caption |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2182 |
w.nextMatch++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2183 |
if(rowContainer != table.firstChild) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2184 |
table.insertBefore(rowContainer,table.firstChild); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2185 |
rowContainer.setAttribute("align",rowCount == 0?"top":"bottom"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2186 |
w.subWikifyTerm(rowContainer,this.rowTermRegExp); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2187 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2188 |
var theRow = createTiddlyElement(rowContainer,"tr",null,(rowCount&1)?"oddRow":"evenRow"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2189 |
theRow.onmouseover = function() {addClass(this,"hoverRow");}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2190 |
theRow.onmouseout = function() {removeClass(this,"hoverRow");}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2191 |
this.rowHandler(w,theRow,prevColumns); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2192 |
rowCount++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2193 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2194 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2195 |
this.lookaheadRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2196 |
lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2197 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2198 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2199 |
rowHandler: function(w,e,prevColumns) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2200 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2201 |
var col = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2202 |
var colSpanCount = 1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2203 |
var prevCell = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2204 |
this.cellRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2205 |
var cellMatch = this.cellRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2206 |
while(cellMatch && cellMatch.index == w.nextMatch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2207 |
if(cellMatch[1] == "~") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2208 |
// Rowspan |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2209 |
var last = prevColumns[col]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2210 |
if(last) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2211 |
last.rowSpanCount++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2212 |
last.element.setAttribute("rowspan",last.rowSpanCount); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2213 |
last.element.setAttribute("rowSpan",last.rowSpanCount); // Needed for IE |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2214 |
last.element.valign = "center"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2215 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2216 |
w.nextMatch = this.cellRegExp.lastIndex-1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2217 |
} else if(cellMatch[1] == ">") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2218 |
// Colspan |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2219 |
colSpanCount++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2220 |
w.nextMatch = this.cellRegExp.lastIndex-1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2221 |
} else if(cellMatch[2]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2222 |
// End of row |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2223 |
if(prevCell && colSpanCount > 1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2224 |
prevCell.setAttribute("colspan",colSpanCount); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2225 |
prevCell.setAttribute("colSpan",colSpanCount); // Needed for IE |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2226 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2227 |
w.nextMatch = this.cellRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2228 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2229 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2230 |
// Cell |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2231 |
w.nextMatch++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2232 |
var styles = config.formatterHelpers.inlineCssHelper(w); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2233 |
var spaceLeft = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2234 |
var chr = w.source.substr(w.nextMatch,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2235 |
while(chr == " ") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2236 |
spaceLeft = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2237 |
w.nextMatch++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2238 |
chr = w.source.substr(w.nextMatch,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2239 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2240 |
var cell; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2241 |
if(chr == "!") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2242 |
cell = createTiddlyElement(e,"th"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2243 |
w.nextMatch++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2244 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2245 |
cell = createTiddlyElement(e,"td"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2246 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2247 |
prevCell = cell; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2248 |
prevColumns[col] = {rowSpanCount:1,element:cell}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2249 |
if(colSpanCount > 1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2250 |
cell.setAttribute("colspan",colSpanCount); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2251 |
cell.setAttribute("colSpan",colSpanCount); // Needed for IE |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2252 |
colSpanCount = 1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2253 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2254 |
config.formatterHelpers.applyCssHelper(cell,styles); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2255 |
w.subWikifyTerm(cell,this.cellTermRegExp); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2256 |
if(w.matchText.substr(w.matchText.length-2,1) == " ") // spaceRight |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2257 |
cell.align = spaceLeft ? "center" : "left"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2258 |
else if(spaceLeft) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2259 |
cell.align = "right"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2260 |
w.nextMatch--; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2261 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2262 |
col++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2263 |
this.cellRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2264 |
cellMatch = this.cellRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2265 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2266 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2267 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2268 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2269 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2270 |
name: "heading", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2271 |
match: "^!{1,6}", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2272 |
termRegExp: /(\n)/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2273 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2274 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2275 |
w.subWikifyTerm(createTiddlyElement(w.output,"h" + w.matchLength),this.termRegExp); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2276 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2277 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2278 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2279 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2280 |
name: "list", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2281 |
match: "^(?:[\\*#;:]+)", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2282 |
lookaheadRegExp: /^(?:(?:(\*)|(#)|(;)|(:))+)/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2283 |
termRegExp: /(\n)/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2284 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2285 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2286 |
var stack = [w.output]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2287 |
var currLevel = 0, currType = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2288 |
var listLevel, listType, itemType, baseType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2289 |
w.nextMatch = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2290 |
this.lookaheadRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2291 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2292 |
while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2293 |
if(lookaheadMatch[1]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2294 |
listType = "ul"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2295 |
itemType = "li"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2296 |
} else if(lookaheadMatch[2]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2297 |
listType = "ol"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2298 |
itemType = "li"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2299 |
} else if(lookaheadMatch[3]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2300 |
listType = "dl"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2301 |
itemType = "dt"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2302 |
} else if(lookaheadMatch[4]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2303 |
listType = "dl"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2304 |
itemType = "dd"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2305 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2306 |
if(!baseType) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2307 |
baseType = listType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2308 |
listLevel = lookaheadMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2309 |
w.nextMatch += lookaheadMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2310 |
var t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2311 |
if(listLevel > currLevel) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2312 |
for(t=currLevel; t<listLevel; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2313 |
var target = (currLevel == 0) ? stack[stack.length-1] : stack[stack.length-1].lastChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2314 |
stack.push(createTiddlyElement(target,listType)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2315 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2316 |
} else if(listType!=baseType && listLevel==1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2317 |
w.nextMatch -= lookaheadMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2318 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2319 |
} else if(listLevel < currLevel) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2320 |
for(t=currLevel; t>listLevel; t--) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2321 |
stack.pop(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2322 |
} else if(listLevel == currLevel && listType != currType) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2323 |
stack.pop(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2324 |
stack.push(createTiddlyElement(stack[stack.length-1].lastChild,listType)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2325 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2326 |
currLevel = listLevel; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2327 |
currType = listType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2328 |
var e = createTiddlyElement(stack[stack.length-1],itemType); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2329 |
w.subWikifyTerm(e,this.termRegExp); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2330 |
this.lookaheadRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2331 |
lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2332 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2333 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2334 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2335 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2336 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2337 |
name: "quoteByBlock", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2338 |
match: "^<<<\\n", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2339 |
termRegExp: /(^<<<(\n|$))/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2340 |
element: "blockquote", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2341 |
handler: config.formatterHelpers.createElementAndWikify |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2342 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2343 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2344 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2345 |
name: "quoteByLine", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2346 |
match: "^>+", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2347 |
lookaheadRegExp: /^>+/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2348 |
termRegExp: /(\n)/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2349 |
element: "blockquote", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2350 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2351 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2352 |
var stack = [w.output]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2353 |
var currLevel = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2354 |
var newLevel = w.matchLength; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2355 |
var t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2356 |
do { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2357 |
if(newLevel > currLevel) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2358 |
for(t=currLevel; t<newLevel; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2359 |
stack.push(createTiddlyElement(stack[stack.length-1],this.element)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2360 |
} else if(newLevel < currLevel) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2361 |
for(t=currLevel; t>newLevel; t--) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2362 |
stack.pop(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2363 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2364 |
currLevel = newLevel; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2365 |
w.subWikifyTerm(stack[stack.length-1],this.termRegExp); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2366 |
createTiddlyElement(stack[stack.length-1],"br"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2367 |
this.lookaheadRegExp.lastIndex = w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2368 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2369 |
var matched = lookaheadMatch && lookaheadMatch.index == w.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2370 |
if(matched) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2371 |
newLevel = lookaheadMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2372 |
w.nextMatch += lookaheadMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2373 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2374 |
} while(matched); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2375 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2376 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2377 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2378 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2379 |
name: "rule", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2380 |
match: "^----+$\\n?", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2381 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2382 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2383 |
createTiddlyElement(w.output,"hr"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2384 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2385 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2386 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2387 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2388 |
name: "monospacedByLine", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2389 |
match: "^(?:/\\*\\{\\{\\{\\*/|\\{\\{\\{|//\\{\\{\\{|<!--\\{\\{\\{-->)\\n", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2390 |
element: "pre", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2391 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2392 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2393 |
switch(w.matchText) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2394 |
case "/*{{{*/\n": // CSS |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2395 |
this.lookaheadRegExp = /\/\*\{\{\{\*\/\n*((?:^[^\n]*\n)+?)(\n*^\/\*\}\}\}\*\/$\n?)/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2396 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2397 |
case "{{{\n": // monospaced block |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2398 |
this.lookaheadRegExp = /^\{\{\{\n((?:^[^\n]*\n)+?)(^\}\}\}$\n?)/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2399 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2400 |
case "//{{{\n": // plugin |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2401 |
this.lookaheadRegExp = /^\/\/\{\{\{\n\n*((?:^[^\n]*\n)+?)(\n*^\/\/\}\}\}$\n?)/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2402 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2403 |
case "<!--{{{-->\n": //template |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2404 |
this.lookaheadRegExp = /<!--\{\{\{-->\n*((?:^[^\n]*\n)+?)(\n*^<!--\}\}\}-->$\n?)/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2405 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2406 |
default: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2407 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2408 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2409 |
config.formatterHelpers.enclosedTextHelper.call(this,w); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2410 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2411 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2412 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2413 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2414 |
name: "wikifyComment", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2415 |
match: "^(?:/\\*\\*\\*|<!---)\\n", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2416 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2417 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2418 |
var termRegExp = (w.matchText == "/***\n") ? (/(^\*\*\*\/\n)/mg) : (/(^--->\n)/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2419 |
w.subWikifyTerm(w.output,termRegExp); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2420 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2421 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2422 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2423 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2424 |
name: "macro", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2425 |
match: "<<", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2426 |
lookaheadRegExp: /<<([^>\s]+)(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2427 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2428 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2429 |
this.lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2430 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2431 |
if(lookaheadMatch && lookaheadMatch.index == w.matchStart && lookaheadMatch[1]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2432 |
w.nextMatch = this.lookaheadRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2433 |
invokeMacro(w.output,lookaheadMatch[1],lookaheadMatch[2],w,w.tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2434 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2435 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2436 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2437 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2438 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2439 |
name: "prettyLink", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2440 |
match: "\\[\\[", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2441 |
lookaheadRegExp: /\[\[(.*?)(?:\|(~)?(.*?))?\]\]/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2442 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2443 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2444 |
this.lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2445 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2446 |
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2447 |
var e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2448 |
var text = lookaheadMatch[1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2449 |
if(lookaheadMatch[3]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2450 |
// Pretty bracketted link |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2451 |
var link = lookaheadMatch[3]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2452 |
e = (!lookaheadMatch[2] && config.formatterHelpers.isExternalLink(link)) ? |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2453 |
createExternalLink(w.output,link) : createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2454 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2455 |
// Simple bracketted link |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2456 |
e = createTiddlyLink(w.output,text,false,null,w.isStatic,w.tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2457 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2458 |
createTiddlyText(e,text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2459 |
w.nextMatch = this.lookaheadRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2460 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2461 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2462 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2463 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2464 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2465 |
name: "wikiLink", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2466 |
match: config.textPrimitives.unWikiLink+"?"+config.textPrimitives.wikiLink, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2467 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2468 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2469 |
if(w.matchText.substr(0,1) == config.textPrimitives.unWikiLink) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2470 |
w.outputText(w.output,w.matchStart+1,w.nextMatch); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2471 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2472 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2473 |
if(w.matchStart > 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2474 |
var preRegExp = new RegExp(config.textPrimitives.anyLetterStrict,"mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2475 |
preRegExp.lastIndex = w.matchStart-1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2476 |
var preMatch = preRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2477 |
if(preMatch.index == w.matchStart-1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2478 |
w.outputText(w.output,w.matchStart,w.nextMatch); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2479 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2480 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2481 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2482 |
if(w.autoLinkWikiWords || store.isShadowTiddler(w.matchText)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2483 |
var link = createTiddlyLink(w.output,w.matchText,false,null,w.isStatic,w.tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2484 |
w.outputText(link,w.matchStart,w.nextMatch); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2485 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2486 |
w.outputText(w.output,w.matchStart,w.nextMatch); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2487 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2488 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2489 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2490 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2491 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2492 |
name: "urlLink", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2493 |
match: config.textPrimitives.urlPattern, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2494 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2495 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2496 |
w.outputText(createExternalLink(w.output,w.matchText),w.matchStart,w.nextMatch); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2497 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2498 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2499 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2500 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2501 |
name: "image", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2502 |
match: "\\[[<>]?[Ii][Mm][Gg]\\[", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2503 |
lookaheadRegExp: /\[([<]?)(>?)[Ii][Mm][Gg]\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2504 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2505 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2506 |
this.lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2507 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2508 |
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2509 |
var e = w.output; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2510 |
if(lookaheadMatch[5]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2511 |
var link = lookaheadMatch[5]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2512 |
e = config.formatterHelpers.isExternalLink(link) ? createExternalLink(w.output,link) : createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2513 |
addClass(e,"imageLink"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2514 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2515 |
var img = createTiddlyElement(e,"img"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2516 |
if(lookaheadMatch[1]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2517 |
img.align = "left"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2518 |
else if(lookaheadMatch[2]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2519 |
img.align = "right"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2520 |
if(lookaheadMatch[3]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2521 |
img.title = lookaheadMatch[3]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2522 |
img.setAttribute("alt",lookaheadMatch[3]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2523 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2524 |
img.src = lookaheadMatch[4]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2525 |
w.nextMatch = this.lookaheadRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2526 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2527 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2528 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2529 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2530 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2531 |
name: "html", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2532 |
match: "<[Hh][Tt][Mm][Ll]>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2533 |
lookaheadRegExp: /<[Hh][Tt][Mm][Ll]>((?:.|\n)*?)<\/[Hh][Tt][Mm][Ll]>/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2534 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2535 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2536 |
this.lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2537 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2538 |
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2539 |
createTiddlyElement(w.output,"span").innerHTML = lookaheadMatch[1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2540 |
w.nextMatch = this.lookaheadRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2541 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2542 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2543 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2544 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2545 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2546 |
name: "commentByBlock", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2547 |
match: "/%", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2548 |
lookaheadRegExp: /\/%((?:.|\n)*?)%\//mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2549 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2550 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2551 |
this.lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2552 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2553 |
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2554 |
w.nextMatch = this.lookaheadRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2555 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2556 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2557 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2558 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2559 |
name: "characterFormat", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2560 |
match: "''|//|__|\\^\\^|~~|--(?!\\s|$)|\\{\\{\\{", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2561 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2562 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2563 |
switch(w.matchText) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2564 |
case "''": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2565 |
w.subWikifyTerm(w.output.appendChild(document.createElement("strong")),/('')/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2566 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2567 |
case "//": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2568 |
w.subWikifyTerm(createTiddlyElement(w.output,"em"),/(\/\/)/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2569 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2570 |
case "__": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2571 |
w.subWikifyTerm(createTiddlyElement(w.output,"u"),/(__)/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2572 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2573 |
case "^^": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2574 |
w.subWikifyTerm(createTiddlyElement(w.output,"sup"),/(\^\^)/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2575 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2576 |
case "~~": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2577 |
w.subWikifyTerm(createTiddlyElement(w.output,"sub"),/(~~)/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2578 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2579 |
case "--": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2580 |
w.subWikifyTerm(createTiddlyElement(w.output,"strike"),/(--)/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2581 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2582 |
case "{{{": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2583 |
var lookaheadRegExp = /\{\{\{((?:.|\n)*?)\}\}\}/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2584 |
lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2585 |
var lookaheadMatch = lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2586 |
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2587 |
createTiddlyElement(w.output,"code",null,null,lookaheadMatch[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2588 |
w.nextMatch = lookaheadRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2589 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2590 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2591 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2592 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2593 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2594 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2595 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2596 |
name: "customFormat", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2597 |
match: "@@|\\{\\{", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2598 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2599 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2600 |
switch(w.matchText) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2601 |
case "@@": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2602 |
var e = createTiddlyElement(w.output,"span"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2603 |
var styles = config.formatterHelpers.inlineCssHelper(w); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2604 |
if(styles.length == 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2605 |
e.className = "marked"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2606 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2607 |
config.formatterHelpers.applyCssHelper(e,styles); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2608 |
w.subWikifyTerm(e,/(@@)/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2609 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2610 |
case "{{": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2611 |
lookaheadRegExp = /\{\{[\s]*([\w]+[\s\w]*)[\s]*\{(\n?)/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2612 |
lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2613 |
lookaheadMatch = lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2614 |
if(lookaheadMatch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2615 |
w.nextMatch = lookaheadRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2616 |
e = createTiddlyElement(w.output,lookaheadMatch[2] == "\n" ? "div" : "span",null,lookaheadMatch[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2617 |
w.subWikifyTerm(e,/(\}\}\})/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2618 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2619 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2620 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2621 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2622 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2623 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2624 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2625 |
name: "mdash", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2626 |
match: "--", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2627 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2628 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2629 |
createTiddlyElement(w.output,"span").innerHTML = "—"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2630 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2631 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2632 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2633 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2634 |
name: "lineBreak", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2635 |
match: "\\n|<br ?/?>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2636 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2637 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2638 |
createTiddlyElement(w.output,"br"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2639 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2640 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2641 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2642 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2643 |
name: "rawText", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2644 |
match: "\\\"{3}|<nowiki>", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2645 |
lookaheadRegExp: /(?:\"{3}|<nowiki>)((?:.|\n)*?)(?:\"{3}|<\/nowiki>)/mg, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2646 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2647 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2648 |
this.lookaheadRegExp.lastIndex = w.matchStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2649 |
var lookaheadMatch = this.lookaheadRegExp.exec(w.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2650 |
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2651 |
createTiddlyElement(w.output,"span",null,null,lookaheadMatch[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2652 |
w.nextMatch = this.lookaheadRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2653 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2654 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2655 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2656 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2657 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2658 |
name: "htmlEntitiesEncoding", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2659 |
match: "(?:(?:&#?[a-zA-Z0-9]{2,8};|.)(?:&#?(?:x0*(?:3[0-6][0-9a-fA-F]|1D[c-fC-F][0-9a-fA-F]|20[d-fD-F][0-9a-fA-F]|FE2[0-9a-fA-F])|0*(?:76[89]|7[7-9][0-9]|8[0-7][0-9]|761[6-9]|76[2-7][0-9]|84[0-3][0-9]|844[0-7]|6505[6-9]|6506[0-9]|6507[0-1]));)+|&#?[a-zA-Z0-9]{2,8};)", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2660 |
handler: function(w) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2661 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2662 |
createTiddlyElement(w.output,"span").innerHTML = w.matchText; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2663 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2664 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2665 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2666 |
]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2667 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2668 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2669 |
//-- Wikifier |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2670 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2671 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2672 |
function getParser(tiddler,format) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2673 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2674 |
if(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2675 |
if(!format) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2676 |
format = tiddler.fields["wikiformat"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2677 |
var i; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2678 |
if(format) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2679 |
for(i in config.parsers) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2680 |
if(format == config.parsers[i].format) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2681 |
return config.parsers[i]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2682 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2683 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2684 |
for(i in config.parsers) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2685 |
if(tiddler.isTagged(config.parsers[i].formatTag)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2686 |
return config.parsers[i]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2687 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2688 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2689 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2690 |
return formatter; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2691 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2692 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2693 |
function wikify(source,output,highlightRegExp,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2694 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2695 |
if(source && source != "") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2696 |
var wikifier = new Wikifier(source,getParser(tiddler),highlightRegExp,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2697 |
wikifier.subWikify(output); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2698 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2699 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2700 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2701 |
function wikifyStatic(source,highlightRegExp,tiddler,format) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2702 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2703 |
var e = createTiddlyElement(document.body,"pre"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2704 |
e.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2705 |
var html = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2706 |
if(source && source != "") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2707 |
if(!tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2708 |
tiddler = new Tiddler("temp"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2709 |
var wikifier = new Wikifier(source,getParser(tiddler,format),highlightRegExp,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2710 |
wikifier.isStatic = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2711 |
wikifier.subWikify(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2712 |
html = e.innerHTML; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2713 |
removeNode(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2714 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2715 |
return html; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2716 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2717 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2718 |
function wikifyPlain(title,theStore,limit) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2719 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2720 |
if(!theStore) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2721 |
theStore = store; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2722 |
if(theStore.tiddlerExists(title) || theStore.isShadowTiddler(title)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2723 |
return wikifyPlainText(theStore.getTiddlerText(title),limit,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2724 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2725 |
return ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2726 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2727 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2728 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2729 |
function wikifyPlainText(text,limit,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2730 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2731 |
if(limit > 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2732 |
text = text.substr(0,limit); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2733 |
var wikifier = new Wikifier(text,formatter,null,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2734 |
return wikifier.wikifyPlain(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2735 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2736 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2737 |
function highlightify(source,output,highlightRegExp,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2738 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2739 |
if(source && source != "") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2740 |
var wikifier = new Wikifier(source,formatter,highlightRegExp,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2741 |
wikifier.outputText(output,0,source.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2742 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2743 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2744 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2745 |
function Wikifier(source,formatter,highlightRegExp,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2746 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2747 |
this.source = source; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2748 |
this.output = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2749 |
this.formatter = formatter; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2750 |
this.nextMatch = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2751 |
this.autoLinkWikiWords = tiddler && tiddler.autoLinkWikiWords() == false ? false : true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2752 |
this.highlightRegExp = highlightRegExp; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2753 |
this.highlightMatch = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2754 |
this.isStatic = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2755 |
if(highlightRegExp) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2756 |
highlightRegExp.lastIndex = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2757 |
this.highlightMatch = highlightRegExp.exec(source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2758 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2759 |
this.tiddler = tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2760 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2761 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2762 |
Wikifier.prototype.wikifyPlain = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2763 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2764 |
var e = createTiddlyElement(document.body,"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2765 |
e.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2766 |
this.subWikify(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2767 |
var text = getPlainText(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2768 |
removeNode(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2769 |
return text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2770 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2771 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2772 |
Wikifier.prototype.subWikify = function(output,terminator) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2773 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2774 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2775 |
if(terminator) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2776 |
this.subWikifyTerm(output,new RegExp("(" + terminator + ")","mg")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2777 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2778 |
this.subWikifyUnterm(output); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2779 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2780 |
showException(ex); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2781 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2782 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2783 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2784 |
Wikifier.prototype.subWikifyUnterm = function(output) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2785 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2786 |
var oldOutput = this.output; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2787 |
this.output = output; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2788 |
this.formatter.formatterRegExp.lastIndex = this.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2789 |
var formatterMatch = this.formatter.formatterRegExp.exec(this.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2790 |
while(formatterMatch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2791 |
// Output any text before the match |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2792 |
if(formatterMatch.index > this.nextMatch) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2793 |
this.outputText(this.output,this.nextMatch,formatterMatch.index); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2794 |
// Set the match parameters for the handler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2795 |
this.matchStart = formatterMatch.index; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2796 |
this.matchLength = formatterMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2797 |
this.matchText = formatterMatch[0]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2798 |
this.nextMatch = this.formatter.formatterRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2799 |
for(var t=1; t<formatterMatch.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2800 |
if(formatterMatch[t]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2801 |
this.formatter.formatters[t-1].handler(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2802 |
this.formatter.formatterRegExp.lastIndex = this.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2803 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2804 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2805 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2806 |
formatterMatch = this.formatter.formatterRegExp.exec(this.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2807 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2808 |
if(this.nextMatch < this.source.length) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2809 |
this.outputText(this.output,this.nextMatch,this.source.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2810 |
this.nextMatch = this.source.length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2811 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2812 |
this.output = oldOutput; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2813 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2814 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2815 |
Wikifier.prototype.subWikifyTerm = function(output,terminatorRegExp) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2816 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2817 |
var oldOutput = this.output; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2818 |
this.output = output; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2819 |
terminatorRegExp.lastIndex = this.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2820 |
var terminatorMatch = terminatorRegExp.exec(this.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2821 |
this.formatter.formatterRegExp.lastIndex = this.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2822 |
var formatterMatch = this.formatter.formatterRegExp.exec(terminatorMatch ? this.source.substr(0,terminatorMatch.index) : this.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2823 |
while(terminatorMatch || formatterMatch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2824 |
if(terminatorMatch && (!formatterMatch || terminatorMatch.index <= formatterMatch.index)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2825 |
if(terminatorMatch.index > this.nextMatch) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2826 |
this.outputText(this.output,this.nextMatch,terminatorMatch.index); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2827 |
this.matchText = terminatorMatch[1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2828 |
this.matchLength = terminatorMatch[1].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2829 |
this.matchStart = terminatorMatch.index; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2830 |
this.nextMatch = this.matchStart + this.matchLength; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2831 |
this.output = oldOutput; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2832 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2833 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2834 |
if(formatterMatch.index > this.nextMatch) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2835 |
this.outputText(this.output,this.nextMatch,formatterMatch.index); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2836 |
this.matchStart = formatterMatch.index; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2837 |
this.matchLength = formatterMatch[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2838 |
this.matchText = formatterMatch[0]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2839 |
this.nextMatch = this.formatter.formatterRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2840 |
for(var t=1; t<formatterMatch.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2841 |
if(formatterMatch[t]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2842 |
this.formatter.formatters[t-1].handler(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2843 |
this.formatter.formatterRegExp.lastIndex = this.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2844 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2845 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2846 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2847 |
terminatorRegExp.lastIndex = this.nextMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2848 |
terminatorMatch = terminatorRegExp.exec(this.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2849 |
formatterMatch = this.formatter.formatterRegExp.exec(terminatorMatch ? this.source.substr(0,terminatorMatch.index) : this.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2850 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2851 |
if(this.nextMatch < this.source.length) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2852 |
this.outputText(this.output,this.nextMatch,this.source.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2853 |
this.nextMatch = this.source.length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2854 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2855 |
this.output = oldOutput; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2856 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2857 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2858 |
Wikifier.prototype.outputText = function(place,startPos,endPos) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2859 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2860 |
while(this.highlightMatch && (this.highlightRegExp.lastIndex > startPos) && (this.highlightMatch.index < endPos) && (startPos < endPos)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2861 |
if(this.highlightMatch.index > startPos) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2862 |
createTiddlyText(place,this.source.substring(startPos,this.highlightMatch.index)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2863 |
startPos = this.highlightMatch.index; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2864 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2865 |
var highlightEnd = Math.min(this.highlightRegExp.lastIndex,endPos); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2866 |
var theHighlight = createTiddlyElement(place,"span",null,"highlight",this.source.substring(startPos,highlightEnd)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2867 |
startPos = highlightEnd; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2868 |
if(startPos >= this.highlightRegExp.lastIndex) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2869 |
this.highlightMatch = this.highlightRegExp.exec(this.source); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2870 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2871 |
if(startPos < endPos) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2872 |
createTiddlyText(place,this.source.substring(startPos,endPos)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2873 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2874 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2875 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2876 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2877 |
//-- Macro definitions |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2878 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2879 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2880 |
config.macros.today.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2881 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2882 |
var now = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2883 |
var text = params[0] ? now.formatString(params[0].trim()) : now.toLocaleString(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2884 |
createTiddlyElement(place,"span",null,null,text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2885 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2886 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2887 |
config.macros.version.handler = function(place) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2888 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2889 |
createTiddlyElement(place,"span",null,null,formatVersion()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2890 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2891 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2892 |
config.macros.list.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2893 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2894 |
var type = params[0] ? params[0] : "all"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2895 |
var list = document.createElement("ul"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2896 |
place.appendChild(list); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2897 |
if(this[type].prompt) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2898 |
createTiddlyElement(list,"li",null,"listTitle",this[type].prompt); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2899 |
var results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2900 |
if(this[type].handler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2901 |
results = this[type].handler(params); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2902 |
for(var t = 0; t < results.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2903 |
var li = document.createElement("li"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2904 |
list.appendChild(li); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2905 |
createTiddlyLink(li,typeof results[t] == "string" ? results[t] : results[t].title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2906 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2907 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2908 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2909 |
config.macros.list.all.handler = function(params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2910 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2911 |
return store.reverseLookup("tags","excludeLists",false,"title"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2912 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2913 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2914 |
config.macros.list.missing.handler = function(params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2915 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2916 |
return store.getMissingLinks(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2917 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2918 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2919 |
config.macros.list.orphans.handler = function(params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2920 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2921 |
return store.getOrphans(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2922 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2923 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2924 |
config.macros.list.shadowed.handler = function(params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2925 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2926 |
return store.getShadowed(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2927 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2928 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2929 |
config.macros.list.touched.handler = function(params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2930 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2931 |
return store.getTouched(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2932 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2933 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2934 |
config.macros.list.filter.handler = function(params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2935 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2936 |
var filter = params[1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2937 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2938 |
if(filter) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2939 |
var tiddlers = store.filterTiddlers(filter); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2940 |
for(var t=0; t<tiddlers.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2941 |
results.push(tiddlers[t].title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2942 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2943 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2944 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2945 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2946 |
config.macros.allTags.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2947 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2948 |
var tags = store.getTags(params[0]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2949 |
var ul = createTiddlyElement(place,"ul"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2950 |
if(tags.length == 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2951 |
createTiddlyElement(ul,"li",null,"listTitle",this.noTags); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2952 |
for(var t=0; t<tags.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2953 |
var title = tags[t][0]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2954 |
var info = getTiddlyLinkInfo(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2955 |
var li = createTiddlyElement(ul,"li"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2956 |
var btn = createTiddlyButton(li,title + " (" + tags[t][1] + ")",this.tooltip.format([title]),onClickTag,info.classes); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2957 |
btn.setAttribute("tag",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2958 |
btn.setAttribute("refresh","link"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2959 |
btn.setAttribute("tiddlyLink",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2960 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2961 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2962 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2963 |
config.macros.timeline.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2964 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2965 |
var field = params[0] ? params[0] : "modified"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2966 |
var tiddlers = store.reverseLookup("tags","excludeLists",false,field); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2967 |
var lastDay = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2968 |
var last = params[1] ? tiddlers.length-Math.min(tiddlers.length,parseInt(params[1])) : 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2969 |
var dateFormat = params[2] ? params[2] : this.dateFormat; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2970 |
for(var t=tiddlers.length-1; t>=last; t--) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2971 |
var tiddler = tiddlers[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2972 |
var theDay = tiddler[field].convertToLocalYYYYMMDDHHMM().substr(0,8); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2973 |
if(theDay != lastDay) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2974 |
var ul = document.createElement("ul"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2975 |
place.appendChild(ul); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2976 |
createTiddlyElement(ul,"li",null,"listTitle",tiddler[field].formatString(dateFormat)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2977 |
lastDay = theDay; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2978 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2979 |
createTiddlyElement(ul,"li",null,"listLink").appendChild(createTiddlyLink(place,tiddler.title,true)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2980 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2981 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2982 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2983 |
config.macros.tiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2984 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2985 |
params = paramString.parseParams("name",null,true,false,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2986 |
var names = params[0]["name"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2987 |
var tiddlerName = names[0]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2988 |
var className = names[1] ? names[1] : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2989 |
var args = params[0]["with"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2990 |
var wrapper = createTiddlyElement(place,"span",null,className); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2991 |
if(!args) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2992 |
wrapper.setAttribute("refresh","content"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2993 |
wrapper.setAttribute("tiddler",tiddlerName); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2994 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2995 |
var text = store.getTiddlerText(tiddlerName); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2996 |
if(text) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2997 |
var stack = config.macros.tiddler.tiddlerStack; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2998 |
if(stack.indexOf(tiddlerName) !== -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2999 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3000 |
stack.push(tiddlerName); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3001 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3002 |
var n = args ? Math.min(args.length,9) : 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3003 |
for(var i=0; i<n; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3004 |
var placeholderRE = new RegExp("\\$" + (i + 1),"mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3005 |
text = text.replace(placeholderRE,args[i]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3006 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3007 |
config.macros.tiddler.renderText(wrapper,text,tiddlerName,params); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3008 |
} finally { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3009 |
stack.pop(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3010 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3011 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3012 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3013 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3014 |
config.macros.tiddler.renderText = function(place,text,tiddlerName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3015 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3016 |
wikify(text,place,null,store.getTiddler(tiddlerName)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3017 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3018 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3019 |
config.macros.tiddler.tiddlerStack = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3020 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3021 |
config.macros.tag.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3022 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3023 |
createTagButton(place,params[0],null,params[1],params[2]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3024 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3025 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3026 |
config.macros.tags.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3027 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3028 |
params = paramString.parseParams("anon",null,true,false,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3029 |
var ul = createTiddlyElement(place,"ul"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3030 |
var title = getParam(params,"anon",""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3031 |
if(title && store.tiddlerExists(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3032 |
tiddler = store.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3033 |
var sep = getParam(params,"sep"," "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3034 |
var lingo = config.views.wikified.tag; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3035 |
var prompt = tiddler.tags.length == 0 ? lingo.labelNoTags : lingo.labelTags; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3036 |
createTiddlyElement(ul,"li",null,"listTitle",prompt.format([tiddler.title])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3037 |
for(var t=0; t<tiddler.tags.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3038 |
createTagButton(createTiddlyElement(ul,"li"),tiddler.tags[t],tiddler.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3039 |
if(t<tiddler.tags.length-1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3040 |
createTiddlyText(ul,sep); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3041 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3042 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3043 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3044 |
config.macros.tagging.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3045 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3046 |
params = paramString.parseParams("anon",null,true,false,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3047 |
var ul = createTiddlyElement(place,"ul"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3048 |
var title = getParam(params,"anon",""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3049 |
if(title == "" && tiddler instanceof Tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3050 |
title = tiddler.title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3051 |
var sep = getParam(params,"sep"," "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3052 |
ul.setAttribute("title",this.tooltip.format([title])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3053 |
var tagged = store.getTaggedTiddlers(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3054 |
var prompt = tagged.length == 0 ? this.labelNotTag : this.label; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3055 |
createTiddlyElement(ul,"li",null,"listTitle",prompt.format([title,tagged.length])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3056 |
for(var t=0; t<tagged.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3057 |
createTiddlyLink(createTiddlyElement(ul,"li"),tagged[t].title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3058 |
if(t<tagged.length-1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3059 |
createTiddlyText(ul,sep); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3060 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3061 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3062 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3063 |
config.macros.closeAll.handler = function(place) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3064 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3065 |
createTiddlyButton(place,this.label,this.prompt,this.onClick); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3066 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3067 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3068 |
config.macros.closeAll.onClick = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3069 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3070 |
story.closeAllTiddlers(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3071 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3072 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3073 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3074 |
config.macros.permaview.handler = function(place) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3075 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3076 |
createTiddlyButton(place,this.label,this.prompt,this.onClick); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3077 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3078 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3079 |
config.macros.permaview.onClick = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3080 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3081 |
story.permaView(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3082 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3083 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3084 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3085 |
config.macros.saveChanges.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3086 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3087 |
if(!readOnly) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3088 |
createTiddlyButton(place,params[0] || this.label,params[1] || this.prompt,this.onClick,null,null,this.accessKey); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3089 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3090 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3091 |
config.macros.saveChanges.onClick = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3092 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3093 |
saveChanges(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3094 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3095 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3096 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3097 |
config.macros.slider.onClickSlider = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3098 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3099 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3100 |
var n = this.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3101 |
var cookie = n.getAttribute("cookie"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3102 |
var isOpen = n.style.display != "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3103 |
if(config.options.chkAnimate && anim && typeof Slider == "function") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3104 |
anim.startAnimating(new Slider(n,!isOpen,null,"none")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3105 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3106 |
n.style.display = isOpen ? "none" : "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3107 |
config.options[cookie] = !isOpen; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3108 |
saveOptionCookie(cookie); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3109 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3110 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3111 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3112 |
config.macros.slider.createSlider = function(place,cookie,title,tooltip) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3113 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3114 |
var c = cookie ? cookie : ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3115 |
var btn = createTiddlyButton(place,title,tooltip,this.onClickSlider); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3116 |
var panel = createTiddlyElement(null,"div",null,"sliderPanel"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3117 |
panel.setAttribute("cookie",c); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3118 |
panel.style.display = config.options[c] ? "block" : "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3119 |
place.appendChild(panel); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3120 |
return panel; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3121 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3122 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3123 |
config.macros.slider.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3124 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3125 |
var panel = this.createSlider(place,params[0],params[2],params[3]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3126 |
var text = store.getTiddlerText(params[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3127 |
panel.setAttribute("refresh","content"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3128 |
panel.setAttribute("tiddler",params[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3129 |
if(text) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3130 |
wikify(text,panel,null,store.getTiddler(params[1])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3131 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3132 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3133 |
// <<gradient [[tiddler name]] vert|horiz rgb rgb rgb rgb... >> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3134 |
config.macros.gradient.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3135 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3136 |
var panel = wikifier ? createTiddlyElement(place,"div",null,"gradient") : place; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3137 |
panel.style.position = "relative"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3138 |
panel.style.overflow = "hidden"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3139 |
panel.style.zIndex = "0"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3140 |
if(wikifier) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3141 |
var styles = config.formatterHelpers.inlineCssHelper(wikifier); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3142 |
config.formatterHelpers.applyCssHelper(panel,styles); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3143 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3144 |
params = paramString.parseParams("color"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3145 |
var locolors = [], hicolors = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3146 |
for(var t=2; t<params.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3147 |
var c = new RGB(params[t].value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3148 |
if(params[t].name == "snap") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3149 |
hicolors[hicolors.length-1] = c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3150 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3151 |
locolors.push(c); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3152 |
hicolors.push(c); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3153 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3154 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3155 |
drawGradient(panel,params[1].value != "vert",locolors,hicolors); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3156 |
if(wikifier) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3157 |
wikifier.subWikify(panel,">>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3158 |
if(document.all) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3159 |
panel.style.height = "100%"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3160 |
panel.style.width = "100%"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3161 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3162 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3163 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3164 |
config.macros.message.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3165 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3166 |
if(params[0]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3167 |
var names = params[0].split("."); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3168 |
var lookupMessage = function(root,nameIndex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3169 |
if(names[nameIndex] in root) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3170 |
if(nameIndex < names.length-1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3171 |
return (lookupMessage(root[names[nameIndex]],nameIndex+1)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3172 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3173 |
return root[names[nameIndex]]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3174 |
} else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3175 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3176 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3177 |
var m = lookupMessage(config,0); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3178 |
if(m == null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3179 |
m = lookupMessage(window,0); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3180 |
createTiddlyText(place,m.toString().format(params.splice(1))); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3181 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3182 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3183 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3184 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3185 |
config.macros.view.views = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3186 |
text: function(value,place,params,wikifier,paramString,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3187 |
highlightify(value,place,highlightHack,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3188 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3189 |
link: function(value,place,params,wikifier,paramString,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3190 |
createTiddlyLink(place,value,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3191 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3192 |
wikified: function(value,place,params,wikifier,paramString,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3193 |
if(params[2]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3194 |
value=params[2].unescapeLineBreaks().format([value]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3195 |
wikify(value,place,highlightHack,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3196 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3197 |
date: function(value,place,params,wikifier,paramString,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3198 |
value = Date.convertFromYYYYMMDDHHMM(value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3199 |
createTiddlyText(place,value.formatString(params[2] ? params[2] : config.views.wikified.dateFormat)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3200 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3201 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3202 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3203 |
config.macros.view.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3204 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3205 |
if((tiddler instanceof Tiddler) && params[0]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3206 |
var value = store.getValue(tiddler,params[0]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3207 |
if(value) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3208 |
var type = params[1] ? params[1] : config.macros.view.defaultView; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3209 |
var handler = config.macros.view.views[type]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3210 |
if(handler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3211 |
handler(value,place,params,wikifier,paramString,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3212 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3213 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3214 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3215 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3216 |
config.macros.edit.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3217 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3218 |
var field = params[0]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3219 |
var rows = params[1] || 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3220 |
var defVal = params[2] || ''; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3221 |
if((tiddler instanceof Tiddler) && field) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3222 |
story.setDirty(tiddler.title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3223 |
var e,v; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3224 |
if(field != "text" && !rows) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3225 |
e = createTiddlyElement(null,"input"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3226 |
if(tiddler.isReadOnly()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3227 |
e.setAttribute("readOnly","readOnly"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3228 |
e.setAttribute("edit",field); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3229 |
e.setAttribute("type","text"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3230 |
e.value = store.getValue(tiddler,field) || defVal; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3231 |
e.setAttribute("size","40"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3232 |
e.setAttribute("autocomplete","off"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3233 |
place.appendChild(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3234 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3235 |
var wrapper1 = createTiddlyElement(null,"fieldset",null,"fieldsetFix"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3236 |
var wrapper2 = createTiddlyElement(wrapper1,"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3237 |
e = createTiddlyElement(wrapper2,"textarea"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3238 |
if(tiddler.isReadOnly()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3239 |
e.setAttribute("readOnly","readOnly"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3240 |
e.value = v = store.getValue(tiddler,field) || defVal; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3241 |
rows = rows ? rows : 10; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3242 |
var lines = v.match(/\n/mg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3243 |
var maxLines = Math.max(parseInt(config.options.txtMaxEditRows),5); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3244 |
if(lines != null && lines.length > rows) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3245 |
rows = lines.length + 5; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3246 |
rows = Math.min(rows,maxLines); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3247 |
e.setAttribute("rows",rows); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3248 |
e.setAttribute("edit",field); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3249 |
place.appendChild(wrapper1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3250 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3251 |
return e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3252 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3253 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3254 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3255 |
config.macros.tagChooser.onClick = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3256 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3257 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3258 |
if(e.metaKey || e.ctrlKey) stopEvent(e); //# keep popup open on CTRL-click |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3259 |
var lingo = config.views.editor.tagChooser; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3260 |
var popup = Popup.create(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3261 |
var tags = store.getTags(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3262 |
if(tags.length == 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3263 |
createTiddlyText(createTiddlyElement(popup,"li"),lingo.popupNone); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3264 |
for(var t=0; t<tags.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3265 |
var tag = createTiddlyButton(createTiddlyElement(popup,"li"),tags[t][0],lingo.tagTooltip.format([tags[t][0]]),config.macros.tagChooser.onTagClick); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3266 |
tag.setAttribute("tag",tags[t][0]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3267 |
tag.setAttribute("tiddler",this.getAttribute("tiddler")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3268 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3269 |
Popup.show(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3270 |
e.cancelBubble = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3271 |
if(e.stopPropagation) e.stopPropagation(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3272 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3273 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3274 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3275 |
config.macros.tagChooser.onTagClick = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3276 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3277 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3278 |
var tag = this.getAttribute("tag"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3279 |
var title = this.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3280 |
if(!readOnly) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3281 |
story.setTiddlerTag(title,tag,0); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3282 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3283 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3284 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3285 |
config.macros.tagChooser.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3286 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3287 |
if(tiddler instanceof Tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3288 |
var lingo = config.views.editor.tagChooser; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3289 |
var btn = createTiddlyButton(place,lingo.text,lingo.tooltip,this.onClick); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3290 |
btn.setAttribute("tiddler",tiddler.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3291 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3292 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3293 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3294 |
config.macros.refreshDisplay.handler = function(place) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3295 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3296 |
createTiddlyButton(place,this.label,this.prompt,this.onClick); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3297 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3298 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3299 |
config.macros.refreshDisplay.onClick = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3300 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3301 |
refreshAll(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3302 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3303 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3304 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3305 |
config.macros.annotations.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3306 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3307 |
var title = tiddler ? tiddler.title : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3308 |
var a = title ? config.annotations[title] : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3309 |
if(!tiddler || !title || !a) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3310 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3311 |
var text = a.format([title]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3312 |
wikify(text,createTiddlyElement(place,"div",null,"annotation"),null,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3313 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3314 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3315 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3316 |
//-- NewTiddler and NewJournal macros |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3317 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3318 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3319 |
config.macros.newTiddler.createNewTiddlerButton = function(place,title,params,label,prompt,accessKey,newFocus,isJournal) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3320 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3321 |
var tags = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3322 |
for(var t=1; t<params.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3323 |
if((params[t].name == "anon" && t != 1) || (params[t].name == "tag")) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3324 |
tags.push(params[t].value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3325 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3326 |
label = getParam(params,"label",label); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3327 |
prompt = getParam(params,"prompt",prompt); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3328 |
accessKey = getParam(params,"accessKey",accessKey); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3329 |
newFocus = getParam(params,"focus",newFocus); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3330 |
var customFields = getParam(params,"fields",""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3331 |
if(!customFields && !store.isShadowTiddler(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3332 |
customFields = String.encodeHashMap(config.defaultCustomFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3333 |
var btn = createTiddlyButton(place,label,prompt,this.onClickNewTiddler,null,null,accessKey); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3334 |
btn.setAttribute("newTitle",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3335 |
btn.setAttribute("isJournal",isJournal ? "true" : "false"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3336 |
if(tags.length > 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3337 |
btn.setAttribute("params",tags.join("|")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3338 |
btn.setAttribute("newFocus",newFocus); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3339 |
btn.setAttribute("newTemplate",getParam(params,"template",DEFAULT_EDIT_TEMPLATE)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3340 |
if(customFields !== "") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3341 |
btn.setAttribute("customFields",customFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3342 |
var text = getParam(params,"text"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3343 |
if(text !== undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3344 |
btn.setAttribute("newText",text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3345 |
return btn; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3346 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3347 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3348 |
config.macros.newTiddler.onClickNewTiddler = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3349 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3350 |
var title = this.getAttribute("newTitle"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3351 |
if(this.getAttribute("isJournal") == "true") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3352 |
var now = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3353 |
title = now.formatString(title.trim()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3354 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3355 |
var params = this.getAttribute("params"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3356 |
var tags = params ? params.split("|") : []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3357 |
var focus = this.getAttribute("newFocus"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3358 |
var template = this.getAttribute("newTemplate"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3359 |
var customFields = this.getAttribute("customFields"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3360 |
story.displayTiddler(null,title,template,false,null,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3361 |
var tiddlerElem = story.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3362 |
if(customFields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3363 |
story.addCustomFields(tiddlerElem,customFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3364 |
var text = this.getAttribute("newText"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3365 |
if(typeof text == "string") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3366 |
story.getTiddlerField(title,"text").value = text.format([title]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3367 |
for(var t=0;t<tags.length;t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3368 |
story.setTiddlerTag(title,tags[t],+1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3369 |
story.focusTiddler(title,focus); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3370 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3371 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3372 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3373 |
config.macros.newTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3374 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3375 |
if(!readOnly) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3376 |
params = paramString.parseParams("anon",null,true,false,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3377 |
var title = params[1] && params[1].name == "anon" ? params[1].value : this.title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3378 |
title = getParam(params,"title",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3379 |
this.createNewTiddlerButton(place,title,params,this.label,this.prompt,this.accessKey,"title",false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3380 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3381 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3382 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3383 |
config.macros.newJournal.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3384 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3385 |
if(!readOnly) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3386 |
params = paramString.parseParams("anon",null,true,false,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3387 |
var title = params[1] && params[1].name == "anon" ? params[1].value : config.macros.timeline.dateFormat; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3388 |
title = getParam(params,"title",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3389 |
config.macros.newTiddler.createNewTiddlerButton(place,title,params,this.label,this.prompt,this.accessKey,"text",true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3390 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3391 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3392 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3393 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3394 |
//-- Search macro |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3395 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3396 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3397 |
config.macros.search.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3398 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3399 |
var searchTimeout = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3400 |
var btn = createTiddlyButton(place,this.label,this.prompt,this.onClick,"searchButton"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3401 |
var txt = createTiddlyElement(place,"input",null,"txtOptionInput searchField"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3402 |
if(params[0]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3403 |
txt.value = params[0]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3404 |
txt.onkeyup = this.onKeyPress; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3405 |
txt.onfocus = this.onFocus; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3406 |
txt.setAttribute("size",this.sizeTextbox); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3407 |
txt.setAttribute("accessKey",this.accessKey); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3408 |
txt.setAttribute("autocomplete","off"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3409 |
txt.setAttribute("lastSearchText",""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3410 |
if(config.browser.isSafari) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3411 |
txt.setAttribute("type","search"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3412 |
txt.setAttribute("results","5"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3413 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3414 |
txt.setAttribute("type","text"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3415 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3416 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3417 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3418 |
// Global because there's only ever one outstanding incremental search timer |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3419 |
config.macros.search.timeout = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3420 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3421 |
config.macros.search.doSearch = function(txt) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3422 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3423 |
if(txt.value.length > 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3424 |
story.search(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3425 |
txt.setAttribute("lastSearchText",txt.value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3426 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3427 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3428 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3429 |
config.macros.search.onClick = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3430 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3431 |
config.macros.search.doSearch(this.nextSibling); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3432 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3433 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3434 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3435 |
config.macros.search.onKeyPress = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3436 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3437 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3438 |
switch(e.keyCode) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3439 |
case 13: // Ctrl-Enter |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3440 |
case 10: // Ctrl-Enter on IE PC |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3441 |
config.macros.search.doSearch(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3442 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3443 |
case 27: // Escape |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3444 |
this.value = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3445 |
clearMessage(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3446 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3447 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3448 |
if(config.options.chkIncrementalSearch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3449 |
if(this.value.length > 2) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3450 |
if(this.value != this.getAttribute("lastSearchText")) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3451 |
if(config.macros.search.timeout) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3452 |
clearTimeout(config.macros.search.timeout); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3453 |
var txt = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3454 |
config.macros.search.timeout = setTimeout(function() {config.macros.search.doSearch(txt);},500); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3455 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3456 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3457 |
if(config.macros.search.timeout) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3458 |
clearTimeout(config.macros.search.timeout); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3459 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3460 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3461 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3462 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3463 |
config.macros.search.onFocus = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3464 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3465 |
this.select(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3466 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3467 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3468 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3469 |
//-- Tabs macro |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3470 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3471 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3472 |
config.macros.tabs.handler = function(place,macroName,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3473 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3474 |
var cookie = params[0]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3475 |
var numTabs = (params.length-1)/3; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3476 |
var wrapper = createTiddlyElement(null,"div",null,"tabsetWrapper " + cookie); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3477 |
var tabset = createTiddlyElement(wrapper,"div",null,"tabset"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3478 |
tabset.setAttribute("cookie",cookie); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3479 |
var validTab = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3480 |
for(var t=0; t<numTabs; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3481 |
var label = params[t*3+1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3482 |
var prompt = params[t*3+2]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3483 |
var content = params[t*3+3]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3484 |
var tab = createTiddlyButton(tabset,label,prompt,this.onClickTab,"tab tabUnselected"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3485 |
tab.setAttribute("tab",label); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3486 |
tab.setAttribute("content",content); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3487 |
tab.title = prompt; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3488 |
if(config.options[cookie] == label) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3489 |
validTab = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3490 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3491 |
if(!validTab) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3492 |
config.options[cookie] = params[1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3493 |
place.appendChild(wrapper); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3494 |
this.switchTab(tabset,config.options[cookie]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3495 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3496 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3497 |
config.macros.tabs.onClickTab = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3498 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3499 |
config.macros.tabs.switchTab(this.parentNode,this.getAttribute("tab")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3500 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3501 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3502 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3503 |
config.macros.tabs.switchTab = function(tabset,tab) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3504 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3505 |
var cookie = tabset.getAttribute("cookie"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3506 |
var theTab = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3507 |
var nodes = tabset.childNodes; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3508 |
for(var t=0; t<nodes.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3509 |
if(nodes[t].getAttribute && nodes[t].getAttribute("tab") == tab) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3510 |
theTab = nodes[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3511 |
theTab.className = "tab tabSelected"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3512 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3513 |
nodes[t].className = "tab tabUnselected"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3514 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3515 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3516 |
if(theTab) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3517 |
if(tabset.nextSibling && tabset.nextSibling.className == "tabContents") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3518 |
removeNode(tabset.nextSibling); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3519 |
var tabContent = createTiddlyElement(null,"div",null,"tabContents"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3520 |
tabset.parentNode.insertBefore(tabContent,tabset.nextSibling); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3521 |
var contentTitle = theTab.getAttribute("content"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3522 |
wikify(store.getTiddlerText(contentTitle),tabContent,null,store.getTiddler(contentTitle)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3523 |
if(cookie) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3524 |
config.options[cookie] = tab; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3525 |
saveOptionCookie(cookie); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3526 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3527 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3528 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3529 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3530 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3531 |
//-- Tiddler toolbar |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3532 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3533 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3534 |
// Create a toolbar command button |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3535 |
config.macros.toolbar.createCommand = function(place,commandName,tiddler,className) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3536 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3537 |
if(typeof commandName != "string") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3538 |
var c = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3539 |
for(var t in config.commands) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3540 |
if(config.commands[t] == commandName) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3541 |
c = t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3542 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3543 |
commandName = c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3544 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3545 |
if((tiddler instanceof Tiddler) && (typeof commandName == "string")) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3546 |
var command = config.commands[commandName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3547 |
if(command.isEnabled ? command.isEnabled(tiddler) : this.isCommandEnabled(command,tiddler)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3548 |
var text = command.getText ? command.getText(tiddler) : this.getCommandText(command,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3549 |
var tooltip = command.getTooltip ? command.getTooltip(tiddler) : this.getCommandTooltip(command,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3550 |
var cmd; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3551 |
switch(command.type) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3552 |
case "popup": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3553 |
cmd = this.onClickPopup; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3554 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3555 |
case "command": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3556 |
default: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3557 |
cmd = this.onClickCommand; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3558 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3559 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3560 |
var btn = createTiddlyButton(null,text,tooltip,cmd); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3561 |
btn.setAttribute("commandName",commandName); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3562 |
btn.setAttribute("tiddler",tiddler.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3563 |
if(className) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3564 |
addClass(btn,className); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3565 |
place.appendChild(btn); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3566 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3567 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3568 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3569 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3570 |
config.macros.toolbar.isCommandEnabled = function(command,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3571 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3572 |
var title = tiddler.title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3573 |
var ro = tiddler.isReadOnly(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3574 |
var shadow = store.isShadowTiddler(title) && !store.tiddlerExists(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3575 |
return (!ro || (ro && !command.hideReadOnly)) && !(shadow && command.hideShadow); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3576 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3577 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3578 |
config.macros.toolbar.getCommandText = function(command,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3579 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3580 |
return tiddler.isReadOnly() && command.readOnlyText ? command.readOnlyText : command.text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3581 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3582 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3583 |
config.macros.toolbar.getCommandTooltip = function(command,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3584 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3585 |
return tiddler.isReadOnly() && command.readOnlyTooltip ? command.readOnlyTooltip : command.tooltip; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3586 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3587 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3588 |
config.macros.toolbar.onClickCommand = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3589 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3590 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3591 |
e.cancelBubble = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3592 |
if(e.stopPropagation) e.stopPropagation(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3593 |
var command = config.commands[this.getAttribute("commandName")]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3594 |
return command.handler(e,this,this.getAttribute("tiddler")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3595 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3596 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3597 |
config.macros.toolbar.onClickPopup = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3598 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3599 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3600 |
e.cancelBubble = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3601 |
if(e.stopPropagation) e.stopPropagation(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3602 |
var popup = Popup.create(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3603 |
var command = config.commands[this.getAttribute("commandName")]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3604 |
var title = this.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3605 |
var tiddler = store.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3606 |
popup.setAttribute("tiddler",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3607 |
command.handlePopup(popup,title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3608 |
Popup.show(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3609 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3610 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3611 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3612 |
// Invoke the first command encountered from a given place that is tagged with a specified class |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3613 |
config.macros.toolbar.invokeCommand = function(place,className,event) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3614 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3615 |
var children = place.getElementsByTagName("a"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3616 |
for(var t=0; t<children.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3617 |
var c = children[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3618 |
if(hasClass(c,className) && c.getAttribute && c.getAttribute("commandName")) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3619 |
if(c.onclick instanceof Function) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3620 |
c.onclick.call(c,event); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3621 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3622 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3623 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3624 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3625 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3626 |
config.macros.toolbar.onClickMore = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3627 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3628 |
var e = this.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3629 |
e.style.display = "inline"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3630 |
removeNode(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3631 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3632 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3633 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3634 |
config.macros.toolbar.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3635 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3636 |
for(var t=0; t<params.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3637 |
var c = params[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3638 |
switch(c) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3639 |
case '>': |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3640 |
var btn = createTiddlyButton(place,this.moreLabel,this.morePrompt,config.macros.toolbar.onClickMore); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3641 |
addClass(btn,"moreCommand"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3642 |
var e = createTiddlyElement(place,"span",null,"moreCommand"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3643 |
e.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3644 |
place = e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3645 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3646 |
default: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3647 |
var className = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3648 |
switch(c.substr(0,1)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3649 |
case "+": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3650 |
className = "defaultCommand"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3651 |
c = c.substr(1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3652 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3653 |
case "-": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3654 |
className = "cancelCommand"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3655 |
c = c.substr(1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3656 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3657 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3658 |
if(c in config.commands) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3659 |
this.createCommand(place,c,tiddler,className); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3660 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3661 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3662 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3663 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3664 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3665 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3666 |
//-- Menu and toolbar commands |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3667 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3668 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3669 |
config.commands.closeTiddler.handler = function(event,src,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3670 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3671 |
if(story.isDirty(title) && !readOnly) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3672 |
if(!confirm(config.commands.cancelTiddler.warning.format([title]))) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3673 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3674 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3675 |
story.setDirty(title,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3676 |
story.closeTiddler(title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3677 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3678 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3679 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3680 |
config.commands.closeOthers.handler = function(event,src,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3681 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3682 |
story.closeAllTiddlers(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3683 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3684 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3685 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3686 |
config.commands.editTiddler.handler = function(event,src,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3687 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3688 |
clearMessage(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3689 |
var tiddlerElem = story.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3690 |
var fields = tiddlerElem.getAttribute("tiddlyFields"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3691 |
story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE,false,null,fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3692 |
story.focusTiddler(title,config.options.txtEditorFocus||"text"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3693 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3694 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3695 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3696 |
config.commands.saveTiddler.handler = function(event,src,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3697 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3698 |
var newTitle = story.saveTiddler(title,event.shiftKey); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3699 |
if(newTitle) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3700 |
story.displayTiddler(null,newTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3701 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3702 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3703 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3704 |
config.commands.cancelTiddler.handler = function(event,src,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3705 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3706 |
if(story.hasChanges(title) && !readOnly) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3707 |
if(!confirm(this.warning.format([title]))) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3708 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3709 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3710 |
story.setDirty(title,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3711 |
story.displayTiddler(null,title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3712 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3713 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3714 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3715 |
config.commands.deleteTiddler.handler = function(event,src,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3716 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3717 |
var deleteIt = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3718 |
if(config.options.chkConfirmDelete) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3719 |
deleteIt = confirm(this.warning.format([title])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3720 |
if(deleteIt) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3721 |
store.removeTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3722 |
story.closeTiddler(title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3723 |
autoSaveChanges(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3724 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3725 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3726 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3727 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3728 |
config.commands.permalink.handler = function(event,src,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3729 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3730 |
var t = encodeURIComponent(String.encodeTiddlyLink(title)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3731 |
if(window.location.hash != t) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3732 |
window.location.hash = t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3733 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3734 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3735 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3736 |
config.commands.references.handlePopup = function(popup,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3737 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3738 |
var references = store.getReferringTiddlers(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3739 |
var c = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3740 |
for(var r=0; r<references.length; r++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3741 |
if(references[r].title != title && !references[r].isTagged("excludeLists")) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3742 |
createTiddlyLink(createTiddlyElement(popup,"li"),references[r].title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3743 |
c = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3744 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3745 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3746 |
if(!c) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3747 |
createTiddlyText(createTiddlyElement(popup,"li",null,"disabled"),this.popupNone); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3748 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3749 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3750 |
config.commands.jump.handlePopup = function(popup,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3751 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3752 |
story.forEachTiddler(function(title,element) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3753 |
createTiddlyLink(createTiddlyElement(popup,"li"),title,true,null,false,null,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3754 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3755 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3756 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3757 |
config.commands.syncing.handlePopup = function(popup,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3758 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3759 |
var tiddler = store.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3760 |
if(!tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3761 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3762 |
var serverType = tiddler.getServerType(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3763 |
var serverHost = tiddler.fields['server.host']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3764 |
var serverWorkspace = tiddler.fields['server.workspace']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3765 |
if(!serverWorkspace) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3766 |
serverWorkspace = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3767 |
if(serverType) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3768 |
var e = createTiddlyElement(popup,"li",null,"popupMessage"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3769 |
e.innerHTML = config.commands.syncing.currentlySyncing.format([serverType,serverHost,serverWorkspace]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3770 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3771 |
createTiddlyElement(popup,"li",null,"popupMessage",config.commands.syncing.notCurrentlySyncing); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3772 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3773 |
if(serverType) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3774 |
createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3775 |
var btn = createTiddlyButton(createTiddlyElement(popup,"li"),this.captionUnSync,null,config.commands.syncing.onChooseServer); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3776 |
btn.setAttribute("tiddler",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3777 |
btn.setAttribute("server.type",""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3778 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3779 |
createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3780 |
createTiddlyElement(popup,"li",null,"popupMessage",config.commands.syncing.chooseServer); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3781 |
var feeds = store.getTaggedTiddlers("systemServer","title"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3782 |
for(var t=0; t<feeds.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3783 |
var f = feeds[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3784 |
var feedServerType = store.getTiddlerSlice(f.title,"Type"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3785 |
if(!feedServerType) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3786 |
feedServerType = "file"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3787 |
var feedServerHost = store.getTiddlerSlice(f.title,"URL"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3788 |
if(!feedServerHost) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3789 |
feedServerHost = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3790 |
var feedServerWorkspace = store.getTiddlerSlice(f.title,"Workspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3791 |
if(!feedServerWorkspace) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3792 |
feedServerWorkspace = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3793 |
var caption = f.title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3794 |
if(serverType == feedServerType && serverHost == feedServerHost && serverWorkspace == feedServerWorkspace) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3795 |
caption = config.commands.syncing.currServerMarker + caption; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3796 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3797 |
caption = config.commands.syncing.notCurrServerMarker + caption; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3798 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3799 |
btn = createTiddlyButton(createTiddlyElement(popup,"li"),caption,null,config.commands.syncing.onChooseServer); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3800 |
btn.setAttribute("tiddler",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3801 |
btn.setAttribute("server.type",feedServerType); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3802 |
btn.setAttribute("server.host",feedServerHost); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3803 |
btn.setAttribute("server.workspace",feedServerWorkspace); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3804 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3805 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3806 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3807 |
config.commands.syncing.onChooseServer = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3808 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3809 |
var tiddler = this.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3810 |
var serverType = this.getAttribute("server.type"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3811 |
if(serverType) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3812 |
store.addTiddlerFields(tiddler,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3813 |
'server.type': serverType, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3814 |
'server.host': this.getAttribute("server.host"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3815 |
'server.workspace': this.getAttribute("server.workspace") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3816 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3817 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3818 |
store.setValue(tiddler,'server',null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3819 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3820 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3821 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3822 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3823 |
config.commands.fields.handlePopup = function(popup,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3824 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3825 |
var tiddler = store.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3826 |
if(!tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3827 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3828 |
var fields = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3829 |
store.forEachField(tiddler,function(tiddler,fieldName,value) {fields[fieldName] = value;},true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3830 |
var items = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3831 |
for(var t in fields) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3832 |
items.push({field: t,value: fields[t]}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3833 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3834 |
items.sort(function(a,b) {return a.field < b.field ? -1 : (a.field == b.field ? 0 : +1);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3835 |
if(items.length > 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3836 |
ListView.create(popup,items,this.listViewTemplate); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3837 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3838 |
createTiddlyElement(popup,"div",null,null,this.emptyText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3839 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3840 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3841 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3842 |
//-- Tiddler() object |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3843 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3844 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3845 |
function Tiddler(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3846 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3847 |
this.title = title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3848 |
this.text = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3849 |
this.modifier = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3850 |
this.created = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3851 |
this.modified = this.created; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3852 |
this.links = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3853 |
this.linksUpdated = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3854 |
this.tags = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3855 |
this.fields = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3856 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3857 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3858 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3859 |
Tiddler.prototype.getLinks = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3860 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3861 |
if(this.linksUpdated==false) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3862 |
this.changed(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3863 |
return this.links; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3864 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3865 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3866 |
// Returns the fields that are inherited in string field:"value" field2:"value2" format |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3867 |
Tiddler.prototype.getInheritedFields = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3868 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3869 |
var f = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3870 |
for(i in this.fields) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3871 |
if(i=="server.host" || i=="server.workspace" || i=="wikiformat"|| i=="server.type") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3872 |
f[i] = this.fields[i]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3873 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3874 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3875 |
return String.encodeHashMap(f); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3876 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3877 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3878 |
// Increment the changeCount of a tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3879 |
Tiddler.prototype.incChangeCount = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3880 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3881 |
var c = this.fields['changecount']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3882 |
c = c ? parseInt(c) : 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3883 |
this.fields['changecount'] = String(c+1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3884 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3885 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3886 |
// Clear the changeCount of a tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3887 |
Tiddler.prototype.clearChangeCount = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3888 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3889 |
if(this.fields['changecount']) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3890 |
delete this.fields['changecount']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3891 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3892 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3893 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3894 |
Tiddler.prototype.doNotSave = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3895 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3896 |
return this.fields['doNotSave']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3897 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3898 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3899 |
// Returns true if the tiddler has been updated since the tiddler was created or downloaded |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3900 |
Tiddler.prototype.isTouched = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3901 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3902 |
var changeCount = this.fields['changecount']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3903 |
if(changeCount === undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3904 |
changeCount = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3905 |
return changeCount > 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3906 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3907 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3908 |
// Return the tiddler as an RSS item |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3909 |
Tiddler.prototype.toRssItem = function(uri) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3910 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3911 |
var s = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3912 |
s.push("<title" + ">" + this.title.htmlEncode() + "</title" + ">"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3913 |
s.push("<description>" + wikifyStatic(this.text,null,this).htmlEncode() + "</description>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3914 |
for(var t=0; t<this.tags.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3915 |
s.push("<category>" + this.tags[t] + "</category>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3916 |
s.push("<link>" + uri + "#" + encodeURIComponent(String.encodeTiddlyLink(this.title)) + "</link>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3917 |
s.push("<pubDate>" + this.modified.toGMTString() + "</pubDate>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3918 |
return s.join("\n"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3919 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3920 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3921 |
// Format the text for storage in an RSS item |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3922 |
Tiddler.prototype.saveToRss = function(uri) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3923 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3924 |
return "<item>\n" + this.toRssItem(uri) + "\n</item>"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3925 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3926 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3927 |
// Change the text and other attributes of a tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3928 |
Tiddler.prototype.set = function(title,text,modifier,modified,tags,created,fields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3929 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3930 |
this.assign(title,text,modifier,modified,tags,created,fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3931 |
this.changed(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3932 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3933 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3934 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3935 |
// Change the text and other attributes of a tiddler without triggered a tiddler.changed() call |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3936 |
Tiddler.prototype.assign = function(title,text,modifier,modified,tags,created,fields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3937 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3938 |
if(title != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3939 |
this.title = title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3940 |
if(text != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3941 |
this.text = text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3942 |
if(modifier != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3943 |
this.modifier = modifier; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3944 |
if(modified != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3945 |
this.modified = modified; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3946 |
if(created != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3947 |
this.created = created; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3948 |
if(fields != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3949 |
this.fields = fields; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3950 |
if(tags != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3951 |
this.tags = (typeof tags == "string") ? tags.readBracketedList() : tags; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3952 |
else if(this.tags == undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3953 |
this.tags = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3954 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3955 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3956 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3957 |
// Get the tags for a tiddler as a string (space delimited, using [[brackets]] for tags containing spaces) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3958 |
Tiddler.prototype.getTags = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3959 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3960 |
return String.encodeTiddlyLinkList(this.tags); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3961 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3962 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3963 |
// Test if a tiddler carries a tag |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3964 |
Tiddler.prototype.isTagged = function(tag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3965 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3966 |
return this.tags.indexOf(tag) != -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3967 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3968 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3969 |
// Static method to convert "\n" to newlines, "\s" to "\" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3970 |
Tiddler.unescapeLineBreaks = function(text) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3971 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3972 |
return text ? text.unescapeLineBreaks() : ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3973 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3974 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3975 |
// Convert newlines to "\n", "\" to "\s" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3976 |
Tiddler.prototype.escapeLineBreaks = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3977 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3978 |
return this.text.escapeLineBreaks(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3979 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3980 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3981 |
// Updates the secondary information (like links[] array) after a change to a tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3982 |
Tiddler.prototype.changed = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3983 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3984 |
this.links = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3985 |
var t = this.autoLinkWikiWords() ? 0 : 1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3986 |
var tiddlerLinkRegExp = t==0 ? config.textPrimitives.tiddlerAnyLinkRegExp : config.textPrimitives.tiddlerForcedLinkRegExp; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3987 |
tiddlerLinkRegExp.lastIndex = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3988 |
var formatMatch = tiddlerLinkRegExp.exec(this.text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3989 |
while(formatMatch) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3990 |
var lastIndex = tiddlerLinkRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3991 |
if(t==0 && formatMatch[1] && formatMatch[1] != this.title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3992 |
// wikiWordLink |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3993 |
if(formatMatch.index > 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3994 |
var preRegExp = new RegExp(config.textPrimitives.unWikiLink+"|"+config.textPrimitives.anyLetter,"mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3995 |
preRegExp.lastIndex = formatMatch.index-1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3996 |
var preMatch = preRegExp.exec(this.text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3997 |
if(preMatch.index != formatMatch.index-1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3998 |
this.links.pushUnique(formatMatch[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3999 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4000 |
this.links.pushUnique(formatMatch[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4001 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4002 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4003 |
else if(formatMatch[2-t] && !config.formatterHelpers.isExternalLink(formatMatch[3-t])) // titledBrackettedLink |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4004 |
this.links.pushUnique(formatMatch[3-t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4005 |
else if(formatMatch[4-t] && formatMatch[4-t] != this.title) // brackettedLink |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4006 |
this.links.pushUnique(formatMatch[4-t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4007 |
tiddlerLinkRegExp.lastIndex = lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4008 |
formatMatch = tiddlerLinkRegExp.exec(this.text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4009 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4010 |
this.linksUpdated = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4011 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4012 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4013 |
Tiddler.prototype.getSubtitle = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4014 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4015 |
var modifier = this.modifier; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4016 |
if(!modifier) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4017 |
modifier = config.messages.subtitleUnknown; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4018 |
var modified = this.modified; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4019 |
if(modified) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4020 |
modified = modified.toLocaleString(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4021 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4022 |
modified = config.messages.subtitleUnknown; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4023 |
return config.messages.tiddlerLinkTooltip.format([this.title,modifier,modified]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4024 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4025 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4026 |
Tiddler.prototype.isReadOnly = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4027 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4028 |
return readOnly; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4029 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4030 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4031 |
Tiddler.prototype.autoLinkWikiWords = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4032 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4033 |
return !(this.isTagged("systemConfig") || this.isTagged("excludeMissing")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4034 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4035 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4036 |
Tiddler.prototype.generateFingerprint = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4037 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4038 |
return "0x" + Crypto.hexSha1Str(this.text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4039 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4040 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4041 |
Tiddler.prototype.getServerType = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4042 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4043 |
var serverType = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4044 |
if(this.fields && this.fields['server.type']) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4045 |
serverType = this.fields['server.type']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4046 |
if(!serverType) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4047 |
serverType = this.fields['wikiformat']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4048 |
if(serverType && !config.adaptors[serverType]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4049 |
serverType = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4050 |
return serverType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4051 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4052 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4053 |
Tiddler.prototype.getAdaptor = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4054 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4055 |
var serverType = this.getServerType(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4056 |
return serverType ? new config.adaptors[serverType] : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4057 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4058 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4059 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4060 |
//-- TiddlyWiki() object contains Tiddler()s |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4061 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4062 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4063 |
function TiddlyWiki() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4064 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4065 |
var tiddlers = {}; // Hashmap by name of tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4066 |
this.tiddlersUpdated = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4067 |
this.namedNotifications = []; // Array of {name:,notify:} of notification functions |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4068 |
this.notificationLevel = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4069 |
this.slices = {}; // map tiddlerName->(map sliceName->sliceValue). Lazy. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4070 |
this.clear = function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4071 |
tiddlers = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4072 |
this.setDirty(false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4073 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4074 |
this.fetchTiddler = function(title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4075 |
var t = tiddlers[title]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4076 |
return t instanceof Tiddler ? t : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4077 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4078 |
this.deleteTiddler = function(title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4079 |
delete this.slices[title]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4080 |
delete tiddlers[title]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4081 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4082 |
this.addTiddler = function(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4083 |
delete this.slices[tiddler.title]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4084 |
tiddlers[tiddler.title] = tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4085 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4086 |
this.forEachTiddler = function(callback) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4087 |
for(var t in tiddlers) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4088 |
var tiddler = tiddlers[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4089 |
if(tiddler instanceof Tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4090 |
callback.call(this,t,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4091 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4092 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4093 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4094 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4095 |
TiddlyWiki.prototype.setDirty = function(dirty) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4096 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4097 |
this.dirty = dirty; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4098 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4099 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4100 |
TiddlyWiki.prototype.isDirty = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4101 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4102 |
return this.dirty; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4103 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4104 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4105 |
TiddlyWiki.prototype.suspendNotifications = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4106 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4107 |
this.notificationLevel--; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4108 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4109 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4110 |
TiddlyWiki.prototype.resumeNotifications = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4111 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4112 |
this.notificationLevel++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4113 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4114 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4115 |
// Invoke the notification handlers for a particular tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4116 |
TiddlyWiki.prototype.notify = function(title,doBlanket) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4117 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4118 |
if(!this.notificationLevel) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4119 |
for(var t=0; t<this.namedNotifications.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4120 |
var n = this.namedNotifications[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4121 |
if((n.name == null && doBlanket) || (n.name == title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4122 |
n.notify(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4123 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4124 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4125 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4126 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4127 |
// Invoke the notification handlers for all tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4128 |
TiddlyWiki.prototype.notifyAll = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4129 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4130 |
if(!this.notificationLevel) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4131 |
for(var t=0; t<this.namedNotifications.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4132 |
var n = this.namedNotifications[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4133 |
if(n.name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4134 |
n.notify(n.name); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4135 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4136 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4137 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4138 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4139 |
// Add a notification handler to a tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4140 |
TiddlyWiki.prototype.addNotification = function(title,fn) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4141 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4142 |
for(var i=0; i<this.namedNotifications.length; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4143 |
if((this.namedNotifications[i].name == title) && (this.namedNotifications[i].notify == fn)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4144 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4145 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4146 |
this.namedNotifications.push({name: title, notify: fn}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4147 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4148 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4149 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4150 |
TiddlyWiki.prototype.removeTiddler = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4151 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4152 |
var tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4153 |
if(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4154 |
this.deleteTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4155 |
this.notify(title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4156 |
this.setDirty(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4157 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4158 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4159 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4160 |
TiddlyWiki.prototype.tiddlerExists = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4161 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4162 |
var t = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4163 |
return t != undefined; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4164 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4165 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4166 |
TiddlyWiki.prototype.isShadowTiddler = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4167 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4168 |
return typeof config.shadowTiddlers[title] == "string"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4169 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4170 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4171 |
TiddlyWiki.prototype.getTiddler = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4172 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4173 |
var t = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4174 |
if(t != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4175 |
return t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4176 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4177 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4178 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4179 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4180 |
TiddlyWiki.prototype.getTiddlerText = function(title,defaultText) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4181 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4182 |
if(!title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4183 |
return defaultText; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4184 |
var pos = title.indexOf(config.textPrimitives.sectionSeparator); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4185 |
var section = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4186 |
if(pos != -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4187 |
section = title.substr(pos + config.textPrimitives.sectionSeparator.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4188 |
title = title.substr(0,pos); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4189 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4190 |
pos = title.indexOf(config.textPrimitives.sliceSeparator); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4191 |
if(pos != -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4192 |
var slice = this.getTiddlerSlice(title.substr(0,pos),title.substr(pos + config.textPrimitives.sliceSeparator.length)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4193 |
if(slice) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4194 |
return slice; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4195 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4196 |
var tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4197 |
if(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4198 |
if(!section) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4199 |
return tiddler.text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4200 |
var re = new RegExp("(^!{1,6}" + section.escapeRegExp() + "[ \t]*\n)","mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4201 |
re.lastIndex = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4202 |
var match = re.exec(tiddler.text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4203 |
if(match) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4204 |
var t = tiddler.text.substr(match.index+match[1].length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4205 |
var re2 = /^!/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4206 |
re2.lastIndex = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4207 |
match = re2.exec(t); //# search for the next heading |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4208 |
if(match) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4209 |
t = t.substr(0,match.index-1);//# don't include final \n |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4210 |
return t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4211 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4212 |
return defaultText; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4213 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4214 |
if(this.isShadowTiddler(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4215 |
return config.shadowTiddlers[title]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4216 |
if(defaultText != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4217 |
return defaultText; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4218 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4219 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4220 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4221 |
TiddlyWiki.prototype.slicesRE = /(?:[\'\/]*~?([\.\w]+)[\'\/]*\:[\'\/]*\s*(.*?)\s*$)|(?:\|[\'\/]*~?([\.\w]+)\:?[\'\/]*\|\s*(.*?)\s*\|)/gm; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4222 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4223 |
// @internal |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4224 |
TiddlyWiki.prototype.calcAllSlices = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4225 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4226 |
var slices = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4227 |
var text = this.getTiddlerText(title,""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4228 |
this.slicesRE.lastIndex = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4229 |
do { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4230 |
var m = this.slicesRE.exec(text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4231 |
if(m) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4232 |
if(m[1]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4233 |
slices[m[1]] = m[2]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4234 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4235 |
slices[m[3]] = m[4]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4236 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4237 |
} while(m); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4238 |
return slices; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4239 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4240 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4241 |
// Returns the slice of text of the given name |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4242 |
TiddlyWiki.prototype.getTiddlerSlice = function(title,sliceName) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4243 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4244 |
var slices = this.slices[title]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4245 |
if(!slices) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4246 |
slices = this.calcAllSlices(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4247 |
this.slices[title] = slices; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4248 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4249 |
return slices[sliceName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4250 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4251 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4252 |
// Build an hashmap of the specified named slices of a tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4253 |
TiddlyWiki.prototype.getTiddlerSlices = function(title,sliceNames) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4254 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4255 |
var r = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4256 |
for(var t=0; t<sliceNames.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4257 |
var slice = this.getTiddlerSlice(title,sliceNames[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4258 |
if(slice) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4259 |
r[sliceNames[t]] = slice; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4260 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4261 |
return r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4262 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4263 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4264 |
TiddlyWiki.prototype.getRecursiveTiddlerText = function(title,defaultText,depth) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4265 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4266 |
var bracketRegExp = new RegExp("(?:\\[\\[([^\\]]+)\\]\\])","mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4267 |
var text = this.getTiddlerText(title,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4268 |
if(text == null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4269 |
return defaultText; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4270 |
var textOut = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4271 |
var lastPos = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4272 |
do { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4273 |
var match = bracketRegExp.exec(text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4274 |
if(match) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4275 |
textOut.push(text.substr(lastPos,match.index-lastPos)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4276 |
if(match[1]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4277 |
if(depth <= 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4278 |
textOut.push(match[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4279 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4280 |
textOut.push(this.getRecursiveTiddlerText(match[1],"[[" + match[1] + "]]",depth-1)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4281 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4282 |
lastPos = match.index + match[0].length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4283 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4284 |
textOut.push(text.substr(lastPos)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4285 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4286 |
} while(match); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4287 |
return textOut.join(""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4288 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4289 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4290 |
TiddlyWiki.prototype.setTiddlerTag = function(title,status,tag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4291 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4292 |
var tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4293 |
if(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4294 |
var t = tiddler.tags.indexOf(tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4295 |
if(t != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4296 |
tiddler.tags.splice(t,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4297 |
if(status) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4298 |
tiddler.tags.push(tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4299 |
tiddler.changed(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4300 |
this.incChangeCount(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4301 |
this.notify(title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4302 |
this.setDirty(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4303 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4304 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4305 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4306 |
TiddlyWiki.prototype.addTiddlerFields = function(title,fields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4307 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4308 |
var tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4309 |
if(!tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4310 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4311 |
merge(tiddler.fields,fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4312 |
tiddler.changed(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4313 |
this.incChangeCount(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4314 |
this.notify(title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4315 |
this.setDirty(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4316 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4317 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4318 |
TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4319 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4320 |
var tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4321 |
if(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4322 |
created = created ? created : tiddler.created; // Preserve created date |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4323 |
this.deleteTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4324 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4325 |
created = created ? created : modified; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4326 |
tiddler = new Tiddler(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4327 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4328 |
tiddler.set(newTitle,newBody,modifier,modified,tags,created,fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4329 |
this.addTiddler(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4330 |
if(clearChangeCount) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4331 |
tiddler.clearChangeCount(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4332 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4333 |
tiddler.incChangeCount(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4334 |
if(title != newTitle) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4335 |
this.notify(title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4336 |
this.notify(newTitle,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4337 |
this.setDirty(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4338 |
return tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4339 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4340 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4341 |
// Reset the sync status of a freshly synced tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4342 |
TiddlyWiki.prototype.resetTiddler = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4343 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4344 |
var tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4345 |
if(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4346 |
tiddler.clearChangeCount(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4347 |
this.notify(title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4348 |
this.setDirty(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4349 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4350 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4351 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4352 |
TiddlyWiki.prototype.incChangeCount = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4353 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4354 |
var tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4355 |
if(tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4356 |
tiddler.incChangeCount(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4357 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4358 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4359 |
TiddlyWiki.prototype.createTiddler = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4360 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4361 |
var tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4362 |
if(!tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4363 |
tiddler = new Tiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4364 |
this.addTiddler(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4365 |
this.setDirty(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4366 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4367 |
return tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4368 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4369 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4370 |
// Load contents of a TiddlyWiki from an HTML DIV |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4371 |
TiddlyWiki.prototype.loadFromDiv = function(src,idPrefix,noUpdate) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4372 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4373 |
this.idPrefix = idPrefix; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4374 |
var storeElem = (typeof src == "string") ? document.getElementById(src) : src; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4375 |
if(!storeElem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4376 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4377 |
var tiddlers = this.getLoader().loadTiddlers(this,storeElem.childNodes); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4378 |
this.setDirty(false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4379 |
if(!noUpdate) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4380 |
for(var i = 0;i<tiddlers.length; i++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4381 |
tiddlers[i].changed(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4382 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4383 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4384 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4385 |
// Load contents of a TiddlyWiki from a string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4386 |
// Returns null if there's an error |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4387 |
TiddlyWiki.prototype.importTiddlyWiki = function(text) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4388 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4389 |
var posDiv = locateStoreArea(text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4390 |
if(!posDiv) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4391 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4392 |
var content = "<" + "html><" + "body>" + text.substring(posDiv[0],posDiv[1] + endSaveArea.length) + "<" + "/body><" + "/html>"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4393 |
// Create the iframe |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4394 |
var iframe = document.createElement("iframe"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4395 |
iframe.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4396 |
document.body.appendChild(iframe); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4397 |
var doc = iframe.document; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4398 |
if(iframe.contentDocument) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4399 |
doc = iframe.contentDocument; // For NS6 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4400 |
else if(iframe.contentWindow) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4401 |
doc = iframe.contentWindow.document; // For IE5.5 and IE6 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4402 |
// Put the content in the iframe |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4403 |
doc.open(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4404 |
doc.writeln(content); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4405 |
doc.close(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4406 |
// Load the content into a TiddlyWiki() object |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4407 |
var storeArea = doc.getElementById("storeArea"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4408 |
this.loadFromDiv(storeArea,"store"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4409 |
// Get rid of the iframe |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4410 |
iframe.parentNode.removeChild(iframe); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4411 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4412 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4413 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4414 |
TiddlyWiki.prototype.updateTiddlers = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4415 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4416 |
this.tiddlersUpdated = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4417 |
this.forEachTiddler(function(title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4418 |
tiddler.changed(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4419 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4420 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4421 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4422 |
// Return all tiddlers formatted as an HTML string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4423 |
TiddlyWiki.prototype.allTiddlersAsHtml = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4424 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4425 |
return store.getSaver().externalize(store); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4426 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4427 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4428 |
// Return an array of tiddlers matching a search regular expression |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4429 |
TiddlyWiki.prototype.search = function(searchRegExp,sortField,excludeTag,match) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4430 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4431 |
var candidates = this.reverseLookup("tags",excludeTag,!!match); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4432 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4433 |
for(var t=0; t<candidates.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4434 |
if((candidates[t].title.search(searchRegExp) != -1) || (candidates[t].text.search(searchRegExp) != -1)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4435 |
results.push(candidates[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4436 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4437 |
if(!sortField) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4438 |
sortField = "title"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4439 |
results.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4440 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4441 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4442 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4443 |
// Returns a list of all tags in use |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4444 |
// excludeTag - if present, excludes tags that are themselves tagged with excludeTag |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4445 |
// Returns an array of arrays where [tag][0] is the name of the tag and [tag][1] is the number of occurances |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4446 |
TiddlyWiki.prototype.getTags = function(excludeTag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4447 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4448 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4449 |
this.forEachTiddler(function(title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4450 |
for(var g=0; g<tiddler.tags.length; g++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4451 |
var tag = tiddler.tags[g]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4452 |
var n = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4453 |
for(var c=0; c<results.length; c++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4454 |
if(results[c][0] == tag) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4455 |
n = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4456 |
results[c][1]++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4457 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4458 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4459 |
if(n && excludeTag) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4460 |
var t = store.fetchTiddler(tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4461 |
if(t && t.isTagged(excludeTag)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4462 |
n = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4463 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4464 |
if(n) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4465 |
results.push([tag,1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4466 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4467 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4468 |
results.sort(function(a,b) {return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : (a[0].toLowerCase() == b[0].toLowerCase() ? 0 : +1);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4469 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4470 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4471 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4472 |
// Return an array of the tiddlers that are tagged with a given tag |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4473 |
TiddlyWiki.prototype.getTaggedTiddlers = function(tag,sortField) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4474 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4475 |
return this.reverseLookup("tags",tag,true,sortField); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4476 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4477 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4478 |
// Return an array of the tiddlers that link to a given tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4479 |
TiddlyWiki.prototype.getReferringTiddlers = function(title,unusedParameter,sortField) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4480 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4481 |
if(!this.tiddlersUpdated) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4482 |
this.updateTiddlers(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4483 |
return this.reverseLookup("links",title,true,sortField); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4484 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4485 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4486 |
// Return an array of the tiddlers that do or do not have a specified entry in the specified storage array (ie, "links" or "tags") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4487 |
// lookupMatch == true to match tiddlers, false to exclude tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4488 |
TiddlyWiki.prototype.reverseLookup = function(lookupField,lookupValue,lookupMatch,sortField) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4489 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4490 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4491 |
this.forEachTiddler(function(title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4492 |
var f = !lookupMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4493 |
for(var lookup=0; lookup<tiddler[lookupField].length; lookup++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4494 |
if(tiddler[lookupField][lookup] == lookupValue) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4495 |
f = lookupMatch; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4496 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4497 |
if(f) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4498 |
results.push(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4499 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4500 |
if(!sortField) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4501 |
sortField = "title"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4502 |
results.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4503 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4504 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4505 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4506 |
// Return the tiddlers as a sorted array |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4507 |
TiddlyWiki.prototype.getTiddlers = function(field,excludeTag) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4508 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4509 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4510 |
this.forEachTiddler(function(title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4511 |
if(excludeTag == undefined || !tiddler.isTagged(excludeTag)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4512 |
results.push(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4513 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4514 |
if(field) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4515 |
results.sort(function(a,b) {return a[field] < b[field] ? -1 : (a[field] == b[field] ? 0 : +1);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4516 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4517 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4518 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4519 |
// Return array of names of tiddlers that are referred to but not defined |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4520 |
TiddlyWiki.prototype.getMissingLinks = function(sortField) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4521 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4522 |
if(!this.tiddlersUpdated) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4523 |
this.updateTiddlers(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4524 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4525 |
this.forEachTiddler(function (title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4526 |
if(tiddler.isTagged("excludeMissing") || tiddler.isTagged("systemConfig")) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4527 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4528 |
for(var n=0; n<tiddler.links.length;n++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4529 |
var link = tiddler.links[n]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4530 |
if(this.fetchTiddler(link) == null && !this.isShadowTiddler(link)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4531 |
results.pushUnique(link); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4532 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4533 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4534 |
results.sort(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4535 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4536 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4537 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4538 |
// Return an array of names of tiddlers that are defined but not referred to |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4539 |
TiddlyWiki.prototype.getOrphans = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4540 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4541 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4542 |
this.forEachTiddler(function (title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4543 |
if(this.getReferringTiddlers(title).length == 0 && !tiddler.isTagged("excludeLists")) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4544 |
results.push(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4545 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4546 |
results.sort(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4547 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4548 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4549 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4550 |
// Return an array of names of all the shadow tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4551 |
TiddlyWiki.prototype.getShadowed = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4552 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4553 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4554 |
for(var t in config.shadowTiddlers) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4555 |
if(typeof config.shadowTiddlers[t] == "string") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4556 |
results.push(t); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4557 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4558 |
results.sort(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4559 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4560 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4561 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4562 |
// Return an array of tiddlers that have been touched since they were downloaded or created |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4563 |
TiddlyWiki.prototype.getTouched = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4564 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4565 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4566 |
this.forEachTiddler(function(title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4567 |
if(tiddler.isTouched()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4568 |
results.push(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4569 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4570 |
results.sort(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4571 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4572 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4573 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4574 |
// Resolves a Tiddler reference or tiddler title into a Tiddler object, or null if it doesn't exist |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4575 |
TiddlyWiki.prototype.resolveTiddler = function(tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4576 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4577 |
var t = (typeof tiddler == 'string') ? this.getTiddler(tiddler) : tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4578 |
return t instanceof Tiddler ? t : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4579 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4580 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4581 |
TiddlyWiki.prototype.getLoader = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4582 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4583 |
if(!this.loader) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4584 |
this.loader = new TW21Loader(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4585 |
return this.loader; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4586 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4587 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4588 |
TiddlyWiki.prototype.getSaver = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4589 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4590 |
if(!this.saver) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4591 |
this.saver = new TW21Saver(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4592 |
return this.saver; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4593 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4594 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4595 |
// Filter a list of tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4596 |
TiddlyWiki.prototype.filterTiddlers = function(filter) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4597 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4598 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4599 |
if(filter) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4600 |
var tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4601 |
var re = /([^\s\[\]]+)|(?:\[([ \w]+)\[([^\]]+)\]\])|(?:\[\[([^\]]+)\]\])/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4602 |
var match = re.exec(filter); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4603 |
while(match) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4604 |
if(match[1] || match[4]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4605 |
var title = match[1] ? match[1] : match[4]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4606 |
tiddler = this.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4607 |
if(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4608 |
results.pushUnique(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4609 |
} else if(store.isShadowTiddler(title)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4610 |
tiddler = new Tiddler(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4611 |
tiddler.set(title,store.getTiddlerText(title)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4612 |
results.pushUnique(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4613 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4614 |
} else if(match[2]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4615 |
switch(match[2]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4616 |
case "tag": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4617 |
var matched = this.getTaggedTiddlers(match[3]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4618 |
for(var m = 0; m < matched.length; m++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4619 |
results.pushUnique(matched[m]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4620 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4621 |
case "sort": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4622 |
results = this.sortTiddlers(results,match[3]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4623 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4624 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4625 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4626 |
match = re.exec(filter); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4627 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4628 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4629 |
return results; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4630 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4631 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4632 |
// Sort a list of tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4633 |
TiddlyWiki.prototype.sortTiddlers = function(tiddlers,field) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4634 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4635 |
var asc = +1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4636 |
switch(field.substr(0,1)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4637 |
case "-": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4638 |
asc = -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4639 |
// Note: this fall-through is intentional |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4640 |
case "+": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4641 |
field = field.substr(1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4642 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4643 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4644 |
if(TiddlyWiki.standardFieldAccess[field]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4645 |
tiddlers.sort(function(a,b) {return a[field] < b[field] ? -asc : (a[field] == b[field] ? 0 : asc);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4646 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4647 |
tiddlers.sort(function(a,b) {return a.fields[field] < b.fields[field] ? -asc : (a.fields[field] == b.fields[field] ? 0 : +asc);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4648 |
return tiddlers; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4649 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4650 |
// Returns true if path is a valid field name (path), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4651 |
// i.e. a sequence of identifiers, separated by '.' |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4652 |
TiddlyWiki.isValidFieldName = function(name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4653 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4654 |
var match = /[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*/.exec(name); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4655 |
return match && (match[0] == name); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4656 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4657 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4658 |
// Throws an exception when name is not a valid field name. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4659 |
TiddlyWiki.checkFieldName = function(name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4660 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4661 |
if(!TiddlyWiki.isValidFieldName(name)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4662 |
throw config.messages.invalidFieldName.format([name]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4663 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4664 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4665 |
function StringFieldAccess(n,readOnly) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4666 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4667 |
this.set = readOnly ? |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4668 |
function(t,v) {if(v != t[n]) throw config.messages.fieldCannotBeChanged.format([n]);} : |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4669 |
function(t,v) {if(v != t[n]) {t[n] = v; return true;}}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4670 |
this.get = function(t) {return t[n];}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4671 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4672 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4673 |
function DateFieldAccess(n) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4674 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4675 |
this.set = function(t,v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4676 |
var d = v instanceof Date ? v : Date.convertFromYYYYMMDDHHMM(v); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4677 |
if(d != t[n]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4678 |
t[n] = d; return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4679 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4680 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4681 |
this.get = function(t) {return t[n].convertToYYYYMMDDHHMM();}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4682 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4683 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4684 |
function LinksFieldAccess(n) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4685 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4686 |
this.set = function(t,v) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4687 |
var s = (typeof v == "string") ? v.readBracketedList() : v; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4688 |
if(s.toString() != t[n].toString()) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4689 |
t[n] = s; return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4690 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4691 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4692 |
this.get = function(t) {return String.encodeTiddlyLinkList(t[n]);}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4693 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4694 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4695 |
TiddlyWiki.standardFieldAccess = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4696 |
// The set functions return true when setting the data has changed the value. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4697 |
"title": new StringFieldAccess("title",true), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4698 |
// Handle the "tiddler" field name as the title |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4699 |
"tiddler": new StringFieldAccess("title",true), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4700 |
"text": new StringFieldAccess("text"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4701 |
"modifier": new StringFieldAccess("modifier"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4702 |
"modified": new DateFieldAccess("modified"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4703 |
"created": new DateFieldAccess("created"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4704 |
"tags": new LinksFieldAccess("tags") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4705 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4706 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4707 |
TiddlyWiki.isStandardField = function(name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4708 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4709 |
return TiddlyWiki.standardFieldAccess[name] != undefined; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4710 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4711 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4712 |
// Sets the value of the given field of the tiddler to the value. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4713 |
// Setting an ExtendedField's value to null or undefined removes the field. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4714 |
// Setting a namespace to undefined removes all fields of that namespace. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4715 |
// The fieldName is case-insensitive. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4716 |
// All values will be converted to a string value. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4717 |
TiddlyWiki.prototype.setValue = function(tiddler,fieldName,value) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4718 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4719 |
TiddlyWiki.checkFieldName(fieldName); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4720 |
var t = this.resolveTiddler(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4721 |
if(!t) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4722 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4723 |
fieldName = fieldName.toLowerCase(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4724 |
var isRemove = (value === undefined) || (value === null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4725 |
var accessor = TiddlyWiki.standardFieldAccess[fieldName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4726 |
if(accessor) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4727 |
if(isRemove) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4728 |
// don't remove StandardFields |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4729 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4730 |
var h = TiddlyWiki.standardFieldAccess[fieldName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4731 |
if(!h.set(t,value)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4732 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4733 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4734 |
var oldValue = t.fields[fieldName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4735 |
if(isRemove) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4736 |
if(oldValue !== undefined) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4737 |
// deletes a single field |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4738 |
delete t.fields[fieldName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4739 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4740 |
// no concrete value is defined for the fieldName |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4741 |
// so we guess this is a namespace path. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4742 |
// delete all fields in a namespace |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4743 |
var re = new RegExp('^'+fieldName+'\\.'); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4744 |
var dirty = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4745 |
for(var n in t.fields) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4746 |
if(n.match(re)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4747 |
delete t.fields[n]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4748 |
dirty = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4749 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4750 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4751 |
if(!dirty) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4752 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4753 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4754 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4755 |
// the "normal" set case. value is defined (not null/undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4756 |
// For convenience provide a nicer conversion Date->String |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4757 |
value = value instanceof Date ? value.convertToYYYYMMDDHHMMSSMMM() : String(value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4758 |
if(oldValue == value) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4759 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4760 |
t.fields[fieldName] = value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4761 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4762 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4763 |
// When we are here the tiddler/store really was changed. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4764 |
this.notify(t.title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4765 |
if(!fieldName.match(/^temp\./)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4766 |
this.setDirty(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4767 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4768 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4769 |
// Returns the value of the given field of the tiddler. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4770 |
// The fieldName is case-insensitive. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4771 |
// Will only return String values (or undefined). |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4772 |
TiddlyWiki.prototype.getValue = function(tiddler,fieldName) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4773 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4774 |
var t = this.resolveTiddler(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4775 |
if(!t) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4776 |
return undefined; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4777 |
fieldName = fieldName.toLowerCase(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4778 |
var accessor = TiddlyWiki.standardFieldAccess[fieldName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4779 |
if(accessor) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4780 |
return accessor.get(t); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4781 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4782 |
return t.fields[fieldName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4783 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4784 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4785 |
// Calls the callback function for every field in the tiddler. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4786 |
// When callback function returns a non-false value the iteration stops |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4787 |
// and that value is returned. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4788 |
// The order of the fields is not defined. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4789 |
// @param callback a function(tiddler,fieldName,value). |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4790 |
TiddlyWiki.prototype.forEachField = function(tiddler,callback,onlyExtendedFields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4791 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4792 |
var t = this.resolveTiddler(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4793 |
if(!t) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4794 |
return undefined; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4795 |
var n,result; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4796 |
for(n in t.fields) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4797 |
result = callback(t,n,t.fields[n]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4798 |
if(result) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4799 |
return result; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4800 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4801 |
if(onlyExtendedFields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4802 |
return undefined; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4803 |
for(n in TiddlyWiki.standardFieldAccess) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4804 |
if(n == "tiddler") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4805 |
// even though the "title" field can also be referenced through the name "tiddler" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4806 |
// we only visit this field once. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4807 |
continue; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4808 |
result = callback(t,n,TiddlyWiki.standardFieldAccess[n].get(t)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4809 |
if(result) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4810 |
return result; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4811 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4812 |
return undefined; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4813 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4814 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4815 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4816 |
//-- Story functions |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4817 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4818 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4819 |
function Story(containerId,idPrefix) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4820 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4821 |
this.container = containerId; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4822 |
this.idPrefix = idPrefix; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4823 |
this.highlightRegExp = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4824 |
this.tiddlerId = function(title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4825 |
return this.idPrefix + title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4826 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4827 |
this.containerId = function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4828 |
return this.container; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4829 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4830 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4831 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4832 |
Story.prototype.forEachTiddler = function(fn) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4833 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4834 |
var place = this.getContainer(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4835 |
if(!place) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4836 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4837 |
var e = place.firstChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4838 |
while(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4839 |
var n = e.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4840 |
var title = e.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4841 |
fn.call(this,title,e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4842 |
e = n; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4843 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4844 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4845 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4846 |
Story.prototype.displayTiddlers = function(srcElement,titles,template,animate,unused,customFields,toggle) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4847 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4848 |
for(var t = titles.length-1;t>=0;t--) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4849 |
this.displayTiddler(srcElement,titles[t],template,animate,unused,customFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4850 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4851 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4852 |
Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4853 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4854 |
var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4855 |
var tiddlerElem = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4856 |
if(tiddlerElem) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4857 |
if(toggle) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4858 |
this.closeTiddler(title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4859 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4860 |
this.refreshTiddler(title,template,false,customFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4861 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4862 |
var place = this.getContainer(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4863 |
var before = this.positionTiddler(srcElement); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4864 |
tiddlerElem = this.createTiddler(place,before,title,template,customFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4865 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4866 |
if(srcElement && typeof srcElement !== "string") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4867 |
if(config.options.chkAnimate && (animate == undefined || animate == true) && anim && typeof Zoomer == "function" && typeof Scroller == "function") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4868 |
anim.startAnimating(new Zoomer(title,srcElement,tiddlerElem),new Scroller(tiddlerElem)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4869 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4870 |
window.scrollTo(0,ensureVisible(tiddlerElem)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4871 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4872 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4873 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4874 |
Story.prototype.positionTiddler = function(srcElement) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4875 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4876 |
var place = this.getContainer(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4877 |
var before = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4878 |
if(typeof srcElement == "string") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4879 |
switch(srcElement) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4880 |
case "top": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4881 |
before = place.firstChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4882 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4883 |
case "bottom": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4884 |
before = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4885 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4886 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4887 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4888 |
var after = this.findContainingTiddler(srcElement); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4889 |
if(after == null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4890 |
before = place.firstChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4891 |
} else if(after.nextSibling) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4892 |
before = after.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4893 |
if(before.nodeType != 1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4894 |
before = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4895 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4896 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4897 |
return before; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4898 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4899 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4900 |
Story.prototype.createTiddler = function(place,before,title,template,customFields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4901 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4902 |
var tiddlerElem = createTiddlyElement(null,"div",this.tiddlerId(title),"tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4903 |
tiddlerElem.setAttribute("refresh","tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4904 |
if(customFields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4905 |
tiddlerElem.setAttribute("tiddlyFields",customFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4906 |
place.insertBefore(tiddlerElem,before); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4907 |
var defaultText = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4908 |
if(!store.tiddlerExists(title) && !store.isShadowTiddler(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4909 |
defaultText = this.loadMissingTiddler(title,customFields,tiddlerElem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4910 |
this.refreshTiddler(title,template,false,customFields,defaultText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4911 |
return tiddlerElem; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4912 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4913 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4914 |
Story.prototype.loadMissingTiddler = function(title,fields,tiddlerElem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4915 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4916 |
var tiddler = new Tiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4917 |
tiddler.fields = typeof fields == "string" ? fields.decodeHashMap() : (fields ? fields : {}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4918 |
var serverType = tiddler.getServerType(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4919 |
var host = tiddler.fields['server.host']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4920 |
var workspace = tiddler.fields['server.workspace']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4921 |
if(!serverType || !host) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4922 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4923 |
var sm = new SyncMachine(serverType,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4924 |
start: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4925 |
return this.openHost(host,"openWorkspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4926 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4927 |
openWorkspace: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4928 |
return this.openWorkspace(workspace,"getTiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4929 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4930 |
getTiddler: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4931 |
return this.getTiddler(title,"onGetTiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4932 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4933 |
onGetTiddler: function(context) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4934 |
var tiddler = context.tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4935 |
if(tiddler && tiddler.text) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4936 |
var downloaded = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4937 |
if(!tiddler.created) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4938 |
tiddler.created = downloaded; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4939 |
if(!tiddler.modified) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4940 |
tiddler.modified = tiddler.created; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4941 |
store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields,true,tiddler.created); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4942 |
autoSaveChanges(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4943 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4944 |
delete this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4945 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4946 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4947 |
error: function(message) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4948 |
displayMessage("Error loading missing tiddler from %0: %1".format([host,message])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4949 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4950 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4951 |
sm.go(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4952 |
return config.messages.loadingMissingTiddler.format([title,serverType,host,workspace]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4953 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4954 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4955 |
Story.prototype.chooseTemplateForTiddler = function(title,template) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4956 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4957 |
if(!template) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4958 |
template = DEFAULT_VIEW_TEMPLATE; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4959 |
if(template == DEFAULT_VIEW_TEMPLATE || template == DEFAULT_EDIT_TEMPLATE) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4960 |
template = config.tiddlerTemplates[template]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4961 |
return template; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4962 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4963 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4964 |
Story.prototype.getTemplateForTiddler = function(title,template,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4965 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4966 |
return store.getRecursiveTiddlerText(template,null,10); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4967 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4968 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4969 |
Story.prototype.refreshTiddler = function(title,template,force,customFields,defaultText) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4970 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4971 |
var tiddlerElem = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4972 |
if(tiddlerElem) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4973 |
if(tiddlerElem.getAttribute("dirty") == "true" && !force) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4974 |
return tiddlerElem; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4975 |
template = this.chooseTemplateForTiddler(title,template); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4976 |
var currTemplate = tiddlerElem.getAttribute("template"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4977 |
if((template != currTemplate) || force) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4978 |
var tiddler = store.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4979 |
if(!tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4980 |
tiddler = new Tiddler(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4981 |
if(store.isShadowTiddler(title)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4982 |
tiddler.set(title,store.getTiddlerText(title),config.views.wikified.shadowModifier,version.date,[],version.date); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4983 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4984 |
var text = template=="EditTemplate" ? |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4985 |
config.views.editor.defaultText.format([title]) : |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4986 |
config.views.wikified.defaultText.format([title]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4987 |
text = defaultText ? defaultText : text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4988 |
var fields = customFields ? customFields.decodeHashMap() : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4989 |
tiddler.set(title,text,config.views.wikified.defaultModifier,version.date,[],version.date,fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4990 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4991 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4992 |
tiddlerElem.setAttribute("tags",tiddler.tags.join(" ")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4993 |
tiddlerElem.setAttribute("tiddler",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4994 |
tiddlerElem.setAttribute("template",template); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4995 |
tiddlerElem.onmouseover = this.onTiddlerMouseOver; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4996 |
tiddlerElem.onmouseout = this.onTiddlerMouseOut; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4997 |
tiddlerElem.ondblclick = this.onTiddlerDblClick; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4998 |
tiddlerElem[window.event?"onkeydown":"onkeypress"] = this.onTiddlerKeyPress; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4999 |
tiddlerElem.innerHTML = this.getTemplateForTiddler(title,template,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5000 |
applyHtmlMacros(tiddlerElem,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5001 |
if(store.getTaggedTiddlers(title).length > 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5002 |
addClass(tiddlerElem,"isTag"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5003 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5004 |
removeClass(tiddlerElem,"isTag"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5005 |
if(store.tiddlerExists(title)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5006 |
removeClass(tiddlerElem,"shadow"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5007 |
removeClass(tiddlerElem,"missing"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5008 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5009 |
addClass(tiddlerElem,store.isShadowTiddler(title) ? "shadow" : "missing"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5010 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5011 |
if(customFields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5012 |
this.addCustomFields(tiddlerElem,customFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5013 |
forceReflow(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5014 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5015 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5016 |
return tiddlerElem; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5017 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5018 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5019 |
Story.prototype.addCustomFields = function(place,customFields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5020 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5021 |
var fields = customFields.decodeHashMap(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5022 |
var w = document.createElement("div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5023 |
w.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5024 |
place.appendChild(w); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5025 |
for(var t in fields) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5026 |
var e = document.createElement("input"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5027 |
e.setAttribute("type","text"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5028 |
e.setAttribute("value",fields[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5029 |
w.appendChild(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5030 |
e.setAttribute("edit",t); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5031 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5032 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5033 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5034 |
Story.prototype.refreshAllTiddlers = function(force) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5035 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5036 |
var place = this.getContainer(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5037 |
var e = place.firstChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5038 |
if(!e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5039 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5040 |
this.refreshTiddler(e.getAttribute("tiddler"),force ? null : e.getAttribute("template"),true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5041 |
while((e = e.nextSibling) != null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5042 |
this.refreshTiddler(e.getAttribute("tiddler"),force ? null : e.getAttribute("template"),true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5043 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5044 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5045 |
Story.prototype.onTiddlerMouseOver = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5046 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5047 |
if(window.addClass instanceof Function) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5048 |
addClass(this,"selected"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5049 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5050 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5051 |
Story.prototype.onTiddlerMouseOut = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5052 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5053 |
if(window.removeClass instanceof Function) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5054 |
removeClass(this,"selected"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5055 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5056 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5057 |
Story.prototype.onTiddlerDblClick = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5058 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5059 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5060 |
var theTarget = resolveTarget(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5061 |
if(theTarget && theTarget.nodeName.toLowerCase() != "input" && theTarget.nodeName.toLowerCase() != "textarea") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5062 |
if(document.selection && document.selection.empty) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5063 |
document.selection.empty(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5064 |
config.macros.toolbar.invokeCommand(this,"defaultCommand",e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5065 |
e.cancelBubble = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5066 |
if(e.stopPropagation) e.stopPropagation(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5067 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5068 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5069 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5070 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5071 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5072 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5073 |
Story.prototype.onTiddlerKeyPress = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5074 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5075 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5076 |
clearMessage(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5077 |
var consume = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5078 |
var title = this.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5079 |
var target = resolveTarget(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5080 |
switch(e.keyCode) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5081 |
case 9: // Tab |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5082 |
if(config.options.chkInsertTabs && target.tagName.toLowerCase() == "textarea") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5083 |
replaceSelection(target,String.fromCharCode(9)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5084 |
consume = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5085 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5086 |
if(config.isOpera) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5087 |
target.onblur = function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5088 |
this.focus(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5089 |
this.onblur = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5090 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5091 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5092 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5093 |
case 13: // Ctrl-Enter |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5094 |
case 10: // Ctrl-Enter on IE PC |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5095 |
case 77: // Ctrl-Enter is "M" on some platforms |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5096 |
if(e.ctrlKey) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5097 |
blurElement(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5098 |
config.macros.toolbar.invokeCommand(this,"defaultCommand",e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5099 |
consume = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5100 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5101 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5102 |
case 27: // Escape |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5103 |
blurElement(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5104 |
config.macros.toolbar.invokeCommand(this,"cancelCommand",e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5105 |
consume = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5106 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5107 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5108 |
e.cancelBubble = consume; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5109 |
if(consume) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5110 |
if(e.stopPropagation) e.stopPropagation(); // Stop Propagation |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5111 |
e.returnValue = true; // Cancel The Event in IE |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5112 |
if(e.preventDefault ) e.preventDefault(); // Cancel The Event in Moz |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5113 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5114 |
return !consume; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5115 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5116 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5117 |
Story.prototype.getTiddlerField = function(title,field) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5118 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5119 |
var tiddlerElem = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5120 |
var e = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5121 |
if(tiddlerElem != null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5122 |
var children = tiddlerElem.getElementsByTagName("*"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5123 |
for(var t=0; t<children.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5124 |
var c = children[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5125 |
if(c.tagName.toLowerCase() == "input" || c.tagName.toLowerCase() == "textarea") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5126 |
if(!e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5127 |
e = c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5128 |
if(c.getAttribute("edit") == field) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5129 |
e = c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5130 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5131 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5132 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5133 |
return e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5134 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5135 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5136 |
Story.prototype.focusTiddler = function(title,field) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5137 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5138 |
var e = this.getTiddlerField(title,field); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5139 |
if(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5140 |
e.focus(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5141 |
e.select(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5142 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5143 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5144 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5145 |
Story.prototype.blurTiddler = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5146 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5147 |
var tiddlerElem = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5148 |
if(tiddlerElem != null && tiddlerElem.focus && tiddlerElem.blur) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5149 |
tiddlerElem.focus(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5150 |
tiddlerElem.blur(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5151 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5152 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5153 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5154 |
Story.prototype.setTiddlerField = function(title,tag,mode,field) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5155 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5156 |
var c = story.getTiddlerField(title,field); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5157 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5158 |
var tags = c.value.readBracketedList(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5159 |
tags.setItem(tag,mode); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5160 |
c.value = String.encodeTiddlyLinkList(tags); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5161 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5162 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5163 |
Story.prototype.setTiddlerTag = function(title,tag,mode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5164 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5165 |
Story.prototype.setTiddlerField(title,tag,mode,"tags"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5166 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5167 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5168 |
Story.prototype.closeTiddler = function(title,animate,unused) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5169 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5170 |
var tiddlerElem = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5171 |
if(tiddlerElem != null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5172 |
clearMessage(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5173 |
this.scrubTiddler(tiddlerElem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5174 |
if(config.options.chkAnimate && animate && anim && typeof Slider == "function") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5175 |
anim.startAnimating(new Slider(tiddlerElem,false,null,"all")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5176 |
else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5177 |
removeNode(tiddlerElem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5178 |
forceReflow(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5179 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5180 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5181 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5182 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5183 |
Story.prototype.scrubTiddler = function(tiddlerElem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5184 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5185 |
tiddlerElem.id = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5186 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5187 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5188 |
Story.prototype.setDirty = function(title,dirty) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5189 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5190 |
var tiddlerElem = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5191 |
if(tiddlerElem != null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5192 |
tiddlerElem.setAttribute("dirty",dirty ? "true" : "false"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5193 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5194 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5195 |
Story.prototype.isDirty = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5196 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5197 |
var tiddlerElem = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5198 |
if(tiddlerElem != null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5199 |
return tiddlerElem.getAttribute("dirty") == "true"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5200 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5201 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5202 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5203 |
Story.prototype.areAnyDirty = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5204 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5205 |
var r = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5206 |
this.forEachTiddler(function(title,element) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5207 |
if(this.isDirty(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5208 |
r = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5209 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5210 |
return r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5211 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5212 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5213 |
Story.prototype.closeAllTiddlers = function(exclude) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5214 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5215 |
clearMessage(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5216 |
this.forEachTiddler(function(title,element) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5217 |
if((title != exclude) && element.getAttribute("dirty") != "true") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5218 |
this.closeTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5219 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5220 |
window.scrollTo(0,ensureVisible(this.container)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5221 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5222 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5223 |
Story.prototype.isEmpty = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5224 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5225 |
var place = this.getContainer(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5226 |
return place && place.firstChild == null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5227 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5228 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5229 |
Story.prototype.search = function(text,useCaseSensitive,useRegExp) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5230 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5231 |
this.closeAllTiddlers(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5232 |
highlightHack = new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5233 |
var matches = store.search(highlightHack,"title","excludeSearch"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5234 |
this.displayTiddlers(null,matches); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5235 |
highlightHack = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5236 |
var q = useRegExp ? "/" : "'"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5237 |
if(matches.length > 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5238 |
displayMessage(config.macros.search.successMsg.format([matches.length.toString(),q + text + q])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5239 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5240 |
displayMessage(config.macros.search.failureMsg.format([q + text + q])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5241 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5242 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5243 |
Story.prototype.findContainingTiddler = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5244 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5245 |
while(e && !hasClass(e,"tiddler")) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5246 |
e = e.parentNode; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5247 |
return e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5248 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5249 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5250 |
Story.prototype.gatherSaveFields = function(e,fields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5251 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5252 |
if(e && e.getAttribute) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5253 |
var f = e.getAttribute("edit"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5254 |
if(f) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5255 |
fields[f] = e.value.replace(/\r/mg,""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5256 |
if(e.hasChildNodes()) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5257 |
var c = e.childNodes; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5258 |
for(var t=0; t<c.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5259 |
this.gatherSaveFields(c[t],fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5260 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5261 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5262 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5263 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5264 |
Story.prototype.hasChanges = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5265 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5266 |
var e = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5267 |
if(e != null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5268 |
var fields = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5269 |
this.gatherSaveFields(e,fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5270 |
var tiddler = store.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5271 |
if(!tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5272 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5273 |
for(var n in fields) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5274 |
if(store.getValue(title,n) != fields[n]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5275 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5276 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5277 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5278 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5279 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5280 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5281 |
Story.prototype.saveTiddler = function(title,minorUpdate) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5282 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5283 |
var tiddlerElem = this.getTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5284 |
if(tiddlerElem != null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5285 |
var fields = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5286 |
this.gatherSaveFields(tiddlerElem,fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5287 |
var newTitle = fields.title ? fields.title : title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5288 |
if(!store.tiddlerExists(newTitle)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5289 |
newTitle = newTitle.trim(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5290 |
if(store.tiddlerExists(newTitle) && newTitle != title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5291 |
if(!confirm(config.messages.overwriteWarning.format([newTitle.toString()]))) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5292 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5293 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5294 |
if(newTitle != title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5295 |
this.closeTiddler(newTitle,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5296 |
tiddlerElem.id = this.tiddlerId(newTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5297 |
tiddlerElem.setAttribute("tiddler",newTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5298 |
tiddlerElem.setAttribute("template",DEFAULT_VIEW_TEMPLATE); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5299 |
tiddlerElem.setAttribute("dirty","false"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5300 |
if(config.options.chkForceMinorUpdate) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5301 |
minorUpdate = !minorUpdate; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5302 |
if(!store.tiddlerExists(newTitle)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5303 |
minorUpdate = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5304 |
var newDate = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5305 |
var extendedFields = store.tiddlerExists(newTitle) ? store.fetchTiddler(newTitle).fields : (newTitle!=title && store.tiddlerExists(title) ? store.fetchTiddler(title).fields : {}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5306 |
for(var n in fields) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5307 |
if(!TiddlyWiki.isStandardField(n)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5308 |
extendedFields[n] = fields[n]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5309 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5310 |
var tiddler = store.saveTiddler(title,newTitle,fields.text,minorUpdate ? undefined : config.options.txtUserName,minorUpdate ? undefined : newDate,fields.tags,extendedFields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5311 |
autoSaveChanges(null,[tiddler]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5312 |
return newTitle; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5313 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5314 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5315 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5316 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5317 |
Story.prototype.permaView = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5318 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5319 |
var links = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5320 |
this.forEachTiddler(function(title,element) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5321 |
links.push(String.encodeTiddlyLink(title)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5322 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5323 |
var t = encodeURIComponent(links.join(" ")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5324 |
if(t == "") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5325 |
t = "#"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5326 |
if(window.location.hash != t) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5327 |
window.location.hash = t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5328 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5329 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5330 |
Story.prototype.switchTheme = function(theme) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5331 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5332 |
if(safeMode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5333 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5334 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5335 |
isAvailable = function(title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5336 |
var s = title ? title.indexOf(config.textPrimitives.sectionSeparator) : -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5337 |
if(s!=-1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5338 |
title = title.substr(0,s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5339 |
return store.tiddlerExists(title) || store.isShadowTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5340 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5341 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5342 |
getSlice = function(theme,slice) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5343 |
var r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5344 |
if(readOnly) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5345 |
r = store.getTiddlerSlice(theme,slice+"ReadOnly") || store.getTiddlerSlice(theme,"Web"+slice); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5346 |
r = r || store.getTiddlerSlice(theme,slice); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5347 |
if(r && r.indexOf(config.textPrimitives.sectionSeparator)==0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5348 |
r = theme + r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5349 |
return isAvailable(r) ? r : slice; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5350 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5351 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5352 |
replaceNotification = function(i,name,theme,slice) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5353 |
var newName = getSlice(theme,slice); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5354 |
if(name!=newName && store.namedNotifications[i].name==name) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5355 |
store.namedNotifications[i].name = newName; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5356 |
return newName; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5357 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5358 |
return name; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5359 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5360 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5361 |
var pt = config.refresherData.pageTemplate; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5362 |
var vi = DEFAULT_VIEW_TEMPLATE; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5363 |
var vt = config.tiddlerTemplates[vi]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5364 |
var ei = DEFAULT_EDIT_TEMPLATE; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5365 |
var et = config.tiddlerTemplates[ei]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5366 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5367 |
for(var i=0; i<config.notifyTiddlers.length; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5368 |
var name = config.notifyTiddlers[i].name; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5369 |
switch(name) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5370 |
case "PageTemplate": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5371 |
config.refresherData.pageTemplate = replaceNotification(i,config.refresherData.pageTemplate,theme,name); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5372 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5373 |
case "StyleSheet": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5374 |
removeStyleSheet(config.refresherData.styleSheet); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5375 |
config.refresherData.styleSheet = replaceNotification(i,config.refresherData.styleSheet,theme,name); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5376 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5377 |
case "ColorPalette": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5378 |
config.refresherData.colorPalette = replaceNotification(i,config.refresherData.colorPalette,theme,name); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5379 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5380 |
default: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5381 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5382 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5383 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5384 |
config.tiddlerTemplates[vi] = getSlice(theme,"ViewTemplate"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5385 |
config.tiddlerTemplates[ei] = getSlice(theme,"EditTemplate"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5386 |
if(!startingUp) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5387 |
if(config.refresherData.pageTemplate!=pt || config.tiddlerTemplates[vi]!=vt || config.tiddlerTemplates[ei]!=et) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5388 |
refreshAll(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5389 |
story.refreshAllTiddlers(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5390 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5391 |
setStylesheet(store.getRecursiveTiddlerText(config.refresherData.styleSheet,"",10),config.refreshers.styleSheet); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5392 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5393 |
config.options.txtTheme = theme; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5394 |
saveOptionCookie("txtTheme"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5395 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5396 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5397 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5398 |
Story.prototype.getTiddler = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5399 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5400 |
return document.getElementById(this.tiddlerId(title)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5401 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5402 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5403 |
Story.prototype.getContainer = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5404 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5405 |
return document.getElementById(this.containerId()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5406 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5407 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5408 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5409 |
//-- Backstage |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5410 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5411 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5412 |
var backstage = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5413 |
area: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5414 |
toolbar: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5415 |
button: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5416 |
showButton: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5417 |
hideButton: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5418 |
cloak: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5419 |
panel: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5420 |
panelBody: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5421 |
panelFooter: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5422 |
currTabName: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5423 |
currTabElem: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5424 |
content: null, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5425 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5426 |
init: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5427 |
var cmb = config.messages.backstage; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5428 |
this.area = document.getElementById("backstageArea"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5429 |
this.toolbar = document.getElementById("backstageToolbar"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5430 |
this.button = document.getElementById("backstageButton"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5431 |
this.button.style.display = "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5432 |
var t = cmb.open.text + " " + glyph("bentArrowLeft"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5433 |
this.showButton = createTiddlyButton(this.button,t,cmb.open.tooltip, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5434 |
function (e) {backstage.show(); return false;},null,"backstageShow"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5435 |
t = glyph("bentArrowRight") + " " + cmb.close.text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5436 |
this.hideButton = createTiddlyButton(this.button,t,cmb.close.tooltip, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5437 |
function (e) {backstage.hide(); return false;},null,"backstageHide"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5438 |
this.cloak = document.getElementById("backstageCloak"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5439 |
this.panel = document.getElementById("backstagePanel"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5440 |
this.panelFooter = createTiddlyElement(this.panel,"div",null,"backstagePanelFooter"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5441 |
this.panelBody = createTiddlyElement(this.panel,"div",null,"backstagePanelBody"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5442 |
this.cloak.onmousedown = function(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5443 |
backstage.switchTab(null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5444 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5445 |
createTiddlyText(this.toolbar,cmb.prompt); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5446 |
for(t=0; t<config.backstageTasks.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5447 |
var taskName = config.backstageTasks[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5448 |
var task = config.tasks[taskName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5449 |
var handler = task.action ? this.onClickCommand : this.onClickTab; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5450 |
var text = task.text + (task.action ? "" : glyph("downTriangle")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5451 |
var btn = createTiddlyButton(this.toolbar,text,task.tooltip,handler,"backstageTab"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5452 |
btn.setAttribute("task",taskName); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5453 |
addClass(btn,task.action ? "backstageAction" : "backstageTask"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5454 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5455 |
this.content = document.getElementById("contentWrapper"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5456 |
if(config.options.chkBackstage) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5457 |
this.show(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5458 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5459 |
this.hide(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5460 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5461 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5462 |
isVisible: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5463 |
return this.area ? this.area.style.display == "block" : false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5464 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5465 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5466 |
show: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5467 |
this.area.style.display = "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5468 |
if(anim && config.options.chkAnimate) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5469 |
backstage.toolbar.style.left = findWindowWidth() + "px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5470 |
var p = [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5471 |
{style: "left", start: findWindowWidth(), end: 0, template: "%0px"} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5472 |
]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5473 |
anim.startAnimating(new Morpher(backstage.toolbar,config.animDuration,p)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5474 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5475 |
backstage.area.style.left = "0px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5476 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5477 |
this.showButton.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5478 |
this.hideButton.style.display = "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5479 |
config.options.chkBackstage = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5480 |
saveOptionCookie("chkBackstage"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5481 |
addClass(this.content,"backstageVisible"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5482 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5483 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5484 |
hide: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5485 |
if(this.currTabElem) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5486 |
this.switchTab(null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5487 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5488 |
backstage.toolbar.style.left = "0px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5489 |
if(anim && config.options.chkAnimate) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5490 |
var p = [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5491 |
{style: "left", start: 0, end: findWindowWidth(), template: "%0px"} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5492 |
]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5493 |
var c = function(element,properties) {backstage.area.style.display = "none";}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5494 |
anim.startAnimating(new Morpher(backstage.toolbar,config.animDuration,p,c)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5495 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5496 |
this.area.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5497 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5498 |
this.showButton.style.display = "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5499 |
this.hideButton.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5500 |
config.options.chkBackstage = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5501 |
saveOptionCookie("chkBackstage"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5502 |
removeClass(this.content,"backstageVisible"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5503 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5504 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5505 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5506 |
onClickCommand: function(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5507 |
var task = config.tasks[this.getAttribute("task")]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5508 |
displayMessage(task); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5509 |
if(task.action) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5510 |
backstage.switchTab(null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5511 |
task.action(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5512 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5513 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5514 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5515 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5516 |
onClickTab: function(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5517 |
backstage.switchTab(this.getAttribute("task")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5518 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5519 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5520 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5521 |
// Switch to a given tab, or none if null is passed |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5522 |
switchTab: function(tabName) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5523 |
var tabElem = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5524 |
var e = this.toolbar.firstChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5525 |
while(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5526 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5527 |
if(e.getAttribute && e.getAttribute("task") == tabName) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5528 |
tabElem = e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5529 |
e = e.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5530 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5531 |
if(tabName == backstage.currTabName) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5532 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5533 |
if(backstage.currTabElem) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5534 |
removeClass(this.currTabElem,"backstageSelTab"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5535 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5536 |
if(tabElem && tabName) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5537 |
backstage.preparePanel(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5538 |
addClass(tabElem,"backstageSelTab"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5539 |
var task = config.tasks[tabName]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5540 |
wikify(task.content,backstage.panelBody,null,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5541 |
backstage.showPanel(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5542 |
} else if(backstage.currTabElem) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5543 |
backstage.hidePanel(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5544 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5545 |
backstage.currTabName = tabName; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5546 |
backstage.currTabElem = tabElem; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5547 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5548 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5549 |
isPanelVisible: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5550 |
return backstage.panel ? backstage.panel.style.display == "block" : false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5551 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5552 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5553 |
preparePanel: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5554 |
backstage.cloak.style.height = findWindowHeight() + "px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5555 |
backstage.cloak.style.display = "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5556 |
removeChildren(backstage.panelBody); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5557 |
return backstage.panelBody; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5558 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5559 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5560 |
showPanel: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5561 |
backstage.panel.style.display = "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5562 |
if(anim && config.options.chkAnimate) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5563 |
backstage.panel.style.top = (-backstage.panel.offsetHeight) + "px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5564 |
var p = [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5565 |
{style: "top", start: -backstage.panel.offsetHeight, end: 0, template: "%0px"} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5566 |
]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5567 |
anim.startAnimating(new Morpher(backstage.panel,config.animDuration,p),new Scroller(backstage.panel,false)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5568 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5569 |
backstage.panel.style.top = "0px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5570 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5571 |
return backstage.panelBody; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5572 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5573 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5574 |
hidePanel: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5575 |
backstage.currTabName = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5576 |
backstage.currTabElem = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5577 |
if(anim && config.options.chkAnimate) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5578 |
var p = [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5579 |
{style: "top", start: 0, end: -(backstage.panel.offsetHeight), template: "%0px"}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5580 |
{style: "display", atEnd: "none"} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5581 |
]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5582 |
var c = function(element,properties) {backstage.cloak.style.display = "none";}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5583 |
anim.startAnimating(new Morpher(backstage.panel,config.animDuration,p,c)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5584 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5585 |
backstage.panel.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5586 |
backstage.cloak.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5587 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5588 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5589 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5590 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5591 |
config.macros.backstage = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5592 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5593 |
config.macros.backstage.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5594 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5595 |
var backstageTask = config.tasks[params[0]]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5596 |
if(backstageTask) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5597 |
createTiddlyButton(place,backstageTask.text,backstageTask.tooltip,function(e) {backstage.switchTab(params[0]); return false;}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5598 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5599 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5600 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5601 |
//-- ImportTiddlers macro |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5602 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5603 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5604 |
config.macros.importTiddlers.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5605 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5606 |
if(readOnly) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5607 |
createTiddlyElement(place,"div",null,"marked",this.readOnlyWarning); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5608 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5609 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5610 |
var w = new Wizard(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5611 |
w.createWizard(place,this.wizardTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5612 |
this.restart(w); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5613 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5614 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5615 |
config.macros.importTiddlers.onCancel = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5616 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5617 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5618 |
var place = wizard.clear(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5619 |
config.macros.importTiddlers.restart(wizard); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5620 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5621 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5622 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5623 |
config.macros.importTiddlers.onClose = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5624 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5625 |
backstage.hidePanel(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5626 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5627 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5628 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5629 |
config.macros.importTiddlers.restart = function(wizard) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5630 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5631 |
wizard.addStep(this.step1Title,this.step1Html); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5632 |
var s = wizard.getElement("selTypes"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5633 |
for(var t in config.adaptors) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5634 |
var e = createTiddlyElement(s,"option",null,null,config.adaptors[t].serverLabel ? config.adaptors[t].serverLabel : t); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5635 |
e.value = t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5636 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5637 |
if(config.defaultAdaptor) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5638 |
s.value = config.defaultAdaptor; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5639 |
s = wizard.getElement("selFeeds"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5640 |
var feeds = this.getFeeds(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5641 |
for(t in feeds) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5642 |
e = createTiddlyElement(s,"option",null,null,t); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5643 |
e.value = t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5644 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5645 |
wizard.setValue("feeds",feeds); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5646 |
s.onchange = config.macros.importTiddlers.onFeedChange; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5647 |
var fileInput = wizard.getElement("txtBrowse"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5648 |
fileInput.onchange = config.macros.importTiddlers.onBrowseChange; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5649 |
fileInput.onkeyup = config.macros.importTiddlers.onBrowseChange; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5650 |
wizard.setButtons([{caption: this.openLabel, tooltip: this.openPrompt, onClick: config.macros.importTiddlers.onOpen}]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5651 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5652 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5653 |
config.macros.importTiddlers.getFeeds = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5654 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5655 |
var feeds = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5656 |
var tagged = store.getTaggedTiddlers("systemServer","title"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5657 |
for(var t=0; t<tagged.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5658 |
var title = tagged[t].title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5659 |
var serverType = store.getTiddlerSlice(title,"Type"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5660 |
if(!serverType) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5661 |
serverType = "file"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5662 |
feeds[title] = {title: title, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5663 |
url: store.getTiddlerSlice(title,"URL"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5664 |
workspace: store.getTiddlerSlice(title,"Workspace"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5665 |
workspaceList: store.getTiddlerSlice(title,"WorkspaceList"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5666 |
tiddlerFilter: store.getTiddlerSlice(title,"TiddlerFilter"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5667 |
serverType: serverType, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5668 |
description: store.getTiddlerSlice(title,"Description")}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5669 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5670 |
return feeds; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5671 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5672 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5673 |
config.macros.importTiddlers.onFeedChange = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5674 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5675 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5676 |
var selTypes = wizard.getElement("selTypes"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5677 |
var fileInput = wizard.getElement("txtPath"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5678 |
var feeds = wizard.getValue("feeds"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5679 |
var f = feeds[this.value]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5680 |
if(f) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5681 |
selTypes.value = f.serverType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5682 |
fileInput.value = f.url; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5683 |
wizard.setValue("feedName",f.serverType); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5684 |
wizard.setValue("feedHost",f.url); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5685 |
wizard.setValue("feedWorkspace",f.workspace); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5686 |
wizard.setValue("feedWorkspaceList",f.workspaceList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5687 |
wizard.setValue("feedTiddlerFilter",f.tiddlerFilter); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5688 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5689 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5690 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5691 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5692 |
config.macros.importTiddlers.onBrowseChange = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5693 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5694 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5695 |
var fileInput = wizard.getElement("txtPath"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5696 |
fileInput.value = "file://" + this.value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5697 |
var serverType = wizard.getElement("selTypes"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5698 |
serverType.value = "file"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5699 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5700 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5701 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5702 |
config.macros.importTiddlers.onOpen = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5703 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5704 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5705 |
var fileInput = wizard.getElement("txtPath"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5706 |
var url = fileInput.value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5707 |
var serverType = wizard.getElement("selTypes").value || config.defaultAdaptor; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5708 |
var adaptor = new config.adaptors[serverType]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5709 |
wizard.setValue("adaptor",adaptor); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5710 |
wizard.setValue("serverType",serverType); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5711 |
wizard.setValue("host",url); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5712 |
var ret = adaptor.openHost(url,null,wizard,config.macros.importTiddlers.onOpenHost); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5713 |
if(ret !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5714 |
displayMessage(ret); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5715 |
wizard.setButtons([{caption: config.macros.importTiddlers.cancelLabel, tooltip: config.macros.importTiddlers.cancelPrompt, onClick: config.macros.importTiddlers.onCancel}],config.macros.importTiddlers.statusOpenHost); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5716 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5717 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5718 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5719 |
config.macros.importTiddlers.onOpenHost = function(context,wizard) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5720 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5721 |
var adaptor = wizard.getValue("adaptor"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5722 |
if(context.status !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5723 |
displayMessage("Error in importTiddlers.onOpenHost: " + context.statusText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5724 |
var ret = adaptor.getWorkspaceList(context,wizard,config.macros.importTiddlers.onGetWorkspaceList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5725 |
if(ret !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5726 |
displayMessage(ret); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5727 |
wizard.setButtons([{caption: config.macros.importTiddlers.cancelLabel, tooltip: config.macros.importTiddlers.cancelPrompt, onClick: config.macros.importTiddlers.onCancel}],config.macros.importTiddlers.statusGetWorkspaceList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5728 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5729 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5730 |
config.macros.importTiddlers.onGetWorkspaceList = function(context,wizard) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5731 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5732 |
if(context.status !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5733 |
displayMessage("Error in importTiddlers.onGetWorkspaceList: " + context.statusText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5734 |
wizard.setValue("context",context); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5735 |
var workspace = wizard.getValue("feedWorkspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5736 |
if(!workspace && context.workspaces.length==1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5737 |
workspace = context.workspaces[0].title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5738 |
if(workspace) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5739 |
var ret = context.adaptor.openWorkspace(workspace,context,wizard,config.macros.importTiddlers.onOpenWorkspace); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5740 |
if(ret !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5741 |
displayMessage(ret); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5742 |
wizard.setValue("workspace",workspace); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5743 |
wizard.setButtons([{caption: config.macros.importTiddlers.cancelLabel, tooltip: config.macros.importTiddlers.cancelPrompt, onClick: config.macros.importTiddlers.onCancel}],config.macros.importTiddlers.statusOpenWorkspace); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5744 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5745 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5746 |
wizard.addStep(config.macros.importTiddlers.step2Title,config.macros.importTiddlers.step2Html); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5747 |
var s = wizard.getElement("selWorkspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5748 |
s.onchange = config.macros.importTiddlers.onWorkspaceChange; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5749 |
for(var t=0; t<context.workspaces.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5750 |
var e = createTiddlyElement(s,"option",null,null,context.workspaces[t].title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5751 |
e.value = context.workspaces[t].title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5752 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5753 |
var workspaceList = wizard.getValue("feedWorkspaceList"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5754 |
if(workspaceList) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5755 |
var list = workspaceList.parseParams("workspace",null,false,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5756 |
for(var n=1; n<list.length; n++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5757 |
if(context.workspaces.findByField("title",list[n].value) == null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5758 |
e = createTiddlyElement(s,"option",null,null,list[n].value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5759 |
e.value = list[n].value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5760 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5761 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5762 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5763 |
if(workspace) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5764 |
t = wizard.getElement("txtWorkspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5765 |
t.value = workspace; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5766 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5767 |
wizard.setButtons([{caption: config.macros.importTiddlers.openLabel, tooltip: config.macros.importTiddlers.openPrompt, onClick: config.macros.importTiddlers.onChooseWorkspace}]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5768 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5769 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5770 |
config.macros.importTiddlers.onWorkspaceChange = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5771 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5772 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5773 |
var t = wizard.getElement("txtWorkspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5774 |
t.value = this.value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5775 |
this.selectedIndex = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5776 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5777 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5778 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5779 |
config.macros.importTiddlers.onChooseWorkspace = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5780 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5781 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5782 |
var adaptor = wizard.getValue("adaptor"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5783 |
var workspace = wizard.getElement("txtWorkspace").value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5784 |
wizard.setValue("workspace",workspace); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5785 |
var context = wizard.getValue("context"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5786 |
var ret = adaptor.openWorkspace(workspace,context,wizard,config.macros.importTiddlers.onOpenWorkspace); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5787 |
if(ret !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5788 |
displayMessage(ret); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5789 |
wizard.setButtons([{caption: config.macros.importTiddlers.cancelLabel, tooltip: config.macros.importTiddlers.cancelPrompt, onClick: config.macros.importTiddlers.onCancel}],config.macros.importTiddlers.statusOpenWorkspace); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5790 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5791 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5792 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5793 |
config.macros.importTiddlers.onOpenWorkspace = function(context,wizard) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5794 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5795 |
if(context.status !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5796 |
displayMessage("Error in importTiddlers.onOpenWorkspace: " + context.statusText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5797 |
var adaptor = wizard.getValue("adaptor"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5798 |
var ret = adaptor.getTiddlerList(context,wizard,config.macros.importTiddlers.onGetTiddlerList,wizard.getValue("feedTiddlerFilter")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5799 |
if(ret !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5800 |
displayMessage(ret); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5801 |
wizard.setButtons([{caption: config.macros.importTiddlers.cancelLabel, tooltip: config.macros.importTiddlers.cancelPrompt, onClick: config.macros.importTiddlers.onCancel}],config.macros.importTiddlers.statusGetTiddlerList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5802 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5803 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5804 |
config.macros.importTiddlers.onGetTiddlerList = function(context,wizard) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5805 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5806 |
if(context.status !== true) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5807 |
wizard.setButtons([{caption: config.macros.importTiddlers.cancelLabel, tooltip: config.macros.importTiddlers.cancelPrompt, onClick: config.macros.importTiddlers.onCancel}],config.macros.importTiddlers.errorGettingTiddlerList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5808 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5809 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5810 |
// Extract data for the listview |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5811 |
var listedTiddlers = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5812 |
if(context.tiddlers) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5813 |
for(var n=0; n<context.tiddlers.length; n++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5814 |
var tiddler = context.tiddlers[n]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5815 |
listedTiddlers.push({ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5816 |
title: tiddler.title, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5817 |
modified: tiddler.modified, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5818 |
modifier: tiddler.modifier, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5819 |
text: tiddler.text ? wikifyPlainText(tiddler.text,100) : "", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5820 |
tags: tiddler.tags, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5821 |
size: tiddler.text ? tiddler.text.length : 0, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5822 |
tiddler: tiddler |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5823 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5824 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5825 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5826 |
listedTiddlers.sort(function(a,b) {return a.title < b.title ? -1 : (a.title == b.title ? 0 : +1);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5827 |
// Display the listview |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5828 |
wizard.addStep(config.macros.importTiddlers.step3Title,config.macros.importTiddlers.step3Html); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5829 |
var markList = wizard.getElement("markList"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5830 |
var listWrapper = document.createElement("div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5831 |
markList.parentNode.insertBefore(listWrapper,markList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5832 |
var listView = ListView.create(listWrapper,listedTiddlers,config.macros.importTiddlers.listViewTemplate); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5833 |
wizard.setValue("listView",listView); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5834 |
var txtSaveTiddler = wizard.getElement("txtSaveTiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5835 |
txtSaveTiddler.value = config.macros.importTiddlers.generateSystemServerName(wizard); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5836 |
wizard.setButtons([ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5837 |
{caption: config.macros.importTiddlers.cancelLabel, tooltip: config.macros.importTiddlers.cancelPrompt, onClick: config.macros.importTiddlers.onCancel}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5838 |
{caption: config.macros.importTiddlers.importLabel, tooltip: config.macros.importTiddlers.importPrompt, onClick: config.macros.importTiddlers.doImport} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5839 |
]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5840 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5841 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5842 |
config.macros.importTiddlers.generateSystemServerName = function(wizard) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5843 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5844 |
var serverType = wizard.getValue("serverType"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5845 |
var host = wizard.getValue("host"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5846 |
var workspace = wizard.getValue("workspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5847 |
var pattern = config.macros.importTiddlers[workspace ? "systemServerNamePattern" : "systemServerNamePatternNoWorkspace"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5848 |
return pattern.format([serverType,host,workspace]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5849 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5850 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5851 |
config.macros.importTiddlers.saveServerTiddler = function(wizard) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5852 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5853 |
var txtSaveTiddler = wizard.getElement("txtSaveTiddler").value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5854 |
if(store.tiddlerExists(txtSaveTiddler)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5855 |
if(!confirm(config.macros.importTiddlers.confirmOverwriteSaveTiddler.format([txtSaveTiddler]))) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5856 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5857 |
store.suspendNotifications(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5858 |
store.removeTiddler(txtSaveTiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5859 |
store.resumeNotifications(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5860 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5861 |
var serverType = wizard.getValue("serverType"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5862 |
var host = wizard.getValue("host"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5863 |
var workspace = wizard.getValue("workspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5864 |
var text = config.macros.importTiddlers.serverSaveTemplate.format([serverType,host,workspace]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5865 |
store.saveTiddler(txtSaveTiddler,txtSaveTiddler,text,config.macros.importTiddlers.serverSaveModifier,new Date(),["systemServer"]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5866 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5867 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5868 |
config.macros.importTiddlers.doImport = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5869 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5870 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5871 |
if(wizard.getElement("chkSave").checked) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5872 |
config.macros.importTiddlers.saveServerTiddler(wizard); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5873 |
var chkSync = wizard.getElement("chkSync").checked; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5874 |
wizard.setValue("sync",chkSync); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5875 |
var listView = wizard.getValue("listView"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5876 |
var rowNames = ListView.getSelectedRows(listView); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5877 |
var adaptor = wizard.getValue("adaptor"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5878 |
var overwrite = new Array(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5879 |
var t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5880 |
for(t=0; t<rowNames.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5881 |
if(store.tiddlerExists(rowNames[t])) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5882 |
overwrite.push(rowNames[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5883 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5884 |
if(overwrite.length > 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5885 |
if(!confirm(config.macros.importTiddlers.confirmOverwriteText.format([overwrite.join(", ")]))) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5886 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5887 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5888 |
wizard.addStep(config.macros.importTiddlers.step4Title.format([rowNames.length]),config.macros.importTiddlers.step4Html); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5889 |
for(t=0; t<rowNames.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5890 |
var link = document.createElement("div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5891 |
createTiddlyLink(link,rowNames[t],true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5892 |
var place = wizard.getElement("markReport"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5893 |
place.parentNode.insertBefore(link,place); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5894 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5895 |
wizard.setValue("remainingImports",rowNames.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5896 |
wizard.setButtons([ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5897 |
{caption: config.macros.importTiddlers.cancelLabel, tooltip: config.macros.importTiddlers.cancelPrompt, onClick: config.macros.importTiddlers.onCancel} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5898 |
],config.macros.importTiddlers.statusDoingImport); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5899 |
for(t=0; t<rowNames.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5900 |
var context = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5901 |
context.allowSynchronous = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5902 |
var inbound = adaptor.getTiddler(rowNames[t],context,wizard,config.macros.importTiddlers.onGetTiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5903 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5904 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5905 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5906 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5907 |
config.macros.importTiddlers.onGetTiddler = function(context,wizard) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5908 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5909 |
if(!context.status) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5910 |
displayMessage("Error in importTiddlers.onGetTiddler: " + context.statusText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5911 |
var tiddler = context.tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5912 |
store.suspendNotifications(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5913 |
store.saveTiddler(tiddler.title, tiddler.title, tiddler.text, tiddler.modifier, tiddler.modified, tiddler.tags, tiddler.fields, true, tiddler.created); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5914 |
if(!wizard.getValue("sync")) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5915 |
store.setValue(tiddler.title,'server',null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5916 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5917 |
store.resumeNotifications(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5918 |
if(!context.isSynchronous) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5919 |
store.notify(tiddler.title,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5920 |
var remainingImports = wizard.getValue("remainingImports")-1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5921 |
wizard.setValue("remainingImports",remainingImports); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5922 |
if(remainingImports == 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5923 |
if(context.isSynchronous) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5924 |
store.notifyAll(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5925 |
refreshDisplay(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5926 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5927 |
wizard.setButtons([ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5928 |
{caption: config.macros.importTiddlers.doneLabel, tooltip: config.macros.importTiddlers.donePrompt, onClick: config.macros.importTiddlers.onClose} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5929 |
],config.macros.importTiddlers.statusDoneImport); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5930 |
autoSaveChanges(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5931 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5932 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5933 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5934 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5935 |
//-- Upgrade macro |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5936 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5937 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5938 |
config.macros.upgrade.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5939 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5940 |
var w = new Wizard(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5941 |
w.createWizard(place,this.wizardTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5942 |
w.addStep(this.step1Title,this.step1Html.format([this.source,this.source])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5943 |
w.setButtons([{caption: this.upgradeLabel, tooltip: this.upgradePrompt, onClick: this.onClickUpgrade}]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5944 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5945 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5946 |
config.macros.upgrade.onClickUpgrade = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5947 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5948 |
var me = config.macros.upgrade; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5949 |
var w = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5950 |
if(window.location.protocol != "file:") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5951 |
alert(me.errorCantUpgrade); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5952 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5953 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5954 |
if(story.areAnyDirty() || store.isDirty()) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5955 |
alert(me.errorNotSaved); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5956 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5957 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5958 |
var localPath = getLocalPath(document.location.toString()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5959 |
var backupPath = getBackupPath(localPath,me.backupExtension); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5960 |
w.setValue("backupPath",backupPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5961 |
w.setButtons([],me.statusPreparingBackup); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5962 |
var original = loadOriginal(localPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5963 |
w.setButtons([],me.statusSavingBackup); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5964 |
var backup = config.browser.isIE ? ieCopyFile(backupPath,localPath) : saveFile(backupPath,original); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5965 |
if(backup != true) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5966 |
w.setButtons([],me.errorSavingBackup); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5967 |
alert(me.errorSavingBackup); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5968 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5969 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5970 |
w.setButtons([],me.statusLoadingCore); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5971 |
var load = loadRemoteFile(me.source,me.onLoadCore,w); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5972 |
if(typeof load == "string") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5973 |
w.setButtons([],me.errorLoadingCore); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5974 |
alert(me.errorLoadingCore); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5975 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5976 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5977 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5978 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5979 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5980 |
config.macros.upgrade.onLoadCore = function(status,params,responseText,url,xhr) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5981 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5982 |
var me = config.macros.upgrade; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5983 |
var w = params; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5984 |
var errMsg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5985 |
if(!status) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5986 |
errMsg = me.errorLoadingCore; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5987 |
var newVer = me.extractVersion(responseText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5988 |
if(!newVer) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5989 |
errMsg = me.errorCoreFormat; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5990 |
if(errMsg) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5991 |
w.setButtons([],errMsg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5992 |
alert(errMsg); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5993 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5994 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5995 |
var onStartUpgrade = function(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5996 |
w.setButtons([],me.statusSavingCore); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5997 |
var localPath = getLocalPath(document.location.toString()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5998 |
saveFile(localPath,responseText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5999 |
w.setButtons([],me.statusReloadingCore); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6000 |
var backupPath = w.getValue("backupPath"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6001 |
var newLoc = document.location.toString() + '?time=' + new Date().convertToYYYYMMDDHHMM() + '#upgrade:[[' + encodeURI(backupPath) + ']]'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6002 |
window.setTimeout(function () {window.location = newLoc;},10) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6003 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6004 |
var step2 = [me.step2Html_downgrade,me.step2Html_restore,me.step2Html_upgrade][compareVersions(version,newVer) + 1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6005 |
w.addStep(me.step2Title,step2.format([formatVersion(newVer),formatVersion(version)])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6006 |
w.setButtons([{caption: me.startLabel, tooltip: me.startPrompt, onClick: onStartUpgrade},{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6007 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6008 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6009 |
config.macros.upgrade.onCancel = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6010 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6011 |
var me = config.macros.upgrade; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6012 |
var w = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6013 |
w.addStep(me.step3Title,me.step3Html); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6014 |
w.setButtons([]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6015 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6016 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6017 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6018 |
config.macros.upgrade.extractVersion = function(upgradeFile) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6019 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6020 |
var re = /^var version = \{title: "([^"]+)", major: (\d+), minor: (\d+), revision: (\d+)(, beta: (\d+)){0,1}, date: new Date\("([^"]+)"\)/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6021 |
var m = re.exec(upgradeFile); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6022 |
return m ? {title: m[1], major: m[2], minor: m[3], revision: m[4], beta: m[6], date: new Date(m[7])} : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6023 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6024 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6025 |
function upgradeFrom(path) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6026 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6027 |
var importStore = new TiddlyWiki(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6028 |
var tw = loadFile(path); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6029 |
if(window.netscape !== undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6030 |
tw = convertUTF8ToUnicode(tw); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6031 |
importStore.importTiddlyWiki(tw); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6032 |
importStore.forEachTiddler(function(title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6033 |
if(!store.getTiddler(title)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6034 |
store.addTiddler(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6035 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6036 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6037 |
refreshDisplay(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6038 |
saveChanges(); //# To create appropriate Markup* sections |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6039 |
alert(config.messages.upgradeDone.format([formatVersion()])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6040 |
window.location = window.location.toString().substr(0,window.location.toString().lastIndexOf('?')); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6041 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6042 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6043 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6044 |
//-- Sync macro |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6045 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6046 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6047 |
// Synchronisation handlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6048 |
config.syncers = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6049 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6050 |
// Sync state. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6051 |
var currSync = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6052 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6053 |
// sync macro |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6054 |
config.macros.sync.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6055 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6056 |
if(!wikifier.isStatic) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6057 |
this.startSync(place); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6058 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6059 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6060 |
config.macros.sync.startSync = function(place) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6061 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6062 |
if(currSync) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6063 |
config.macros.sync.cancelSync(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6064 |
currSync = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6065 |
currSync.syncList = this.getSyncableTiddlers(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6066 |
this.createSyncTasks(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6067 |
this.preProcessSyncableTiddlers(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6068 |
var wizard = new Wizard(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6069 |
currSync.wizard = wizard; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6070 |
wizard.createWizard(place,this.wizardTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6071 |
wizard.addStep(this.step1Title,this.step1Html); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6072 |
var markList = wizard.getElement("markList"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6073 |
var listWrapper = document.createElement("div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6074 |
markList.parentNode.insertBefore(listWrapper,markList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6075 |
currSync.listView = ListView.create(listWrapper,currSync.syncList,this.listViewTemplate); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6076 |
this.processSyncableTiddlers(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6077 |
wizard.setButtons([ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6078 |
{caption: this.syncLabel, tooltip: this.syncPrompt, onClick: this.doSync} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6079 |
]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6080 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6081 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6082 |
config.macros.sync.getSyncableTiddlers = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6083 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6084 |
var list = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6085 |
store.forEachTiddler(function(title,tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6086 |
var syncItem = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6087 |
syncItem.serverType = tiddler.getServerType(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6088 |
syncItem.serverHost = tiddler.fields['server.host']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6089 |
syncItem.serverWorkspace = tiddler.fields['server.workspace']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6090 |
syncItem.tiddler = tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6091 |
syncItem.title = tiddler.title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6092 |
syncItem.isTouched = tiddler.isTouched(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6093 |
syncItem.selected = syncItem.isTouched; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6094 |
syncItem.syncStatus = config.macros.sync.syncStatusList[syncItem.isTouched ? "changedLocally" : "none"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6095 |
syncItem.status = syncItem.syncStatus.text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6096 |
if(syncItem.serverType && syncItem.serverHost) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6097 |
list.push(syncItem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6098 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6099 |
list.sort(function(a,b) {return a.title < b.title ? -1 : (a.title == b.title ? 0 : +1);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6100 |
return list; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6101 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6102 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6103 |
config.macros.sync.preProcessSyncableTiddlers = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6104 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6105 |
for(var t=0; t<currSync.syncList.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6106 |
si = currSync.syncList[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6107 |
var ti = si.syncTask.syncMachine.generateTiddlerInfo(si.tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6108 |
si.serverUrl = ti.uri; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6109 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6110 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6111 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6112 |
config.macros.sync.processSyncableTiddlers = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6113 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6114 |
for(var t=0; t<currSync.syncList.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6115 |
si = currSync.syncList[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6116 |
si.rowElement.style.backgroundColor = si.syncStatus.color; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6117 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6118 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6119 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6120 |
config.macros.sync.createSyncTasks = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6121 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6122 |
currSync.syncTasks = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6123 |
for(var t=0; t<currSync.syncList.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6124 |
var si = currSync.syncList[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6125 |
var r = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6126 |
for(var st=0; st<currSync.syncTasks.length; st++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6127 |
var cst = currSync.syncTasks[st]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6128 |
if(si.serverType == cst.serverType && si.serverHost == cst.serverHost && si.serverWorkspace == cst.serverWorkspace) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6129 |
r = cst; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6130 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6131 |
if(r == null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6132 |
si.syncTask = this.createSyncTask(si); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6133 |
currSync.syncTasks.push(si.syncTask); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6134 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6135 |
si.syncTask = r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6136 |
r.syncItems.push(si); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6137 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6138 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6139 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6140 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6141 |
config.macros.sync.createSyncTask = function(syncItem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6142 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6143 |
var st = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6144 |
st.serverType = syncItem.serverType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6145 |
st.serverHost = syncItem.serverHost; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6146 |
st.serverWorkspace = syncItem.serverWorkspace; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6147 |
st.syncItems = [syncItem]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6148 |
st.syncMachine = new SyncMachine(st.serverType,{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6149 |
start: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6150 |
return this.openHost(st.serverHost,"openWorkspace"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6151 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6152 |
openWorkspace: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6153 |
return this.openWorkspace(st.serverWorkspace,"getTiddlerList"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6154 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6155 |
getTiddlerList: function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6156 |
return this.getTiddlerList("onGetTiddlerList"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6157 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6158 |
onGetTiddlerList: function(context) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6159 |
var tiddlers = context.tiddlers; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6160 |
for(var t=0; t<st.syncItems.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6161 |
var si = st.syncItems[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6162 |
var f = tiddlers.findByField("title",si.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6163 |
if(f !== null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6164 |
if(tiddlers[f].fields['server.page.revision'] > si.tiddler.fields['server.page.revision']) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6165 |
si.syncStatus = config.macros.sync.syncStatusList[si.isTouched ? 'changedBoth' : 'changedServer']; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6166 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6167 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6168 |
si.syncStatus = config.macros.sync.syncStatusList.notFound; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6169 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6170 |
config.macros.sync.updateSyncStatus(si); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6171 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6172 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6173 |
getTiddler: function(title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6174 |
return this.getTiddler(title,"onGetTiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6175 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6176 |
onGetTiddler: function(context) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6177 |
var tiddler = context.tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6178 |
var syncItem = st.syncItems.findByField("title",tiddler.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6179 |
if(syncItem !== null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6180 |
syncItem = st.syncItems[syncItem]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6181 |
store.saveTiddler(tiddler.title, tiddler.title, tiddler.text, tiddler.modifier, tiddler.modified, tiddler.tags, tiddler.fields, true, tiddler.created); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6182 |
syncItem.syncStatus = config.macros.sync.syncStatusList.gotFromServer; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6183 |
config.macros.sync.updateSyncStatus(syncItem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6184 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6185 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6186 |
putTiddler: function(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6187 |
return this.putTiddler(tiddler,"onPutTiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6188 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6189 |
onPutTiddler: function(context) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6190 |
var title = context.title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6191 |
var syncItem = st.syncItems.findByField("title",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6192 |
if(syncItem !== null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6193 |
syncItem = st.syncItems[syncItem]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6194 |
store.resetTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6195 |
syncItem.syncStatus = config.macros.sync.syncStatusList.putToServer; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6196 |
config.macros.sync.updateSyncStatus(syncItem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6197 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6198 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6199 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6200 |
st.syncMachine.go(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6201 |
return st; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6202 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6203 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6204 |
config.macros.sync.updateSyncStatus = function(syncItem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6205 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6206 |
var e = syncItem.colElements["status"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6207 |
removeChildren(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6208 |
createTiddlyText(e,syncItem.syncStatus.text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6209 |
syncItem.rowElement.style.backgroundColor = syncItem.syncStatus.color; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6210 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6211 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6212 |
config.macros.sync.doSync = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6213 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6214 |
var rowNames = ListView.getSelectedRows(currSync.listView); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6215 |
for(var t=0; t<currSync.syncList.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6216 |
var si = currSync.syncList[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6217 |
if(rowNames.indexOf(si.title) != -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6218 |
config.macros.sync.doSyncItem(si); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6219 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6220 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6221 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6222 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6223 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6224 |
config.macros.sync.doSyncItem = function(syncItem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6225 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6226 |
var r = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6227 |
var sl = config.macros.sync.syncStatusList; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6228 |
switch(syncItem.syncStatus) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6229 |
case sl.changedServer: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6230 |
r = syncItem.syncTask.syncMachine.go("getTiddler",syncItem.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6231 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6232 |
case sl.notFound: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6233 |
case sl.changedLocally: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6234 |
case sl.changedBoth: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6235 |
r = syncItem.syncTask.syncMachine.go("putTiddler",syncItem.tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6236 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6237 |
default: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6238 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6239 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6240 |
if(r !== true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6241 |
displayMessage("Error in doSyncItem: " + r); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6242 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6243 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6244 |
config.macros.sync.cancelSync = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6245 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6246 |
currSync = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6247 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6248 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6249 |
function SyncMachine(serverType,steps) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6250 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6251 |
this.serverType = serverType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6252 |
this.adaptor = new config.adaptors[serverType]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6253 |
this.steps = steps; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6254 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6255 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6256 |
SyncMachine.prototype.go = function(step,context) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6257 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6258 |
var r = context ? context.status : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6259 |
if(typeof r == "string") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6260 |
this.invokeError(r); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6261 |
return r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6262 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6263 |
var h = this.steps[step ? step : "start"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6264 |
if(!h) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6265 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6266 |
r = h.call(this,context); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6267 |
if(typeof r == "string") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6268 |
this.invokeError(r); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6269 |
return r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6270 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6271 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6272 |
SyncMachine.prototype.invokeError = function(message) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6273 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6274 |
if(this.steps.error) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6275 |
this.steps.error(message); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6276 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6277 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6278 |
SyncMachine.prototype.openHost = function(host,nextStep) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6279 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6280 |
var me = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6281 |
return me.adaptor.openHost(host,null,null,function(context) {me.go(nextStep,context);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6282 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6283 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6284 |
SyncMachine.prototype.getWorkspaceList = function(nextStep) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6285 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6286 |
var me = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6287 |
return me.adaptor.getWorkspaceList(null,null,function(context) {me.go(nextStep,context);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6288 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6289 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6290 |
SyncMachine.prototype.openWorkspace = function(workspace,nextStep) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6291 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6292 |
var me = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6293 |
return me.adaptor.openWorkspace(workspace,null,null,function(context) {me.go(nextStep,context);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6294 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6295 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6296 |
SyncMachine.prototype.getTiddlerList = function(nextStep) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6297 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6298 |
var me = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6299 |
return me.adaptor.getTiddlerList(null,null,function(context) {me.go(nextStep,context);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6300 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6301 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6302 |
SyncMachine.prototype.generateTiddlerInfo = function(tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6303 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6304 |
return this.adaptor.generateTiddlerInfo(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6305 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6306 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6307 |
SyncMachine.prototype.getTiddler = function(title,nextStep) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6308 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6309 |
var me = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6310 |
return me.adaptor.getTiddler(title,null,null,function(context) {me.go(nextStep,context);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6311 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6312 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6313 |
SyncMachine.prototype.putTiddler = function(tiddler,nextStep) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6314 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6315 |
var me = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6316 |
return me.adaptor.putTiddler(tiddler,null,null,function(context) {me.go(nextStep,context);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6317 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6318 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6319 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6320 |
//-- Manager UI for groups of tiddlers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6321 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6322 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6323 |
config.macros.plugins.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6324 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6325 |
var wizard = new Wizard(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6326 |
wizard.createWizard(place,this.wizardTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6327 |
wizard.addStep(this.step1Title,this.step1Html); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6328 |
var markList = wizard.getElement("markList"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6329 |
var listWrapper = document.createElement("div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6330 |
markList.parentNode.insertBefore(listWrapper,markList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6331 |
listWrapper.setAttribute("refresh","macro"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6332 |
listWrapper.setAttribute("macroName","plugins"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6333 |
listWrapper.setAttribute("params",paramString); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6334 |
this.refresh(listWrapper,paramString); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6335 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6336 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6337 |
config.macros.plugins.refresh = function(listWrapper,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6338 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6339 |
var wizard = new Wizard(listWrapper); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6340 |
var selectedRows = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6341 |
ListView.forEachSelector(listWrapper,function(e,rowName) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6342 |
if(e.checked) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6343 |
selectedRows.push(e.getAttribute("rowName")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6344 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6345 |
removeChildren(listWrapper); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6346 |
params = params.parseParams("anon"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6347 |
var plugins = installedPlugins.slice(0); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6348 |
var t,tiddler,p; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6349 |
var configTiddlers = store.getTaggedTiddlers("systemConfig"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6350 |
for(t=0; t<configTiddlers.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6351 |
tiddler = configTiddlers[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6352 |
if(plugins.findByField("title",tiddler.title) == null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6353 |
p = getPluginInfo(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6354 |
p.executed = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6355 |
p.log.splice(0,0,this.skippedText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6356 |
plugins.push(p); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6357 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6358 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6359 |
for(t=0; t<plugins.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6360 |
p = plugins[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6361 |
p.size = p.tiddler.text ? p.tiddler.text.length : 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6362 |
p.forced = p.tiddler.isTagged("systemConfigForce"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6363 |
p.disabled = p.tiddler.isTagged("systemConfigDisable"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6364 |
p.Selected = selectedRows.indexOf(plugins[t].title) != -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6365 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6366 |
if(plugins.length == 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6367 |
createTiddlyElement(listWrapper,"em",null,null,this.noPluginText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6368 |
wizard.setButtons([]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6369 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6370 |
var listView = ListView.create(listWrapper,plugins,this.listViewTemplate,this.onSelectCommand); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6371 |
wizard.setValue("listView",listView); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6372 |
wizard.setButtons([ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6373 |
{caption: config.macros.plugins.removeLabel, tooltip: config.macros.plugins.removePrompt, onClick: config.macros.plugins.doRemoveTag}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6374 |
{caption: config.macros.plugins.deleteLabel, tooltip: config.macros.plugins.deletePrompt, onClick: config.macros.plugins.doDelete} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6375 |
]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6376 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6377 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6378 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6379 |
config.macros.plugins.doRemoveTag = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6380 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6381 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6382 |
var listView = wizard.getValue("listView"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6383 |
var rowNames = ListView.getSelectedRows(listView); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6384 |
if(rowNames.length == 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6385 |
alert(config.messages.nothingSelected); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6386 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6387 |
for(var t=0; t<rowNames.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6388 |
store.setTiddlerTag(rowNames[t],false,"systemConfig"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6389 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6390 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6391 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6392 |
config.macros.plugins.doDelete = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6393 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6394 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6395 |
var listView = wizard.getValue("listView"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6396 |
var rowNames = ListView.getSelectedRows(listView); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6397 |
if(rowNames.length == 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6398 |
alert(config.messages.nothingSelected); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6399 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6400 |
if(confirm(config.macros.plugins.confirmDeleteText.format([rowNames.join(", ")]))) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6401 |
for(t=0; t<rowNames.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6402 |
store.removeTiddler(rowNames[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6403 |
story.closeTiddler(rowNames[t],true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6404 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6405 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6406 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6407 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6408 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6409 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6410 |
//-- Message area |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6411 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6412 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6413 |
function getMessageDiv() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6414 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6415 |
var msgArea = document.getElementById("messageArea"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6416 |
if(!msgArea) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6417 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6418 |
if(!msgArea.hasChildNodes()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6419 |
createTiddlyButton(createTiddlyElement(msgArea,"div",null,"messageToolbar"), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6420 |
config.messages.messageClose.text, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6421 |
config.messages.messageClose.tooltip, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6422 |
clearMessage); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6423 |
msgArea.style.display = "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6424 |
return createTiddlyElement(msgArea,"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6425 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6426 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6427 |
function displayMessage(text,linkText) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6428 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6429 |
var e = getMessageDiv(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6430 |
if(!e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6431 |
alert(text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6432 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6433 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6434 |
if(linkText) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6435 |
var link = createTiddlyElement(e,"a",null,null,text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6436 |
link.href = linkText; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6437 |
link.target = "_blank"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6438 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6439 |
e.appendChild(document.createTextNode(text)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6440 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6441 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6442 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6443 |
function clearMessage() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6444 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6445 |
var msgArea = document.getElementById("messageArea"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6446 |
if(msgArea) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6447 |
removeChildren(msgArea); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6448 |
msgArea.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6449 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6450 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6451 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6452 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6453 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6454 |
//-- Refresh mechanism |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6455 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6456 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6457 |
config.refreshers = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6458 |
link: function(e,changeList) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6459 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6460 |
var title = e.getAttribute("tiddlyLink"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6461 |
refreshTiddlyLink(e,title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6462 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6463 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6464 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6465 |
tiddler: function(e,changeList) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6466 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6467 |
var title = e.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6468 |
var template = e.getAttribute("template"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6469 |
if(changeList && changeList.indexOf(title) != -1 && !story.isDirty(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6470 |
story.refreshTiddler(title,template,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6471 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6472 |
refreshElements(e,changeList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6473 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6474 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6475 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6476 |
content: function(e,changeList) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6477 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6478 |
var title = e.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6479 |
var force = e.getAttribute("force"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6480 |
if(force != null || changeList == null || changeList.indexOf(title) != -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6481 |
removeChildren(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6482 |
wikify(store.getTiddlerText(title,title),e,null,store.fetchTiddler(title)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6483 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6484 |
} else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6485 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6486 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6487 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6488 |
macro: function(e,changeList) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6489 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6490 |
var macro = e.getAttribute("macroName"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6491 |
var params = e.getAttribute("params"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6492 |
if(macro) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6493 |
macro = config.macros[macro]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6494 |
if(macro && macro.refresh) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6495 |
macro.refresh(e,params); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6496 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6497 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6498 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6499 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6500 |
config.refresherData = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6501 |
styleSheet: "StyleSheet", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6502 |
defaultStyleSheet: "StyleSheet", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6503 |
pageTemplate: "PageTemplate", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6504 |
defaultPageTemplate: "PageTemplate", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6505 |
colorPalette: "ColorPalette", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6506 |
defaultColorPalette: "ColorPalette" |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6507 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6508 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6509 |
function refreshElements(root,changeList) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6510 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6511 |
var nodes = root.childNodes; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6512 |
for(var c=0; c<nodes.length; c++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6513 |
var e = nodes[c], type = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6514 |
if(e.getAttribute && (e.tagName ? e.tagName != "IFRAME" : true)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6515 |
type = e.getAttribute("refresh"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6516 |
var refresher = config.refreshers[type]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6517 |
var refreshed = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6518 |
if(refresher != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6519 |
refreshed = refresher(e,changeList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6520 |
if(e.hasChildNodes() && !refreshed) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6521 |
refreshElements(e,changeList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6522 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6523 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6524 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6525 |
function applyHtmlMacros(root,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6526 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6527 |
var e = root.firstChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6528 |
while(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6529 |
var nextChild = e.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6530 |
if(e.getAttribute) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6531 |
var macro = e.getAttribute("macro"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6532 |
if(macro) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6533 |
var params = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6534 |
var p = macro.indexOf(" "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6535 |
if(p != -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6536 |
params = macro.substr(p+1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6537 |
macro = macro.substr(0,p); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6538 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6539 |
invokeMacro(e,macro,params,null,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6540 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6541 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6542 |
if(e.hasChildNodes()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6543 |
applyHtmlMacros(e,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6544 |
e = nextChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6545 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6546 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6547 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6548 |
function refreshPageTemplate(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6549 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6550 |
var stash = createTiddlyElement(document.body,"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6551 |
stash.style.display = "none"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6552 |
var display = story.getContainer(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6553 |
var nodes,t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6554 |
if(display) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6555 |
nodes = display.childNodes; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6556 |
for(t=nodes.length-1; t>=0; t--) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6557 |
stash.appendChild(nodes[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6558 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6559 |
var wrapper = document.getElementById("contentWrapper"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6560 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6561 |
isAvailable = function(title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6562 |
var s = title ? title.indexOf(config.textPrimitives.sectionSeparator) : -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6563 |
if(s!=-1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6564 |
title = title.substr(0,s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6565 |
return store.tiddlerExists(title) || store.isShadowTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6566 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6567 |
if(!title || !isAvailable(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6568 |
title = config.refresherData.pageTemplate; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6569 |
if(!isAvailable(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6570 |
title = config.refresherData.defaultPageTemplate; //# this one is always avaialable |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6571 |
html = store.getRecursiveTiddlerText(title,null,10); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6572 |
wrapper.innerHTML = html; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6573 |
applyHtmlMacros(wrapper); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6574 |
refreshElements(wrapper); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6575 |
display = story.getContainer(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6576 |
removeChildren(display); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6577 |
if(!display) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6578 |
display = createTiddlyElement(wrapper,"div",story.containerId()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6579 |
nodes = stash.childNodes; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6580 |
for(t=nodes.length-1; t>=0; t--) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6581 |
display.appendChild(nodes[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6582 |
removeNode(stash); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6583 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6584 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6585 |
function refreshDisplay(hint) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6586 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6587 |
if(typeof hint == "string") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6588 |
hint = [hint]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6589 |
var e = document.getElementById("contentWrapper"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6590 |
refreshElements(e,hint); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6591 |
if(backstage.isPanelVisible()) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6592 |
e = document.getElementById("backstage"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6593 |
refreshElements(e,hint); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6594 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6595 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6596 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6597 |
function refreshPageTitle() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6598 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6599 |
document.title = getPageTitle(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6600 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6601 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6602 |
function getPageTitle() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6603 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6604 |
var st = wikifyPlain("SiteTitle"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6605 |
var ss = wikifyPlain("SiteSubtitle"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6606 |
return st + ((st == "" || ss == "") ? "" : " - ") + ss; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6607 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6608 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6609 |
function refreshStyles(title,doc) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6610 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6611 |
setStylesheet(title == null ? "" : store.getRecursiveTiddlerText(title,"",10),title,doc ? doc : document); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6612 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6613 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6614 |
function refreshColorPalette(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6615 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6616 |
if(!startingUp) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6617 |
refreshAll(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6618 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6619 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6620 |
function refreshAll() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6621 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6622 |
refreshPageTemplate(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6623 |
refreshDisplay(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6624 |
refreshStyles("StyleSheetLayout"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6625 |
refreshStyles("StyleSheetColors"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6626 |
refreshStyles(config.refresherData.styleSheet); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6627 |
refreshStyles("StyleSheetPrint"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6628 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6629 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6630 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6631 |
//-- Options stuff |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6632 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6633 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6634 |
config.optionHandlers = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6635 |
'txt': { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6636 |
get: function(name) {return encodeCookie(config.options[name].toString());}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6637 |
set: function(name,value) {config.options[name] = decodeCookie(value);} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6638 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6639 |
'chk': { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6640 |
get: function(name) {return config.options[name] ? "true" : "false";}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6641 |
set: function(name,value) {config.options[name] = value == "true";} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6642 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6643 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6644 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6645 |
function loadOptionsCookie() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6646 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6647 |
if(safeMode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6648 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6649 |
var cookies = document.cookie.split(";"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6650 |
for(var c=0; c<cookies.length; c++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6651 |
var p = cookies[c].indexOf("="); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6652 |
if(p != -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6653 |
var name = cookies[c].substr(0,p).trim(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6654 |
var value = cookies[c].substr(p+1).trim(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6655 |
var optType = name.substr(0,3); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6656 |
if(config.optionHandlers[optType] && config.optionHandlers[optType].set) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6657 |
config.optionHandlers[optType].set(name,value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6658 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6659 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6660 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6661 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6662 |
function saveOptionCookie(name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6663 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6664 |
if(safeMode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6665 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6666 |
var c = name + "="; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6667 |
var optType = name.substr(0,3); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6668 |
if(config.optionHandlers[optType] && config.optionHandlers[optType].get) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6669 |
c += config.optionHandlers[optType].get(name); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6670 |
c += "; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6671 |
document.cookie = c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6672 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6673 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6674 |
function encodeCookie(s) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6675 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6676 |
return escape(manualConvertUnicodeToUTF8(s)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6677 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6678 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6679 |
function decodeCookie(s) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6680 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6681 |
s = unescape(s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6682 |
var re = /&#[0-9]{1,5};/g; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6683 |
return s.replace(re,function($0) {return String.fromCharCode(eval($0.replace(/[&#;]/g,"")));}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6684 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6685 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6686 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6687 |
config.macros.option.genericCreate = function(place,type,opt,className,desc) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6688 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6689 |
var typeInfo = config.macros.option.types[type]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6690 |
var c = document.createElement(typeInfo.elementType); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6691 |
if(typeInfo.typeValue) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6692 |
c.setAttribute("type",typeInfo.typeValue); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6693 |
c[typeInfo.eventName] = typeInfo.onChange; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6694 |
c.setAttribute("option",opt); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6695 |
if(className) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6696 |
c.className = className; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6697 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6698 |
c.className = typeInfo.className; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6699 |
if(config.optionsDesc[opt]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6700 |
c.setAttribute("title",config.optionsDesc[opt]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6701 |
place.appendChild(c); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6702 |
if(desc != "no") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6703 |
createTiddlyText(place,config.optionsDesc[opt] ? config.optionsDesc[opt] : opt); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6704 |
c[typeInfo.valueField] = config.options[opt]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6705 |
return c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6706 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6707 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6708 |
config.macros.option.genericOnChange = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6709 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6710 |
var opt = this.getAttribute("option"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6711 |
if(opt) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6712 |
var optType = opt.substr(0,3); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6713 |
var handler = config.macros.option.types[optType]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6714 |
if(handler.elementType && handler.valueField) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6715 |
config.macros.option.propagateOption(opt,handler.valueField,this[handler.valueField],handler.elementType); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6716 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6717 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6718 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6719 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6720 |
config.macros.option.types = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6721 |
'txt': { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6722 |
elementType: "input", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6723 |
valueField: "value", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6724 |
eventName: "onkeyup", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6725 |
className: "txtOptionInput", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6726 |
create: config.macros.option.genericCreate, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6727 |
onChange: config.macros.option.genericOnChange |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6728 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6729 |
'chk': { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6730 |
elementType: "input", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6731 |
valueField: "checked", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6732 |
eventName: "onclick", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6733 |
className: "chkOptionInput", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6734 |
typeValue: "checkbox", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6735 |
create: config.macros.option.genericCreate, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6736 |
onChange: config.macros.option.genericOnChange |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6737 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6738 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6739 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6740 |
config.macros.option.propagateOption = function(opt,valueField,value,elementType) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6741 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6742 |
config.options[opt] = value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6743 |
saveOptionCookie(opt); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6744 |
var nodes = document.getElementsByTagName(elementType); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6745 |
for(var t=0; t<nodes.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6746 |
var optNode = nodes[t].getAttribute("option"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6747 |
if(opt == optNode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6748 |
nodes[t][valueField] = value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6749 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6750 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6751 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6752 |
config.macros.option.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6753 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6754 |
params = paramString.parseParams("anon",null,true,false,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6755 |
var opt = (params[1] && params[1].name == "anon") ? params[1].value : getParam(params,"name",null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6756 |
var className = (params[2] && params[2].name == "anon") ? params[2].value : getParam(params,"class",null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6757 |
var desc = getParam(params,"desc","no"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6758 |
var type = opt.substr(0,3); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6759 |
var h = config.macros.option.types[type]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6760 |
if(h && h.create) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6761 |
h.create(place,type,opt,className,desc); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6762 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6763 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6764 |
config.macros.options.handler = function(place,macroName,params,wikifier,paramString,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6765 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6766 |
params = paramString.parseParams("anon",null,true,false,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6767 |
var showUnknown = getParam(params,"showUnknown","no"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6768 |
var wizard = new Wizard(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6769 |
wizard.createWizard(place,this.wizardTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6770 |
wizard.addStep(this.step1Title,this.step1Html); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6771 |
var markList = wizard.getElement("markList"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6772 |
var chkUnknown = wizard.getElement("chkUnknown"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6773 |
chkUnknown.checked = showUnknown == "yes"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6774 |
chkUnknown.onchange = this.onChangeUnknown; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6775 |
var listWrapper = document.createElement("div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6776 |
markList.parentNode.insertBefore(listWrapper,markList); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6777 |
wizard.setValue("listWrapper",listWrapper); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6778 |
this.refreshOptions(listWrapper,showUnknown == "yes"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6779 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6780 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6781 |
config.macros.options.refreshOptions = function(listWrapper,showUnknown) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6782 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6783 |
var opts = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6784 |
for(var n in config.options) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6785 |
var opt = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6786 |
opt.option = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6787 |
opt.name = n; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6788 |
opt.lowlight = !config.optionsDesc[n]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6789 |
opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6790 |
if(!opt.lowlight || showUnknown) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6791 |
opts.push(opt); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6792 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6793 |
opts.sort(function(a,b) {return a.name.substr(3) < b.name.substr(3) ? -1 : (a.name.substr(3) == b.name.substr(3) ? 0 : +1);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6794 |
var listview = ListView.create(listWrapper,opts,this.listViewTemplate); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6795 |
for(n=0; n<opts.length; n++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6796 |
var type = opts[n].name.substr(0,3); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6797 |
var h = config.macros.option.types[type]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6798 |
if(h && h.create) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6799 |
h.create(opts[n].colElements['option'],type,opts[n].name,null,"no"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6800 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6801 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6802 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6803 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6804 |
config.macros.options.onChangeUnknown = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6805 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6806 |
var wizard = new Wizard(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6807 |
var listWrapper = wizard.getValue("listWrapper"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6808 |
removeChildren(listWrapper); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6809 |
config.macros.options.refreshOptions(listWrapper,this.checked); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6810 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6811 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6812 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6813 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6814 |
//-- Saving |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6815 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6816 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6817 |
var saveUsingSafari = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6818 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6819 |
var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6820 |
var endSaveArea = '</d' + 'iv>'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6821 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6822 |
// If there are unsaved changes, force the user to confirm before exitting |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6823 |
function confirmExit() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6824 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6825 |
hadConfirmExit = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6826 |
if((store && store.isDirty && store.isDirty()) || (story && story.areAnyDirty && story.areAnyDirty())) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6827 |
return config.messages.confirmExit; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6828 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6829 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6830 |
// Give the user a chance to save changes before exitting |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6831 |
function checkUnsavedChanges() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6832 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6833 |
if(store && store.isDirty && store.isDirty() && window.hadConfirmExit === false) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6834 |
if(confirm(config.messages.unsavedChangesWarning)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6835 |
saveChanges(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6836 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6837 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6838 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6839 |
function updateLanguageAttribute(s) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6840 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6841 |
if(config.locale) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6842 |
var mRE = /(<html(?:.*?)?)(?: xml:lang\="([a-z]+)")?(?: lang\="([a-z]+)")?>/; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6843 |
var m = mRE.exec(s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6844 |
if(m) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6845 |
var t = m[1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6846 |
if(m[2]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6847 |
t += ' xml:lang="' + config.locale + '"'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6848 |
if(m[3]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6849 |
t += ' lang="' + config.locale + '"'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6850 |
t += ">"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6851 |
s = s.substr(0,m.index) + t + s.substr(m.index+m[0].length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6852 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6853 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6854 |
return s; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6855 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6856 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6857 |
function updateMarkupBlock(s,blockName,tiddlerName) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6858 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6859 |
return s.replaceChunk( |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6860 |
"<!--%0-START-->".format([blockName]), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6861 |
"<!--%0-END-->".format([blockName]), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6862 |
"\n" + convertUnicodeToUTF8(store.getRecursiveTiddlerText(tiddlerName,"")) + "\n"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6863 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6864 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6865 |
function updateOriginal(original,posDiv) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6866 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6867 |
if(!posDiv) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6868 |
posDiv = locateStoreArea(original); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6869 |
if(!posDiv) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6870 |
alert(config.messages.invalidFileError.format([localPath])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6871 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6872 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6873 |
var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6874 |
convertUnicodeToUTF8(store.allTiddlersAsHtml()) + "\n" + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6875 |
original.substr(posDiv[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6876 |
var newSiteTitle = convertUnicodeToUTF8(getPageTitle()).htmlEncode(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6877 |
revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6878 |
revised = updateLanguageAttribute(revised); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6879 |
revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6880 |
revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6881 |
revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6882 |
revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6883 |
return revised; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6884 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6885 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6886 |
function locateStoreArea(original) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6887 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6888 |
// Locate the storeArea div's |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6889 |
var posOpeningDiv = original.indexOf(startSaveArea); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6890 |
var limitClosingDiv = original.indexOf("<"+"!--POST-STOREAREA--"+">"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6891 |
if(limitClosingDiv == -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6892 |
limitClosingDiv = original.indexOf("<"+"!--POST-BODY-START--"+">"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6893 |
var posClosingDiv = original.lastIndexOf(endSaveArea,limitClosingDiv == -1 ? original.length : limitClosingDiv); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6894 |
return (posOpeningDiv != -1 && posClosingDiv != -1) ? [posOpeningDiv,posClosingDiv] : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6895 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6896 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6897 |
function autoSaveChanges(onlyIfDirty,tiddlers) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6898 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6899 |
if(config.options.chkAutoSave) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6900 |
saveChanges(onlyIfDirty,tiddlers); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6901 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6902 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6903 |
function loadOriginal(localPath) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6904 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6905 |
return loadFile(localPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6906 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6907 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6908 |
// Save this tiddlywiki with the pending changes |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6909 |
function saveChanges(onlyIfDirty,tiddlers) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6910 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6911 |
if(onlyIfDirty && !store.isDirty()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6912 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6913 |
clearMessage(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6914 |
var t0 = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6915 |
var originalPath = document.location.toString(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6916 |
if(originalPath.substr(0,5) != "file:") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6917 |
alert(config.messages.notFileUrlError); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6918 |
if(store.tiddlerExists(config.messages.saveInstructions)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6919 |
story.displayTiddler(null,config.messages.saveInstructions); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6920 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6921 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6922 |
var localPath = getLocalPath(originalPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6923 |
var original = loadOriginal(localPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6924 |
if(original == null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6925 |
alert(config.messages.cantSaveError); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6926 |
if(store.tiddlerExists(config.messages.saveInstructions)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6927 |
story.displayTiddler(null,config.messages.saveInstructions); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6928 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6929 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6930 |
var posDiv = locateStoreArea(original); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6931 |
if(!posDiv) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6932 |
alert(config.messages.invalidFileError.format([localPath])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6933 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6934 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6935 |
saveMain(localPath,original,posDiv); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6936 |
if(config.options.chkSaveBackups) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6937 |
saveBackup(localPath,original); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6938 |
if(config.options.chkSaveEmptyTemplate) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6939 |
saveEmpty(localPath,original,posDiv); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6940 |
if(config.options.chkGenerateAnRssFeed) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6941 |
saveRss(localPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6942 |
if(config.options.chkDisplayInstrumentation) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6943 |
displayMessage("saveChanges " + (new Date()-t0) + " ms"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6944 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6945 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6946 |
function saveMain(localPath,original,posDiv) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6947 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6948 |
var save; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6949 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6950 |
var revised = updateOriginal(original,posDiv); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6951 |
save = saveFile(localPath,revised); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6952 |
} catch (ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6953 |
showException(ex); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6954 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6955 |
if(save) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6956 |
displayMessage(config.messages.mainSaved,"file://" + localPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6957 |
store.setDirty(false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6958 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6959 |
alert(config.messages.mainFailed); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6960 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6961 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6962 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6963 |
function saveBackup(localPath,original) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6964 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6965 |
var backupPath = getBackupPath(localPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6966 |
var backup = copyFile(backupPath,localPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6967 |
if(!backup) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6968 |
backup = saveFile(backupPath,original); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6969 |
if(backup) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6970 |
displayMessage(config.messages.backupSaved,"file://" + backupPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6971 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6972 |
alert(config.messages.backupFailed); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6973 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6974 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6975 |
function saveEmpty(localPath,original,posDiv) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6976 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6977 |
var emptyPath,p; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6978 |
if((p = localPath.lastIndexOf("/")) != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6979 |
emptyPath = localPath.substr(0,p) + "/"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6980 |
else if((p = localPath.lastIndexOf("\\")) != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6981 |
emptyPath = localPath.substr(0,p) + "\\"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6982 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6983 |
emptyPath = localPath + "."; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6984 |
emptyPath += "empty.html"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6985 |
var empty = original.substr(0,posDiv[0] + startSaveArea.length) + original.substr(posDiv[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6986 |
var emptySave = saveFile(emptyPath,empty); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6987 |
if(emptySave) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6988 |
displayMessage(config.messages.emptySaved,"file://" + emptyPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6989 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6990 |
alert(config.messages.emptyFailed); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6991 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6992 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6993 |
function saveRss(localPath) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6994 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6995 |
var rssPath = localPath.substr(0,localPath.lastIndexOf(".")) + ".xml"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6996 |
if(saveFile(rssPath,convertUnicodeToUTF8(generateRss()))) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6997 |
displayMessage(config.messages.rssSaved,"file://" + rssPath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6998 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6999 |
alert(config.messages.rssFailed); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7000 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7001 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7002 |
function getLocalPath(origPath) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7003 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7004 |
var originalPath = convertUriToUTF8(origPath,config.options.txtFileSystemCharSet); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7005 |
// Remove any location or query part of the URL |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7006 |
var argPos = originalPath.indexOf("?"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7007 |
if(argPos != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7008 |
originalPath = originalPath.substr(0,argPos); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7009 |
var hashPos = originalPath.indexOf("#"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7010 |
if(hashPos != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7011 |
originalPath = originalPath.substr(0,hashPos); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7012 |
// Convert file://localhost/ to file:/// |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7013 |
if(originalPath.indexOf("file://localhost/") == 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7014 |
originalPath = "file://" + originalPath.substr(16); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7015 |
// Convert to a native file format |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7016 |
var localPath; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7017 |
if(originalPath.charAt(9) == ":") // pc local file |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7018 |
localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\\"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7019 |
else if(originalPath.indexOf("file://///") == 0) // FireFox pc network file |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7020 |
localPath = "\\\\" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\\"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7021 |
else if(originalPath.indexOf("file:///") == 0) // mac/unix local file |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7022 |
localPath = unescape(originalPath.substr(7)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7023 |
else if(originalPath.indexOf("file:/") == 0) // mac/unix local file |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7024 |
localPath = unescape(originalPath.substr(5)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7025 |
else // pc network file |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7026 |
localPath = "\\\\" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\\"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7027 |
return localPath; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7028 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7029 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7030 |
function getBackupPath(localPath,title,extension) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7031 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7032 |
var slash = "\\"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7033 |
var dirPathPos = localPath.lastIndexOf("\\"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7034 |
if(dirPathPos == -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7035 |
dirPathPos = localPath.lastIndexOf("/"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7036 |
slash = "/"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7037 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7038 |
var backupFolder = config.options.txtBackupFolder; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7039 |
if(!backupFolder || backupFolder == "") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7040 |
backupFolder = "."; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7041 |
var backupPath = localPath.substr(0,dirPathPos) + slash + backupFolder + localPath.substr(dirPathPos); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7042 |
backupPath = backupPath.substr(0,backupPath.lastIndexOf(".")) + "."; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7043 |
if(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7044 |
backupPath += title.replace(/[\\\/\*\?\":<> ]/g,"_") + "."; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7045 |
backupPath += (new Date()).convertToYYYYMMDDHHMMSSMMM() + "." + (extension ? extension : "html"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7046 |
return backupPath; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7047 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7048 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7049 |
function generateRss() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7050 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7051 |
var s = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7052 |
var d = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7053 |
var u = store.getTiddlerText("SiteUrl"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7054 |
// Assemble the header |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7055 |
s.push("<" + "?xml version=\"1.0\"?" + ">"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7056 |
s.push("<rss version=\"2.0\">"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7057 |
s.push("<channel>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7058 |
s.push("<title" + ">" + wikifyPlain("SiteTitle").htmlEncode() + "</title" + ">"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7059 |
if(u) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7060 |
s.push("<link>" + u.htmlEncode() + "</link>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7061 |
s.push("<description>" + wikifyPlain("SiteSubtitle").htmlEncode() + "</description>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7062 |
s.push("<language>en-us</language>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7063 |
s.push("<copyright>Copyright " + d.getFullYear() + " " + config.options.txtUserName.htmlEncode() + "</copyright>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7064 |
s.push("<pubDate>" + d.toGMTString() + "</pubDate>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7065 |
s.push("<lastBuildDate>" + d.toGMTString() + "</lastBuildDate>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7066 |
s.push("<docs>http://blogs.law.harvard.edu/tech/rss</docs>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7067 |
s.push("<generator>TiddlyWiki " + formatVersion() + "</generator>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7068 |
// The body |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7069 |
var tiddlers = store.getTiddlers("modified","excludeLists"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7070 |
var n = config.numRssItems > tiddlers.length ? 0 : tiddlers.length-config.numRssItems; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7071 |
for(var t=tiddlers.length-1; t>=n; t--) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7072 |
s.push("<item>\n" + tiddlers[t].toRssItem(u) + "\n</item>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7073 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7074 |
// And footer |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7075 |
s.push("</channel>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7076 |
s.push("</rss>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7077 |
// Save it all |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7078 |
return s.join("\n"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7079 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7080 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7081 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7082 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7083 |
//-- Filesystem code |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7084 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7085 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7086 |
function convertUTF8ToUnicode(u) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7087 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7088 |
return window.netscape == undefined ? manualConvertUTF8ToUnicode(u) : mozConvertUTF8ToUnicode(u); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7089 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7090 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7091 |
function manualConvertUTF8ToUnicode(utf) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7092 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7093 |
var uni = utf; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7094 |
var src = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7095 |
var dst = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7096 |
var b1, b2, b3; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7097 |
var c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7098 |
while(src < utf.length) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7099 |
b1 = utf.charCodeAt(src++); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7100 |
if(b1 < 0x80) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7101 |
dst++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7102 |
} else if(b1 < 0xE0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7103 |
b2 = utf.charCodeAt(src++); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7104 |
c = String.fromCharCode(((b1 & 0x1F) << 6) | (b2 & 0x3F)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7105 |
uni = uni.substring(0,dst++).concat(c,utf.substr(src)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7106 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7107 |
b2 = utf.charCodeAt(src++); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7108 |
b3 = utf.charCodeAt(src++); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7109 |
c = String.fromCharCode(((b1 & 0xF) << 12) | ((b2 & 0x3F) << 6) | (b3 & 0x3F)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7110 |
uni = uni.substring(0,dst++).concat(c,utf.substr(src)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7111 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7112 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7113 |
return uni; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7114 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7115 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7116 |
function mozConvertUTF8ToUnicode(u) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7117 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7118 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7119 |
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7120 |
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7121 |
converter.charset = "UTF-8"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7122 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7123 |
return manualConvertUTF8ToUnicode(u); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7124 |
} // fallback |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7125 |
var s = converter.ConvertToUnicode(u); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7126 |
var fin = converter.Finish(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7127 |
return (fin.length > 0) ? s+fin : s; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7128 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7129 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7130 |
function convertUnicodeToUTF8(s) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7131 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7132 |
if(window.netscape == undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7133 |
return manualConvertUnicodeToUTF8(s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7134 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7135 |
return mozConvertUnicodeToUTF8(s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7136 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7137 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7138 |
function manualConvertUnicodeToUTF8(s) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7139 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7140 |
var re = /[^\u0000-\u007F]/g ; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7141 |
return s.replace(re,function($0) {return "&#" + $0.charCodeAt(0).toString() + ";";}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7142 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7143 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7144 |
function mozConvertUnicodeToUTF8(s) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7145 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7146 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7147 |
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7148 |
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7149 |
converter.charset = "UTF-8"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7150 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7151 |
return manualConvertUnicodeToUTF8(s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7152 |
} // fallback |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7153 |
var u = converter.ConvertFromUnicode(s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7154 |
var fin = converter.Finish(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7155 |
return fin.length > 0 ? u + fin : u; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7156 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7157 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7158 |
function convertUriToUTF8(uri,charSet) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7159 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7160 |
if(window.netscape == undefined || charSet == undefined || charSet == "") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7161 |
return uri; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7162 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7163 |
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7164 |
var converter = Components.classes["@mozilla.org/intl/utf8converterservice;1"].getService(Components.interfaces.nsIUTF8ConverterService); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7165 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7166 |
return uri; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7167 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7168 |
return converter.convertURISpecToUTF8(uri,charSet); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7169 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7170 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7171 |
function copyFile(dest,source) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7172 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7173 |
return config.browser.isIE ? ieCopyFile(dest,source) : false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7174 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7175 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7176 |
function saveFile(fileUrl,content) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7177 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7178 |
var r = mozillaSaveFile(fileUrl,content); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7179 |
if(!r) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7180 |
r = ieSaveFile(fileUrl,content); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7181 |
if(!r) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7182 |
r = javaSaveFile(fileUrl,content); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7183 |
return r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7184 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7185 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7186 |
function loadFile(fileUrl) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7187 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7188 |
var r = mozillaLoadFile(fileUrl); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7189 |
if((r == null) || (r == false)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7190 |
r = ieLoadFile(fileUrl); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7191 |
if((r == null) || (r == false)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7192 |
r = javaLoadFile(fileUrl); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7193 |
return r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7194 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7195 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7196 |
function ieCreatePath(path) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7197 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7198 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7199 |
var fso = new ActiveXObject("Scripting.FileSystemObject"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7200 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7201 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7202 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7203 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7204 |
var pos = path.lastIndexOf("\\"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7205 |
if(pos!=-1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7206 |
path = path.substring(0, pos+1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7207 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7208 |
var scan = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7209 |
scan.push(path); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7210 |
var i = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7211 |
do { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7212 |
var parent = fso.GetParentFolderName(scan[i++]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7213 |
if(fso.FolderExists(parent)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7214 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7215 |
scan.push(parent); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7216 |
} while(true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7217 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7218 |
for(i=scan.length-1;i>=0;i--) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7219 |
if(!fso.FolderExists(scan[i])) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7220 |
fso.CreateFolder(scan[i]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7221 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7222 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7223 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7224 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7225 |
// Returns null if it can't do it, false if there's an error, true if it saved OK |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7226 |
function ieSaveFile(filePath,content) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7227 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7228 |
ieCreatePath(filePath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7229 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7230 |
var fso = new ActiveXObject("Scripting.FileSystemObject"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7231 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7232 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7233 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7234 |
var file = fso.OpenTextFile(filePath,2,-1,0); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7235 |
file.Write(content); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7236 |
file.Close(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7237 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7238 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7239 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7240 |
// Returns null if it can't do it, false if there's an error, or a string of the content if successful |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7241 |
function ieLoadFile(filePath) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7242 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7243 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7244 |
var fso = new ActiveXObject("Scripting.FileSystemObject"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7245 |
var file = fso.OpenTextFile(filePath,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7246 |
var content = file.ReadAll(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7247 |
file.Close(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7248 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7249 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7250 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7251 |
return content; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7252 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7253 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7254 |
function ieCopyFile(dest,source) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7255 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7256 |
ieCreatePath(dest); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7257 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7258 |
var fso = new ActiveXObject("Scripting.FileSystemObject"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7259 |
fso.GetFile(source).Copy(dest); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7260 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7261 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7262 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7263 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7264 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7265 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7266 |
// Returns null if it can't do it, false if there's an error, true if it saved OK |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7267 |
function mozillaSaveFile(filePath,content) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7268 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7269 |
if(window.Components) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7270 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7271 |
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7272 |
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7273 |
file.initWithPath(filePath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7274 |
if(!file.exists()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7275 |
file.create(0,0664); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7276 |
var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7277 |
out.init(file,0x20|0x02,00004,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7278 |
out.write(content,content.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7279 |
out.flush(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7280 |
out.close(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7281 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7282 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7283 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7284 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7285 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7286 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7287 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7288 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7289 |
// Returns null if it can't do it, false if there's an error, or a string of the content if successful |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7290 |
function mozillaLoadFile(filePath) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7291 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7292 |
if(window.Components) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7293 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7294 |
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7295 |
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7296 |
file.initWithPath(filePath); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7297 |
if(!file.exists()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7298 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7299 |
var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7300 |
inputStream.init(file,0x01,00004,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7301 |
var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7302 |
sInputStream.init(inputStream); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7303 |
var contents = sInputStream.read(sInputStream.available()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7304 |
sInputStream.close(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7305 |
inputStream.close(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7306 |
return contents; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7307 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7308 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7309 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7310 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7311 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7312 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7313 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7314 |
function javaUrlToFilename(url) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7315 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7316 |
var f = "//localhost"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7317 |
if(url.indexOf(f) == 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7318 |
return url.substring(f.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7319 |
var i = url.indexOf(":"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7320 |
if(i > 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7321 |
return url.substring(i-1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7322 |
return url; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7323 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7324 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7325 |
function javaSaveFile(filePath,content) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7326 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7327 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7328 |
if(document.applets["TiddlySaver"]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7329 |
return document.applets["TiddlySaver"].saveFile(javaUrlToFilename(filePath),"UTF-8",content); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7330 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7331 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7332 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7333 |
var s = new java.io.PrintStream(new java.io.FileOutputStream(javaUrlToFilename(filePath))); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7334 |
s.print(content); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7335 |
s.close(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7336 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7337 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7338 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7339 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7340 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7341 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7342 |
function javaLoadFile(filePath) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7343 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7344 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7345 |
if(document.applets["TiddlySaver"]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7346 |
return String(document.applets["TiddlySaver"].loadFile(javaUrlToFilename(filePath),"UTF-8")); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7347 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7348 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7349 |
var content = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7350 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7351 |
var r = new java.io.BufferedReader(new java.io.FileReader(javaUrlToFilename(filePath))); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7352 |
var line; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7353 |
while((line = r.readLine()) != null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7354 |
content.push(new String(line)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7355 |
r.close(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7356 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7357 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7358 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7359 |
return content.join("\n"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7360 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7361 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7362 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7363 |
//-- Server adaptor for talking to static TiddlyWiki files |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7364 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7365 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7366 |
function FileAdaptor() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7367 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7368 |
this.host = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7369 |
this.store = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7370 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7371 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7372 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7373 |
FileAdaptor.serverType = 'file'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7374 |
FileAdaptor.serverLabel = 'TiddlyWiki'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7375 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7376 |
FileAdaptor.prototype.setContext = function(context,userParams,callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7377 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7378 |
if(!context) context = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7379 |
context.userParams = userParams; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7380 |
if(callback) context.callback = callback; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7381 |
context.adaptor = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7382 |
if(!context.host) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7383 |
context.host = this.host; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7384 |
context.host = FileAdaptor.fullHostName(context.host); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7385 |
if(!context.workspace) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7386 |
context.workspace = this.workspace; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7387 |
return context; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7388 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7389 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7390 |
FileAdaptor.fullHostName = function(host) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7391 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7392 |
if(!host) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7393 |
return ''; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7394 |
if(!host.match(/:\/\//)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7395 |
host = 'http://' + host; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7396 |
return host; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7397 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7398 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7399 |
FileAdaptor.minHostName = function(host) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7400 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7401 |
return host ? host.replace(/^http:\/\//,'').replace(/\/$/,'') : ''; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7402 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7403 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7404 |
// Open the specified host |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7405 |
FileAdaptor.prototype.openHost = function(host,context,userParams,callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7406 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7407 |
this.host = host; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7408 |
context = this.setContext(context,userParams,callback); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7409 |
context.status = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7410 |
if(callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7411 |
window.setTimeout(function() {context.callback(context,userParams);},10); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7412 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7413 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7414 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7415 |
FileAdaptor.loadTiddlyWikiCallback = function(status,context,responseText,url,xhr) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7416 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7417 |
context.status = status; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7418 |
if(!status) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7419 |
context.statusText = "Error reading file"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7420 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7421 |
context.adaptor.store = new TiddlyWiki(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7422 |
if(!context.adaptor.store.importTiddlyWiki(responseText)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7423 |
context.statusText = config.messages.invalidFileError.format([url]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7424 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7425 |
context.complete(context,context.userParams); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7426 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7427 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7428 |
// Get the list of workspaces on a given server |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7429 |
FileAdaptor.prototype.getWorkspaceList = function(context,userParams,callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7430 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7431 |
context = this.setContext(context,userParams,callback); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7432 |
context.workspaces = [{title:"(default)"}]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7433 |
context.status = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7434 |
if(callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7435 |
window.setTimeout(function() {callback(context,userParams);},10); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7436 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7437 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7438 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7439 |
// Open the specified workspace |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7440 |
FileAdaptor.prototype.openWorkspace = function(workspace,context,userParams,callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7441 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7442 |
this.workspace = workspace; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7443 |
context = this.setContext(context,userParams,callback); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7444 |
context.status = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7445 |
if(callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7446 |
window.setTimeout(function() {callback(context,userParams);},10); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7447 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7448 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7449 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7450 |
// Gets the list of tiddlers within a given workspace |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7451 |
FileAdaptor.prototype.getTiddlerList = function(context,userParams,callback,filter) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7452 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7453 |
context = this.setContext(context,userParams,callback); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7454 |
if(!context.filter) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7455 |
context.filter = filter; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7456 |
context.complete = FileAdaptor.getTiddlerListComplete; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7457 |
if(this.store) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7458 |
var ret = context.complete(context,context.userParams); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7459 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7460 |
ret = loadRemoteFile(context.host,FileAdaptor.loadTiddlyWikiCallback,context); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7461 |
if(typeof ret != "string") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7462 |
ret = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7463 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7464 |
return ret; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7465 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7466 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7467 |
FileAdaptor.getTiddlerListComplete = function(context,userParams) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7468 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7469 |
if(context.status) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7470 |
if(context.filter) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7471 |
context.tiddlers = context.adaptor.store.filterTiddlers(context.filter); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7472 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7473 |
context.tiddlers = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7474 |
context.adaptor.store.forEachTiddler(function(title,tiddler) {context.tiddlers.push(tiddler);}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7475 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7476 |
for(var i=0; i<context.tiddlers.length; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7477 |
context.tiddlers[i].fields['server.type'] = FileAdaptor.serverType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7478 |
context.tiddlers[i].fields['server.host'] = FileAdaptor.minHostName(context.host); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7479 |
context.tiddlers[i].fields['server.page.revision'] = context.tiddlers[i].modified.convertToYYYYMMDDHHMM(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7480 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7481 |
context.status = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7482 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7483 |
if(context.callback) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7484 |
window.setTimeout(function() {context.callback(context,userParams);},10); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7485 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7486 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7487 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7488 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7489 |
FileAdaptor.prototype.generateTiddlerInfo = function(tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7490 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7491 |
var info = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7492 |
info.uri = tiddler.fields['server.host'] + "#" + tiddler.title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7493 |
return info; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7494 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7495 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7496 |
// Retrieve a tiddler from a given workspace on a given server |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7497 |
FileAdaptor.prototype.getTiddler = function(title,context,userParams,callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7498 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7499 |
context = this.setContext(context,userParams,callback); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7500 |
context.title = title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7501 |
context.complete = FileAdaptor.getTiddlerComplete; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7502 |
return context.adaptor.store ? |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7503 |
context.complete(context,context.userParams) : |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7504 |
loadRemoteFile(context.host,FileAdaptor.loadTiddlyWikiCallback,context); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7505 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7506 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7507 |
FileAdaptor.getTiddlerComplete = function(context,userParams) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7508 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7509 |
var t = context.adaptor.store.fetchTiddler(context.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7510 |
t.fields['server.type'] = FileAdaptor.serverType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7511 |
t.fields['server.host'] = FileAdaptor.minHostName(context.host); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7512 |
t.fields['server.page.revision'] = t.modified.convertToYYYYMMDDHHMM(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7513 |
context.tiddler = t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7514 |
context.status = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7515 |
if(context.allowSynchronous) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7516 |
context.isSynchronous = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7517 |
context.callback(context,userParams); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7518 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7519 |
window.setTimeout(function() {context.callback(context,userParams);},10); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7520 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7521 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7522 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7523 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7524 |
FileAdaptor.prototype.close = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7525 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7526 |
delete this.store; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7527 |
this.store = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7528 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7529 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7530 |
config.adaptors[FileAdaptor.serverType] = FileAdaptor; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7531 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7532 |
config.defaultAdaptor = FileAdaptor.serverType; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7533 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7534 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7535 |
//-- Remote HTTP requests |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7536 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7537 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7538 |
function loadRemoteFile(url,callback,params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7539 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7540 |
return doHttp("GET",url,null,null,null,null,callback,params,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7541 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7542 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7543 |
// HTTP status codes |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7544 |
var httpStatus = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7545 |
OK: 200, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7546 |
ContentCreated: 201, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7547 |
NoContent: 204, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7548 |
MultiStatus: 207, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7549 |
Unauthorized: 401, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7550 |
Forbidden: 403, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7551 |
NotFound: 404, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7552 |
MethodNotAllowed: 405 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7553 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7554 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7555 |
function doHttp(type,url,data,contentType,username,password,callback,params,headers,allowCache) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7556 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7557 |
var x = getXMLHttpRequest(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7558 |
if(!x) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7559 |
return "Can't create XMLHttpRequest object"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7560 |
x.onreadystatechange = function() { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7561 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7562 |
var status = x.status; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7563 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7564 |
status = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7565 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7566 |
if(x.readyState == 4 && callback && (status !== undefined)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7567 |
if([0, httpStatus.OK, httpStatus.ContentCreated, httpStatus.NoContent, httpStatus.MultiStatus].contains(status)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7568 |
callback(true,params,x.responseText,url,x); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7569 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7570 |
callback(false,params,null,url,x); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7571 |
x.onreadystatechange = function(){}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7572 |
x = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7573 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7574 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7575 |
if(window.Components && window.netscape && window.netscape.security && document.location.protocol.indexOf("http") == -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7576 |
window.netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7577 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7578 |
if(!allowCache) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7579 |
url = url + (url.indexOf("?") < 0 ? "?" : "&") + "nocache=" + Math.random(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7580 |
x.open(type,url,true,username,password); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7581 |
if(data) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7582 |
x.setRequestHeader("Content-Type", contentType ? contentType : "application/x-www-form-urlencoded"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7583 |
if(x.overrideMimeType) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7584 |
x.setRequestHeader("Connection", "close"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7585 |
if(headers) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7586 |
for(var n in headers) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7587 |
x.setRequestHeader(n,headers[n]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7588 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7589 |
x.setRequestHeader("X-Requested-With", "TiddlyWiki " + formatVersion()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7590 |
x.send(data); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7591 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7592 |
return exceptionText(ex); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7593 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7594 |
return x; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7595 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7596 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7597 |
function getXMLHttpRequest() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7598 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7599 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7600 |
var x = new XMLHttpRequest(); // Modern |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7601 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7602 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7603 |
x = new ActiveXObject("Msxml2.XMLHTTP"); // IE 6 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7604 |
} catch (ex2) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7605 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7606 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7607 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7608 |
return x; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7609 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7610 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7611 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7612 |
//-- TiddlyWiki-specific utility functions |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7613 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7614 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7615 |
formatVersion = function(v) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7616 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7617 |
v = v || version; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7618 |
return v.major + "." + v.minor + "." + v.revision + (v.beta ? " (beta " + v.beta + ")" : ""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7619 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7620 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7621 |
compareVersions = function(v1,v2) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7622 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7623 |
var a = ["major","minor","revision"]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7624 |
for(var i = 0; i<a.length; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7625 |
var x1 = v1[a[i]] || 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7626 |
var x2 = v2[a[i]] || 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7627 |
if(x1<x2) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7628 |
return 1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7629 |
if(x1>x2) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7630 |
return -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7631 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7632 |
x1 = v1.beta || 9999; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7633 |
x2 = v2.beta || 9999; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7634 |
if(x1<x2) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7635 |
return 1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7636 |
return x1 > x2 ? -1 : 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7637 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7638 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7639 |
function createTiddlyButton(parent,text,tooltip,action,className,id,accessKey,attribs) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7640 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7641 |
var btn = document.createElement("a"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7642 |
if(action) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7643 |
btn.onclick = action; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7644 |
btn.setAttribute("href","javascript:;"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7645 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7646 |
if(tooltip) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7647 |
btn.setAttribute("title",tooltip); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7648 |
if(text) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7649 |
btn.appendChild(document.createTextNode(text)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7650 |
btn.className = className ? className : "button"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7651 |
if(id) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7652 |
btn.id = id; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7653 |
if(attribs) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7654 |
for(var n in attribs) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7655 |
btn.setAttribute(n,attribs[n]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7656 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7657 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7658 |
if(parent) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7659 |
parent.appendChild(btn); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7660 |
if(accessKey) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7661 |
btn.setAttribute("accessKey",accessKey); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7662 |
return btn; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7663 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7664 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7665 |
function createTiddlyLink(place,title,includeText,className,isStatic,linkedFromTiddler,noToggle) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7666 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7667 |
var text = includeText ? title : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7668 |
var i = getTiddlyLinkInfo(title,className); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7669 |
var btn = isStatic ? createExternalLink(place,store.getTiddlerText("SiteUrl",null) + "#" + title) : createTiddlyButton(place,text,i.subTitle,onClickTiddlerLink,i.classes); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7670 |
btn.setAttribute("refresh","link"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7671 |
btn.setAttribute("tiddlyLink",title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7672 |
if(noToggle) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7673 |
btn.setAttribute("noToggle","true"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7674 |
if(linkedFromTiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7675 |
var fields = linkedFromTiddler.getInheritedFields(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7676 |
if(fields) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7677 |
btn.setAttribute("tiddlyFields",fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7678 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7679 |
return btn; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7680 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7681 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7682 |
function refreshTiddlyLink(e,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7683 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7684 |
var i = getTiddlyLinkInfo(title,e.className); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7685 |
e.className = i.classes; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7686 |
e.title = i.subTitle; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7687 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7688 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7689 |
function getTiddlyLinkInfo(title,currClasses) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7690 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7691 |
var classes = currClasses ? currClasses.split(" ") : []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7692 |
classes.pushUnique("tiddlyLink"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7693 |
var tiddler = store.fetchTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7694 |
var subTitle; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7695 |
if(tiddler) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7696 |
subTitle = tiddler.getSubtitle(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7697 |
classes.pushUnique("tiddlyLinkExisting"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7698 |
classes.remove("tiddlyLinkNonExisting"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7699 |
classes.remove("shadow"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7700 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7701 |
classes.remove("tiddlyLinkExisting"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7702 |
classes.pushUnique("tiddlyLinkNonExisting"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7703 |
if(store.isShadowTiddler(title)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7704 |
subTitle = config.messages.shadowedTiddlerToolTip.format([title]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7705 |
classes.pushUnique("shadow"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7706 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7707 |
subTitle = config.messages.undefinedTiddlerToolTip.format([title]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7708 |
classes.remove("shadow"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7709 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7710 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7711 |
if(typeof config.annotations[title]=="string") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7712 |
subTitle = config.annotations[title]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7713 |
return {classes: classes.join(" "),subTitle: subTitle}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7714 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7715 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7716 |
function createExternalLink(place,url) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7717 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7718 |
var link = document.createElement("a"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7719 |
link.className = "externalLink"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7720 |
link.href = url; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7721 |
link.title = config.messages.externalLinkTooltip.format([url]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7722 |
if(config.options.chkOpenInNewWindow) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7723 |
link.target = "_blank"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7724 |
place.appendChild(link); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7725 |
return link; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7726 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7727 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7728 |
// Event handler for clicking on a tiddly link |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7729 |
function onClickTiddlerLink(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7730 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7731 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7732 |
var target = resolveTarget(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7733 |
var link = target; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7734 |
var title = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7735 |
var fields = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7736 |
var noToggle = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7737 |
do { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7738 |
title = link.getAttribute("tiddlyLink"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7739 |
fields = link.getAttribute("tiddlyFields"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7740 |
noToggle = link.getAttribute("noToggle"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7741 |
link = link.parentNode; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7742 |
} while(title == null && link != null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7743 |
if(!store.isShadowTiddler(title)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7744 |
var f = fields ? fields.decodeHashMap() : {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7745 |
fields = String.encodeHashMap(merge(f,config.defaultCustomFields,true)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7746 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7747 |
if(title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7748 |
var toggling = e.metaKey || e.ctrlKey; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7749 |
if(config.options.chkToggleLinks) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7750 |
toggling = !toggling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7751 |
if(noToggle) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7752 |
toggling = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7753 |
if(store.getTiddler(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7754 |
fields = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7755 |
story.displayTiddler(target,title,null,true,null,fields,toggling); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7756 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7757 |
clearMessage(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7758 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7759 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7760 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7761 |
// Create a button for a tag with a popup listing all the tiddlers that it tags |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7762 |
function createTagButton(place,tag,excludeTiddler,title,tooltip) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7763 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7764 |
var btn = createTiddlyButton(place,title||tag,(tooltip||config.views.wikified.tag.tooltip).format([tag]),onClickTag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7765 |
btn.setAttribute("tag",tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7766 |
if(excludeTiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7767 |
btn.setAttribute("tiddler",excludeTiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7768 |
return btn; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7769 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7770 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7771 |
// Event handler for clicking on a tiddler tag |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7772 |
function onClickTag(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7773 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7774 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7775 |
var popup = Popup.create(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7776 |
var tag = this.getAttribute("tag"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7777 |
var title = this.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7778 |
if(popup && tag) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7779 |
var tagged = store.getTaggedTiddlers(tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7780 |
var titles = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7781 |
var li,r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7782 |
for(r=0;r<tagged.length;r++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7783 |
if(tagged[r].title != title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7784 |
titles.push(tagged[r].title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7785 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7786 |
var lingo = config.views.wikified.tag; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7787 |
if(titles.length > 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7788 |
var openAll = createTiddlyButton(createTiddlyElement(popup,"li"),lingo.openAllText.format([tag]),lingo.openAllTooltip,onClickTagOpenAll); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7789 |
openAll.setAttribute("tag",tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7790 |
createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7791 |
for(r=0; r<titles.length; r++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7792 |
createTiddlyLink(createTiddlyElement(popup,"li"),titles[r],true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7793 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7794 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7795 |
createTiddlyText(createTiddlyElement(popup,"li",null,"disabled"),lingo.popupNone.format([tag])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7796 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7797 |
createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7798 |
var h = createTiddlyLink(createTiddlyElement(popup,"li"),tag,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7799 |
createTiddlyText(h,lingo.openTag.format([tag])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7800 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7801 |
Popup.show(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7802 |
e.cancelBubble = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7803 |
if(e.stopPropagation) e.stopPropagation(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7804 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7805 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7806 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7807 |
// Event handler for 'open all' on a tiddler popup |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7808 |
function onClickTagOpenAll(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7809 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7810 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7811 |
var tag = this.getAttribute("tag"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7812 |
var tagged = store.getTaggedTiddlers(tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7813 |
story.displayTiddlers(this,tagged); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7814 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7815 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7816 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7817 |
function onClickError(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7818 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7819 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7820 |
var popup = Popup.create(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7821 |
var lines = this.getAttribute("errorText").split("\n"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7822 |
for(var t=0; t<lines.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7823 |
createTiddlyElement(popup,"li",null,null,lines[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7824 |
Popup.show(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7825 |
e.cancelBubble = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7826 |
if(e.stopPropagation) e.stopPropagation(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7827 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7828 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7829 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7830 |
function createTiddlyDropDown(place,onchange,options,defaultValue) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7831 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7832 |
var sel = createTiddlyElement(place,"select"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7833 |
sel.onchange = onchange; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7834 |
for(var t=0; t<options.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7835 |
var e = createTiddlyElement(sel,"option",null,null,options[t].caption); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7836 |
e.value = options[t].name; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7837 |
if(options[t].name == defaultValue) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7838 |
e.selected = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7839 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7840 |
return sel; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7841 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7842 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7843 |
function createTiddlyPopup(place,caption,tooltip,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7844 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7845 |
if(tiddler.text) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7846 |
createTiddlyLink(place,caption,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7847 |
var btn = createTiddlyButton(place,glyph("downArrow"),tooltip,onClickTiddlyPopup,"tiddlerPopupButton"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7848 |
btn.tiddler = tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7849 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7850 |
createTiddlyText(place,caption); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7851 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7852 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7853 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7854 |
function onClickTiddlyPopup(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7855 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7856 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7857 |
var tiddler = this.tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7858 |
if(tiddler.text) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7859 |
var popup = Popup.create(this,"div","popupTiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7860 |
wikify(tiddler.text,popup,null,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7861 |
Popup.show(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7862 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7863 |
if(e) e.cancelBubble = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7864 |
if(e && e.stopPropagation) e.stopPropagation(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7865 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7866 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7867 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7868 |
function createTiddlyError(place,title,text) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7869 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7870 |
var btn = createTiddlyButton(place,title,null,onClickError,"errorButton"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7871 |
if(text) btn.setAttribute("errorText",text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7872 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7873 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7874 |
function merge(dst,src,preserveExisting) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7875 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7876 |
for(p in src) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7877 |
if(!preserveExisting || dst[p] === undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7878 |
dst[p] = src[p]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7879 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7880 |
return dst; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7881 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7882 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7883 |
// Returns a string containing the description of an exception, optionally prepended by a message |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7884 |
function exceptionText(e,message) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7885 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7886 |
var s = e.description ? e.description : e.toString(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7887 |
return message ? "%0:\n%1".format([message,s]) : s; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7888 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7889 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7890 |
// Displays an alert of an exception description with optional message |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7891 |
function showException(e,message) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7892 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7893 |
alert(exceptionText(e,message)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7894 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7895 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7896 |
function alertAndThrow(m) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7897 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7898 |
alert(m); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7899 |
throw(m); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7900 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7901 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7902 |
function glyph(name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7903 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7904 |
var g = config.glyphs; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7905 |
var b = g.currBrowser; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7906 |
if(b == null) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7907 |
b = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7908 |
while(!g.browsers[b]() && b < g.browsers.length-1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7909 |
b++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7910 |
g.currBrowser = b; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7911 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7912 |
if(!g.codes[name]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7913 |
return ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7914 |
return g.codes[name][b]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7915 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7916 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7917 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7918 |
//- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7919 |
//- Animation engine |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7920 |
//- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7921 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7922 |
function Animator() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7923 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7924 |
this.running = 0; // Incremented at start of each animation, decremented afterwards. If zero, the interval timer is disabled |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7925 |
this.timerID = 0; // ID of the timer used for animating |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7926 |
this.animations = []; // List of animations in progress |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7927 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7928 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7929 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7930 |
// Start animation engine |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7931 |
Animator.prototype.startAnimating = function() //# Variable number of arguments |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7932 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7933 |
for(var t=0; t<arguments.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7934 |
this.animations.push(arguments[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7935 |
if(this.running == 0) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7936 |
var me = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7937 |
this.timerID = window.setInterval(function() {me.doAnimate(me);},10); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7938 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7939 |
this.running += arguments.length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7940 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7941 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7942 |
// Perform an animation engine tick, calling each of the known animation modules |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7943 |
Animator.prototype.doAnimate = function(me) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7944 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7945 |
var a = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7946 |
while(a < me.animations.length) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7947 |
var animation = me.animations[a]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7948 |
if(animation.tick()) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7949 |
a++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7950 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7951 |
me.animations.splice(a,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7952 |
if(--me.running == 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7953 |
window.clearInterval(me.timerID); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7954 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7955 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7956 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7957 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7958 |
Animator.slowInSlowOut = function(progress) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7959 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7960 |
return(1-((Math.cos(progress * Math.PI)+1)/2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7961 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7962 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7963 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7964 |
//-- Morpher animation |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7965 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7966 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7967 |
// Animate a set of properties of an element |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7968 |
function Morpher(element,duration,properties,callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7969 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7970 |
this.element = element; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7971 |
this.duration = duration; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7972 |
this.properties = properties; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7973 |
this.startTime = new Date(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7974 |
this.endTime = Number(this.startTime) + duration; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7975 |
this.callback = callback; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7976 |
this.tick(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7977 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7978 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7979 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7980 |
Morpher.prototype.assignStyle = function(element,style,value) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7981 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7982 |
switch(style) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7983 |
case "-tw-vertScroll": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7984 |
window.scrollTo(findScrollX(),value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7985 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7986 |
case "-tw-horizScroll": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7987 |
window.scrollTo(value,findScrollY()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7988 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7989 |
default: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7990 |
element.style[style] = value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7991 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7992 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7993 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7994 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7995 |
Morpher.prototype.stop = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7996 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7997 |
for(var t=0; t<this.properties.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7998 |
var p = this.properties[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7999 |
if(p.atEnd !== undefined) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8000 |
this.assignStyle(this.element,p.style,p.atEnd); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8001 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8002 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8003 |
if(this.callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8004 |
this.callback(this.element,this.properties); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8005 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8006 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8007 |
Morpher.prototype.tick = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8008 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8009 |
var currTime = Number(new Date()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8010 |
progress = Animator.slowInSlowOut(Math.min(1,(currTime-this.startTime)/this.duration)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8011 |
for(var t=0; t<this.properties.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8012 |
var p = this.properties[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8013 |
if(p.start !== undefined && p.end !== undefined) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8014 |
var template = p.template ? p.template : "%0"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8015 |
switch(p.format) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8016 |
case undefined: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8017 |
case "style": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8018 |
var v = p.start + (p.end-p.start) * progress; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8019 |
this.assignStyle(this.element,p.style,template.format([v])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8020 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8021 |
case "color": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8022 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8023 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8024 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8025 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8026 |
if(currTime >= this.endTime) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8027 |
this.stop(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8028 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8029 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8030 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8031 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8032 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8033 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8034 |
//-- Zoomer animation |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8035 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8036 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8037 |
function Zoomer(text,startElement,targetElement,unused) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8038 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8039 |
var e = createTiddlyElement(document.body,"div",null,"zoomer"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8040 |
createTiddlyElement(e,"div",null,null,text); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8041 |
var winWidth = findWindowWidth(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8042 |
var winHeight = findWindowHeight(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8043 |
var p = [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8044 |
{style: 'left', start: findPosX(startElement), end: findPosX(targetElement), template: '%0px'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8045 |
{style: 'top', start: findPosY(startElement), end: findPosY(targetElement), template: '%0px'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8046 |
{style: 'width', start: Math.min(startElement.scrollWidth,winWidth), end: Math.min(targetElement.scrollWidth,winWidth), template: '%0px', atEnd: 'auto'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8047 |
{style: 'height', start: Math.min(startElement.scrollHeight,winHeight), end: Math.min(targetElement.scrollHeight,winHeight), template: '%0px', atEnd: 'auto'}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8048 |
{style: 'fontSize', start: 8, end: 24, template: '%0pt'} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8049 |
]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8050 |
var c = function(element,properties) {removeNode(element);}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8051 |
return new Morpher(e,config.animDuration,p,c); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8052 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8053 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8054 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8055 |
//-- Scroller animation |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8056 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8057 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8058 |
function Scroller(targetElement,unused) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8059 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8060 |
var p = [ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8061 |
{style: '-tw-vertScroll', start: findScrollY(), end: ensureVisible(targetElement)} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8062 |
]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8063 |
return new Morpher(targetElement,config.animDuration,p); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8064 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8065 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8066 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8067 |
//-- Slider animation |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8068 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8069 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8070 |
// deleteMode - "none", "all" [delete target element and it's children], [only] "children" [but not the target element] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8071 |
function Slider(element,opening,unused,deleteMode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8072 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8073 |
element.style.overflow = 'hidden'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8074 |
if(opening) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8075 |
element.style.height = '0px'; // Resolves a Firefox flashing bug |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8076 |
element.style.display = 'block'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8077 |
var left = findPosX(element); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8078 |
var width = element.scrollWidth; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8079 |
var height = element.scrollHeight; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8080 |
var winWidth = findWindowWidth(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8081 |
var p = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8082 |
var c = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8083 |
if(opening) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8084 |
p.push({style: 'height', start: 0, end: height, template: '%0px', atEnd: 'auto'}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8085 |
p.push({style: 'opacity', start: 0, end: 1, template: '%0'}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8086 |
p.push({style: 'filter', start: 0, end: 100, template: 'alpha(opacity:%0)'}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8087 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8088 |
p.push({style: 'height', start: height, end: 0, template: '%0px'}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8089 |
p.push({style: 'display', atEnd: 'none'}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8090 |
p.push({style: 'opacity', start: 1, end: 0, template: '%0'}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8091 |
p.push({style: 'filter', start: 100, end: 0, template: 'alpha(opacity:%0)'}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8092 |
switch(deleteMode) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8093 |
case "all": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8094 |
c = function(element,properties) {removeNode(element);}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8095 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8096 |
case "children": |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8097 |
c = function(element,properties) {removeChildren(element);}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8098 |
break; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8099 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8100 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8101 |
return new Morpher(element,config.animDuration,p,c); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8102 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8103 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8104 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8105 |
//-- Popup menu |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8106 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8107 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8108 |
var Popup = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8109 |
stack: [] // Array of objects with members root: and popup: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8110 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8111 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8112 |
Popup.create = function(root,elem,theClass) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8113 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8114 |
var stackPosition = this.find(root,"popup"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8115 |
Popup.remove(stackPosition+1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8116 |
var popup = createTiddlyElement(document.body,elem ? elem : "ol","popup",theClass ? theClass : "popup"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8117 |
popup.stackPosition = stackPosition; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8118 |
Popup.stack.push({root: root, popup: popup}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8119 |
return popup; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8120 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8121 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8122 |
Popup.onDocumentClick = function(ev) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8123 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8124 |
var e = ev ? ev : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8125 |
if(e.eventPhase == undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8126 |
Popup.remove(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8127 |
else if(e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8128 |
Popup.remove(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8129 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8130 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8131 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8132 |
Popup.show = function(valign,halign,offset) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8133 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8134 |
var curr = Popup.stack[Popup.stack.length-1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8135 |
this.place(curr.root,curr.popup,valign,halign,offset); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8136 |
addClass(curr.root,"highlight"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8137 |
if(config.options.chkAnimate && anim && typeof Scroller == "function") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8138 |
anim.startAnimating(new Scroller(curr.popup)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8139 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8140 |
window.scrollTo(0,ensureVisible(curr.popup)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8141 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8142 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8143 |
Popup.place = function(root,popup,valign,halign,offset) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8144 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8145 |
if(!offset) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8146 |
var offset = {x:0,y:0}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8147 |
if(popup.stackPosition >= 0 && !valign && !halign) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8148 |
offset.x = offset.x + root.offsetWidth; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8149 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8150 |
offset.x = (halign == 'right') ? offset.x + root.offsetWidth : offset.x; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8151 |
offset.y = (valign == 'top') ? offset.y : offset.y + root.offsetHeight; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8152 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8153 |
var rootLeft = findPosX(root); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8154 |
var rootTop = findPosY(root); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8155 |
var popupLeft = rootLeft + offset.x; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8156 |
var popupTop = rootTop + offset.y; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8157 |
var winWidth = findWindowWidth(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8158 |
if(popup.offsetWidth > winWidth*0.75) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8159 |
popup.style.width = winWidth*0.75 + "px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8160 |
var popupWidth = popup.offsetWidth; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8161 |
var scrollWidth = winWidth - document.body.offsetWidth; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8162 |
if(popupLeft + popupWidth > winWidth - scrollWidth - 1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8163 |
if(halign == 'right') |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8164 |
popupLeft = popupLeft - root.offsetWidth - popupWidth; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8165 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8166 |
popupLeft = winWidth - popupWidth - scrollWidth - 1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8167 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8168 |
popup.style.left = popupLeft + "px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8169 |
popup.style.top = popupTop + "px"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8170 |
popup.style.display = "block"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8171 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8172 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8173 |
Popup.find = function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8174 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8175 |
var pos = -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8176 |
for (var t=this.stack.length-1; t>=0; t--) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8177 |
if(isDescendant(e,this.stack[t].popup)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8178 |
pos = i; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8179 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8180 |
return pos; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8181 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8182 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8183 |
Popup.remove = function(pos) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8184 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8185 |
if(!pos) var pos = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8186 |
if(Popup.stack.length > pos) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8187 |
Popup.removeFrom(pos); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8188 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8189 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8190 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8191 |
Popup.removeFrom = function(from) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8192 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8193 |
for(var t=Popup.stack.length-1; t>=from; t--) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8194 |
var p = Popup.stack[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8195 |
removeClass(p.root,"highlight"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8196 |
removeNode(p.popup); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8197 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8198 |
Popup.stack = Popup.stack.slice(0,from); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8199 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8200 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8201 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8202 |
//-- Wizard support |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8203 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8204 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8205 |
function Wizard(elem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8206 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8207 |
if(elem) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8208 |
this.formElem = findRelated(elem,"wizard","className"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8209 |
this.bodyElem = findRelated(this.formElem.firstChild,"wizardBody","className","nextSibling"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8210 |
this.footElem = findRelated(this.formElem.firstChild,"wizardFooter","className","nextSibling"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8211 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8212 |
this.formElem = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8213 |
this.bodyElem = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8214 |
this.footElem = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8215 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8216 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8217 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8218 |
Wizard.prototype.setValue = function(name,value) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8219 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8220 |
if(this.formElem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8221 |
this.formElem[name] = value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8222 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8223 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8224 |
Wizard.prototype.getValue = function(name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8225 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8226 |
return this.formElem ? this.formElem[name] : null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8227 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8228 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8229 |
Wizard.prototype.createWizard = function(place,title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8230 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8231 |
this.formElem = createTiddlyElement(place,"form",null,"wizard"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8232 |
createTiddlyElement(this.formElem,"h1",null,null,title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8233 |
this.bodyElem = createTiddlyElement(this.formElem,"div",null,"wizardBody"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8234 |
this.footElem = createTiddlyElement(this.formElem,"div",null,"wizardFooter"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8235 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8236 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8237 |
Wizard.prototype.clear = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8238 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8239 |
removeChildren(this.bodyElem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8240 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8241 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8242 |
Wizard.prototype.setButtons = function(buttonInfo,status) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8243 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8244 |
removeChildren(this.footElem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8245 |
for(var t=0; t<buttonInfo.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8246 |
createTiddlyButton(this.footElem,buttonInfo[t].caption,buttonInfo[t].tooltip,buttonInfo[t].onClick); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8247 |
insertSpacer(this.footElem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8248 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8249 |
if(typeof status == "string") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8250 |
createTiddlyElement(this.footElem,"span",null,"status",status); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8251 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8252 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8253 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8254 |
Wizard.prototype.addStep = function(stepTitle,html) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8255 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8256 |
removeChildren(this.bodyElem); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8257 |
var w = createTiddlyElement(this.bodyElem,"div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8258 |
createTiddlyElement(w,"h2",null,null,stepTitle); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8259 |
var step = createTiddlyElement(w,"div",null,"wizardStep"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8260 |
step.innerHTML = html; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8261 |
applyHtmlMacros(step,tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8262 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8263 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8264 |
Wizard.prototype.getElement = function(name) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8265 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8266 |
return this.formElem.elements[name]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8267 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8268 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8269 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8270 |
//-- ListView gadget |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8271 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8272 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8273 |
var ListView = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8274 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8275 |
// Create a listview |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8276 |
ListView.create = function(place,listObject,listTemplate,callback,className) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8277 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8278 |
var table = createTiddlyElement(place,"table",null,className ? className : "listView twtable"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8279 |
var thead = createTiddlyElement(table,"thead"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8280 |
var r = createTiddlyElement(thead,"tr"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8281 |
for(var t=0; t<listTemplate.columns.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8282 |
var columnTemplate = listTemplate.columns[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8283 |
var c = createTiddlyElement(r,"th"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8284 |
var colType = ListView.columnTypes[columnTemplate.type]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8285 |
if(colType && colType.createHeader) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8286 |
colType.createHeader(c,columnTemplate,t); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8287 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8288 |
var tbody = createTiddlyElement(table,"tbody"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8289 |
for(var rc=0; rc<listObject.length; rc++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8290 |
rowObject = listObject[rc]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8291 |
r = createTiddlyElement(tbody,"tr"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8292 |
for(c=0; c<listTemplate.rowClasses.length; c++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8293 |
if(rowObject[listTemplate.rowClasses[c].field]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8294 |
addClass(r,listTemplate.rowClasses[c].className); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8295 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8296 |
rowObject.rowElement = r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8297 |
rowObject.colElements = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8298 |
for(var cc=0; cc<listTemplate.columns.length; cc++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8299 |
c = createTiddlyElement(r,"td"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8300 |
columnTemplate = listTemplate.columns[cc]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8301 |
var field = columnTemplate.field; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8302 |
colType = ListView.columnTypes[columnTemplate.type]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8303 |
if(colType && colType.createItem) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8304 |
colType.createItem(c,rowObject,field,columnTemplate,cc,rc); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8305 |
rowObject.colElements[field] = c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8306 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8307 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8308 |
if(callback && listTemplate.actions) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8309 |
createTiddlyDropDown(place,ListView.getCommandHandler(callback),listTemplate.actions); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8310 |
if(callback && listTemplate.buttons) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8311 |
for(t=0; t<listTemplate.buttons.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8312 |
var a = listTemplate.buttons[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8313 |
if(a && a.name != "") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8314 |
createTiddlyButton(place,a.caption,null,ListView.getCommandHandler(callback,a.name,a.allowEmptySelection)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8315 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8316 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8317 |
return table; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8318 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8319 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8320 |
ListView.getCommandHandler = function(callback,name,allowEmptySelection) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8321 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8322 |
return function(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8323 |
var view = findRelated(this,"TABLE",null,"previousSibling"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8324 |
var tiddlers = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8325 |
ListView.forEachSelector(view,function(e,rowName) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8326 |
if(e.checked) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8327 |
tiddlers.push(rowName); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8328 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8329 |
if(tiddlers.length == 0 && !allowEmptySelection) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8330 |
alert(config.messages.nothingSelected); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8331 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8332 |
if(this.nodeName.toLowerCase() == "select") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8333 |
callback(view,this.value,tiddlers); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8334 |
this.selectedIndex = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8335 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8336 |
callback(view,name,tiddlers); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8337 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8338 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8339 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8340 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8341 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8342 |
// Invoke a callback for each selector checkbox in the listview |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8343 |
ListView.forEachSelector = function(view,callback) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8344 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8345 |
var checkboxes = view.getElementsByTagName("input"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8346 |
var hadOne = false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8347 |
for(var t=0; t<checkboxes.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8348 |
var cb = checkboxes[t]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8349 |
if(cb.getAttribute("type") == "checkbox") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8350 |
var rn = cb.getAttribute("rowName"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8351 |
if(rn) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8352 |
callback(cb,rn); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8353 |
hadOne = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8354 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8355 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8356 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8357 |
return hadOne; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8358 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8359 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8360 |
ListView.getSelectedRows = function(view) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8361 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8362 |
var rowNames = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8363 |
ListView.forEachSelector(view,function(e,rowName) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8364 |
if(e.checked) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8365 |
rowNames.push(rowName); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8366 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8367 |
return rowNames; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8368 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8369 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8370 |
ListView.columnTypes = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8371 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8372 |
ListView.columnTypes.String = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8373 |
createHeader: function(place,columnTemplate,col) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8374 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8375 |
createTiddlyText(place,columnTemplate.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8376 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8377 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8378 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8379 |
var v = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8380 |
if(v != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8381 |
createTiddlyText(place,v); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8382 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8383 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8384 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8385 |
ListView.columnTypes.WikiText = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8386 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8387 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8388 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8389 |
var v = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8390 |
if(v != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8391 |
wikify(v,place,null,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8392 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8393 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8394 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8395 |
ListView.columnTypes.Tiddler = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8396 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8397 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8398 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8399 |
var v = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8400 |
if(v != undefined && v.title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8401 |
createTiddlyPopup(place,v.title,config.messages.listView.tiddlerTooltip,v); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8402 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8403 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8404 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8405 |
ListView.columnTypes.Size = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8406 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8407 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8408 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8409 |
var v = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8410 |
if(v != undefined) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8411 |
var t = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8412 |
while(t<config.messages.sizeTemplates.length-1 && v<config.messages.sizeTemplates[t].unit) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8413 |
t++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8414 |
createTiddlyText(place,config.messages.sizeTemplates[t].template.format([Math.round(v/config.messages.sizeTemplates[t].unit)])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8415 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8416 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8417 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8418 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8419 |
ListView.columnTypes.Link = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8420 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8421 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8422 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8423 |
var v = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8424 |
var c = columnTemplate.text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8425 |
if(v != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8426 |
createTiddlyText(createExternalLink(place,v),c ? c : v); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8427 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8428 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8429 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8430 |
ListView.columnTypes.Date = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8431 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8432 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8433 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8434 |
var v = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8435 |
if(v != undefined) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8436 |
createTiddlyText(place,v.formatString(columnTemplate.dateFormat)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8437 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8438 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8439 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8440 |
ListView.columnTypes.StringList = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8441 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8442 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8443 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8444 |
var v = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8445 |
if(v != undefined) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8446 |
for(var t=0; t<v.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8447 |
createTiddlyText(place,v[t]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8448 |
createTiddlyElement(place,"br"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8449 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8450 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8451 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8452 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8453 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8454 |
ListView.columnTypes.Selector = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8455 |
createHeader: function(place,columnTemplate,col) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8456 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8457 |
createTiddlyCheckbox(place,null,false,this.onHeaderChange); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8458 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8459 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8460 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8461 |
var e = createTiddlyCheckbox(place,null,listObject[field],null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8462 |
e.setAttribute("rowName",listObject[columnTemplate.rowName]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8463 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8464 |
onHeaderChange: function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8465 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8466 |
var state = this.checked; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8467 |
var view = findRelated(this,"TABLE"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8468 |
if(!view) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8469 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8470 |
ListView.forEachSelector(view,function(e,rowName) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8471 |
e.checked = state; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8472 |
}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8473 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8474 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8475 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8476 |
ListView.columnTypes.Tags = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8477 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8478 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8479 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8480 |
var tags = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8481 |
createTiddlyText(place,String.encodeTiddlyLinkList(tags)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8482 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8483 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8484 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8485 |
ListView.columnTypes.Boolean = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8486 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8487 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8488 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8489 |
if(listObject[field] == true) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8490 |
createTiddlyText(place,columnTemplate.trueText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8491 |
if(listObject[field] == false) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8492 |
createTiddlyText(place,columnTemplate.falseText); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8493 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8494 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8495 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8496 |
ListView.columnTypes.TagCheckbox = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8497 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8498 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8499 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8500 |
var e = createTiddlyCheckbox(place,null,listObject[field],this.onChange); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8501 |
e.setAttribute("tiddler",listObject.title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8502 |
e.setAttribute("tag",columnTemplate.tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8503 |
}, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8504 |
onChange : function(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8505 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8506 |
var tag = this.getAttribute("tag"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8507 |
var tiddler = this.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8508 |
store.setTiddlerTag(tiddler,this.checked,tag); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8509 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8510 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8511 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8512 |
ListView.columnTypes.TiddlerLink = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8513 |
createHeader: ListView.columnTypes.String.createHeader, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8514 |
createItem: function(place,listObject,field,columnTemplate,col,row) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8515 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8516 |
var v = listObject[field]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8517 |
if(v != undefined) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8518 |
var link = createTiddlyLink(place,listObject[columnTemplate.tiddlerLink],false,null); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8519 |
createTiddlyText(link,listObject[field]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8520 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8521 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8522 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8523 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8524 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8525 |
//-- Augmented methods for the JavaScript Number(), Array(), String() and Date() objects |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8526 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8527 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8528 |
// Clamp a number to a range |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8529 |
Number.prototype.clamp = function(min,max) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8530 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8531 |
var c = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8532 |
if(c < min) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8533 |
c = min; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8534 |
if(c > max) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8535 |
c = max; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8536 |
return c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8537 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8538 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8539 |
// Add indexOf function if browser does not support it |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8540 |
if(!Array.indexOf) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8541 |
Array.prototype.indexOf = function(item,from) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8542 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8543 |
if(!from) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8544 |
from = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8545 |
for(var i=from; i<this.length; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8546 |
if(this[i] === item) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8547 |
return i; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8548 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8549 |
return -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8550 |
};} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8551 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8552 |
// Find an entry in a given field of the members of an array |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8553 |
Array.prototype.findByField = function(field,value) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8554 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8555 |
for(var t=0; t<this.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8556 |
if(this[t][field] == value) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8557 |
return t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8558 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8559 |
return null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8560 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8561 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8562 |
// Return whether an entry exists in an array |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8563 |
Array.prototype.contains = function(item) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8564 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8565 |
return this.indexOf(item) != -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8566 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8567 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8568 |
// Adds, removes or toggles a particular value within an array |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8569 |
// value - value to add |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8570 |
// mode - +1 to add value, -1 to remove value, 0 to toggle it |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8571 |
Array.prototype.setItem = function(value,mode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8572 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8573 |
var p = this.indexOf(value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8574 |
if(mode == 0) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8575 |
mode = (p == -1) ? +1 : -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8576 |
if(mode == +1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8577 |
if(p == -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8578 |
this.push(value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8579 |
} else if(mode == -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8580 |
if(p != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8581 |
this.splice(p,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8582 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8583 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8584 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8585 |
// Return whether one of a list of values exists in an array |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8586 |
Array.prototype.containsAny = function(items) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8587 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8588 |
for(var i=0; i<items.length; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8589 |
if(this.indexOf(items[i]) != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8590 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8591 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8592 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8593 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8594 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8595 |
// Return whether all of a list of values exists in an array |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8596 |
Array.prototype.containsAll = function(items) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8597 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8598 |
for(var i = 0; i<items.length; i++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8599 |
if(this.indexOf(items[i]) == -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8600 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8601 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8602 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8603 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8604 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8605 |
// Push a new value into an array only if it is not already present in the array. If the optional unique parameter is false, it reverts to a normal push |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8606 |
Array.prototype.pushUnique = function(item,unique) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8607 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8608 |
if(unique === false) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8609 |
this.push(item); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8610 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8611 |
if(this.indexOf(item) == -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8612 |
this.push(item); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8613 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8614 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8615 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8616 |
Array.prototype.remove = function(item) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8617 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8618 |
var p = this.indexOf(item); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8619 |
if(p != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8620 |
this.splice(p,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8621 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8622 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8623 |
if(!Array.prototype.map) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8624 |
Array.prototype.map = function(fn,thisObj) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8625 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8626 |
var scope = thisObj || window; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8627 |
var a = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8628 |
for(var i=0, j=this.length; i < j; ++i) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8629 |
a.push(fn.call(scope,this[i],i,this)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8630 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8631 |
return a; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8632 |
};} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8633 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8634 |
// Get characters from the right end of a string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8635 |
String.prototype.right = function(n) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8636 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8637 |
return n < this.length ? this.slice(this.length-n) : this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8638 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8639 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8640 |
// Trim whitespace from both ends of a string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8641 |
String.prototype.trim = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8642 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8643 |
return this.replace(/^\s*|\s*$/g,""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8644 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8645 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8646 |
// Convert a string from a CSS style property name to a JavaScript style name ("background-color" -> "backgroundColor") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8647 |
String.prototype.unDash = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8648 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8649 |
var s = this.split("-"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8650 |
if(s.length > 1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8651 |
for(var t=1; t<s.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8652 |
s[t] = s[t].substr(0,1).toUpperCase() + s[t].substr(1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8653 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8654 |
return s.join(""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8655 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8656 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8657 |
// Substitute substrings from an array into a format string that includes '%1'-type specifiers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8658 |
String.prototype.format = function(substrings) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8659 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8660 |
var subRegExp = /(?:%(\d+))/mg; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8661 |
var currPos = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8662 |
var r = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8663 |
do { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8664 |
var match = subRegExp.exec(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8665 |
if(match && match[1]) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8666 |
if(match.index > currPos) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8667 |
r.push(this.substring(currPos,match.index)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8668 |
r.push(substrings[parseInt(match[1])]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8669 |
currPos = subRegExp.lastIndex; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8670 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8671 |
} while(match); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8672 |
if(currPos < this.length) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8673 |
r.push(this.substring(currPos,this.length)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8674 |
return r.join(""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8675 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8676 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8677 |
// Escape any special RegExp characters with that character preceded by a backslash |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8678 |
String.prototype.escapeRegExp = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8679 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8680 |
var s = "\\^$*+?()=!|,{}[]."; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8681 |
var c = this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8682 |
for(var t=0; t<s.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8683 |
c = c.replace(new RegExp("\\" + s.substr(t,1),"g"),"\\" + s.substr(t,1)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8684 |
return c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8685 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8686 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8687 |
// Convert "\" to "\s", newlines to "\n" (and remove carriage returns) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8688 |
String.prototype.escapeLineBreaks = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8689 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8690 |
return this.replace(/\\/mg,"\\s").replace(/\n/mg,"\\n").replace(/\r/mg,""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8691 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8692 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8693 |
// Convert "\n" to newlines, "\b" to " ", "\s" to "\" (and remove carriage returns) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8694 |
String.prototype.unescapeLineBreaks = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8695 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8696 |
return this.replace(/\\n/mg,"\n").replace(/\\b/mg," ").replace(/\\s/mg,"\\").replace(/\r/mg,""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8697 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8698 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8699 |
// Convert & to "&", < to "<", > to ">" and " to """ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8700 |
String.prototype.htmlEncode = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8701 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8702 |
return this.replace(/&/mg,"&").replace(/</mg,"<").replace(/>/mg,">").replace(/\"/mg,"""); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8703 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8704 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8705 |
// Convert "&" to &, "<" to <, ">" to > and """ to " |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8706 |
String.prototype.htmlDecode = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8707 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8708 |
return this.replace(/</mg,"<").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8709 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8710 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8711 |
// Convert a string to it's JSON representation by encoding control characters, double quotes and backslash. See json.org |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8712 |
String.prototype.toJSONString = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8713 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8714 |
var m = { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8715 |
'\b': '\\b', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8716 |
'\f': '\\f', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8717 |
'\n': '\\n', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8718 |
'\r': '\\r', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8719 |
'\t': '\\t', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8720 |
'"' : '\\"', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8721 |
'\\': '\\\\' |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8722 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8723 |
var replaceFn = function(a,b) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8724 |
var c = m[b]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8725 |
if(c) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8726 |
return c; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8727 |
c = b.charCodeAt(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8728 |
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8729 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8730 |
if(/["\\\x00-\x1f]/.test(this)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8731 |
return '"' + this.replace(/([\x00-\x1f\\"])/g,replaceFn) + '"'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8732 |
return '"' + this + '"'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8733 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8734 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8735 |
// Parse a space-separated string of name:value parameters |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8736 |
// The result is an array of objects: |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8737 |
// result[0] = object with a member for each parameter name, value of that member being an array of values |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8738 |
// result[1..n] = one object for each parameter, with 'name' and 'value' members |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8739 |
String.prototype.parseParams = function(defaultName,defaultValue,allowEval,noNames,cascadeDefaults) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8740 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8741 |
var parseToken = function(match,p) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8742 |
var n; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8743 |
if(match[p]) // Double quoted |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8744 |
n = match[p]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8745 |
else if(match[p+1]) // Single quoted |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8746 |
n = match[p+1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8747 |
else if(match[p+2]) // Double-square-bracket quoted |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8748 |
n = match[p+2]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8749 |
else if(match[p+3]) // Double-brace quoted |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8750 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8751 |
n = match[p+3]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8752 |
if(allowEval) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8753 |
n = window.eval(n); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8754 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8755 |
throw "Unable to evaluate {{" + match[p+3] + "}}: " + exceptionText(ex); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8756 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8757 |
else if(match[p+4]) // Unquoted |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8758 |
n = match[p+4]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8759 |
else if(match[p+5]) // empty quote |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8760 |
n = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8761 |
return n; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8762 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8763 |
var r = [{}]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8764 |
var dblQuote = "(?:\"((?:(?:\\\\\")|[^\"])+)\")"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8765 |
var sngQuote = "(?:'((?:(?:\\\\\')|[^'])+)')"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8766 |
var dblSquare = "(?:\\[\\[((?:\\s|\\S)*?)\\]\\])"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8767 |
var dblBrace = "(?:\\{\\{((?:\\s|\\S)*?)\\}\\})"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8768 |
var unQuoted = noNames ? "([^\"'\\s]\\S*)" : "([^\"':\\s][^\\s:]*)"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8769 |
var emptyQuote = "((?:\"\")|(?:''))"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8770 |
var skipSpace = "(?:\\s*)"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8771 |
var token = "(?:" + dblQuote + "|" + sngQuote + "|" + dblSquare + "|" + dblBrace + "|" + unQuoted + "|" + emptyQuote + ")"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8772 |
var re = noNames ? new RegExp(token,"mg") : new RegExp(skipSpace + token + skipSpace + "(?:(\\:)" + skipSpace + token + ")?","mg"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8773 |
var params = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8774 |
do { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8775 |
var match = re.exec(this); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8776 |
if(match) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8777 |
var n = parseToken(match,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8778 |
if(noNames) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8779 |
r.push({name:"",value:n}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8780 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8781 |
var v = parseToken(match,8); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8782 |
if(v == null && defaultName) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8783 |
v = n; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8784 |
n = defaultName; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8785 |
} else if(v == null && defaultValue) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8786 |
v = defaultValue; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8787 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8788 |
r.push({name:n,value:v}); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8789 |
if(cascadeDefaults) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8790 |
defaultName = n; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8791 |
defaultValue = v; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8792 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8793 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8794 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8795 |
} while(match); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8796 |
// Summarise parameters into first element |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8797 |
for(var t=1; t<r.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8798 |
if(r[0][r[t].name]) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8799 |
r[0][r[t].name].push(r[t].value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8800 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8801 |
r[0][r[t].name] = [r[t].value]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8802 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8803 |
return r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8804 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8805 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8806 |
// Process a string list of macro parameters into an array. Parameters can be quoted with "", '', |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8807 |
// [[]], {{ }} or left unquoted (and therefore space-separated). Double-braces {{}} results in |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8808 |
// an *evaluated* parameter: e.g. {{config.options.txtUserName}} results in the current user's name. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8809 |
String.prototype.readMacroParams = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8810 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8811 |
var p = this.parseParams("list",null,true,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8812 |
var n = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8813 |
for(var t=1; t<p.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8814 |
n.push(p[t].value); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8815 |
return n; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8816 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8817 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8818 |
// Process a string list of unique tiddler names into an array. Tiddler names that have spaces in them must be [[bracketed]] |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8819 |
String.prototype.readBracketedList = function(unique) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8820 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8821 |
var p = this.parseParams("list",null,false,true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8822 |
var n = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8823 |
for(var t=1; t<p.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8824 |
if(p[t].value) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8825 |
n.pushUnique(p[t].value,unique); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8826 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8827 |
return n; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8828 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8829 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8830 |
// Returns array with start and end index of chunk between given start and end marker, or undefined. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8831 |
String.prototype.getChunkRange = function(start,end) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8832 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8833 |
var s = this.indexOf(start); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8834 |
if(s != -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8835 |
s += start.length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8836 |
var e = this.indexOf(end,s); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8837 |
if(e != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8838 |
return [s,e]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8839 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8840 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8841 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8842 |
// Replace a chunk of a string given start and end markers |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8843 |
String.prototype.replaceChunk = function(start,end,sub) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8844 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8845 |
var r = this.getChunkRange(start,end); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8846 |
return r ? this.substring(0,r[0]) + sub + this.substring(r[1]) : this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8847 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8848 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8849 |
// Returns a chunk of a string between start and end markers, or undefined |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8850 |
String.prototype.getChunk = function(start,end) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8851 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8852 |
var r = this.getChunkRange(start,end); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8853 |
if(r) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8854 |
return this.substring(r[0],r[1]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8855 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8856 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8857 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8858 |
// Static method to bracket a string with double square brackets if it contains a space |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8859 |
String.encodeTiddlyLink = function(title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8860 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8861 |
return title.indexOf(" ") == -1 ? title : "[[" + title + "]]"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8862 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8863 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8864 |
// Static method to encodeTiddlyLink for every item in an array and join them with spaces |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8865 |
String.encodeTiddlyLinkList = function(list) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8866 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8867 |
if(list) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8868 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8869 |
for(var t=0; t<list.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8870 |
results.push(String.encodeTiddlyLink(list[t])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8871 |
return results.join(" "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8872 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8873 |
return ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8874 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8875 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8876 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8877 |
// Convert a string as a sequence of name:"value" pairs into a hashmap |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8878 |
String.prototype.decodeHashMap = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8879 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8880 |
var fields = this.parseParams("anon","",false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8881 |
var r = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8882 |
for(var t=1; t<fields.length; t++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8883 |
r[fields[t].name] = fields[t].value; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8884 |
return r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8885 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8886 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8887 |
// Static method to encode a hashmap into a name:"value"... string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8888 |
String.encodeHashMap = function(hashmap) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8889 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8890 |
var r = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8891 |
for(var t in hashmap) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8892 |
r.push(t + ':"' + hashmap[t] + '"'); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8893 |
return r.join(" "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8894 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8895 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8896 |
// Static method to left-pad a string with 0s to a certain width |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8897 |
String.zeroPad = function(n,d) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8898 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8899 |
var s = n.toString(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8900 |
if(s.length < d) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8901 |
s = "000000000000000000000000000".substr(0,d-s.length) + s; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8902 |
return s; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8903 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8904 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8905 |
String.prototype.startsWith = function(prefix) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8906 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8907 |
return !prefix || this.substring(0,prefix.length) == prefix; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8908 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8909 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8910 |
// Returns the first value of the given named parameter. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8911 |
function getParam(params,name,defaultValue) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8912 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8913 |
if(!params) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8914 |
return defaultValue; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8915 |
var p = params[0][name]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8916 |
return p ? p[0] : defaultValue; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8917 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8918 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8919 |
// Returns the first value of the given boolean named parameter. |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8920 |
function getFlag(params,name,defaultValue) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8921 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8922 |
return !!getParam(params,name,defaultValue); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8923 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8924 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8925 |
// Substitute date components into a string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8926 |
Date.prototype.formatString = function(template) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8927 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8928 |
var t = template.replace(/0hh12/g,String.zeroPad(this.getHours12(),2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8929 |
t = t.replace(/hh12/g,this.getHours12()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8930 |
t = t.replace(/0hh/g,String.zeroPad(this.getHours(),2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8931 |
t = t.replace(/hh/g,this.getHours()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8932 |
t = t.replace(/mmm/g,config.messages.dates.shortMonths[this.getMonth()]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8933 |
t = t.replace(/0mm/g,String.zeroPad(this.getMinutes(),2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8934 |
t = t.replace(/mm/g,this.getMinutes()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8935 |
t = t.replace(/0ss/g,String.zeroPad(this.getSeconds(),2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8936 |
t = t.replace(/ss/g,this.getSeconds()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8937 |
t = t.replace(/[ap]m/g,this.getAmPm().toLowerCase()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8938 |
t = t.replace(/[AP]M/g,this.getAmPm().toUpperCase()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8939 |
t = t.replace(/wYYYY/g,this.getYearForWeekNo()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8940 |
t = t.replace(/wYY/g,String.zeroPad(this.getYearForWeekNo()-2000,2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8941 |
t = t.replace(/YYYY/g,this.getFullYear()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8942 |
t = t.replace(/YY/g,String.zeroPad(this.getFullYear()-2000,2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8943 |
t = t.replace(/MMM/g,config.messages.dates.months[this.getMonth()]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8944 |
t = t.replace(/0MM/g,String.zeroPad(this.getMonth()+1,2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8945 |
t = t.replace(/MM/g,this.getMonth()+1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8946 |
t = t.replace(/0WW/g,String.zeroPad(this.getWeek(),2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8947 |
t = t.replace(/WW/g,this.getWeek()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8948 |
t = t.replace(/DDD/g,config.messages.dates.days[this.getDay()]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8949 |
t = t.replace(/ddd/g,config.messages.dates.shortDays[this.getDay()]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8950 |
t = t.replace(/0DD/g,String.zeroPad(this.getDate(),2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8951 |
t = t.replace(/DDth/g,this.getDate()+this.daySuffix()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8952 |
t = t.replace(/DD/g,this.getDate()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8953 |
var tz = this.getTimezoneOffset(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8954 |
var atz = Math.abs(tz); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8955 |
t = t.replace(/TZD/g,(tz < 0 ? '+' : '-') + String.zeroPad(Math.floor(atz / 60),2) + ':' + String.zeroPad(atz % 60,2)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8956 |
return t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8957 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8958 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8959 |
Date.prototype.getWeek = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8960 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8961 |
var dt = new Date(this.getTime()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8962 |
var d = dt.getDay(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8963 |
if(d==0) d=7;// JavaScript Sun=0, ISO Sun=7 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8964 |
dt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week to calculate weekNo |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8965 |
var n = Math.floor((dt.getTime()-new Date(dt.getFullYear(),0,1)+3600000)/86400000); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8966 |
return Math.floor(n/7)+1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8967 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8968 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8969 |
Date.prototype.getYearForWeekNo = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8970 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8971 |
var dt = new Date(this.getTime()); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8972 |
var d = dt.getDay(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8973 |
if(d==0) d=7;// JavaScript Sun=0, ISO Sun=7 |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8974 |
dt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8975 |
return dt.getFullYear(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8976 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8977 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8978 |
Date.prototype.getHours12 = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8979 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8980 |
var h = this.getHours(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8981 |
return h > 12 ? h-12 : ( h > 0 ? h : 12 ); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8982 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8983 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8984 |
Date.prototype.getAmPm = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8985 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8986 |
return this.getHours() >= 12 ? config.messages.dates.pm : config.messages.dates.am; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8987 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8988 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8989 |
Date.prototype.daySuffix = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8990 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8991 |
return config.messages.dates.daySuffixes[this.getDate()-1]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8992 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8993 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8994 |
// Convert a date to local YYYYMMDDHHMM string format |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8995 |
Date.prototype.convertToLocalYYYYMMDDHHMM = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8996 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8997 |
return this.getFullYear() + String.zeroPad(this.getMonth()+1,2) + String.zeroPad(this.getDate(),2) + String.zeroPad(this.getHours(),2) + String.zeroPad(this.getMinutes(),2); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8998 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8999 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9000 |
// Convert a date to UTC YYYYMMDDHHMM string format |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9001 |
Date.prototype.convertToYYYYMMDDHHMM = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9002 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9003 |
return this.getUTCFullYear() + String.zeroPad(this.getUTCMonth()+1,2) + String.zeroPad(this.getUTCDate(),2) + String.zeroPad(this.getUTCHours(),2) + String.zeroPad(this.getUTCMinutes(),2); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9004 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9005 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9006 |
// Convert a date to UTC YYYYMMDD.HHMMSSMMM string format |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9007 |
Date.prototype.convertToYYYYMMDDHHMMSSMMM = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9008 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9009 |
return this.getUTCFullYear() + String.zeroPad(this.getUTCMonth()+1,2) + String.zeroPad(this.getUTCDate(),2) + "." + String.zeroPad(this.getUTCHours(),2) + String.zeroPad(this.getUTCMinutes(),2) + String.zeroPad(this.getUTCSeconds(),2) + String.zeroPad(this.getUTCMilliseconds(),4); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9010 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9011 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9012 |
// Static method to create a date from a UTC YYYYMMDDHHMM format string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9013 |
Date.convertFromYYYYMMDDHHMM = function(d) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9014 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9015 |
var hh = d.substr(8,2) || "00"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9016 |
var mm = d.substr(10,2) || "00"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9017 |
return new Date(Date.UTC(parseInt(d.substr(0,4),10), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9018 |
parseInt(d.substr(4,2),10)-1, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9019 |
parseInt(d.substr(6,2),10), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9020 |
parseInt(hh,10), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9021 |
parseInt(mm,10),0,0)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9022 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9023 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9024 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9025 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9026 |
//-- Crypto functions and associated conversion routines |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9027 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9028 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9029 |
// Crypto 'namespace' |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9030 |
function Crypto() {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9031 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9032 |
// Convert a string to an array of big-endian 32-bit words |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9033 |
Crypto.strToBe32s = function(str) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9034 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9035 |
var be=Array(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9036 |
var len=Math.floor(str.length/4); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9037 |
var i, j; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9038 |
for(i=0, j=0; i<len; i++, j+=4) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9039 |
be[i]=((str.charCodeAt(j)&0xff) << 24)|((str.charCodeAt(j+1)&0xff) << 16)|((str.charCodeAt(j+2)&0xff) << 8)|(str.charCodeAt(j+3)&0xff); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9040 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9041 |
while(j<str.length) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9042 |
be[j>>2] |= (str.charCodeAt(j)&0xff)<<(24-(j*8)%32); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9043 |
j++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9044 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9045 |
return be; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9046 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9047 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9048 |
// Convert an array of big-endian 32-bit words to a string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9049 |
Crypto.be32sToStr = function(be) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9050 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9051 |
var str=''; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9052 |
for(var i=0;i<be.length*32;i+=8) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9053 |
str += String.fromCharCode((be[i>>5]>>>(24-i%32)) & 0xff); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9054 |
return str; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9055 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9056 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9057 |
// Convert an array of big-endian 32-bit words to a hex string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9058 |
Crypto.be32sToHex = function(be) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9059 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9060 |
var hex='0123456789ABCDEF'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9061 |
var str=''; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9062 |
for(var i=0;i<be.length*4;i++) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9063 |
str += hex.charAt((be[i>>2]>>((3-i%4)*8+4))&0xF) + hex.charAt((be[i>>2]>>((3-i%4)*8))&0xF); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9064 |
return str; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9065 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9066 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9067 |
// Return, in hex, the SHA-1 hash of a string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9068 |
Crypto.hexSha1Str = function(str) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9069 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9070 |
return Crypto.be32sToHex(Crypto.sha1Str(str)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9071 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9072 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9073 |
// Return the SHA-1 hash of a string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9074 |
Crypto.sha1Str = function(str) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9075 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9076 |
return Crypto.sha1(Crypto.strToBe32s(str),str.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9077 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9078 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9079 |
// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9080 |
Crypto.sha1 = function(x,blen) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9081 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9082 |
// Add 32-bit integers, wrapping at 32 bits |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9083 |
function add32(a,b) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9084 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9085 |
var lsw=(a&0xFFFF)+(b&0xFFFF); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9086 |
var msw=(a>>16)+(b>>16)+(lsw>>16); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9087 |
return (msw<<16)|(lsw&0xFFFF); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9088 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9089 |
function AA(a,b,c,d,e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9090 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9091 |
b=(b>>>27)|(b<<5); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9092 |
var lsw=(a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9093 |
var msw=(a>>16)+(b>>16)+(c>>16)+(d>>16)+(e>>16)+(lsw>>16); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9094 |
return (msw<<16)|(lsw&0xFFFF); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9095 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9096 |
function RR(w,j) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9097 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9098 |
var n=w[j-3]^w[j-8]^w[j-14]^w[j-16]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9099 |
return (n>>>31)|(n<<1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9100 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9101 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9102 |
var len=blen*8; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9103 |
x[len>>5] |= 0x80 << (24-len%32); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9104 |
x[((len+64>>9)<<4)+15]=len; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9105 |
var w=Array(80); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9106 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9107 |
var k1=0x5A827999; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9108 |
var k2=0x6ED9EBA1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9109 |
var k3=0x8F1BBCDC; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9110 |
var k4=0xCA62C1D6; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9111 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9112 |
var h0=0x67452301; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9113 |
var h1=0xEFCDAB89; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9114 |
var h2=0x98BADCFE; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9115 |
var h3=0x10325476; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9116 |
var h4=0xC3D2E1F0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9117 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9118 |
for(var i=0;i<x.length;i+=16) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9119 |
var j=0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9120 |
var t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9121 |
var a=h0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9122 |
var b=h1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9123 |
var c=h2; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9124 |
var d=h3; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9125 |
var e=h4; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9126 |
while(j<16) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9127 |
w[j]=x[i+j]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9128 |
t=AA(e,a,d^(b&(c^d)),w[j],k1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9129 |
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9130 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9131 |
while(j<20) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9132 |
w[j]=RR(w,j); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9133 |
t=AA(e,a,d^(b&(c^d)),w[j],k1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9134 |
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9135 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9136 |
while(j<40) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9137 |
w[j]=RR(w,j); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9138 |
t=AA(e,a,b^c^d,w[j],k2); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9139 |
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9140 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9141 |
while(j<60) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9142 |
w[j]=RR(w,j); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9143 |
t=AA(e,a,(b&c)|(d&(b|c)),w[j],k3); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9144 |
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9145 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9146 |
while(j<80) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9147 |
w[j]=RR(w,j); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9148 |
t=AA(e,a,b^c^d,w[j],k4); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9149 |
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9150 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9151 |
h0=add32(h0,a); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9152 |
h1=add32(h1,b); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9153 |
h2=add32(h2,c); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9154 |
h3=add32(h3,d); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9155 |
h4=add32(h4,e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9156 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9157 |
return [h0,h1,h2,h3,h4]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9158 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9159 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9160 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9161 |
//-- RGB colour object |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9162 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9163 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9164 |
// Construct an RGB colour object from a '#rrggbb', '#rgb' or 'rgb(n,n,n)' string or from separate r,g,b values |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9165 |
function RGB(r,g,b) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9166 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9167 |
this.r = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9168 |
this.g = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9169 |
this.b = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9170 |
if(typeof r == "string") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9171 |
if(r.substr(0,1) == "#") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9172 |
if(r.length == 7) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9173 |
this.r = parseInt(r.substr(1,2),16)/255; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9174 |
this.g = parseInt(r.substr(3,2),16)/255; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9175 |
this.b = parseInt(r.substr(5,2),16)/255; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9176 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9177 |
this.r = parseInt(r.substr(1,1),16)/15; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9178 |
this.g = parseInt(r.substr(2,1),16)/15; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9179 |
this.b = parseInt(r.substr(3,1),16)/15; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9180 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9181 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9182 |
var rgbPattern = /rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9183 |
var c = r.match(rgbPattern); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9184 |
if(c) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9185 |
this.r = parseInt(c[1],10)/255; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9186 |
this.g = parseInt(c[2],10)/255; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9187 |
this.b = parseInt(c[3],10)/255; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9188 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9189 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9190 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9191 |
this.r = r; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9192 |
this.g = g; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9193 |
this.b = b; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9194 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9195 |
return this; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9196 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9197 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9198 |
// Mixes this colour with another in a specified proportion |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9199 |
// c = other colour to mix |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9200 |
// f = 0..1 where 0 is this colour and 1 is the new colour |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9201 |
// Returns an RGB object |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9202 |
RGB.prototype.mix = function(c,f) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9203 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9204 |
return new RGB(this.r + (c.r-this.r) * f,this.g + (c.g-this.g) * f,this.b + (c.b-this.b) * f); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9205 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9206 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9207 |
// Return an rgb colour as a #rrggbb format hex string |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9208 |
RGB.prototype.toString = function() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9209 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9210 |
return "#" + ("0" + Math.floor(this.r.clamp(0,1) * 255).toString(16)).right(2) + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9211 |
("0" + Math.floor(this.g.clamp(0,1) * 255).toString(16)).right(2) + |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9212 |
("0" + Math.floor(this.b.clamp(0,1) * 255).toString(16)).right(2); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9213 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9214 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9215 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9216 |
//-- DOM utilities - many derived from www.quirksmode.org |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9217 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9218 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9219 |
function drawGradient(place,horiz,locolors,hicolors) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9220 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9221 |
if(!hicolors) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9222 |
hicolors = locolors; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9223 |
for(var t=0; t<= 100; t+=2) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9224 |
var bar = document.createElement("div"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9225 |
place.appendChild(bar); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9226 |
bar.style.position = "absolute"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9227 |
bar.style.left = horiz ? t + "%" : 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9228 |
bar.style.top = horiz ? 0 : t + "%"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9229 |
bar.style.width = horiz ? (101-t) + "%" : "100%"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9230 |
bar.style.height = horiz ? "100%" : (101-t) + "%"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9231 |
bar.style.zIndex = -1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9232 |
var p = t/100*(locolors.length-1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9233 |
bar.style.backgroundColor = hicolors[Math.floor(p)].mix(locolors[Math.ceil(p)],p-Math.floor(p)).toString(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9234 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9235 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9236 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9237 |
function createTiddlyText(parent,text) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9238 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9239 |
return parent.appendChild(document.createTextNode(text)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9240 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9241 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9242 |
function createTiddlyCheckbox(parent,caption,checked,onChange) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9243 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9244 |
var cb = document.createElement("input"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9245 |
cb.setAttribute("type","checkbox"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9246 |
cb.onclick = onChange; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9247 |
parent.appendChild(cb); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9248 |
cb.checked = checked; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9249 |
cb.className = "chkOptionInput"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9250 |
if(caption) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9251 |
wikify(caption,parent); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9252 |
return cb; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9253 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9254 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9255 |
function createTiddlyElement(parent,element,id,className,text,attribs) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9256 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9257 |
var e = document.createElement(element); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9258 |
if(className != null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9259 |
e.className = className; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9260 |
if(id != null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9261 |
e.setAttribute("id",id); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9262 |
if(text != null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9263 |
e.appendChild(document.createTextNode(text)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9264 |
if(attribs) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9265 |
for(var n in attribs) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9266 |
e.setAttribute(n,attribs[n]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9267 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9268 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9269 |
if(parent != null) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9270 |
parent.appendChild(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9271 |
return e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9272 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9273 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9274 |
function addEvent(obj,type,fn) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9275 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9276 |
if(obj.attachEvent) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9277 |
obj['e'+type+fn] = fn; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9278 |
obj[type+fn] = function(){obj['e'+type+fn](window.event);}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9279 |
obj.attachEvent('on'+type,obj[type+fn]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9280 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9281 |
obj.addEventListener(type,fn,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9282 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9283 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9284 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9285 |
function removeEvent(obj,type,fn) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9286 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9287 |
if(obj.detachEvent) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9288 |
obj.detachEvent('on'+type,obj[type+fn]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9289 |
obj[type+fn] = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9290 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9291 |
obj.removeEventListener(type,fn,false); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9292 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9293 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9294 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9295 |
function addClass(e,className) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9296 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9297 |
var currClass = e.className.split(" "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9298 |
if(currClass.indexOf(className) == -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9299 |
e.className += " " + className; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9300 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9301 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9302 |
function removeClass(e,className) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9303 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9304 |
var currClass = e.className.split(" "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9305 |
var i = currClass.indexOf(className); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9306 |
while(i != -1) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9307 |
currClass.splice(i,1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9308 |
i = currClass.indexOf(className); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9309 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9310 |
e.className = currClass.join(" "); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9311 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9312 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9313 |
function hasClass(e,className) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9314 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9315 |
if(e.className) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9316 |
if(e.className.split(" ").indexOf(className) != -1) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9317 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9318 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9319 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9320 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9321 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9322 |
// Find the closest relative with a given property value (property defaults to tagName, relative defaults to parentNode) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9323 |
function findRelated(e,value,name,relative) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9324 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9325 |
name = name ? name : "tagName"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9326 |
relative = relative ? relative : "parentNode"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9327 |
if(name == "className") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9328 |
while(e && !hasClass(e,value)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9329 |
e = e[relative]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9330 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9331 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9332 |
while(e && e[name] != value) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9333 |
e = e[relative]; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9334 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9335 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9336 |
return e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9337 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9338 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9339 |
// Resolve the target object of an event |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9340 |
function resolveTarget(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9341 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9342 |
var obj; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9343 |
if(e.target) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9344 |
obj = e.target; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9345 |
else if(e.srcElement) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9346 |
obj = e.srcElement; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9347 |
if(obj.nodeType == 3) // defeat Safari bug |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9348 |
obj = obj.parentNode; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9349 |
return obj; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9350 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9351 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9352 |
// Prevent an event from bubbling |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9353 |
function stopEvent(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9354 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9355 |
var ev = e ? e : window.event; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9356 |
ev.cancelBubble = true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9357 |
if(ev.stopPropagation) ev.stopPropagation(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9358 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9359 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9360 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9361 |
// Return the content of an element as plain text with no formatting |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9362 |
function getPlainText(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9363 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9364 |
var text = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9365 |
if(e.innerText) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9366 |
text = e.innerText; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9367 |
else if(e.textContent) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9368 |
text = e.textContent; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9369 |
return text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9370 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9371 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9372 |
// Get the scroll position for window.scrollTo necessary to scroll a given element into view |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9373 |
function ensureVisible(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9374 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9375 |
var posTop = findPosY(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9376 |
var posBot = posTop + e.offsetHeight; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9377 |
var winTop = findScrollY(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9378 |
var winHeight = findWindowHeight(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9379 |
var winBot = winTop + winHeight; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9380 |
if(posTop < winTop) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9381 |
return posTop; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9382 |
} else if(posBot > winBot) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9383 |
if(e.offsetHeight < winHeight) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9384 |
return posTop - (winHeight - e.offsetHeight); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9385 |
else |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9386 |
return posTop; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9387 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9388 |
return winTop; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9389 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9390 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9391 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9392 |
// Get the current width of the display window |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9393 |
function findWindowWidth() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9394 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9395 |
return window.innerWidth ? window.innerWidth : document.documentElement.clientWidth; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9396 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9397 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9398 |
// Get the current height of the display window |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9399 |
function findWindowHeight() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9400 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9401 |
return window.innerHeight ? window.innerHeight : document.documentElement.clientHeight; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9402 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9403 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9404 |
// Get the current horizontal page scroll position |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9405 |
function findScrollX() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9406 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9407 |
return window.scrollX ? window.scrollX : document.documentElement.scrollLeft; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9408 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9409 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9410 |
// Get the current vertical page scroll position |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9411 |
function findScrollY() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9412 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9413 |
return window.scrollY ? window.scrollY : document.documentElement.scrollTop; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9414 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9415 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9416 |
function findPosX(obj) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9417 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9418 |
var curleft = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9419 |
while(obj.offsetParent) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9420 |
curleft += obj.offsetLeft; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9421 |
obj = obj.offsetParent; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9422 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9423 |
return curleft; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9424 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9425 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9426 |
function findPosY(obj) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9427 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9428 |
var curtop = 0; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9429 |
while(obj.offsetParent) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9430 |
curtop += obj.offsetTop; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9431 |
obj = obj.offsetParent; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9432 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9433 |
return curtop; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9434 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9435 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9436 |
// Blur a particular element |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9437 |
function blurElement(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9438 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9439 |
if(e != null && e.focus && e.blur) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9440 |
e.focus(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9441 |
e.blur(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9442 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9443 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9444 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9445 |
// Create a non-breaking space |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9446 |
function insertSpacer(place) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9447 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9448 |
var e = document.createTextNode(String.fromCharCode(160)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9449 |
if(place) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9450 |
place.appendChild(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9451 |
return e; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9452 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9453 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9454 |
// Remove all children of a node |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9455 |
function removeChildren(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9456 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9457 |
while(e && e.hasChildNodes()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9458 |
removeNode(e.firstChild); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9459 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9460 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9461 |
// Remove a node and all it's children |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9462 |
function removeNode(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9463 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9464 |
scrubNode(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9465 |
e.parentNode.removeChild(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9466 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9467 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9468 |
// Remove any event handlers or non-primitve custom attributes |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9469 |
function scrubNode(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9470 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9471 |
if(!config.browser.isIE) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9472 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9473 |
var att = e.attributes; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9474 |
if(att) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9475 |
for(var t=0; t<att.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9476 |
var n = att[t].name; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9477 |
if(n !== 'style' && (typeof e[n] === 'function' || (typeof e[n] === 'object' && e[n] != null))) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9478 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9479 |
e[n] = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9480 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9481 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9482 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9483 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9484 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9485 |
var c = e.firstChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9486 |
while(c) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9487 |
scrubNode(c); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9488 |
c = c.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9489 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9490 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9491 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9492 |
// Add a stylesheet, replacing any previous custom stylesheet |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9493 |
function setStylesheet(s,id,doc) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9494 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9495 |
if(!id) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9496 |
id = "customStyleSheet"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9497 |
if(!doc) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9498 |
doc = document; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9499 |
var n = doc.getElementById(id); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9500 |
if(doc.createStyleSheet) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9501 |
// Test for IE's non-standard createStyleSheet method |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9502 |
if(n) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9503 |
n.parentNode.removeChild(n); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9504 |
// This failed without the |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9505 |
doc.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd"," <style id='" + id + "'>" + s + "</style>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9506 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9507 |
if(n) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9508 |
n.replaceChild(doc.createTextNode(s),n.firstChild); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9509 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9510 |
n = doc.createElement("style"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9511 |
n.type = "text/css"; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9512 |
n.id = id; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9513 |
n.appendChild(doc.createTextNode(s)); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9514 |
doc.getElementsByTagName("head")[0].appendChild(n); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9515 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9516 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9517 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9518 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9519 |
function removeStyleSheet(id) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9520 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9521 |
var e = document.getElementById(id); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9522 |
if(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9523 |
e.parentNode.removeChild(e); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9524 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9525 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9526 |
// Force the browser to do a document reflow when needed to workaround browser bugs |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9527 |
function forceReflow() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9528 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9529 |
if(config.browser.isGecko) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9530 |
setStylesheet("body {top:0px;margin-top:0px;}","forceReflow"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9531 |
setTimeout(function() {setStylesheet("","forceReflow");},1); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9532 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9533 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9534 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9535 |
// Replace the current selection of a textarea or text input and scroll it into view |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9536 |
function replaceSelection(e,text) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9537 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9538 |
if(e.setSelectionRange) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9539 |
var oldpos = e.selectionStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9540 |
var isRange = e.selectionEnd > e.selectionStart; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9541 |
e.value = e.value.substr(0,e.selectionStart) + text + e.value.substr(e.selectionEnd); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9542 |
e.setSelectionRange(isRange ? oldpos : oldpos + text.length,oldpos + text.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9543 |
var linecount = e.value.split('\n').length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9544 |
var thisline = e.value.substr(0,e.selectionStart).split('\n').length-1; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9545 |
e.scrollTop = Math.floor((thisline - e.rows / 2) * e.scrollHeight / linecount); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9546 |
} else if(document.selection) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9547 |
var range = document.selection.createRange(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9548 |
if(range.parentElement() == e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9549 |
var isCollapsed = range.text == ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9550 |
range.text = text; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9551 |
if(!isCollapsed) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9552 |
range.moveStart('character', -text.length); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9553 |
range.select(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9554 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9555 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9556 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9557 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9558 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9559 |
// Returns the text of the given (text) node, possibly merging subsequent text nodes |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9560 |
function getNodeText(e) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9561 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9562 |
var t = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9563 |
while(e && e.nodeName == "#text") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9564 |
t += e.nodeValue; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9565 |
e = e.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9566 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9567 |
return t; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9568 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9569 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9570 |
// Returns true if the element e has a given ancestor element |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9571 |
function isDescendant(e,ancestor) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9572 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9573 |
while(e) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9574 |
if(e === ancestor) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9575 |
return true; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9576 |
e = e.parentNode; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9577 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9578 |
return false; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9579 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9580 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9581 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9582 |
//-- LoaderBase and SaverBase |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9583 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9584 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9585 |
function LoaderBase() {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9586 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9587 |
LoaderBase.prototype.loadTiddler = function(store,node,tiddlers) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9588 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9589 |
var title = this.getTitle(store,node); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9590 |
if(safeMode && store.isShadowTiddler(title)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9591 |
return; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9592 |
if(title) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9593 |
var tiddler = store.createTiddler(title); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9594 |
this.internalizeTiddler(store,tiddler,title,node); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9595 |
tiddlers.push(tiddler); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9596 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9597 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9598 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9599 |
LoaderBase.prototype.loadTiddlers = function(store,nodes) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9600 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9601 |
var tiddlers = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9602 |
for(var t = 0; t < nodes.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9603 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9604 |
this.loadTiddler(store,nodes[t],tiddlers); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9605 |
} catch(ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9606 |
showException(ex,config.messages.tiddlerLoadError.format([this.getTitle(store,nodes[t])])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9607 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9608 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9609 |
return tiddlers; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9610 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9611 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9612 |
function SaverBase() {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9613 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9614 |
SaverBase.prototype.externalize = function(store) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9615 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9616 |
var results = []; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9617 |
var tiddlers = store.getTiddlers("title"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9618 |
for(var t = 0; t < tiddlers.length; t++) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9619 |
if(!tiddlers[t].doNotSave()) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9620 |
results.push(this.externalizeTiddler(store, tiddlers[t])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9621 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9622 |
return results.join("\n"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9623 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9624 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9625 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9626 |
//-- TW21Loader (inherits from LoaderBase) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9627 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9628 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9629 |
function TW21Loader() {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9630 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9631 |
TW21Loader.prototype = new LoaderBase(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9632 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9633 |
TW21Loader.prototype.getTitle = function(store,node) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9634 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9635 |
var title = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9636 |
if(node.getAttribute) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9637 |
title = node.getAttribute("title"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9638 |
if(!title) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9639 |
title = node.getAttribute("tiddler"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9640 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9641 |
if(!title && node.id) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9642 |
var lenPrefix = store.idPrefix.length; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9643 |
if(node.id.substr(0,lenPrefix) == store.idPrefix) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9644 |
title = node.id.substr(lenPrefix); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9645 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9646 |
return title; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9647 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9648 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9649 |
TW21Loader.prototype.internalizeTiddler = function(store,tiddler,title,node) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9650 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9651 |
var e = node.firstChild; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9652 |
var text = null; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9653 |
if(node.getAttribute("tiddler")) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9654 |
text = getNodeText(e).unescapeLineBreaks(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9655 |
} else { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9656 |
while(e.nodeName!="PRE" && e.nodeName!="pre") { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9657 |
e = e.nextSibling; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9658 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9659 |
text = e.innerHTML.replace(/\r/mg,"").htmlDecode(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9660 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9661 |
var modifier = node.getAttribute("modifier"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9662 |
var c = node.getAttribute("created"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9663 |
var m = node.getAttribute("modified"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9664 |
var created = c ? Date.convertFromYYYYMMDDHHMM(c) : version.date; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9665 |
var modified = m ? Date.convertFromYYYYMMDDHHMM(m) : created; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9666 |
var tags = node.getAttribute("tags"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9667 |
var fields = {}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9668 |
var attrs = node.attributes; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9669 |
for(var i = attrs.length-1; i >= 0; i--) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9670 |
var name = attrs[i].name; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9671 |
if(attrs[i].specified && !TiddlyWiki.isStandardField(name)) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9672 |
fields[name] = attrs[i].value.unescapeLineBreaks(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9673 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9674 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9675 |
tiddler.assign(title,text,modifier,modified,tags,created,fields); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9676 |
return tiddler; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9677 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9678 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9679 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9680 |
//-- TW21Saver (inherits from SaverBase) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9681 |
//-- |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9682 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9683 |
function TW21Saver() {} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9684 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9685 |
TW21Saver.prototype = new SaverBase(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9686 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9687 |
TW21Saver.prototype.externalizeTiddler = function(store,tiddler) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9688 |
{ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9689 |
try { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9690 |
var extendedAttributes = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9691 |
var usePre = config.options.chkUsePreForStorage; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9692 |
store.forEachField(tiddler, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9693 |
function(tiddler,fieldName,value) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9694 |
// don't store stuff from the temp namespace |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9695 |
if(typeof value != "string") |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9696 |
value = ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9697 |
if(!fieldName.match(/^temp\./)) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9698 |
extendedAttributes += ' %0="%1"'.format([fieldName,value.escapeLineBreaks().htmlEncode()]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9699 |
},true); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9700 |
var created = tiddler.created; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9701 |
var modified = tiddler.modified; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9702 |
var attributes = tiddler.modifier ? ' modifier="' + tiddler.modifier.htmlEncode() + '"' : ""; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9703 |
attributes += (usePre && created == version.date) ? "" :' created="' + created.convertToYYYYMMDDHHMM() + '"'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9704 |
attributes += (usePre && modified == created) ? "" : ' modified="' + modified.convertToYYYYMMDDHHMM() +'"'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9705 |
var tags = tiddler.getTags(); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9706 |
if(!usePre || tags) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9707 |
attributes += ' tags="' + tags.htmlEncode() + '"'; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9708 |
return ('<div %0="%1"%2%3>%4</'+'div>').format([ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9709 |
usePre ? "title" : "tiddler", |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9710 |
tiddler.title.htmlEncode(), |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9711 |
attributes, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9712 |
extendedAttributes, |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9713 |
usePre ? "\n<pre>" + tiddler.text.htmlEncode() + "</pre>\n" : tiddler.text.escapeLineBreaks().htmlEncode() |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9714 |
]); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9715 |
} catch (ex) { |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9716 |
throw exceptionText(ex,config.messages.tiddlerSaveError.format([tiddler.title])); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9717 |
} |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9718 |
}; |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9719 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9720 |
//]]> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9721 |
</script> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9722 |
<script type="text/javascript"> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9723 |
//<![CDATA[ |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9724 |
if(useJavaSaver) |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9725 |
document.write("<applet style='position:absolute;left:-1px' name='TiddlySaver' code='TiddlySaver.class' archive='TiddlySaver.jar' width='1' height='1'></applet>"); |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9726 |
//]]> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9727 |
</script> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9728 |
<!--POST-SCRIPT-START--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9729 |
|
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9730 |
<!--POST-SCRIPT-END--> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9731 |
</body> |
0ede2f3adbc1
Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9732 |
</html> |