Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -31,7 +31,11 @@ |
32 | 32 | |
33 | 33 | function addOnloadHook(hookFunct) { |
34 | 34 | // Allows add-on scripts to add onload functions |
35 | | - onloadFuncts[onloadFuncts.length] = hookFunct; |
| 35 | + if(!doneOnloadHook) { |
| 36 | + onloadFuncts[onloadFuncts.length] = hookFunct; |
| 37 | + } else { |
| 38 | + hookFunct(); // bug in MSIE script loading |
| 39 | + } |
36 | 40 | } |
37 | 41 | |
38 | 42 | function hookEvent(hookName, hookFunct) { |
— | — | @@ -42,6 +46,41 @@ |
43 | 47 | } |
44 | 48 | } |
45 | 49 | |
| 50 | +function importScript(page) { |
| 51 | + return importScriptURI(wgScript + '?action=raw&ctype=text/javascript&title=' + encodeURIComponent(page.replace(/ /g,'_'))); |
| 52 | +} |
| 53 | + |
| 54 | +var loadedScripts = {}; // included-scripts tracker |
| 55 | +function importScriptURI(url) { |
| 56 | + if (loadedScripts[url]) { |
| 57 | + return; |
| 58 | + } |
| 59 | + loadedScripts[url] = true; |
| 60 | + var s = document.createElement('script'); |
| 61 | + s.setAttribute('src',url); |
| 62 | + s.setAttribute('type','text/javascript'); |
| 63 | + document.getElementsByTagName('head')[0].appendChild(s); |
| 64 | + return s; |
| 65 | +} |
| 66 | + |
| 67 | +function importStylesheet(page) { |
| 68 | + return importStylesheetURI(wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent(page.replace(/ /g,'_'))); |
| 69 | +} |
| 70 | + |
| 71 | +function importStylesheetURI(url) { |
| 72 | + return document.createStyleSheet ? document.createStyleSheet(url) : appendCSS('@import "' + url + '";'); |
| 73 | +} |
| 74 | + |
| 75 | +function appendCSS(text) { |
| 76 | + var s = document.createElement('style'); |
| 77 | + s.type = 'text/css'; |
| 78 | + s.rel = 'stylesheet'; |
| 79 | + if (s.styleSheet) s.styleSheet.cssText = text //IE |
| 80 | + else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null |
| 81 | + document.getElementsByTagName('head')[0].appendChild(s); |
| 82 | + return s; |
| 83 | +} |
| 84 | + |
46 | 85 | // document.write special stylesheet links |
47 | 86 | if (typeof stylepath != 'undefined' && typeof skin != 'undefined') { |
48 | 87 | if (is_opera_preseven) { |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1347,7 +1347,7 @@ |
1348 | 1348 | * to ensure that client-side caches don't keep obsolete copies of global |
1349 | 1349 | * styles. |
1350 | 1350 | */ |
1351 | | -$wgStyleVersion = '145'; |
| 1351 | +$wgStyleVersion = '146'; |
1352 | 1352 | |
1353 | 1353 | |
1354 | 1354 | # Server-side caching: |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -117,7 +117,9 @@ |
118 | 118 | * Use rel="start", "prev", "next" appropriately on Pager-based pages |
119 | 119 | * Add support for SQLite |
120 | 120 | * AutoAuthenticate hook renamed to UserLoadFromSession |
| 121 | +* (bug 13232) importScript(), importStylesheet() funcs available to custom JS |
121 | 122 | |
| 123 | + |
122 | 124 | === Bug fixes in 1.13 === |
123 | 125 | |
124 | 126 | * (bug 10677) Add link to the file description page on the shared repository |
— | — | @@ -282,7 +284,10 @@ |
283 | 285 | * (bug 13693) Categories sometimes claim to have a negative number of members |
284 | 286 | * (bug 1701) Korean Hangul syllables now broken down properly in Category lists |
285 | 287 | even if the wiki's overall content language is not Korean |
| 288 | +* (bug 12773) addOnloadHook() now calls functions immediately when scripts are |
| 289 | + loaded after the primary page completion, instead of dropping them |
286 | 290 | |
| 291 | + |
287 | 292 | === API changes in 1.13 === |
288 | 293 | |
289 | 294 | * Fixing main page display in meta=siteinfo |