Index: trunk/phase3/skins/common/ajaxwatch.js |
— | — | @@ -21,16 +21,29 @@ |
22 | 22 | wgAjaxWatch.inprogress = false; // ajax request in progress |
23 | 23 | wgAjaxWatch.timeoutID = null; // see wgAjaxWatch.ajaxCall |
24 | 24 | wgAjaxWatch.watchLinks = []; // "watch"/"unwatch" links |
| 25 | +wgAjaxWatch.iconMode = false; // new icon driven functionality |
| 26 | +wgAjaxWatch.imgBasePath = ""; // base img path derived from icons on load |
25 | 27 | |
26 | | -wgAjaxWatch.setLinkText = function(newText) { |
27 | | - for (i = 0; i < wgAjaxWatch.watchLinks.length; i++) { |
28 | | - changeText(wgAjaxWatch.watchLinks[i], newText); |
| 28 | +wgAjaxWatch.setLinkText = function( newText ) { |
| 29 | + if( wgAjaxWatch.iconMode ) { |
| 30 | + for ( i = 0; i < wgAjaxWatch.watchLinks.length; i++ ) { |
| 31 | + wgAjaxWatch.watchLinks[i].firstChild.alt = newText; |
| 32 | + if ( newText == wgAjaxWatch.watchingMsg || newText == wgAjaxWatch.unwatchingMsg ) { |
| 33 | + wgAjaxWatch.watchLinks[i].className += ' loading'; |
| 34 | + } else if ( newText == wgAjaxWatch.watchMsg || newText == wgAjaxWatch.unwatchMsg ) { |
| 35 | + wgAjaxWatch.watchLinks[i].className = wgAjaxWatch.watchLinks[i].className.replace( /loading/i, '' ); |
| 36 | + } |
| 37 | + } |
| 38 | + } else { |
| 39 | + for ( i = 0; i < wgAjaxWatch.watchLinks.length; i++ ) { |
| 40 | + changeText( wgAjaxWatch.watchLinks[i], newText ); |
| 41 | + } |
29 | 42 | } |
30 | 43 | }; |
31 | 44 | |
32 | | -wgAjaxWatch.setLinkID = function(newId) { |
| 45 | +wgAjaxWatch.setLinkID = function( newId ) { |
33 | 46 | // We can only set the first one |
34 | | - wgAjaxWatch.watchLinks[0].setAttribute( 'id', newId ); |
| 47 | + wgAjaxWatch.watchLinks[0].parentNode.setAttribute( 'id', newId ); |
35 | 48 | akeytt(newId); // update tooltips for Monobook |
36 | 49 | }; |
37 | 50 | |
— | — | @@ -112,27 +125,33 @@ |
113 | 126 | wgAjaxWatch.onLoad = function() { |
114 | 127 | // This document structure hardcoding sucks. We should make a class and |
115 | 128 | // toss all this out the window. |
| 129 | + |
116 | 130 | var el1 = document.getElementById("ca-unwatch"); |
117 | 131 | var el2 = null; |
118 | | - if (!el1) { |
| 132 | + if ( !el1 ) { |
119 | 133 | el1 = document.getElementById("mw-unwatch-link1"); |
120 | 134 | el2 = document.getElementById("mw-unwatch-link2"); |
121 | 135 | } |
122 | | - if(el1) { |
| 136 | + if( el1 ) { |
123 | 137 | wgAjaxWatch.watching = true; |
124 | 138 | } else { |
125 | 139 | wgAjaxWatch.watching = false; |
126 | 140 | el1 = document.getElementById("ca-watch"); |
127 | | - if (!el1) { |
| 141 | + if ( !el1 ) { |
128 | 142 | el1 = document.getElementById("mw-watch-link1"); |
129 | 143 | el2 = document.getElementById("mw-watch-link2"); |
130 | 144 | } |
131 | | - if(!el1) { |
| 145 | + if( !el1 ) { |
132 | 146 | wgAjaxWatch.supported = false; |
133 | 147 | return; |
134 | 148 | } |
135 | 149 | } |
136 | | - |
| 150 | + |
| 151 | + // Detect if the watch/unwatch feature is in icon mode |
| 152 | + if ( el1.className.match( /icon/i ) ) { |
| 153 | + wgAjaxWatch.iconMode = true; |
| 154 | + } |
| 155 | + |
137 | 156 | // The id can be either for the parent (Monobook-based) or the element |
138 | 157 | // itself (non-Monobook) |
139 | 158 | wgAjaxWatch.watchLinks.push( el1.tagName.toLowerCase() == "a" |
Index: trunk/phase3/skins/Vector.php |
— | — | @@ -59,8 +59,8 @@ |
60 | 60 | * @private |
61 | 61 | */ |
62 | 62 | function buildNavigationUrls() { |
63 | | - global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; |
64 | | - global $wgDisableLangConversion; |
| 63 | + global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle, $wgStylePath; |
| 64 | + global $wgDisableLangConversion, $wgVectorUseIconWatch; |
65 | 65 | |
66 | 66 | wfProfileIn( __METHOD__ ); |
67 | 67 | |
— | — | @@ -271,7 +271,6 @@ |
272 | 272 | } |
273 | 273 | } |
274 | 274 | wfProfileOut( __METHOD__ . '-live' ); |
275 | | - |
276 | 275 | /** |
277 | 276 | * The following actions use messages which, if made particular to |
278 | 277 | * the Vector skin, would break the Ajax code which makes this |
— | — | @@ -282,29 +281,21 @@ |
283 | 282 | * the global versions. |
284 | 283 | */ |
285 | 284 | // Checks if the user is logged in |
286 | | - if( $this->loggedin ) { |
287 | | - // Checks if the user is watching this page |
288 | | - if( !$this->mTitle->userIsWatching() ) { |
289 | | - // Adds watch action link |
290 | | - $links['actions']['watch'] = array( |
291 | | - 'class' => |
292 | | - ( $action == 'watch' or $action == 'unwatch' ) ? |
293 | | - 'selected' : false, |
294 | | - 'text' => wfMsg( 'watch' ), |
295 | | - 'href' => $this->mTitle->getLocalUrl( 'action=watch' ) |
296 | | - ); |
| 285 | + if ( $this->loggedin ) { |
| 286 | + if ( $wgVectorUseIconWatch ) { |
| 287 | + $class = 'icon '; |
| 288 | + $place = 'views'; |
297 | 289 | } else { |
298 | | - // Adds unwatch action link |
299 | | - $links['actions']['unwatch'] = array( |
300 | | - 'class' => |
301 | | - ($action == 'unwatch' or $action == 'watch') ? |
302 | | - 'selected' : false, |
303 | | - 'text' => wfMsg( 'unwatch' ), |
304 | | - 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' ) |
305 | | - ); |
| 290 | + $class = ''; |
| 291 | + $place = 'actions'; |
306 | 292 | } |
| 293 | + $mode = $this->mTitle->userIsWatching() ? 'unwatch' : 'watch'; |
| 294 | + $links[$place][$mode] = array( |
| 295 | + 'class' => $class . ( ( $action == 'watch' || $action == 'unwatch' ) ? ' selected' : false ), |
| 296 | + 'text' => wfMsg( $mode ), // uses 'watch' or 'unwatch' message |
| 297 | + 'href' => $this->mTitle->getLocalUrl( 'action=' . $mode ) |
| 298 | + ); |
307 | 299 | } |
308 | | - |
309 | 300 | // This is instead of SkinTemplateTabs - which uses a flat array |
310 | 301 | wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) ); |
311 | 302 | |
— | — | @@ -722,7 +713,7 @@ |
723 | 714 | <h5><?php $this->msg('views') ?></h5> |
724 | 715 | <ul <?php $this->html('userlangattributes') ?>> |
725 | 716 | <?php foreach ($this->data['view_urls'] as $key => $link ): ?> |
726 | | - <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><span><?php echo htmlspecialchars( $link['text'] ) ?></span></a></li> |
| 717 | + <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo (array_key_exists('img',$link) ? '<img src="'.$link['img'].'" alt="'.$link['text'].'" />' : '<span>'.htmlspecialchars( $link['text'] ).'</span>') ?></a></li> |
727 | 718 | <?php endforeach; ?> |
728 | 719 | </ul> |
729 | 720 | </div> |
Index: trunk/phase3/skins/vector/images/watch-icons.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/phase3/skins/vector/images/watch-icons.png |
___________________________________________________________________ |
Name: svn:mime-type |
730 | 721 | + application/octet-stream |
Index: trunk/phase3/skins/vector/images/watch-icon-loading.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/phase3/skins/vector/images/watch-icon-loading.gif |
___________________________________________________________________ |
Name: svn:mime-type |
731 | 722 | + application/octet-stream |
Index: trunk/phase3/skins/vector/main-ltr.css |
— | — | @@ -1049,3 +1049,41 @@ |
1050 | 1050 | line-height: 1.5em; |
1051 | 1051 | } |
1052 | 1052 | |
| 1053 | +/* Watch/Unwatch Icon Styling */ |
| 1054 | +#ca-unwatch.icon, |
| 1055 | +#ca-watch.icon { |
| 1056 | +} |
| 1057 | +#ca-unwatch.icon a, |
| 1058 | +#ca-watch.icon a { |
| 1059 | + margin: 0; |
| 1060 | + padding: 0; |
| 1061 | + outline: none; |
| 1062 | + display: block; |
| 1063 | + width: 26px; |
| 1064 | + height: 2.5em; |
| 1065 | +} |
| 1066 | +#ca-unwatch.icon a { |
| 1067 | + background-image: url(images/watch-icons.png); |
| 1068 | + background-position: -43px 60%; |
| 1069 | +} |
| 1070 | +#ca-watch.icon a { |
| 1071 | + background-image: url(images/watch-icons.png); |
| 1072 | + background-position: 5px 60%; |
| 1073 | +} |
| 1074 | +#ca-unwatch.icon a:hover { |
| 1075 | + background-image: url(images/watch-icons.png); |
| 1076 | + background-position: -67px 60%; |
| 1077 | +} |
| 1078 | +#ca-watch.icon a:hover { |
| 1079 | + background-image: url(images/watch-icons.png); |
| 1080 | + background-position: -19px 60%; |
| 1081 | +} |
| 1082 | +#ca-unwatch.icon a.loading, |
| 1083 | +#ca-watch.icon a.loading { |
| 1084 | + background-image: url(images/watch-icon-loading.gif); |
| 1085 | + background-position: center 60%; |
| 1086 | +} |
| 1087 | +#ca-unwatch.icon a span, |
| 1088 | +#ca-watch.icon a span { |
| 1089 | + display: none; |
| 1090 | +} |
Index: trunk/phase3/skins/vector/main-rtl.css |
— | — | @@ -1049,4 +1049,41 @@ |
1050 | 1050 | line-height: 1.5em; |
1051 | 1051 | } |
1052 | 1052 | |
1053 | | - |
\ No newline at end of file |
| 1053 | +/* Watch/Unwatch Icon Styling */ |
| 1054 | +#ca-unwatch.icon, |
| 1055 | +#ca-watch.icon { |
| 1056 | +} |
| 1057 | +#ca-unwatch.icon a, |
| 1058 | +#ca-watch.icon a { |
| 1059 | + margin: 0; |
| 1060 | + padding: 0; |
| 1061 | + outline: none; |
| 1062 | + display: block; |
| 1063 | + width: 26px; |
| 1064 | + height: 2.5em; |
| 1065 | +} |
| 1066 | +#ca-unwatch.icon a { |
| 1067 | + background-image: url(images/watch-icons.png); |
| 1068 | + background-position: -43px 60%; |
| 1069 | +} |
| 1070 | +#ca-watch.icon a { |
| 1071 | + background-image: url(images/watch-icons.png); |
| 1072 | + background-position: 5px 60%; |
| 1073 | +} |
| 1074 | +#ca-unwatch.icon a:hover { |
| 1075 | + background-image: url(images/watch-icons.png); |
| 1076 | + background-position: -67px 60%; |
| 1077 | +} |
| 1078 | +#ca-watch.icon a:hover { |
| 1079 | + background-image: url(images/watch-icons.png); |
| 1080 | + background-position: -19px 60%; |
| 1081 | +} |
| 1082 | +#ca-unwatch.icon a.loading, |
| 1083 | +#ca-watch.icon a.loading { |
| 1084 | + background-image: url(images/watch-icon-loading.gif); |
| 1085 | + background-position: center 60%; |
| 1086 | +} |
| 1087 | +#ca-unwatch.icon a span, |
| 1088 | +#ca-watch.icon a span { |
| 1089 | + display: none; |
| 1090 | +} |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1606,7 +1606,7 @@ |
1607 | 1607 | * to ensure that client-side caches do not keep obsolete copies of global |
1608 | 1608 | * styles. |
1609 | 1609 | */ |
1610 | | -$wgStyleVersion = '241'; |
| 1610 | +$wgStyleVersion = '243'; |
1611 | 1611 | |
1612 | 1612 | |
1613 | 1613 | # Server-side caching: |
— | — | @@ -4096,13 +4096,20 @@ |
4097 | 4097 | $wgUseTwoButtonsSearchForm = true; |
4098 | 4098 | |
4099 | 4099 | /** |
4100 | | - * Search form behavior for Vector skin only |
| 4100 | + * Search form behavior for Vector skin only |
4101 | 4101 | * true = use an icon search button |
4102 | 4102 | * false = use Go & Search buttons |
4103 | 4103 | */ |
4104 | 4104 | $wgVectorUseSimpleSearch = false; |
4105 | 4105 | |
4106 | 4106 | /** |
| 4107 | + * Watch and unwatch as an icon rather than a link for Vector skin only |
| 4108 | + * true = use an icon watch/unwatch button |
| 4109 | + * false = use watch/unwatch text link |
| 4110 | + */ |
| 4111 | +$wgVectorUseIconWatch = false; |
| 4112 | + |
| 4113 | +/** |
4107 | 4114 | * Preprocessor caching threshold |
4108 | 4115 | */ |
4109 | 4116 | $wgPreprocessorCacheThreshold = 1000; |