Smalyshev has uploaded a new change for review.

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

Change subject: Do not show explorer twice
......................................................................

Do not show explorer twice

Bug: T100852
Change-Id: I9f77dab6eedc1d8dd3b8166acc819182aefdf119
---
M gui/gui.js
1 file changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/rdf 
refs/changes/70/240770/1

diff --git a/gui/gui.js b/gui/gui.js
index e8c317e..47bb7b7 100644
--- a/gui/gui.js
+++ b/gui/gui.js
@@ -4,6 +4,7 @@
 (function($, mw) {
        var SERVICE = '/bigdata/namespace/wdq/sparql',
                SHORTURL = 'http://tinyurl.com/create.php?url=',
+               EXPLORE_URL = 'http://www.wikidata.org/entity/',
                NAMESPACE_SHORTCUTS = {
                        'Wikidata' : {
                                'wikibase' : 'http://wikiba.se/ontology#',
@@ -183,7 +184,7 @@
                                                                .attr("href", 
binding.value)
                                                                
.append(linkText)
                                                        );
-                                                       
if(binding.value.match(/http:\/\/www.wikidata.org\/entity\//)) {
+                                                       
if(binding.value.match(EXPLORE_URL)) {
                                                                
td.append($('<a>')
                                                                        
.attr("href", '#')
                                                                        
.bind('click', exploreURL.bind(undefined, binding.value))
@@ -331,12 +332,16 @@
         */
        function exploreURL(url) {
                var id,
-                       match = 
url.match(/http:\/\/www.wikidata.org\/entity\/(.+)/);
+                       match = url.match(EXPLORE_URL+'(.+)');
                if(!match) {
                        return;
                }
-               $('#hide-explorer').show();
-               $('#show-explorer').hide();
+               if($('#hide-explorer').is(":visible")) {
+                       $('#explore').empty('');
+               } else {
+                       $('#hide-explorer').show();
+                       $('#show-explorer').hide();
+               }
                id = match[1];
                mw.config = { get: function() {
                        return id;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f77dab6eedc1d8dd3b8166acc819182aefdf119
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/rdf
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to