|
From: <tob...@us...> - 2014-07-24 23:36:37
|
Revision: 8592
http://sourceforge.net/p/bigdata/code/8592
Author: tobycraig
Date: 2014-07-24 23:36:30 +0000 (Thu, 24 Jul 2014)
Log Message:
-----------
Added load last explored URI upon startup
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 05:53:45 UTC (rev 8591)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 23:36:30 UTC (rev 8592)
@@ -259,14 +259,18 @@
$.ajax(settings);
}
-function useNamespace(name) {
- if(!namespaceExists(name)) {
+function useNamespace(name, leaveLast) {
+ if(!namespaceExists(name) || name === NAMESPACE) {
return;
}
$('#current-namespace').html(name);
NAMESPACE = name;
getNamespaces();
- localStorage.lastNamespace = name;
+ // this is for loading the last explored URI, which might otherwise
+ // overwrite the last used namespace
+ if(!leaveLast) {
+ localStorage.lastNamespace = name;
+ }
}
function deleteNamespace(namespace) {
@@ -1067,7 +1071,7 @@
$('#query-response a').click(function(e) {
e.preventDefault();
- explore(this.textContent);
+ explore(NAMESPACE, this.textContent);
});
}
}
@@ -1170,7 +1174,7 @@
// add matching bindings
var table = $('#query-response table');
- var text, tdData;
+ var text, tdData, linkText;
for(var i=start; i<end; i++) {
var tr = $('<tr>');
for(var j=0; j<QUERY_RESULTS.head.vars.length; j++) {
@@ -1389,22 +1393,22 @@
$('#explore-results a').click(function(e) {
e.preventDefault();
var components = parseHash(this.hash);
- exploreNamespacedURI(components[2], components[3]);
+ explore(components[2], components[3]);
});
}
-function exploreNamespacedURI(namespace, uri, nopush) {
- useNamespace(namespace);
- explore(uri, nopush);
-}
-
-function explore(uri, nopush) {
+function explore(namespace, uri, noPush, loadLast) {
+ useNamespace(namespace, loadLast);
$('#explore-form input[type=text]').val(uri);
$('#explore-form').submit();
- showTab('explore', true);
- if(!nopush) {
+ if(!loadLast) {
+ showTab('explore', true);
+ }
+ if(!noPush) {
history.pushState(null, null, '#explore:' + NAMESPACE + ':' + uri);
}
+ localStorage.lastExploreNamespace = namespace;
+ localStorage.lastExploreURI = uri;
}
function parseHash(hash) {
@@ -1420,8 +1424,8 @@
if(!hash) {
$('#tab-selector a:first').click();
} else {
- if(hash[1] == 'explore') {
- exploreNamespacedURI(hash[2], hash[3], true);
+ if(hash[1] == 'explore' && typeof hash[2] !== 'undefined') {
+ explore(hash[2], hash[3], true);
} else {
$('a[data-target=' + hash[1] + ']').click();
}
@@ -1673,7 +1677,13 @@
}
}
+function loadLastExplore() {
+ if(localStorage.lastExploreURI) {
+ explore(localStorage.lastExploreNamespace, localStorage.lastExploreURI, true, true);
+ }
+}
+
/* Startup functions */
function setupHandlers() {
@@ -1749,7 +1759,8 @@
createQueryEditor();
createExportOptions();
- // restore last used namespace
+ // restore last used namespace and explored URI
+ loadLastExplore();
loadLastNamespace();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|