jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/333852 )

Change subject: Watchlist: add / remove from watchlist changed to ajax.
......................................................................


Watchlist: add / remove from watchlist changed to ajax.

CodingConventions: spaces between brackets
Adding less to js file
Code wraped in immediately invoked function expressions (IIFE)
Fixed issue from ERM4954

Needs merge to master

Change-Id: I002dbf5f677f8b7bbb8f6411645d6ae05991401c
---
D resources/components/skin.ajaxwatchlist.less
M resources/components/skin.contentActions.js
A resources/components/skin.watch.js
M skin.json
4 files changed, 36 insertions(+), 50 deletions(-)

Approvals:
  Robert Vogel: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/components/skin.ajaxwatchlist.less 
b/resources/components/skin.ajaxwatchlist.less
deleted file mode 100644
index d368a5a..0000000
--- a/resources/components/skin.ajaxwatchlist.less
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Code from <mediawiki>/skins/vector/screen.css */
-
-li#ca-unwatch.icon,
-li#ca-watch.icon {
-       float:none;
-       margin-left: -4px
-}
-
-
-/* Watch/Unwatch Icon Styling */
-#ca-unwatch.icon a,
-#ca-watch.icon a {
-       outline: none;
-       display: inline-block;
-       width: 16px;
-       height: 16px;
-       margin: 0;
-       text-indent: 9999px;
-       white-space: nowrap;
-       /* @embed */
-       background-image: url("../../vector/images/watch-icons.png");
-}
-#ca-unwatch.icon a {
-       background-position: -48px;
-}
-#ca-watch.icon a {
-       background-position: 0px;
-}
-#ca-unwatch.icon a:hover,
-#ca-unwatch.icon a:focus {
-       background-position: -72px;
-}
-#ca-watch.icon a:hover,
-#ca-watch.icon a:focus {
-       background-position: -24px;
-}
-#ca-unwatch.icon a.loading,
-#ca-watch.icon a.loading {
-       /* @embed */
-       background-image: url("../../vector/images/watch-icon-loading.gif");
-       background-position: 0px;
-}
\ No newline at end of file
diff --git a/resources/components/skin.contentActions.js 
b/resources/components/skin.contentActions.js
index e18c9f2..f1226ff 100644
--- a/resources/components/skin.contentActions.js
+++ b/resources/components/skin.contentActions.js
@@ -10,13 +10,5 @@
                                }
                        });
                }
-
-               $("#ca-watch, #ca-unwatch").click(function(e){
-                       $(this).children().first().trigger('click');
-                       if ($(this).hasClass("icon-star"))
-                               
$(this).removeClass("icon-star").addClass("icon-star3");
-                       else
-                               
$(this).removeClass("icon-star3").addClass("icon-star");
-               });
        });
 })( mediaWiki, jQuery );
\ No newline at end of file
diff --git a/resources/components/skin.watch.js 
b/resources/components/skin.watch.js
new file mode 100644
index 0000000..78aa2ef
--- /dev/null
+++ b/resources/components/skin.watch.js
@@ -0,0 +1,35 @@
+(function ( mw, $ ) {
+    $( function () {
+        $( '#ca-watch, #ca-unwatch' ).on( 'click', function () {
+            api = new mw.Api();
+
+            var me = this;
+
+            if ( $( this ).attr( "id" ) == "ca-watch" ) {
+                api.watch( mw.config.get( 'wgPageName' ) ).done( function ( 
result ) {
+                    doWatch( result, me, 'ca-unwatch' );
+                } );
+            } else {
+                api.unwatch( mw.config.get( 'wgPageName' ) ).done( function ( 
result ) {
+                    doWatch( result, me, 'ca-watch' );
+                } );
+            }
+
+            return false; // Do not follow the link if JS is enabled.
+        } );
+
+        /**
+         * Adds or removes a page to watchlist and shows a notify.
+         *
+         * @param result jQuery.Promise.done()
+         * @param me this
+         * @param sWatch
+         */
+        function doWatch( result, me, sWatch ) {
+            mw.notify( $( result.message ) );
+            $( me ).attr( "id", sWatch );
+            $( 'a', me ).attr( 'title', mw.message( 'tooltip-' + sWatch 
).plain() );
+            $( 'a', me ).updateTooltipAccessKeys();
+        }
+    } );
+})( mediaWiki, jQuery );
\ No newline at end of file
diff --git a/skin.json b/skin.json
index fda16ba..b006a00 100644
--- a/skin.json
+++ b/skin.json
@@ -62,6 +62,7 @@
                                "components/skin.closeMenu.js",
                                "components/skin.scrollToTop.js",
                                "components/skin.dataAfterContent.js",
+                               "components/skin.watch.js",
                                "components/special.preferences.js"
                        ],
                        "messages": [

-- 
To view, visit https://gerrit.wikimedia.org/r/333852
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I002dbf5f677f8b7bbb8f6411645d6ae05991401c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/BlueSpiceSkin
Gerrit-Branch: master
Gerrit-Owner: Robert Vogel <vo...@hallowelt.biz>
Gerrit-Reviewer: Dvogel hallowelt <daniel.vo...@hallowelt.com>
Gerrit-Reviewer: Ljonka <l.verhovs...@gmail.com>
Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz>
Gerrit-Reviewer: Nasty <kon...@hallowelt.com>
Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz>
Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to