Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/142489

Change subject: Refactoring: remove disableLinks from source module
......................................................................

Refactoring: remove disableLinks from source module

Disable links was doing more than disabling links

Change-Id: I11049ac6d357d5d22032a0b808486f4dcdaeb13d
---
M modules/source/ext.cx.source.js
1 file changed, 10 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/89/142489/1

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index 3e7894f..09ab610 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -104,25 +104,7 @@
                // @todo figure out what should be done here
                this.$content.find( 'base' ).detach();
 
-               // Disable all links
-               this.disableLinks();
-
                mw.hook( 'mw.cx.source.ready' ).fire();
-       };
-
-       /**
-        * Disable all links in the content area.
-        */
-       ContentTranslationSource.prototype.disableLinks = function () {
-               this.$content.find( 'a' ).bind( 'click', function () {
-                       var $link = $( this );
-                       // avoid all reference links
-                       if ( !$link.parent().hasClass( 'reference' ) ) {
-                               mw.hook( 'mw.cx.select.link' ).fire( 
$link.text(), mw.cx.sourceLanguage );
-                       }
-                       // Disable link click
-                       return false;
-               } );
        };
 
        ContentTranslationSource.prototype.listen = function () {
@@ -134,6 +116,16 @@
                                mw.hook( 'mw.cx.select.word' ).fire( 
selection.toLowerCase() );
                        }
                } );
+
+               this.$content.on( 'click', 'a', function () {
+                       var $link = $( this );
+                       // avoid all reference links
+                       if ( $link.parent().attr( 'typeof' ) !== 
'mw:Extension/ref' ) {
+                               mw.hook( 'mw.cx.select.link' ).fire( 
$link.text(), mw.cx.sourceLanguage );
+                       }
+                       // Disable link click
+                       return false;
+               } );
        };
 
        $.fn.cxSource = function ( options ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11049ac6d357d5d22032a0b808486f4dcdaeb13d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

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

Reply via email to