Index: trunk/extensions/BookManager/jquery.hotkeys.js |
— | — | @@ -1,244 +0,0 @@ |
2 | | -/* |
3 | | -(c) Copyrights 2007 - 2008 |
4 | | - |
5 | | -Original idea by by Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ |
6 | | - |
7 | | -jQuery Plugin by Tzury Bar Yochay |
8 | | -tzury.by@gmail.com |
9 | | -http://evalinux.wordpress.com |
10 | | -http://facebook.com/profile.php?id=513676303 |
11 | | - |
12 | | -Project's sites: |
13 | | -http://code.google.com/p/js-hotkeys/ |
14 | | -http://github.com/tzuryby/hotkeys/tree/master |
15 | | - |
16 | | -License: same as jQuery license. |
17 | | - |
18 | | -USAGE: |
19 | | - // simple usage |
20 | | - $(document).bind('keydown', 'Ctrl+c', function(){ alert('copy anyone?');}); |
21 | | - |
22 | | - // special options such as disableInIput |
23 | | - $(document).bind('keydown', {combi:'Ctrl+x', disableInInput: true} , function() {}); |
24 | | - |
25 | | -Note: |
26 | | - This plugin wraps the following jQuery methods: $.fn.find, $.fn.bind and $.fn.unbind |
27 | | -*/ |
28 | | - |
29 | | -(function (jQuery){ |
30 | | - // keep reference to the original $.fn.bind, $.fn.unbind and $.fn.find |
31 | | - jQuery.fn.__bind__ = jQuery.fn.bind; |
32 | | - jQuery.fn.__unbind__ = jQuery.fn.unbind; |
33 | | - jQuery.fn.__find__ = jQuery.fn.find; |
34 | | - |
35 | | - var hotkeys = { |
36 | | - version: '0.7.9', |
37 | | - override: /keypress|keydown|keyup/g, |
38 | | - triggersMap: {}, |
39 | | - |
40 | | - specialKeys: { 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', |
41 | | - 20: 'capslock', 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del', |
42 | | - 35:'end', 33: 'pageup', 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', |
43 | | - 109: '-', |
44 | | - 112:'f1',113:'f2', 114:'f3', 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', |
45 | | - 120:'f9', 121:'f10', 122:'f11', 123:'f12', 191: '/'}, |
46 | | - |
47 | | - shiftNums: { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", |
48 | | - "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", |
49 | | - ".":">", "/":"?", "\\":"|" }, |
50 | | - |
51 | | - newTrigger: function (type, combi, callback) { |
52 | | - // i.e. {'keyup': {'ctrl': {cb: callback, disableInInput: false}}} |
53 | | - var result = {}; |
54 | | - result[type] = {}; |
55 | | - result[type][combi] = {cb: callback, disableInInput: false}; |
56 | | - return result; |
57 | | - } |
58 | | - }; |
59 | | - // add firefox num pad char codes |
60 | | - //if (jQuery.browser.mozilla){ |
61 | | - // add num pad char codes |
62 | | - hotkeys.specialKeys = jQuery.extend(hotkeys.specialKeys, { 96: '0', 97:'1', 98: '2', 99: |
63 | | - '3', 100: '4', 101: '5', 102: '6', 103: '7', 104: '8', 105: '9', 106: '*', |
64 | | - 107: '+', 109: '-', 110: '.', 111 : '/' |
65 | | - }); |
66 | | - //} |
67 | | - |
68 | | - // a wrapper around of $.fn.find |
69 | | - // see more at: http://groups.google.com/group/jquery-en/browse_thread/thread/18f9825e8d22f18d |
70 | | - jQuery.fn.find = function( selector ) { |
71 | | - this.query = selector; |
72 | | - return jQuery.fn.__find__.apply(this, arguments); |
73 | | - }; |
74 | | - |
75 | | - jQuery.fn.unbind = function (type, combi, fn){ |
76 | | - if (jQuery.isFunction(combi)){ |
77 | | - fn = combi; |
78 | | - combi = null; |
79 | | - } |
80 | | - if (combi && typeof combi === 'string'){ |
81 | | - var selectorId = ((this.prevObject && this.prevObject.query) || (this[0].id && this[0].id) || this[0]).toString(); |
82 | | - var hkTypes = type.split(' '); |
83 | | - for (var x=0; x<hkTypes.length; x++){ |
84 | | - delete hotkeys.triggersMap[selectorId][hkTypes[x]][combi]; |
85 | | - } |
86 | | - } |
87 | | - // call jQuery original unbind |
88 | | - return this.__unbind__(type, fn); |
89 | | - }; |
90 | | - |
91 | | - jQuery.fn.bind = function(type, data, fn){ |
92 | | - // grab keyup,keydown,keypress |
93 | | - var handle = type.match(hotkeys.override); |
94 | | - |
95 | | - if (jQuery.isFunction(data) || !handle){ |
96 | | - // call jQuery.bind only |
97 | | - return this.__bind__(type, data, fn); |
98 | | - } |
99 | | - else{ |
100 | | - // split the job |
101 | | - var result = null, |
102 | | - // pass the rest to the original $.fn.bind |
103 | | - pass2jq = jQuery.trim(type.replace(hotkeys.override, '')); |
104 | | - |
105 | | - // see if there are other types, pass them to the original $.fn.bind |
106 | | - if (pass2jq){ |
107 | | - result = this.__bind__(pass2jq, data, fn); |
108 | | - } |
109 | | - |
110 | | - if (typeof data === "string"){ |
111 | | - data = {'combi': data}; |
112 | | - } |
113 | | - if(data.combi){ |
114 | | - for (var x=0; x < handle.length; x++){ |
115 | | - var eventType = handle[x]; |
116 | | - var combi = data.combi.toLowerCase(), |
117 | | - trigger = hotkeys.newTrigger(eventType, combi, fn), |
118 | | - selectorId = ((this.prevObject && this.prevObject.query) || (this[0].id && this[0].id) || this[0]).toString(); |
119 | | - |
120 | | - //trigger[eventType][combi].propagate = data.propagate; |
121 | | - trigger[eventType][combi].disableInInput = data.disableInInput; |
122 | | - |
123 | | - // first time selector is bounded |
124 | | - if (!hotkeys.triggersMap[selectorId]) { |
125 | | - hotkeys.triggersMap[selectorId] = trigger; |
126 | | - } |
127 | | - // first time selector is bounded with this type |
128 | | - else if (!hotkeys.triggersMap[selectorId][eventType]) { |
129 | | - hotkeys.triggersMap[selectorId][eventType] = trigger[eventType]; |
130 | | - } |
131 | | - // make trigger point as array so more than one handler can be bound |
132 | | - var mapPoint = hotkeys.triggersMap[selectorId][eventType][combi]; |
133 | | - if (!mapPoint){ |
134 | | - hotkeys.triggersMap[selectorId][eventType][combi] = [trigger[eventType][combi]]; |
135 | | - } |
136 | | - else if (mapPoint.constructor !== Array){ |
137 | | - hotkeys.triggersMap[selectorId][eventType][combi] = [mapPoint]; |
138 | | - } |
139 | | - else { |
140 | | - hotkeys.triggersMap[selectorId][eventType][combi][mapPoint.length] = trigger[eventType][combi]; |
141 | | - } |
142 | | - |
143 | | - // add attribute and call $.event.add per matched element |
144 | | - this.each(function(){ |
145 | | - // jQuery wrapper for the current element |
146 | | - var jqElem = jQuery(this); |
147 | | - |
148 | | - // element already associated with another collection |
149 | | - if (jqElem.attr('hkId') && jqElem.attr('hkId') !== selectorId){ |
150 | | - selectorId = jqElem.attr('hkId') + ";" + selectorId; |
151 | | - } |
152 | | - jqElem.attr('hkId', selectorId); |
153 | | - }); |
154 | | - result = this.__bind__(handle.join(' '), data, hotkeys.handler) |
155 | | - } |
156 | | - } |
157 | | - return result; |
158 | | - } |
159 | | - }; |
160 | | - // work-around for opera and safari where (sometimes) the target is the element which was last |
161 | | - // clicked with the mouse and not the document event it would make sense to get the document |
162 | | - hotkeys.findElement = function (elem){ |
163 | | - if (!jQuery(elem).attr('hkId')){ |
164 | | - if (jQuery.browser.opera || jQuery.browser.safari){ |
165 | | - while (!jQuery(elem).attr('hkId') && elem.parentNode){ |
166 | | - elem = elem.parentNode; |
167 | | - } |
168 | | - } |
169 | | - } |
170 | | - return elem; |
171 | | - }; |
172 | | - // the event handler |
173 | | - hotkeys.handler = function(event) { |
174 | | - var target = hotkeys.findElement(event.currentTarget), |
175 | | - jTarget = jQuery(target), |
176 | | - ids = jTarget.attr('hkId'); |
177 | | - |
178 | | - if(ids){ |
179 | | - ids = ids.split(';'); |
180 | | - var code = event.which, |
181 | | - type = event.type, |
182 | | - special = hotkeys.specialKeys[code], |
183 | | - // prevent f5 overlapping with 't' (or f4 with 's', etc.) |
184 | | - character = !special && String.fromCharCode(code).toLowerCase(), |
185 | | - shift = event.shiftKey, |
186 | | - ctrl = event.ctrlKey, |
187 | | - // patch for jquery 1.2.5 && 1.2.6 see more at: |
188 | | - // http://groups.google.com/group/jquery-en/browse_thread/thread/83e10b3bb1f1c32b |
189 | | - alt = event.altKey || event.originalEvent.altKey, |
190 | | - mapPoint = null; |
191 | | - |
192 | | - for (var x=0; x < ids.length; x++){ |
193 | | - if (hotkeys.triggersMap[ids[x]][type]){ |
194 | | - mapPoint = hotkeys.triggersMap[ids[x]][type]; |
195 | | - break; |
196 | | - } |
197 | | - } |
198 | | - |
199 | | - //find by: id.type.combi.options |
200 | | - if (mapPoint){ |
201 | | - var trigger; |
202 | | - // event type is associated with the hkId |
203 | | - if(!shift && !ctrl && !alt) { // No Modifiers |
204 | | - trigger = mapPoint[special] || (character && mapPoint[character]); |
205 | | - } |
206 | | - else{ |
207 | | - // check combinations (alt|ctrl|shift+anything) |
208 | | - var modif = ''; |
209 | | - if(alt) modif +='alt+'; |
210 | | - if(ctrl) modif+= 'ctrl+'; |
211 | | - if(shift) modif += 'shift+'; |
212 | | - // modifiers + special keys or modifiers + character or modifiers + shift character or just shift character |
213 | | - trigger = mapPoint[modif+special]; |
214 | | - if (!trigger){ |
215 | | - if (character){ |
216 | | - trigger = mapPoint[modif+character] |
217 | | - || mapPoint[modif+hotkeys.shiftNums[character]] |
218 | | - // '$' can be triggered as 'Shift+4' or 'Shift+$' or just '$' |
219 | | - || (modif === 'shift+' && mapPoint[hotkeys.shiftNums[character]]); |
220 | | - } |
221 | | - } |
222 | | - } |
223 | | - if (trigger){ |
224 | | - var result = false; |
225 | | - for (var x=0; x < trigger.length; x++){ |
226 | | - if(trigger[x].disableInInput){ |
227 | | - // double check event.currentTarget and event.target |
228 | | - var elem = jQuery(event.target); |
229 | | - if (jTarget.is("input") || jTarget.is("textarea") || jTarget.is("select") |
230 | | - || elem.is("input") || elem.is("textarea") || elem.is("select")) { |
231 | | - return true; |
232 | | - } |
233 | | - } |
234 | | - // call the registered callback function |
235 | | - result = result || trigger[x].cb.apply(this, [event]); |
236 | | - } |
237 | | - return result; |
238 | | - } |
239 | | - } |
240 | | - } |
241 | | - }; |
242 | | - // place it under window so it can be extended and overridden by others |
243 | | - window.hotkeys = hotkeys; |
244 | | - return jQuery; |
245 | | -})(jQuery); |
Index: trunk/extensions/BookManager/bookmanager.js |
— | — | @@ -1,16 +0,0 @@ |
2 | | -/* Navigation by arrow keys */ |
3 | | -$(function() { |
4 | | - $nav = $( ' .mw-book-navigation ' ); |
5 | | - $prev = $nav.find( ' .mw-prev a ' ); |
6 | | - $next = $nav.find( ' .mw-next a ' ); |
7 | | - if ( $prev.length ) { |
8 | | - $(document).bind('keydown', 'left', function(){ |
9 | | - location.href = $prev[0].href; |
10 | | - }); |
11 | | - } |
12 | | - if ( $next.length ) { |
13 | | - $(document).bind('keydown', 'right', function(){ |
14 | | - location.href = $next[0].href; |
15 | | - }); |
16 | | - } |
17 | | -}); |
Index: trunk/extensions/BookManager/bookmanager.css |
— | — | @@ -1,35 +0,0 @@ |
2 | | -.mw-book-navigation{ |
3 | | - -moz-border-radius:4px; /* Firefox, etc */ |
4 | | - -khtml-border-radius:4px; /* Konqueror, etc */ |
5 | | - -webkit-border-radius:4px; /* Safari, Google Chrome, etc */ |
6 | | - -opera-border-radius:4px; /* Opera */ |
7 | | - border-radius:4px; |
8 | | - padding:8px; |
9 | | - border: 1px solid #a7d7f9; |
10 | | - background-color:#eaf2f8; |
11 | | - margin:5px auto; |
12 | | - font-size:95%; |
13 | | - display:table; |
14 | | - clear:both; |
15 | | -} |
16 | | -.mw-book-navigation li{ |
17 | | - list-style:none; |
18 | | - display:inline; |
19 | | - display:table-cell; |
20 | | - } |
21 | | -.mw-book-navigation .mw-prev, .mw-book-navigation .mw-next{ |
22 | | - white-space:nowrap; |
23 | | -} |
24 | | -.mw-book-navigation .mw-prev a { |
25 | | - background:url("images/18px-1leftarrow.png") no-repeat scroll left center transparent; |
26 | | - padding: 0 50px 0 20px; |
27 | | -} |
28 | | -.mw-book-navigation .mw-index a { |
29 | | - background:url("images/18px-1uparrow.png") no-repeat scroll left center transparent; |
30 | | - padding: 0 0 0 20px; |
31 | | - margin: 0 8px; |
32 | | -} |
33 | | -.mw-book-navigation .mw-next a { |
34 | | - background:url("images/18px-1rightarrow.png") no-repeat scroll right center transparent; |
35 | | - padding: 0 20px 0 50px; |
36 | | -} |
Index: trunk/extensions/BookManager/BookManager.body.php |
— | — | @@ -343,7 +343,7 @@ |
344 | 344 | $out->addHTML( "<div>$bottom</div>" ); |
345 | 345 | # adds CSS and JS to navigation bar |
346 | 346 | $out->addModuleStyles( 'ext.BookManager' ); |
347 | | - //$out->addModules( 'ext.BookManager' ); |
| 347 | + $out->addModules( 'ext.BookManager' ); |
348 | 348 | return true; |
349 | 349 | } |
350 | 350 | } |
Index: trunk/extensions/BookManager/BookManager.php |
— | — | @@ -9,10 +9,8 @@ |
10 | 10 | * - NEXTPAGENAMEE (get next page encode) |
11 | 11 | * - ROOTPAGENAME (get root page) |
12 | 12 | * - ROOTPAGENAMEE (get root page encode) |
13 | | - * - CHAPTERNAME (get chapter) |
14 | | - * - CHAPTERNAMEE (get chapter encode) |
15 | | - * - RANDOMCHAPTER (get random page) |
16 | | - * - RANDOMCHAPTERE (get random page encode) |
| 13 | + * - CHAPTERNAME (get root page) |
| 14 | + * - CHAPTERNAMEE (get root page encode) |
17 | 15 | * @addtogroup Extensions |
18 | 16 | * @author Raylton P. Sousa <raylton.sousa@gmail.com> |
19 | 17 | * @author Helder.wiki |
— | — | @@ -66,8 +64,8 @@ |
67 | 65 | 'styles' => 'bookmanager.css', |
68 | 66 | 'messages' => array( 'BookManager', 'BookManager-top', 'BookManager-bottom' ), |
69 | 67 | 'dependencies' => array( 'jquery', 'mediawiki.util' ), |
70 | | - 'localBasePath' => $dir, |
71 | | - 'remoteExtPath' => 'BookManager' |
| 68 | + 'localBasePath' => $dir. '/client', |
| 69 | + 'remoteExtPath' => 'BookManager/client' |
72 | 70 | ); |
73 | 71 | $wgBookManagerNamespaces = array( NS_MAIN ); |
74 | 72 | $wgBookManagerVariables = true ; |
Index: trunk/extensions/BookManager/client/jquery.hotkeys.js |
— | — | @@ -0,0 +1,244 @@ |
| 2 | +/* |
| 3 | +(c) Copyrights 2007 - 2008 |
| 4 | + |
| 5 | +Original idea by by Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ |
| 6 | + |
| 7 | +jQuery Plugin by Tzury Bar Yochay |
| 8 | +tzury.by@gmail.com |
| 9 | +http://evalinux.wordpress.com |
| 10 | +http://facebook.com/profile.php?id=513676303 |
| 11 | + |
| 12 | +Project's sites: |
| 13 | +http://code.google.com/p/js-hotkeys/ |
| 14 | +http://github.com/tzuryby/hotkeys/tree/master |
| 15 | + |
| 16 | +License: same as jQuery license. |
| 17 | + |
| 18 | +USAGE: |
| 19 | + // simple usage |
| 20 | + $(document).bind('keydown', 'Ctrl+c', function(){ alert('copy anyone?');}); |
| 21 | + |
| 22 | + // special options such as disableInIput |
| 23 | + $(document).bind('keydown', {combi:'Ctrl+x', disableInInput: true} , function() {}); |
| 24 | + |
| 25 | +Note: |
| 26 | + This plugin wraps the following jQuery methods: $.fn.find, $.fn.bind and $.fn.unbind |
| 27 | +*/ |
| 28 | + |
| 29 | +(function (jQuery){ |
| 30 | + // keep reference to the original $.fn.bind, $.fn.unbind and $.fn.find |
| 31 | + jQuery.fn.__bind__ = jQuery.fn.bind; |
| 32 | + jQuery.fn.__unbind__ = jQuery.fn.unbind; |
| 33 | + jQuery.fn.__find__ = jQuery.fn.find; |
| 34 | + |
| 35 | + var hotkeys = { |
| 36 | + version: '0.7.9', |
| 37 | + override: /keypress|keydown|keyup/g, |
| 38 | + triggersMap: {}, |
| 39 | + |
| 40 | + specialKeys: { 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', |
| 41 | + 20: 'capslock', 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del', |
| 42 | + 35:'end', 33: 'pageup', 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', |
| 43 | + 109: '-', |
| 44 | + 112:'f1',113:'f2', 114:'f3', 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', |
| 45 | + 120:'f9', 121:'f10', 122:'f11', 123:'f12', 191: '/'}, |
| 46 | + |
| 47 | + shiftNums: { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", |
| 48 | + "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", |
| 49 | + ".":">", "/":"?", "\\":"|" }, |
| 50 | + |
| 51 | + newTrigger: function (type, combi, callback) { |
| 52 | + // i.e. {'keyup': {'ctrl': {cb: callback, disableInInput: false}}} |
| 53 | + var result = {}; |
| 54 | + result[type] = {}; |
| 55 | + result[type][combi] = {cb: callback, disableInInput: false}; |
| 56 | + return result; |
| 57 | + } |
| 58 | + }; |
| 59 | + // add firefox num pad char codes |
| 60 | + //if (jQuery.browser.mozilla){ |
| 61 | + // add num pad char codes |
| 62 | + hotkeys.specialKeys = jQuery.extend(hotkeys.specialKeys, { 96: '0', 97:'1', 98: '2', 99: |
| 63 | + '3', 100: '4', 101: '5', 102: '6', 103: '7', 104: '8', 105: '9', 106: '*', |
| 64 | + 107: '+', 109: '-', 110: '.', 111 : '/' |
| 65 | + }); |
| 66 | + //} |
| 67 | + |
| 68 | + // a wrapper around of $.fn.find |
| 69 | + // see more at: http://groups.google.com/group/jquery-en/browse_thread/thread/18f9825e8d22f18d |
| 70 | + jQuery.fn.find = function( selector ) { |
| 71 | + this.query = selector; |
| 72 | + return jQuery.fn.__find__.apply(this, arguments); |
| 73 | + }; |
| 74 | + |
| 75 | + jQuery.fn.unbind = function (type, combi, fn){ |
| 76 | + if (jQuery.isFunction(combi)){ |
| 77 | + fn = combi; |
| 78 | + combi = null; |
| 79 | + } |
| 80 | + if (combi && typeof combi === 'string'){ |
| 81 | + var selectorId = ((this.prevObject && this.prevObject.query) || (this[0].id && this[0].id) || this[0]).toString(); |
| 82 | + var hkTypes = type.split(' '); |
| 83 | + for (var x=0; x<hkTypes.length; x++){ |
| 84 | + delete hotkeys.triggersMap[selectorId][hkTypes[x]][combi]; |
| 85 | + } |
| 86 | + } |
| 87 | + // call jQuery original unbind |
| 88 | + return this.__unbind__(type, fn); |
| 89 | + }; |
| 90 | + |
| 91 | + jQuery.fn.bind = function(type, data, fn){ |
| 92 | + // grab keyup,keydown,keypress |
| 93 | + var handle = type.match(hotkeys.override); |
| 94 | + |
| 95 | + if (jQuery.isFunction(data) || !handle){ |
| 96 | + // call jQuery.bind only |
| 97 | + return this.__bind__(type, data, fn); |
| 98 | + } |
| 99 | + else{ |
| 100 | + // split the job |
| 101 | + var result = null, |
| 102 | + // pass the rest to the original $.fn.bind |
| 103 | + pass2jq = jQuery.trim(type.replace(hotkeys.override, '')); |
| 104 | + |
| 105 | + // see if there are other types, pass them to the original $.fn.bind |
| 106 | + if (pass2jq){ |
| 107 | + result = this.__bind__(pass2jq, data, fn); |
| 108 | + } |
| 109 | + |
| 110 | + if (typeof data === "string"){ |
| 111 | + data = {'combi': data}; |
| 112 | + } |
| 113 | + if(data.combi){ |
| 114 | + for (var x=0; x < handle.length; x++){ |
| 115 | + var eventType = handle[x]; |
| 116 | + var combi = data.combi.toLowerCase(), |
| 117 | + trigger = hotkeys.newTrigger(eventType, combi, fn), |
| 118 | + selectorId = ((this.prevObject && this.prevObject.query) || (this[0].id && this[0].id) || this[0]).toString(); |
| 119 | + |
| 120 | + //trigger[eventType][combi].propagate = data.propagate; |
| 121 | + trigger[eventType][combi].disableInInput = data.disableInInput; |
| 122 | + |
| 123 | + // first time selector is bounded |
| 124 | + if (!hotkeys.triggersMap[selectorId]) { |
| 125 | + hotkeys.triggersMap[selectorId] = trigger; |
| 126 | + } |
| 127 | + // first time selector is bounded with this type |
| 128 | + else if (!hotkeys.triggersMap[selectorId][eventType]) { |
| 129 | + hotkeys.triggersMap[selectorId][eventType] = trigger[eventType]; |
| 130 | + } |
| 131 | + // make trigger point as array so more than one handler can be bound |
| 132 | + var mapPoint = hotkeys.triggersMap[selectorId][eventType][combi]; |
| 133 | + if (!mapPoint){ |
| 134 | + hotkeys.triggersMap[selectorId][eventType][combi] = [trigger[eventType][combi]]; |
| 135 | + } |
| 136 | + else if (mapPoint.constructor !== Array){ |
| 137 | + hotkeys.triggersMap[selectorId][eventType][combi] = [mapPoint]; |
| 138 | + } |
| 139 | + else { |
| 140 | + hotkeys.triggersMap[selectorId][eventType][combi][mapPoint.length] = trigger[eventType][combi]; |
| 141 | + } |
| 142 | + |
| 143 | + // add attribute and call $.event.add per matched element |
| 144 | + this.each(function(){ |
| 145 | + // jQuery wrapper for the current element |
| 146 | + var jqElem = jQuery(this); |
| 147 | + |
| 148 | + // element already associated with another collection |
| 149 | + if (jqElem.attr('hkId') && jqElem.attr('hkId') !== selectorId){ |
| 150 | + selectorId = jqElem.attr('hkId') + ";" + selectorId; |
| 151 | + } |
| 152 | + jqElem.attr('hkId', selectorId); |
| 153 | + }); |
| 154 | + result = this.__bind__(handle.join(' '), data, hotkeys.handler) |
| 155 | + } |
| 156 | + } |
| 157 | + return result; |
| 158 | + } |
| 159 | + }; |
| 160 | + // work-around for opera and safari where (sometimes) the target is the element which was last |
| 161 | + // clicked with the mouse and not the document event it would make sense to get the document |
| 162 | + hotkeys.findElement = function (elem){ |
| 163 | + if (!jQuery(elem).attr('hkId')){ |
| 164 | + if (jQuery.browser.opera || jQuery.browser.safari){ |
| 165 | + while (!jQuery(elem).attr('hkId') && elem.parentNode){ |
| 166 | + elem = elem.parentNode; |
| 167 | + } |
| 168 | + } |
| 169 | + } |
| 170 | + return elem; |
| 171 | + }; |
| 172 | + // the event handler |
| 173 | + hotkeys.handler = function(event) { |
| 174 | + var target = hotkeys.findElement(event.currentTarget), |
| 175 | + jTarget = jQuery(target), |
| 176 | + ids = jTarget.attr('hkId'); |
| 177 | + |
| 178 | + if(ids){ |
| 179 | + ids = ids.split(';'); |
| 180 | + var code = event.which, |
| 181 | + type = event.type, |
| 182 | + special = hotkeys.specialKeys[code], |
| 183 | + // prevent f5 overlapping with 't' (or f4 with 's', etc.) |
| 184 | + character = !special && String.fromCharCode(code).toLowerCase(), |
| 185 | + shift = event.shiftKey, |
| 186 | + ctrl = event.ctrlKey, |
| 187 | + // patch for jquery 1.2.5 && 1.2.6 see more at: |
| 188 | + // http://groups.google.com/group/jquery-en/browse_thread/thread/83e10b3bb1f1c32b |
| 189 | + alt = event.altKey || event.originalEvent.altKey, |
| 190 | + mapPoint = null; |
| 191 | + |
| 192 | + for (var x=0; x < ids.length; x++){ |
| 193 | + if (hotkeys.triggersMap[ids[x]][type]){ |
| 194 | + mapPoint = hotkeys.triggersMap[ids[x]][type]; |
| 195 | + break; |
| 196 | + } |
| 197 | + } |
| 198 | + |
| 199 | + //find by: id.type.combi.options |
| 200 | + if (mapPoint){ |
| 201 | + var trigger; |
| 202 | + // event type is associated with the hkId |
| 203 | + if(!shift && !ctrl && !alt) { // No Modifiers |
| 204 | + trigger = mapPoint[special] || (character && mapPoint[character]); |
| 205 | + } |
| 206 | + else{ |
| 207 | + // check combinations (alt|ctrl|shift+anything) |
| 208 | + var modif = ''; |
| 209 | + if(alt) modif +='alt+'; |
| 210 | + if(ctrl) modif+= 'ctrl+'; |
| 211 | + if(shift) modif += 'shift+'; |
| 212 | + // modifiers + special keys or modifiers + character or modifiers + shift character or just shift character |
| 213 | + trigger = mapPoint[modif+special]; |
| 214 | + if (!trigger){ |
| 215 | + if (character){ |
| 216 | + trigger = mapPoint[modif+character] |
| 217 | + || mapPoint[modif+hotkeys.shiftNums[character]] |
| 218 | + // '$' can be triggered as 'Shift+4' or 'Shift+$' or just '$' |
| 219 | + || (modif === 'shift+' && mapPoint[hotkeys.shiftNums[character]]); |
| 220 | + } |
| 221 | + } |
| 222 | + } |
| 223 | + if (trigger){ |
| 224 | + var result = false; |
| 225 | + for (var x=0; x < trigger.length; x++){ |
| 226 | + if(trigger[x].disableInInput){ |
| 227 | + // double check event.currentTarget and event.target |
| 228 | + var elem = jQuery(event.target); |
| 229 | + if (jTarget.is("input") || jTarget.is("textarea") || jTarget.is("select") |
| 230 | + || elem.is("input") || elem.is("textarea") || elem.is("select")) { |
| 231 | + return true; |
| 232 | + } |
| 233 | + } |
| 234 | + // call the registered callback function |
| 235 | + result = result || trigger[x].cb.apply(this, [event]); |
| 236 | + } |
| 237 | + return result; |
| 238 | + } |
| 239 | + } |
| 240 | + } |
| 241 | + }; |
| 242 | + // place it under window so it can be extended and overridden by others |
| 243 | + window.hotkeys = hotkeys; |
| 244 | + return jQuery; |
| 245 | +})(jQuery); |
Property changes on: trunk/extensions/BookManager/client/jquery.hotkeys.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 246 | + native |
Index: trunk/extensions/BookManager/client/bookmanager.js |
— | — | @@ -0,0 +1,16 @@ |
| 2 | +/* Navigation by arrow keys */ |
| 3 | +$(function() { |
| 4 | + $nav = $( ' .mw-book-navigation ' ); |
| 5 | + $prev = $nav.find( ' .mw-prev a ' ); |
| 6 | + $next = $nav.find( ' .mw-next a ' ); |
| 7 | + if ( $prev.length ) { |
| 8 | + $(document).bind('keydown', 'left', function(){ |
| 9 | + location.href = $prev[0].href; |
| 10 | + }); |
| 11 | + } |
| 12 | + if ( $next.length ) { |
| 13 | + $(document).bind('keydown', 'right', function(){ |
| 14 | + location.href = $next[0].href; |
| 15 | + }); |
| 16 | + } |
| 17 | +}); |
Property changes on: trunk/extensions/BookManager/client/bookmanager.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 18 | + native |
Index: trunk/extensions/BookManager/client/images/18px-1uparrow.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/BookManager/client/images/18px-1uparrow.png |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 19 | + image/png |
Index: trunk/extensions/BookManager/client/images/18px-1leftarrow.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/BookManager/client/images/18px-1leftarrow.png |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 20 | + image/png |
Index: trunk/extensions/BookManager/client/images/18px-1rightarrow.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/BookManager/client/images/18px-1rightarrow.png |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 21 | + image/png |
Index: trunk/extensions/BookManager/client/bookmanager.css |
— | — | @@ -0,0 +1,39 @@ |
| 2 | +.mw-book-navigation{ |
| 3 | + -moz-border-radius:4px; /* Firefox, etc */ |
| 4 | + -khtml-border-radius:4px; /* Konqueror, etc */ |
| 5 | + -webkit-border-radius:4px; /* Safari, Google Chrome, etc */ |
| 6 | + -opera-border-radius:4px; /* Opera */ |
| 7 | + border-radius:4px; |
| 8 | + padding:8px; |
| 9 | + border: 1px solid #a7d7f9; |
| 10 | + background-color:#eaf2f8; |
| 11 | + margin:5px auto; |
| 12 | + font-size:95%; |
| 13 | + display:table; |
| 14 | + clear:both; |
| 15 | +} |
| 16 | +.mw-book-navigation li{ |
| 17 | + list-style:none; |
| 18 | + display:inline; |
| 19 | + display:table-cell; |
| 20 | + } |
| 21 | +.mw-book-navigation .mw-prev, .mw-book-navigation .mw-next{ |
| 22 | + white-space:nowrap; |
| 23 | +} |
| 24 | +.mw-book-navigation .mw-prev a { |
| 25 | + background:url("images/18px-1leftarrow.png") no-repeat scroll left center transparent; |
| 26 | + padding: 0 0 0 20px; |
| 27 | + margin: 0 50px 0 0; |
| 28 | + |
| 29 | +} |
| 30 | +.mw-book-navigation .mw-index a { |
| 31 | + background:url("images/18px-1uparrow.png") no-repeat scroll left center transparent; |
| 32 | + padding: 0 0 0 20px; |
| 33 | + margin: 0 8px; |
| 34 | +} |
| 35 | +.mw-book-navigation .mw-next a { |
| 36 | + background:url("images/18px-1rightarrow.png") no-repeat scroll right center transparent; |
| 37 | + padding: 0 20px 0 0; |
| 38 | + margin: 0 0 0 50px; |
| 39 | + |
| 40 | +} |
Property changes on: trunk/extensions/BookManager/client/bookmanager.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 41 | + native |