From a50f026701ee6bc0abc90f09f39096aef4b5f174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Mon, 22 Feb 2016 15:09:51 +0100 Subject: [PATCH] Fixed Playground --- senpy/extensions.py | 2 +- senpy/static/js/main.js | 17 +++- senpy/templates/index.html | 178 ++++++++++++++++--------------------- 3 files changed, 93 insertions(+), 104 deletions(-) diff --git a/senpy/extensions.py b/senpy/extensions.py index b04980a..ce64e3f 100644 --- a/senpy/extensions.py +++ b/senpy/extensions.py @@ -107,7 +107,7 @@ class Senpy(object): candidates = self.filter_plugins(is_activated=True) if len(candidates) > 0: candidate = list(candidates.values())[0] - logger.debug("Default: {}".format(candidate)) + logger.debug("Default: {}".format(candidate.name)) return candidate else: return None diff --git a/senpy/static/js/main.js b/senpy/static/js/main.js index 6ab2b3d..6f5d7bd 100644 --- a/senpy/static/js/main.js +++ b/senpy/static/js/main.js @@ -1,6 +1,7 @@ var ONYX = "http://www.gsi.dit.upm.es/ontologies/onyx/ns#"; var RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; var plugins_params={}; + function replaceURLWithHTMLLinks(text) { console.log('Text: ' + text); var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; @@ -15,6 +16,15 @@ function encodeHTML(text) { .replace(/'/g, '''); }; +function hashchanged(){ + var hash = location.hash + , hashPieces = hash.split('?'); + if( hashPieces[0].length > 0 ){ + activeTab = $('[href=' + hashPieces[0] + ']'); + activeTab && activeTab.tab('show'); + } +} + $(document).ready(function() { var response = JSON.parse($.ajax({type: "GET", url: "/api/plugins/" , async: false}).responseText); var defaultPlugin= JSON.parse($.ajax({type: "GET", url: "/api/plugins/default" , async: false}).responseText); @@ -55,15 +65,18 @@ $(document).ready(function() { } document.getElementById('plugins').innerHTML = html; change_params(); + $(window).on('hashchange', hashchanged); + hashchanged(); + $('.tooltip-form').tooltip(); }); function change_params(){ var plugin = document.getElementById("plugins").options[document.getElementById("plugins").selectedIndex].value; + html="" for (param in plugins_params[plugin]){ if (param || plugins_params[plugin][param].length > 1){ - html="" html+= "" html+= " +
+
+

-
-
-
- + Analyse! - -
- -

-                
+ +

+            
+            
           
         
-              
-                 
+           
+
+      
+    
+