Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 344
- Log:
Massive changeset which brings the old, ROOL customised Instiki
version up to date, but without any ROOL customisations in this
latest checked-in version (which is 0.19.1). This is deliberate,
so that it's easy to see the changes made for the ROOL version
in a subsequent changeset. The 'app/views/shared' directory is not
part of Instiki but is kept to maintain the change history with
updated ROOL customisations, some of which involve the same files
in that same directory.
- Author:
- rool
- Date:
- Sat Mar 19 19:52:13 +0000 2011
- Size:
- 7902 Bytes
1 | /* |
2 | * Based on Simon Willison's blockquotes.js |
3 | * http://simon.incutio.com/archive/2002/12/20/#blockquoteCitations |
4 | */ |
5 | function extractBlockquoteCitations() { |
6 | var quotes = document.getElementsByTagName('blockquote'); |
7 | for (i = 0; i < quotes.length; i++) { |
8 | var cite = quotes[i].getAttribute('cite'); |
9 | if (cite && cite != '') { |
10 | var newlink = document.createElement('a'); |
11 | newlink.setAttribute('href', cite); |
12 | newlink.setAttribute('title', cite); |
13 | newlink.appendChild(document.createTextNode('#')); |
14 | var newspan = document.createElement('span'); |
15 | newspan.setAttribute('class','blockquotesource'); |
16 | newspan.appendChild(newlink); |
17 | quotes[i].lastChild.previousSibling.appendChild(newspan); |
18 | } |
19 | } |
20 | } |
21 | |
22 | function fixRunIn() { |
23 | // work around lack of gecko support for display:run-in |
24 | var re = /^num_|\s+num_|^un_|\s+un_|proof/; |
25 | $$('div > h6').each(function(element) { |
26 | if(re.test($(element.parentNode).className)) { |
27 | var new_span = new Element('span').update(element.textContent); |
28 | new_span.addClassName('theorem_label'); |
29 | var next_el = element.next().firstChild; |
30 | next_el.parentNode.insertBefore(new_span, next_el); |
31 | var period = new Element('span').update('. '); |
32 | next_el.parentNode.insertBefore(period, next_el); |
33 | element.remove(); |
34 | } |
35 | }); |
36 | // add tombstone to proof, since gecko doesn't support :last-child properly |
37 | $$('div.proof').each(function(element) { |
38 | var l = element.childElements().length -1; |
39 | var span = new Element('span').update('\u00a0\u00a0\u25ae'); |
40 | element.childElements()[l].insert(span); |
41 | }); |
42 | } |
43 | |
44 | function mactionWorkarounds() { |
45 | $$('maction[actiontype="tooltip"]').each( function(mtool){ |
46 | Element.writeAttribute(mtool, 'title', |
47 | Element.firstDescendant(mtool).nextSibling.firstChild.data); |
48 | }); |
49 | $$('maction[actiontype="statusline"]').each( function(mstatus){ |
50 | var v = Element.firstDescendant(mstatus).nextSibling.firstChild.data; |
51 | Event.observe(mstatus, 'mouseover', function(){window.status = v;}); |
52 | Event.observe(mstatus, 'mouseout', function(){window.status = '';}); |
53 | }); |
54 | } |
55 | |
56 | function addS5button(page_name) { |
57 | var f = $('MarkupHelp'); |
58 | if (f) { |
59 | var s5button = new Element('input', {id:'S5button', type:'button', value: 'Make this page an S5 slideshow'}); |
60 | f.insert({top: s5button}); |
61 | Event.observe(s5button, 'click', function(){ |
62 | var preamble = "author: " + document.getElementById('author').value + |
63 | "\ncompany: \ntitle: " + page_name + |
64 | "\nsubtitle: \nslide_theme: default\nslide_footer: \nslide_subfooter: " + |
65 | "\n\n:category: S5-slideshow\n\n" + page_name + |
66 | "\n==============\n\nMy First Slide\n-----------------\n\n"; |
67 | var content = document.getElementById('content'); |
68 | content.value = preamble + content.value; |
69 | document.getElementById('S5button').hide(); |
70 | }); |
71 | } |
72 | } |
73 | |
74 | function setupSVGedit(path){ |
75 | var f = $('MarkupHelp'); |
76 | var selected; |
77 | var before; |
78 | var after; |
79 | // create a control button |
80 | if (f) { |
81 | var SVGeditButton = new Element('input', {id:'SVGeditButton', type:'button', value: 'Create an SVG graphic'}); |
82 | f.insert({top: SVGeditButton}); |
83 | SVGeditButton.disabled = true; |
84 | Event.observe(SVGeditButton, 'click', function(){ |
85 | var editor = window.open(path + "?initStroke[width]=2", 'Edit SVG graphic', 'status=1,resizable=1,scrollbars=1'); |
86 | editor.addEventListener("load", function() { |
87 | editor.svgEditor.setCustomHandlers({ |
88 | 'save': function(window,svg){ |
89 | editor.svgEditor.setConfig({no_save_warning: true}); |
90 | window.opener.postMessage(svg, window.location.protocol + '//' + window.location.host); |
91 | window.close(); |
92 | } |
93 | }); |
94 | editor.svgEditor.randomizeIds(); |
95 | if (selected) editor.svgEditor.loadFromString(selected); |
96 | }, true); |
97 | SVGeditButton.disabled = true; |
98 | SVGeditButton.value = 'Create SVG graphic'; |
99 | editor.focus(); |
100 | }); |
101 | } |
102 | var t = $('content'); |
103 | |
104 | var callback = function(){ |
105 | // This is triggered by 'onmouseup' events |
106 | var sel = window.getSelection(); |
107 | var a = sel.anchorOffset; |
108 | var f = sel.focusOffset; |
109 | // A bit of ugliness, because Gecko-based browsers |
110 | // don't support getSelection in textareas |
111 | if (t.selectionStart ) { |
112 | var begin = t.selectionStart; |
113 | var end = t.selectionEnd; |
114 | } else { |
115 | if( a < f) { |
116 | begin = a; |
117 | end = f; |
118 | } else { |
119 | begin = f; |
120 | end = a; |
121 | } |
122 | } |
123 | // finally, slice up the textarea content into before, selected, & after pieces |
124 | before = t.value.slice(0, begin); |
125 | selected = t.value.slice(begin, end); |
126 | after = t.value.slice(end, t.value.length); |
127 | if (selected && selected != '') { |
128 | if ( selected.match(/^<svg(.|\n)*<\/svg>$/) && !selected.match(/<\/svg>(.|\n)/)) { |
129 | SVGeditButton.disabled = false; |
130 | SVGeditButton.value = 'Edit existing SVG graphic'; |
131 | } else { |
132 | SVGeditButton.disabled = true; |
133 | } |
134 | } else { |
135 | SVGeditButton.disabled = false; |
136 | SVGeditButton.value = 'Create SVG graphic'; |
137 | } |
138 | } |
139 | Event.observe(t, 'mouseup', callback ); |
140 | var my_loc = window.location.protocol + '//' + window.location.host; |
141 | Event.observe(window, "message", function(event){ |
142 | if(event.origin !== my_loc) { return;} |
143 | t.value = before + event.data + after; |
144 | t.focus(); |
145 | selectRange(t, before.length, before.length+event.data.length); |
146 | callback(); |
147 | }); |
148 | } |
149 | |
150 | function selectRange(elt, start, end) { |
151 | if (elt.setSelectionRange) { |
152 | elt.focus(); |
153 | elt.setSelectionRange(start, end); |
154 | } else if (elt.createTextRange) { |
155 | var range = elt.createTextRange(); |
156 | range.collapse(true); |
157 | range.moveEnd('character', end); |
158 | range.moveStart('character', start); |
159 | range.select(); |
160 | } |
161 | } |
162 | |
163 | function updateSize(elt, w, h) { |
164 | // adjust to the size of the user's browser area. |
165 | // w and h are the original, unadjusted, width and height per row/column |
166 | var parentheight = document.viewport.getHeight() - $('pageName').getHeight() |
167 | - $('editFormButtons').getHeight() - $('hidebutton').getHeight(); |
168 | var parentwidth = $('Content').getWidth(); |
169 | var f = $('MarkupHelp'); |
170 | if (f.visible()) { parentwidth = parentwidth - f.getWidth() - 20 } |
171 | var changename = $('alter_title'); |
172 | if (changename) { |
173 | parentheight = parentheight - changename.parentNode.getHeight()-2*h; |
174 | } |
175 | elt.writeAttribute({'cols': Math.floor(parentwidth/w) - 1, |
176 | 'rows': Math.floor(parentheight/h) - 4 }); |
177 | elt.setStyle({Width: parentwidth, Height: parentheight}); |
178 | } |
179 | |
180 | function resizeableTextarea() { |
181 | //make the textarea resize to fit available space |
182 | var f = $('MarkupHelp'); |
183 | if (f) { |
184 | var hidebutton = new Element('input', {id:'hidebutton', type:'button', value: 'Hide markup help'}); |
185 | f.insert({before: hidebutton}); |
186 | } |
187 | $$('textarea#content').each( function(textarea) { |
188 | var w = textarea.getWidth()/textarea.getAttribute('cols'); |
189 | var h = textarea.getStyle('lineHeight').replace(/(\d*)px/, "$1"); |
190 | var changename = $('alter_title'); |
191 | if (changename) { |
192 | Event.observe(changename.parentNode, 'change', function() { |
193 | updateSize(textarea, w, h); |
194 | }); |
195 | } |
196 | Event.observe(hidebutton, 'click', function(){ |
197 | if (f.visible()) { |
198 | f.hide(); |
199 | hidebutton.writeAttribute({value: 'Show markup help'}); |
200 | updateSize(textarea, w, h) |
201 | } else { |
202 | f.show(); |
203 | hidebutton.writeAttribute({value: 'Hide markup help'}); |
204 | updateSize(textarea, w, h) |
205 | } |
206 | }); |
207 | Event.observe(window, 'resize', function(){ updateSize(textarea, w, h) }); |
208 | updateSize(textarea, w, h); |
209 | }); |
210 | } |
211 | |
212 | window.onload = function (){ |
213 | extractBlockquoteCitations(); |
214 | fixRunIn(); |
215 | mactionWorkarounds(); |
216 | resizeableTextarea(); |
217 | }; |