mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
- Update jQuery.jStore, JSON2
- Fix issue with all local prefs being deleted on "collapse all" - Refactored history display code into galaxy.base
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>Flash External Object</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript">
|
||||
/**
|
||||
* This function captures the flash_ready event. We need to relay this
|
||||
* back to the parent so it knows flash is ready.
|
||||
*/
|
||||
function flash_ready(){
|
||||
parent.flash_ready();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1" height="1" id="jStoreFlash"><param name="allowScriptAccess" value="always" /><param name="movie" value="jStore.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffcc00" /><embed src="jStore.swf" quality="high" bgcolor="#ffcc00" width="1" height="1" name="jStoreFlash" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -0,0 +1,80 @@
|
||||
/*!
|
||||
* Class definition
|
||||
*
|
||||
* Copyright (c) 2008 John Resig (http://ejohn.org/blog/simple-javascript-inheritance/)
|
||||
* Inspired by base2 and Prototype
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
(function () {
|
||||
|
||||
var initializing = false,
|
||||
|
||||
fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
|
||||
|
||||
// The base Class implementation (does nothing)
|
||||
this.Class = function(){};
|
||||
|
||||
// Create a new Class that inherits from this class
|
||||
Class.extend = function (prop)
|
||||
{
|
||||
var _super = this.prototype;
|
||||
|
||||
// Instantiate a base class (but only create the instance, don't run the init constructor)
|
||||
initializing = true;
|
||||
|
||||
var prototype = new this();
|
||||
|
||||
initializing = false;
|
||||
|
||||
// Copy the properties over onto the new prototype
|
||||
for (var name in prop)
|
||||
{
|
||||
|
||||
// Check if we're overwriting an existing function
|
||||
prototype[name] = (typeof prop[name] === "function" && typeof _super[name] === "function" && fnTest.test(prop[name]) ?
|
||||
|
||||
(function(name, fn)
|
||||
{
|
||||
return function()
|
||||
{
|
||||
var tmp = this._super;
|
||||
|
||||
// Add a new ._super() method that is the same method
|
||||
// but on the super-class
|
||||
this._super = _super[name];
|
||||
|
||||
// The method only need to be bound temporarily, so we
|
||||
// remove it when we're done executing
|
||||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
|
||||
return ret;
|
||||
};
|
||||
}(name, prop[name])) : prop[name]);
|
||||
}
|
||||
|
||||
// The dummy class constructor
|
||||
function Class()
|
||||
{
|
||||
// All construction is actually done in the init method
|
||||
if (!initializing && this.init)
|
||||
{
|
||||
this.init.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
// Populate our constructed prototype object
|
||||
Class.prototype = prototype;
|
||||
|
||||
// Enforce the constructor to be what we expect
|
||||
Class.constructor = Class;
|
||||
|
||||
// And make this class extendable
|
||||
Class.extend = arguments.callee;
|
||||
|
||||
return Class;
|
||||
};
|
||||
|
||||
}());
|
||||
@@ -275,6 +275,93 @@ function async_save_text(click_to_edit_elt, text_elt_id, save_url, text_parm_nam
|
||||
});
|
||||
}
|
||||
|
||||
function init_history_items(historywrapper, noinit) {
|
||||
|
||||
var action = function() {
|
||||
// Load saved state and show as necessary
|
||||
try {
|
||||
var stored = $.jStore.store("history_expand_state");
|
||||
if (stored) {
|
||||
for (var id in stored) {
|
||||
$("#" + id + " div.historyItemBody" ).show();
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
// Something was wrong with values in storage, so clear storage
|
||||
$.jStore.remove("history_expand_state");
|
||||
}
|
||||
|
||||
// If Mozilla, hide scrollbars in hidden items since they cause animation bugs
|
||||
if ( $.browser.mozilla ) {
|
||||
$( "div.historyItemBody" ).each( function() {
|
||||
if ( ! $(this).is( ":visible" ) ) $(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
})
|
||||
}
|
||||
|
||||
historywrapper.each( function() {
|
||||
var id = this.id;
|
||||
var body = $(this).children( "div.historyItemBody" );
|
||||
var peek = body.find( "pre.peek" )
|
||||
$(this).children( ".historyItemTitleBar" ).find( ".historyItemTitle" ).wrap( "<a href='#'></a>" ).click( function() {
|
||||
if ( body.is(":visible") ) {
|
||||
// Hiding stuff here
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "hidden" ) }
|
||||
body.slideUp( "fast" );
|
||||
|
||||
if (!noinit) { // Ignore embedded item actions
|
||||
// Save setting
|
||||
var prefs = $.jStore.store("history_expand_state");
|
||||
if (prefs) {
|
||||
delete prefs[id];
|
||||
$.jStore.store("history_expand_state", prefs);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Showing stuff here
|
||||
body.slideDown( "fast", function() {
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "auto" ); }
|
||||
});
|
||||
|
||||
if (!noinit) {
|
||||
// Save setting
|
||||
var prefs = $.jStore.store("history_expand_state");
|
||||
if (prefs === undefined) { prefs = {}; }
|
||||
prefs[id] = true;
|
||||
$.jStore.store("history_expand_state", prefs);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// Generate 'collapse all' link
|
||||
$("#top-links > a.toggle").click( function() {
|
||||
var prefs = $.jStore.store("history_expand_state");
|
||||
if (prefs === undefined) { prefs = {}; }
|
||||
$( "div.historyItemBody:visible" ).each( function() {
|
||||
if ( $.browser.mozilla ) {
|
||||
$(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
}
|
||||
$(this).slideUp( "fast" );
|
||||
if (prefs) {
|
||||
delete prefs[$(this).parent().attr("id")];
|
||||
}
|
||||
});
|
||||
$.jStore.store("history_expand_state", prefs);
|
||||
}).show();
|
||||
}
|
||||
|
||||
if (noinit) {
|
||||
action();
|
||||
} else {
|
||||
// Load jStore for local storage
|
||||
$.jStore.init("galaxy"); // Auto-select best storage
|
||||
$.jStore.engineReady(function() {
|
||||
action();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready( function() {
|
||||
// Links with confirmation
|
||||
$( "a[confirm]" ).click( function() {
|
||||
|
||||
@@ -1,748 +0,0 @@
|
||||
/*
|
||||
* jStore - Persistent Client-Side Storage
|
||||
*
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
*
|
||||
* Dual licensed under:
|
||||
* MIT: http://www.opensource.org/licenses/mit-license.php
|
||||
* GPLv3: http://www.opensource.org/licenses/gpl-3.0.html
|
||||
*//**
|
||||
* Javascript Class Framework
|
||||
*
|
||||
* Copyright (c) 2008 John Resig (http://ejohn.org/blog/simple-javascript-inheritance/)
|
||||
* Inspired by base2 and Prototype
|
||||
*/
|
||||
(function(){
|
||||
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
|
||||
|
||||
// The base Class implementation (does nothing)
|
||||
this.Class = function(){};
|
||||
|
||||
// Create a new Class that inherits from this class
|
||||
Class.extend = function(prop) {
|
||||
var _super = this.prototype;
|
||||
|
||||
// Instantiate a base class (but only create the instance,
|
||||
// don't run the init constructor)
|
||||
initializing = true;
|
||||
var prototype = new this();
|
||||
initializing = false;
|
||||
|
||||
// Copy the properties over onto the new prototype
|
||||
for (var name in prop) {
|
||||
// Check if we're overwriting an existing function
|
||||
prototype[name] = typeof prop[name] == "function" &&
|
||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
|
||||
(function(name, fn){
|
||||
return function() {
|
||||
var tmp = this._super;
|
||||
|
||||
// Add a new ._super() method that is the same method
|
||||
// but on the super-class
|
||||
this._super = _super[name];
|
||||
|
||||
// The method only need to be bound temporarily, so we
|
||||
// remove it when we're done executing
|
||||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(name, prop[name]) :
|
||||
prop[name];
|
||||
}
|
||||
|
||||
// The dummy class constructor
|
||||
function Class() {
|
||||
// All construction is actually done in the init method
|
||||
if ( !initializing && this.init )
|
||||
this.init.apply(this, arguments);
|
||||
}
|
||||
|
||||
// Populate our constructed prototype object
|
||||
Class.prototype = prototype;
|
||||
|
||||
// Enforce the constructor to be what we expect
|
||||
Class.constructor = Class;
|
||||
|
||||
// And make this class extendable
|
||||
Class.extend = arguments.callee;
|
||||
|
||||
return Class;
|
||||
};
|
||||
})();
|
||||
/*
|
||||
* jStore Delegate Framework
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
this.jStoreDelegate = Class.extend({
|
||||
init: function(parent){
|
||||
// The Object this delgate operates for
|
||||
this.parent = parent;
|
||||
// Container for callbacks to dispatch.
|
||||
// eventType => [ callback, callback, ... ]
|
||||
this.callbacks = {};
|
||||
},
|
||||
bind: function(event, callback){
|
||||
if ( !$.isFunction(callback) ) return this;
|
||||
if ( !this.callbacks[ event ] ) this.callbacks[ event ] = [];
|
||||
|
||||
this.callbacks[ event ].push(callback);
|
||||
|
||||
return this;
|
||||
},
|
||||
trigger: function(){
|
||||
var parent = this.parent,
|
||||
args = [].slice.call(arguments),
|
||||
event = args.shift(),
|
||||
handlers = this.callbacks[ event ];
|
||||
|
||||
if ( !handlers ) return false;
|
||||
|
||||
$.each(handlers, function(){ this.apply(parent, args) });
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);/**
|
||||
* jStore-jQuery Interface
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
// Setup the jStore namespace in jQuery for options storage
|
||||
$.jStore = {};
|
||||
|
||||
// Seed the options in
|
||||
$.extend($.jStore, {
|
||||
EngineOrder: [],
|
||||
// Engines should put their availability tests within jStore.Availability
|
||||
Availability: {},
|
||||
// Defined engines should enter themselves into the jStore.Engines
|
||||
Engines: {},
|
||||
// Instanciated engines should exist within jStore.Instances
|
||||
Instances: {},
|
||||
// The current engine to use for storage
|
||||
CurrentEngine: null,
|
||||
// Provide global settings for overwriting
|
||||
defaults: {
|
||||
project: null,
|
||||
engine: null,
|
||||
autoload: true,
|
||||
flash: 'jStore.Flash.html'
|
||||
},
|
||||
// Boolean for ready state handling
|
||||
isReady: false,
|
||||
// Boolean for flash ready state handling
|
||||
isFlashReady: false,
|
||||
// An event delegate
|
||||
delegate: new jStoreDelegate($.jStore)
|
||||
.bind('jStore-ready', function(engine){
|
||||
$.jStore.isReady = true;
|
||||
if ($.jStore.defaults.autoload) engine.connect();
|
||||
})
|
||||
.bind('flash-ready', function(){
|
||||
$.jStore.isFlashReady = true;
|
||||
})
|
||||
});
|
||||
|
||||
// Enable ready callback for jStore
|
||||
$.jStore.ready = function(callback){
|
||||
if ($.jStore.isReady) callback.apply($.jStore, [$.jStore.CurrentEngine]);
|
||||
else $.jStore.delegate.bind('jStore-ready', callback);
|
||||
}
|
||||
|
||||
// Enable failure callback registration for jStore
|
||||
$.jStore.fail = function(callback){
|
||||
$.jStore.delegate.bind('jStore-failure', callback);
|
||||
}
|
||||
|
||||
// Enable ready callback for Flash
|
||||
$.jStore.flashReady = function(callback){
|
||||
if ($.jStore.isFlashReady) callback.apply($.jStore, [$.jStore.CurrentEngine]);
|
||||
else $.jStore.delegate.bind('flash-ready', callback);
|
||||
}
|
||||
|
||||
// Enable and test an engine
|
||||
$.jStore.use = function(engine, project, identifier){
|
||||
project = project || $.jStore.defaults.project || location.hostname.replace(/\./g, '-') || 'unknown';
|
||||
|
||||
var e = $.jStore.Engines[engine.toLowerCase()] || null,
|
||||
name = (identifier ? identifier + '.' : '') + project + '.' + engine;
|
||||
|
||||
if ( !e ) throw 'JSTORE_ENGINE_UNDEFINED';
|
||||
|
||||
// Instanciate the engine
|
||||
e = new e(project, name);
|
||||
|
||||
// Prevent against naming conflicts
|
||||
if ($.jStore.Instances[name]) throw 'JSTORE_JRI_CONFLICT';
|
||||
|
||||
// Test the engine
|
||||
if (e.isAvailable()){
|
||||
$.jStore.Instances[name] = e; // The Easy Way
|
||||
if (!$.jStore.CurrentEngine){
|
||||
$.jStore.CurrentEngine = e;
|
||||
}
|
||||
$.jStore.delegate.trigger('jStore-ready', e);
|
||||
} else {
|
||||
if (!e.autoload) // Not available
|
||||
throw 'JSTORE_ENGINE_UNAVILABLE';
|
||||
else { // The hard way
|
||||
e.included(function(){
|
||||
if (this.isAvailable()) { // Worked out
|
||||
$.jStore.Instances[name] = this;
|
||||
// If there is no current engine, use this one
|
||||
if (!$.jStore.CurrentEngine){
|
||||
$.jStore.CurrentEngine = this;
|
||||
}
|
||||
$.jStore.delegate.trigger('jStore-ready', this);
|
||||
}
|
||||
else $.jStore.delegate.trigger('jStore-failure', this);
|
||||
}).include();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the current storage engine
|
||||
$.jStore.setCurrentEngine = function(name){
|
||||
if (!$.jStore.Instances.length ) // If no instances exist, attempt to load one
|
||||
return $.jStore.FindEngine();
|
||||
|
||||
if (!name && $.jStore.Instances.length >= 1) { // If no name is specified, use the first engine
|
||||
$.jStore.delegate.trigger('jStore-ready', $.jStore.Instances[0]);
|
||||
return $.jStore.CurrentEngine = $.jStore.Instances[0];
|
||||
}
|
||||
|
||||
if (name && $.jStore.Instances[name]) { // If a name is specified and exists, use it
|
||||
$.jStore.delegate.trigger('jStore-ready', $.jStore.Instances[name]);
|
||||
return $.jStore.CurrentEngine = $.jStore.Instances[name];
|
||||
}
|
||||
|
||||
throw 'JSTORE_JRI_NO_MATCH';
|
||||
}
|
||||
|
||||
// Test all possible engines for straightforward useability
|
||||
$.jStore.FindEngine = function(){
|
||||
$.each($.jStore.EngineOrder, function(k){
|
||||
if ($.jStore.Availability[this]()){ // Find the first, easiest option and use it.
|
||||
$.jStore.use(this, $.jStore.defaults.project, 'default');
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Provide a simple interface for storing/getting values
|
||||
$.jStore.store = function(key, value){
|
||||
if (!$.jStore.CurrentEngine) return false;
|
||||
|
||||
if ( !value ) // Executing a get command
|
||||
return $.jStore.CurrentEngine.get(key);
|
||||
// Executing a set command
|
||||
return $.jStore.CurrentEngine.set(key, value);
|
||||
}
|
||||
// Provide a simple interface for storing/getting values
|
||||
$.jStore.remove = function(key){
|
||||
if (!$.jStore.CurrentEngine) return false;
|
||||
|
||||
return $.jStore.CurrentEngine.rem(key);
|
||||
}
|
||||
|
||||
// Provide a chainable interface for storing values/getting a value at the end of a chain
|
||||
$.fn.store = function(key, value){
|
||||
if (!$.jStore.CurrentEngine) return this;
|
||||
|
||||
var result = $.jStore.store(key, value);
|
||||
|
||||
return !value ? result : this;
|
||||
}
|
||||
|
||||
// Provide a chainable interface for removing values
|
||||
$.fn.removeStore = function(key){
|
||||
$.jStore.remove(key);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// Provide a way for users to call for auto-loading
|
||||
$.jStore.load = function(){
|
||||
if ($.jStore.defaults.engine)
|
||||
return $.jStore.use($.jStore.defaults.engine, $.jStore.defaults.project, 'default');
|
||||
|
||||
// Attempt to find a valid engine, and catch any exceptions if we can't
|
||||
try {
|
||||
$.jStore.FindEngine();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
/**
|
||||
* jStore Engine Core
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
this.StorageEngine = Class.extend({
|
||||
init: function(project, name){
|
||||
// Configure the project name
|
||||
this.project = project;
|
||||
// The JRI name given by the manager
|
||||
this.jri = name;
|
||||
// Cache the data so we can work synchronously
|
||||
this.data = {};
|
||||
// The maximum limit of the storage engine
|
||||
this.limit = -1;
|
||||
// Third party script includes
|
||||
this.includes = [];
|
||||
// Create an event delegate for users to subscribe to event triggers
|
||||
this.delegate = new jStoreDelegate(this)
|
||||
.bind('engine-ready', function(){
|
||||
this.isReady = true;
|
||||
})
|
||||
.bind('engine-included', function(){
|
||||
this.hasIncluded = true;
|
||||
});
|
||||
// If enabled, the manager will check availability, then run include(), then check again
|
||||
this.autoload = false; // This should be changed by the engines, if they have required includes
|
||||
// When set, we're ready to transact data
|
||||
this.isReady = false;
|
||||
// When the includer is finished, it will set this to true
|
||||
this.hasIncluded = false;
|
||||
},
|
||||
// Performs all necessary script includes
|
||||
include: function(){
|
||||
var self = this,
|
||||
total = this.includes.length,
|
||||
count = 0;
|
||||
|
||||
$.each(this.includes, function(){
|
||||
$.ajax({type: 'get', url: this, dataType: 'script', cache: true,
|
||||
success: function(){
|
||||
count++;
|
||||
if (count == total) self.delegate.trigger('engine-included');
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
// This should be overloaded with an actual functionality presence check
|
||||
isAvailable: function(){
|
||||
return false;
|
||||
},
|
||||
/** Event Subscription Shortcuts **/
|
||||
ready: function(callback){
|
||||
if (this.isReady) callback.apply(this);
|
||||
else this.delegate.bind('engine-ready', callback);
|
||||
return this;
|
||||
},
|
||||
included: function(callback){
|
||||
if (this.hasIncluded) callback.apply(this);
|
||||
else this.delegate.bind('engine-included', callback);
|
||||
return this;
|
||||
},
|
||||
/** Cache Data Access **/
|
||||
get: function(key){
|
||||
return this.data[key] || null;
|
||||
},
|
||||
set: function(key, value){
|
||||
this.data[key] = value;
|
||||
return value;
|
||||
},
|
||||
rem: function(key){
|
||||
var beforeDelete = this.data[key];
|
||||
this.data[key] = null;
|
||||
return beforeDelete;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
/*
|
||||
* jStore DOM Storage Engine
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
// Set up a static test function for this instance
|
||||
var sessionAvailability = $.jStore.Availability.session = function(){
|
||||
return !!window.sessionStorage;
|
||||
},
|
||||
localAvailability = $.jStore.Availability.local = function(){
|
||||
return !!(window.localStorage || window.globalStorage);
|
||||
};
|
||||
|
||||
this.jStoreDom = StorageEngine.extend({
|
||||
init: function(project, name){
|
||||
// Call the parental init object
|
||||
this._super(project, name);
|
||||
|
||||
// The type of storage engine
|
||||
this.type = 'DOM';
|
||||
|
||||
// Set the Database limit
|
||||
this.limit = 5 * 1024 * 1024;
|
||||
},
|
||||
connect: function(){
|
||||
// Fire our delegate to indicate we're ready for data transactions
|
||||
this.delegate.trigger('engine-ready');
|
||||
},
|
||||
get: function(key){
|
||||
var out = this.db.getItem(key);
|
||||
// Gecko's getItem returns {value: 'the value'}, WebKit returns 'the value'
|
||||
return out && out.value ? out.value : out
|
||||
},
|
||||
set: function(key, value){
|
||||
this.db.setItem(key,value);
|
||||
return value;
|
||||
},
|
||||
rem: function(key){
|
||||
var out = this.get(key);
|
||||
this.db.removeItem(key);
|
||||
return out
|
||||
}
|
||||
})
|
||||
|
||||
this.jStoreLocal = jStoreDom.extend({
|
||||
connect: function(){
|
||||
// Gecko uses a non-standard globalStorage[ www.example.com ] DOM access object for persistant storage.
|
||||
this.db = !window.globalStorage ? window.localStorage : window.globalStorage[location.hostname];
|
||||
this._super();
|
||||
},
|
||||
isAvailable: localAvailability
|
||||
})
|
||||
|
||||
this.jStoreSession = jStoreDom.extend({
|
||||
connect: function(){
|
||||
this.db = sessionStorage;
|
||||
this._super();
|
||||
},
|
||||
isAvailable: sessionAvailability
|
||||
})
|
||||
|
||||
$.jStore.Engines.local = jStoreLocal;
|
||||
$.jStore.Engines.session = jStoreSession;
|
||||
|
||||
// Store the ordering preference
|
||||
$.jStore.EngineOrder[ 1 ] = 'local';
|
||||
|
||||
})(jQuery);
|
||||
/*
|
||||
* jStore Flash Storage Engine
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
* jStore.swf Copyright (c) 2008 Daniel Bulli (http://www.nuff-respec.com)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
// Set up a static test function for this instance
|
||||
var avilability = $.jStore.Availability.flash = function(){
|
||||
return !!($.jStore.hasFlash('8.0.0'));
|
||||
}
|
||||
|
||||
this.jStoreFlash = StorageEngine.extend({
|
||||
init: function(project, name){
|
||||
// Call the parental init object
|
||||
this._super(project, name);
|
||||
|
||||
// The type of storage engine
|
||||
this.type = 'Flash';
|
||||
|
||||
// Bind our flashReady function to the jStore Delegate
|
||||
var self = this;
|
||||
$.jStore.flashReady(function(){ self.flashReady() });
|
||||
},
|
||||
connect: function(){
|
||||
var name = 'jstore-flash-embed-' + this.project;
|
||||
|
||||
// To make Flash Storage work on IE, we have to load up an iFrame
|
||||
// which contains an HTML page that embeds the object using an
|
||||
// object tag wrapping an embed tag. Of course, this is unnecessary for
|
||||
// all browsers except for IE, which, to my knowledge, is the only browser
|
||||
// in existance where you need to complicate your code to fix bugs. Goddamnit. :(
|
||||
$(document.body)
|
||||
.append('<iframe style="height:1px;width:1px;position:absolute;left:0;top:0;margin-left:-100px;" ' +
|
||||
'id="jStoreFlashFrame" src="' +$.jStore.defaults.flash + '"></iframe>');
|
||||
},
|
||||
flashReady: function(e){
|
||||
var iFrame = $('#jStoreFlashFrame')[0];
|
||||
|
||||
// IE
|
||||
if (iFrame.Document && $.isFunction(iFrame.Document['jStoreFlash'].f_get_cookie)) this.db = iFrame.Document['jStoreFlash'];
|
||||
// Safari && Firefox
|
||||
else if (iFrame.contentWindow && iFrame.contentWindow.document){
|
||||
var doc = iFrame.contentWindow.document;
|
||||
// Safari
|
||||
if ($.isFunction($('object', $(doc))[0].f_get_cookie)) this.db = $('object', $(doc))[0];
|
||||
// Firefox
|
||||
else if ($.isFunction($('embed', $(doc))[0].f_get_cookie)) this.db = $('embed', $(doc))[0];
|
||||
}
|
||||
|
||||
// We're ready to process data
|
||||
if (this.db) this.delegate.trigger('engine-ready');
|
||||
},
|
||||
isAvailable: avilability,
|
||||
get: function(key){
|
||||
var out = this.db.f_get_cookie(key);
|
||||
return out == 'null' ? null : out;
|
||||
},
|
||||
set: function(key, value){
|
||||
this.db.f_set_cookie(key, value);
|
||||
return value;
|
||||
},
|
||||
rem: function(key){
|
||||
var beforeDelete = this.get(key);
|
||||
this.db.f_delete_cookie(key);
|
||||
return beforeDelete;
|
||||
}
|
||||
})
|
||||
|
||||
$.jStore.Engines.flash = jStoreFlash;
|
||||
|
||||
// Store the ordering preference
|
||||
$.jStore.EngineOrder[ 2 ] = 'flash';
|
||||
|
||||
/**
|
||||
* Flash Detection functions copied from the jQuery Flash Plugin
|
||||
* Copyright (c) 2006 Luke Lutman (http://jquery.lukelutman.com/plugins/flash)
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.opensource.org/licenses/gpl-license.php
|
||||
*/
|
||||
$.jStore.hasFlash = function(version){
|
||||
var pv = $.jStore.flashVersion().match(/\d+/g),
|
||||
rv = version.match(/\d+/g);
|
||||
|
||||
for(var i = 0; i < 3; i++) {
|
||||
pv[i] = parseInt(pv[i] || 0);
|
||||
rv[i] = parseInt(rv[i] || 0);
|
||||
// player is less than required
|
||||
if(pv[i] < rv[i]) return false;
|
||||
// player is greater than required
|
||||
if(pv[i] > rv[i]) return true;
|
||||
}
|
||||
// major version, minor version and revision match exactly
|
||||
return true;
|
||||
}
|
||||
|
||||
$.jStore.flashVersion = function(){
|
||||
// ie
|
||||
try {
|
||||
try {
|
||||
// avoid fp6 minor version lookup issues
|
||||
// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
|
||||
var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
|
||||
try { axo.AllowScriptAccess = 'always'; }
|
||||
catch(e) { return '6,0,0'; }
|
||||
} catch(e) {}
|
||||
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
|
||||
// other browsers
|
||||
} catch(e) {
|
||||
try {
|
||||
if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
|
||||
return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
return '0,0,0';
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
// Callback fired when ExternalInterface is established
|
||||
function flash_ready(){
|
||||
$.jStore.delegate.trigger('flash-ready');
|
||||
}
|
||||
/*
|
||||
* jStore Google Gears Storage Engine
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
// Set up a static test function for this instance
|
||||
var avilability = $.jStore.Availability.gears = function(){
|
||||
return !!(window.google && window.google.gears)
|
||||
}
|
||||
|
||||
this.jStoreGears = StorageEngine.extend({
|
||||
init: function(project, name){
|
||||
// Call the parental init object
|
||||
this._super(project, name);
|
||||
|
||||
// The type of storage engine
|
||||
this.type = 'Google Gears';
|
||||
|
||||
// Add required third-party scripts
|
||||
this.includes.push('http://code.google.com/apis/gears/gears_init.js');
|
||||
|
||||
// Allow Autoloading on fail
|
||||
this.autoload = true;
|
||||
},
|
||||
connect: function(){
|
||||
// Create our database connection
|
||||
var db = this.db = google.gears.factory.create('beta.database');
|
||||
db.open( 'jstore-' + this.project );
|
||||
db.execute( 'CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)' );
|
||||
|
||||
// Cache the data from the table
|
||||
this.updateCache();
|
||||
},
|
||||
updateCache: function(){
|
||||
// Read the database into our cache object
|
||||
var result = this.db.execute( 'SELECT k,v FROM jstore' );
|
||||
while (result.isValidRow()){
|
||||
this.data[result.field(0)] = result.field(1);
|
||||
result.next();
|
||||
} result.close();
|
||||
|
||||
// Fire our delegate to indicate we're ready for data transactions
|
||||
this.delegate.trigger('engine-ready');
|
||||
},
|
||||
isAvailable: avilability,
|
||||
set: function(key, value){
|
||||
// Update the database
|
||||
var db = this.db;
|
||||
db.execute( 'BEGIN' );
|
||||
db.execute( 'INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)', [key,value] );
|
||||
db.execute( 'COMMIT' );
|
||||
return this._super(key, value);
|
||||
},
|
||||
rem: function(key){
|
||||
// Update the database
|
||||
var db = this.db;
|
||||
db.execute( 'BEGIN' );
|
||||
db.execute( 'DELETE FROM jstore WHERE k = ?', [key] );
|
||||
db.execute( 'COMMIT' );
|
||||
return this._super(key);
|
||||
}
|
||||
})
|
||||
|
||||
$.jStore.Engines.gears = jStoreGears;
|
||||
|
||||
// Store the ordering preference
|
||||
$.jStore.EngineOrder[ 3 ] = 'gears';
|
||||
|
||||
})(jQuery);
|
||||
/*
|
||||
* jStore HTML5 Specification Storage Engine
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
// Set up a static test function for this instance
|
||||
var avilability = $.jStore.Availability.html5 = function(){
|
||||
return !!window.openDatabase
|
||||
}
|
||||
|
||||
this.jStoreHtml5 = StorageEngine.extend({
|
||||
init: function(project, name){
|
||||
// Call the parental init object
|
||||
this._super(project, name);
|
||||
|
||||
// The type of storage engine
|
||||
this.type = 'HTML5';
|
||||
|
||||
// Set the Database limit
|
||||
this.limit = 1024 * 200;
|
||||
},
|
||||
connect: function(){
|
||||
// Create our database connection
|
||||
var db = this.db = openDatabase('jstore-' + this.project, '1.0', this.project, this.limit);
|
||||
if (!db) throw 'JSTORE_ENGINE_HTML5_NODB';
|
||||
db.transaction(function(db){
|
||||
db.executeSql( 'CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)' );
|
||||
});
|
||||
|
||||
// Cache the data from the table
|
||||
this.updateCache();
|
||||
},
|
||||
updateCache: function(){
|
||||
var self = this;
|
||||
// Read the database into our cache object
|
||||
this.db.transaction(function(db){
|
||||
db.executeSql( 'SELECT k,v FROM jstore', [], function(db, result){
|
||||
var rows = result.rows, i = 0, row;
|
||||
for (; i < rows.length; ++i){
|
||||
row = rows.item(i);
|
||||
self.data[row.k] = row.v;
|
||||
}
|
||||
|
||||
// Fire our delegate to indicate we're ready for data transactions
|
||||
self.delegate.trigger('engine-ready');
|
||||
});
|
||||
});
|
||||
},
|
||||
isAvailable: avilability,
|
||||
set: function(key, value){
|
||||
// Update the database
|
||||
this.db.transaction(function(db){
|
||||
db.executeSql( 'INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)', [key,value]);
|
||||
});
|
||||
return this._super(key, value);
|
||||
},
|
||||
rem: function(key){
|
||||
// Update the database
|
||||
this.db.transaction(function(db){
|
||||
db.executeSql( 'DELETE FROM jstore WHERE k = ?', [key] )
|
||||
})
|
||||
return this._super(key);
|
||||
}
|
||||
})
|
||||
|
||||
$.jStore.Engines.html5 = jStoreHtml5;
|
||||
|
||||
// Store the ordering preference
|
||||
$.jStore.EngineOrder[ 0 ] = 'html5';
|
||||
|
||||
})(jQuery);
|
||||
/*
|
||||
* jStore IE Storage Engine
|
||||
* Copyright (c) 2009 Eric Garside (http://eric.garside.name)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
// Set up a static test function for this instance
|
||||
var avilability = $.jStore.Availability.ie = function(){
|
||||
return !!window.ActiveXObject;
|
||||
}
|
||||
|
||||
this.jStoreIE = StorageEngine.extend({
|
||||
init: function(project, name){
|
||||
// Call the parental init object
|
||||
this._super(project, name);
|
||||
|
||||
// The type of storage engine
|
||||
this.type = 'IE';
|
||||
|
||||
// Allow Autoloading on fail
|
||||
this.limit = 64 * 1024;
|
||||
},
|
||||
connect: function(){
|
||||
// Create a hidden div to store attributes in
|
||||
this.db = $('<div style="display:none;behavior:url(\'#default#userData\')" id="jstore-' + this.project + '"></div>')
|
||||
.appendTo(document.body).get(0);
|
||||
// Fire our delegate to indicate we're ready for data transactions
|
||||
this.delegate.trigger('engine-ready');
|
||||
},
|
||||
isAvailable: avilability,
|
||||
get: function(key){
|
||||
this.db.load(this.project);
|
||||
return this.db.getAttribute(key);
|
||||
},
|
||||
set: function(key, value){
|
||||
this.db.setAttribute(key, value);
|
||||
this.db.save(this.project);
|
||||
return value;
|
||||
},
|
||||
rem: function(key){
|
||||
var beforeDelete = this.get(key);
|
||||
this.db.removeAttribute(key);
|
||||
this.db.save(this.project);
|
||||
return beforeDelete;
|
||||
}
|
||||
})
|
||||
|
||||
$.jStore.Engines.ie = jStoreIE;
|
||||
|
||||
// Store the ordering preference
|
||||
$.jStore.EngineOrder[ 4 ] = 'ie';
|
||||
|
||||
})(jQuery);
|
||||
File diff suppressed because it is too large
Load Diff
+16
-10
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
http://www.JSON.org/json2.js
|
||||
2009-06-29
|
||||
2010-03-20
|
||||
|
||||
Public Domain.
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
NOT CONTROL.
|
||||
|
||||
|
||||
This file creates a global JSON object containing two methods: stringify
|
||||
and parse.
|
||||
|
||||
@@ -33,7 +41,7 @@
|
||||
value represented by the name/value pair that should be serialized,
|
||||
or undefined if nothing should be serialized. The toJSON method
|
||||
will be passed the key associated with the value, and this will be
|
||||
bound to the object holding the key.
|
||||
bound to the value
|
||||
|
||||
For example, this would serialize Dates as ISO strings.
|
||||
|
||||
@@ -136,15 +144,9 @@
|
||||
|
||||
This is a reference implementation. You are free to copy, modify, or
|
||||
redistribute.
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
NOT CONTROL.
|
||||
*/
|
||||
|
||||
/*jslint evil: true */
|
||||
/*jslint evil: true, strict: false */
|
||||
|
||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||
@@ -153,10 +155,13 @@
|
||||
test, toJSON, toString, valueOf
|
||||
*/
|
||||
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
|
||||
var JSON = JSON || {};
|
||||
if (!this.JSON) {
|
||||
this.JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
|
||||
@@ -428,6 +433,7 @@ var JSON = JSON || {};
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
text = String(text);
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Class definition
|
||||
*
|
||||
* Copyright (c) 2008 John Resig (http://ejohn.org/blog/simple-javascript-inheritance/)
|
||||
* Inspired by base2 and Prototype
|
||||
*/
|
||||
"use strict";(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=(typeof g[d]==="function"&&typeof f[d]==="function"&&b.test(g[d])?(function(h,i){return function(){var k=this._super;this._super=f[h];var j=i.apply(this,arguments);this._super=k;return j}}(d,g[d])):g[d])}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.extend=arguments.callee;return c}}());
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
var JSON=JSON||{};(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
|
||||
if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
|
||||
+12
-17
@@ -32,29 +32,25 @@
|
||||
|
||||
<%def name="javascripts()">
|
||||
${parent.javascripts()}
|
||||
${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "jquery.autocomplete", "jquery.jstore-all", "autocomplete_tagging" )}
|
||||
${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "class", "jquery.jstore", "jquery.autocomplete", "autocomplete_tagging" )}
|
||||
|
||||
<script type="text/javascript">
|
||||
//
|
||||
|
||||
// Handle click on community tag.
|
||||
//
|
||||
function community_tag_click(tag_name, tag_value)
|
||||
{
|
||||
function community_tag_click(tag_name, tag_value) {
|
||||
<% controller_name = get_controller_name( item ) %>
|
||||
var href = '${h.url_for ( controller='/' + controller_name , action='list_published')}';
|
||||
href = href + "?f-tags=" + tag_name;
|
||||
if (tag_value != undefined && tag_value != "")
|
||||
if (tag_value != undefined && tag_value != "") {
|
||||
href = href + ":" + tag_value;
|
||||
}
|
||||
self.location = href;
|
||||
}
|
||||
|
||||
$(document).ready( function()
|
||||
{
|
||||
$(function() {
|
||||
// Set links to Galaxy screencasts to open in overlay.
|
||||
$(this).find("a[href^='http://screencast.g2.bx.psu.edu/']").each( function()
|
||||
{
|
||||
$(this).click( function()
|
||||
{
|
||||
$(this).find("a[href^='http://screencast.g2.bx.psu.edu/']").each( function() {
|
||||
$(this).click( function() {
|
||||
var href = $(this).attr('href');
|
||||
show_in_overlay(
|
||||
{
|
||||
@@ -67,7 +63,8 @@
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// Init history boxes
|
||||
init_history_items( $("div.historyItemWrapper") );
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
@@ -76,14 +73,12 @@
|
||||
${parent.stylesheets()}
|
||||
${h.css( "autocomplete_tagging", "embed_item" )}
|
||||
<style type="text/css">
|
||||
.page-body
|
||||
{
|
||||
.page-body {
|
||||
padding: 10px;
|
||||
## float: left;
|
||||
## width: 65%;
|
||||
}
|
||||
.page-meta
|
||||
{
|
||||
.page-meta {
|
||||
float: right;
|
||||
width: 27%;
|
||||
padding: 0.5em;
|
||||
|
||||
+35
-229
@@ -1,207 +1,14 @@
|
||||
<%inherit file="/display_base.mako"/>
|
||||
<%namespace file="/root/history_common.mako" import="render_dataset" />
|
||||
|
||||
## Set vars so that there's no need to change the code below.
|
||||
<%
|
||||
history = published_item
|
||||
datasets = published_item_data
|
||||
%>
|
||||
|
||||
<%def name="javascripts()">
|
||||
${parent.javascripts()}
|
||||
${h.js( "jquery.jstore-all" )}
|
||||
|
||||
## Set vars so that there's no need to change the code below.
|
||||
<%
|
||||
history = published_item
|
||||
datasets = published_item_data
|
||||
%>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
// Load jStore for local storage
|
||||
$.extend(jQuery.jStore.defaults, { project: 'galaxy', flash: '/static/jStore.Flash.html' })
|
||||
$.jStore.load(); // Auto-select best storage
|
||||
|
||||
$.jStore.ready(function(engine) {
|
||||
engine.ready(function() {
|
||||
// Init stuff that requires the local storage to be running
|
||||
initShowHide();
|
||||
setupHistoryItem( $("div.historyItemWrapper") );
|
||||
});
|
||||
});
|
||||
|
||||
// Generate 'collapse all' link
|
||||
$("#top-links").append( "| " ).append( $("<a href='#'>${_('collapse all')}</a>").click( function() {
|
||||
$( "div.historyItemBody:visible" ).each( function() {
|
||||
if ( $.browser.mozilla ) {
|
||||
$(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
}
|
||||
$(this).slideUp( "fast" );
|
||||
});
|
||||
$.jStore.remove("history_expand_state");
|
||||
}));
|
||||
|
||||
});
|
||||
// Functionized so AJAX'd datasets can call them
|
||||
function initShowHide() {
|
||||
|
||||
// Load saved state and show as necessary
|
||||
try {
|
||||
var stored = $.jStore.store("history_expand_state");
|
||||
if (stored) {
|
||||
var st = JSON.parse(stored);
|
||||
for (var id in st) {
|
||||
$("#" + id + " div.historyItemBody" ).show();
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
// Something was wrong with values in storage, so clear storage
|
||||
$.jStore.remove("history_expand_state");
|
||||
}
|
||||
|
||||
// If Mozilla, hide scrollbars in hidden items since they cause animation bugs
|
||||
if ( $.browser.mozilla ) {
|
||||
$( "div.historyItemBody" ).each( function() {
|
||||
if ( ! $(this).is( ":visible" ) ) $(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
})
|
||||
}
|
||||
}
|
||||
// Add show/hide link and delete link to a history item
|
||||
function setupHistoryItem( query ) {
|
||||
query.each( function() {
|
||||
var id = this.id;
|
||||
var body = $(this).children( "div.historyItemBody" );
|
||||
var peek = body.find( "pre.peek" )
|
||||
$(this).children( ".historyItemTitleBar" ).find( ".historyItemTitle" ).wrap( "<a href='#'></a>" ).click( function() {
|
||||
if ( body.is(":visible") ) {
|
||||
// Hiding stuff here
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "hidden" ) }
|
||||
body.slideUp( "fast" );
|
||||
|
||||
// Save setting
|
||||
var stored = $.jStore.store("history_expand_state")
|
||||
var prefs = stored ? JSON.parse(stored) : null
|
||||
if (prefs) {
|
||||
delete prefs[id];
|
||||
$.jStore.store("history_expand_state", JSON.stringify(prefs));
|
||||
}
|
||||
} else {
|
||||
// Showing stuff here
|
||||
body.slideDown( "fast", function() {
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "auto" ); }
|
||||
});
|
||||
|
||||
// Save setting
|
||||
var stored = $.jStore.store("history_expand_state")
|
||||
var prefs = stored ? JSON.parse(stored) : new Object;
|
||||
prefs[id] = true;
|
||||
$.jStore.store("history_expand_state", JSON.stringify(prefs));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// Delete link
|
||||
$(this).find( "div.historyItemButtons > .delete" ).each( function() {
|
||||
var data_id = this.id.split( "-" )[1];
|
||||
$(this).click( function() {
|
||||
$( '#historyItem-' + data_id + "> div.historyItemTitleBar" ).addClass( "spinner" );
|
||||
$.ajax({
|
||||
url: "${h.url_for( action='delete_async', id='XXX' )}".replace( 'XXX', data_id ),
|
||||
error: function() { alert( "Delete failed" ) },
|
||||
success: function() {
|
||||
%if show_deleted:
|
||||
var to_update = {};
|
||||
to_update[data_id] = "none";
|
||||
updater( to_update );
|
||||
%else:
|
||||
$( "#historyItem-" + data_id ).fadeOut( "fast", function() {
|
||||
$( "#historyItemContainer-" + data_id ).remove();
|
||||
if ( $( "div.historyItemContainer" ).length < 1 ) {
|
||||
$( "#emptyHistoryMessage" ).show();
|
||||
}
|
||||
});
|
||||
%endif
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
// Undelete link
|
||||
$(this).find( "a.historyItemUndelete" ).each( function() {
|
||||
var data_id = this.id.split( "-" )[1];
|
||||
$(this).click( function() {
|
||||
$( '#historyItem-' + data_id + " > div.historyItemTitleBar" ).addClass( "spinner" );
|
||||
$.ajax({
|
||||
url: "${h.url_for( controller='dataset', action='undelete_async', id='XXX' )}".replace( 'XXX', data_id ),
|
||||
error: function() { alert( "Undelete failed" ) },
|
||||
success: function() {
|
||||
var to_update = {};
|
||||
to_update[data_id] = "none";
|
||||
updater( to_update );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
// Looks for changes in dataset state using an async request. Keeps
|
||||
// calling itself (via setTimeout) until all datasets are in a terminal
|
||||
// state.
|
||||
var updater = function ( tracked_datasets ) {
|
||||
// Check if there are any items left to track
|
||||
var empty = true;
|
||||
for ( i in tracked_datasets ) {
|
||||
empty = false;
|
||||
break;
|
||||
}
|
||||
if ( ! empty ) {
|
||||
// console.log( "Updater running in 3 seconds" );
|
||||
setTimeout( function() { updater_callback( tracked_datasets ) }, 3000 );
|
||||
} else {
|
||||
// console.log( "Updater finished" );
|
||||
}
|
||||
};
|
||||
var updater_callback = function ( tracked_datasets ) {
|
||||
// Build request data
|
||||
var ids = []
|
||||
var states = []
|
||||
var force_history_refresh = false
|
||||
$.each( tracked_datasets, function ( id, state ) {
|
||||
ids.push( id );
|
||||
states.push( state );
|
||||
});
|
||||
// Make ajax call
|
||||
$.ajax( {
|
||||
type: "POST",
|
||||
url: "${h.url_for( controller='root', action='history_item_updates' )}",
|
||||
dataType: "json",
|
||||
data: { ids: ids.join( "," ), states: states.join( "," ) },
|
||||
success : function ( data ) {
|
||||
$.each( data, function( id, val ) {
|
||||
// Replace HTML
|
||||
var container = $("#historyItemContainer-" + id);
|
||||
container.html( val.html );
|
||||
setupHistoryItem( container.children( ".historyItemWrapper" ) );
|
||||
initShowHide();
|
||||
// If new state was terminal, stop tracking
|
||||
if (( val.state == "ok") || ( val.state == "error") || ( val.state == "empty") || ( val.state == "deleted" ) || ( val.state == "discarded" )) {
|
||||
if ( val.force_history_refresh ){
|
||||
force_history_refresh = true;
|
||||
}
|
||||
delete tracked_datasets[ parseInt(id) ];
|
||||
} else {
|
||||
tracked_datasets[ parseInt(id) ] = val.state;
|
||||
}
|
||||
});
|
||||
if ( force_history_refresh ) {
|
||||
parent.frames.galaxy_history.location.reload();
|
||||
} else {
|
||||
// Keep going (if there are still any items to track)
|
||||
updater( tracked_datasets );
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
// Just retry, like the old method, should try to be smarter
|
||||
updater( tracked_datasets );
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
<%def name="stylesheets()">
|
||||
@@ -235,35 +42,34 @@
|
||||
</%def>
|
||||
|
||||
<%def name="render_item( history, datasets )">
|
||||
%if history.deleted:
|
||||
<div class="warningmessagesmall">
|
||||
${_('You are currently viewing a deleted history!')}
|
||||
</div>
|
||||
<p></p>
|
||||
%endif
|
||||
|
||||
%if not datasets:
|
||||
<div class="infomessagesmall" id="emptyHistoryMessage">
|
||||
%else:
|
||||
## Render requested datasets, ordered from newest to oldest, including annotations.
|
||||
<table class="annotated-item">
|
||||
<tr><th>Dataset</th><th class="annotation">Annotation</th></tr>
|
||||
%for data in datasets:
|
||||
<tr>
|
||||
%if data.visible:
|
||||
<td>
|
||||
<div class="historyItemContainer visible-right-border" id="historyItemContainer-${data.id}">
|
||||
${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, user_owns_dataset=user_owns_history )}
|
||||
</div>
|
||||
</td>
|
||||
<td class="annotation">${data.annotation}</td>
|
||||
%endif
|
||||
</tr>
|
||||
%endfor
|
||||
</table>
|
||||
<div class="infomessagesmall" id="emptyHistoryMessage" style="display:none;">
|
||||
%endif
|
||||
${_("This history is empty.")}
|
||||
</div>
|
||||
%if history.deleted:
|
||||
<div class="warningmessagesmall">
|
||||
${_('You are currently viewing a deleted history!')}
|
||||
</div>
|
||||
<p></p>
|
||||
%endif
|
||||
|
||||
%if not datasets:
|
||||
<div class="infomessagesmall" id="emptyHistoryMessage">
|
||||
%else:
|
||||
## Render requested datasets, ordered from newest to oldest, including annotations.
|
||||
<table class="annotated-item">
|
||||
<tr><th>Dataset</th><th class="annotation">Annotation</th></tr>
|
||||
%for data in datasets:
|
||||
<tr>
|
||||
%if data.visible:
|
||||
<td>
|
||||
<div class="historyItemContainer visible-right-border" id="historyItemContainer-${data.id}">
|
||||
${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, user_owns_dataset=user_owns_history )}
|
||||
</div>
|
||||
</td>
|
||||
<td class="annotation">${data.annotation}</td>
|
||||
%endif
|
||||
</tr>
|
||||
%endfor
|
||||
</table>
|
||||
<div class="infomessagesmall" id="emptyHistoryMessage" style="display:none;">
|
||||
%endif
|
||||
${_("This history is empty.")}
|
||||
</div>
|
||||
</%def>
|
||||
+4
-255
@@ -5,263 +5,11 @@
|
||||
|
||||
<%def name="javascripts()">
|
||||
${parent.javascripts()}
|
||||
${h.js( "galaxy.base", "jquery", "json2", "jquery.jstore-all", "jquery.autocomplete", "autocomplete_tagging" )}
|
||||
${h.js( "galaxy.base", "jquery", "json2", "class", "jquery.jstore" )}
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
// Load jStore for local storage
|
||||
$.extend(jQuery.jStore.defaults, { project: 'galaxy', flash: '/static/jStore.Flash.html' })
|
||||
$.jStore.load(); // Auto-select best storage
|
||||
|
||||
$.jStore.ready(function(engine) {
|
||||
engine.ready(function() {
|
||||
// Init stuff that requires the local storage to be running
|
||||
initShowHide();
|
||||
setupHistoryItem( $("div.historyItemWrapper") );
|
||||
});
|
||||
$(function() {
|
||||
init_history_items( $("div.historyItemWrapper") );
|
||||
});
|
||||
|
||||
// Generate 'collapse all' link
|
||||
$("#top-links").append( "| " ).append( $("<a href='#'>${_('collapse all')}</a>").click( function() {
|
||||
$( "div.historyItemBody:visible" ).each( function() {
|
||||
if ( $.browser.mozilla ) {
|
||||
$(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
}
|
||||
$(this).slideUp( "fast" );
|
||||
});
|
||||
$.jStore.remove("history_expand_state");
|
||||
}));
|
||||
|
||||
$("#history-rename").click( function() {
|
||||
var old_name = $("#history-name").text()
|
||||
var t = $("<input type='text' value='" + old_name + "'></input>" );
|
||||
t.blur( function() {
|
||||
$(this).remove();
|
||||
$("#history-name").show();
|
||||
});
|
||||
t.keyup( function( e ) {
|
||||
if ( e.keyCode == 27 ) {
|
||||
// Escape key
|
||||
$(this).trigger( "blur" );
|
||||
} else if ( e.keyCode == 13 ) {
|
||||
// Enter key
|
||||
new_value = this.value;
|
||||
$(this).trigger( "blur" );
|
||||
$.ajax({
|
||||
url: "${h.url_for( controller='history', action='rename_async', id=history.id )}",
|
||||
data: { "_": true, new_name: new_value },
|
||||
error: function() { alert( "Rename failed" ) },
|
||||
success: function() {
|
||||
$("#history-name").text( new_value );
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
$("#history-name").hide();
|
||||
$("#history-name-area").append( t );
|
||||
t.focus();
|
||||
return false;
|
||||
});
|
||||
// Updater
|
||||
updater({
|
||||
<% updateable = [data for data in reversed( datasets ) if data.visible and data.state not in [ "deleted", "empty", "error", "ok" ]] %>
|
||||
${ ",".join( map(lambda data: "\"%s\" : \"%s\"" % (data.id, data.state), updateable) ) }
|
||||
});
|
||||
});
|
||||
// Functionized so AJAX'd datasets can call them
|
||||
function initShowHide() {
|
||||
|
||||
// Load saved state and show as necessary
|
||||
try {
|
||||
var stored = $.jStore.store("history_expand_state");
|
||||
if (stored) {
|
||||
var st = JSON.parse(stored);
|
||||
for (var id in st) {
|
||||
$("#" + id + " div.historyItemBody" ).show();
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
// Something was wrong with values in storage, so clear storage
|
||||
$.jStore.remove("history_expand_state");
|
||||
}
|
||||
|
||||
// If Mozilla, hide scrollbars in hidden items since they cause animation bugs
|
||||
if ( $.browser.mozilla ) {
|
||||
$( "div.historyItemBody" ).each( function() {
|
||||
if ( ! $(this).is( ":visible" ) ) $(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
})
|
||||
}
|
||||
}
|
||||
// Add show/hide link and delete link to a history item
|
||||
function setupHistoryItem( query ) {
|
||||
query.each( function() {
|
||||
var id = this.id;
|
||||
var body = $(this).children( "div.historyItemBody" );
|
||||
var peek = body.find( "pre.peek" )
|
||||
$(this).children( ".historyItemTitleBar" ).find( ".historyItemTitle" ).wrap( "<a href='#'></a>" ).click( function() {
|
||||
if ( body.is(":visible") ) {
|
||||
// Hiding stuff here
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "hidden" ) }
|
||||
body.slideUp( "fast" );
|
||||
|
||||
// Save setting
|
||||
var stored = $.jStore.store("history_expand_state")
|
||||
var prefs = stored ? JSON.parse(stored) : null
|
||||
if (prefs) {
|
||||
delete prefs[id];
|
||||
$.jStore.store("history_expand_state", JSON.stringify(prefs));
|
||||
}
|
||||
} else {
|
||||
// Showing stuff here
|
||||
body.slideDown( "fast", function() {
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "auto" ); }
|
||||
});
|
||||
|
||||
// Save setting
|
||||
var stored = $.jStore.store("history_expand_state")
|
||||
var prefs = stored ? JSON.parse(stored) : new Object;
|
||||
prefs[id] = true;
|
||||
$.jStore.store("history_expand_state", JSON.stringify(prefs));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// Delete link
|
||||
$(this).find( "div.historyItemButtons > .delete" ).each( function() {
|
||||
var data_id = this.id.split( "-" )[1];
|
||||
$(this).click( function() {
|
||||
$( '#historyItem-' + data_id + "> div.historyItemTitleBar" ).addClass( "spinner" );
|
||||
$.ajax({
|
||||
url: "${h.url_for( action='delete_async', id='XXX' )}".replace( 'XXX', data_id ),
|
||||
error: function() { alert( "Delete failed" ) },
|
||||
success: function() {
|
||||
%if show_deleted:
|
||||
var to_update = {};
|
||||
to_update[data_id] = "none";
|
||||
updater( to_update );
|
||||
%else:
|
||||
$( "#historyItem-" + data_id ).fadeOut( "fast", function() {
|
||||
$( "#historyItemContainer-" + data_id ).remove();
|
||||
if ( $( "div.historyItemContainer" ).length < 1 ) {
|
||||
$( "#emptyHistoryMessage" ).show();
|
||||
}
|
||||
});
|
||||
%endif
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
// Undelete link
|
||||
$(this).find( "a.historyItemUndelete" ).each( function() {
|
||||
var data_id = this.id.split( "-" )[1];
|
||||
$(this).click( function() {
|
||||
$( '#historyItem-' + data_id + " > div.historyItemTitleBar" ).addClass( "spinner" );
|
||||
$.ajax({
|
||||
url: "${h.url_for( controller='dataset', action='undelete_async', id='XXX' )}".replace( 'XXX', data_id ),
|
||||
error: function() { alert( "Undelete failed" ) },
|
||||
success: function() {
|
||||
var to_update = {};
|
||||
to_update[data_id] = "none";
|
||||
updater( to_update );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
// Looks for changes in dataset state using an async request. Keeps
|
||||
// calling itself (via setTimeout) until all datasets are in a terminal
|
||||
// state.
|
||||
var updater = function ( tracked_datasets ) {
|
||||
// Check if there are any items left to track
|
||||
var empty = true;
|
||||
for ( i in tracked_datasets ) {
|
||||
empty = false;
|
||||
break;
|
||||
}
|
||||
if ( ! empty ) {
|
||||
// console.log( "Updater running in 3 seconds" );
|
||||
setTimeout( function() { updater_callback( tracked_datasets ) }, 3000 );
|
||||
} else {
|
||||
// console.log( "Updater finished" );
|
||||
}
|
||||
};
|
||||
var updater_callback = function ( tracked_datasets ) {
|
||||
// Build request data
|
||||
var ids = []
|
||||
var states = []
|
||||
var force_history_refresh = false
|
||||
$.each( tracked_datasets, function ( id, state ) {
|
||||
ids.push( id );
|
||||
states.push( state );
|
||||
});
|
||||
// Make ajax call
|
||||
$.ajax( {
|
||||
type: "POST",
|
||||
url: "${h.url_for( controller='root', action='history_item_updates' )}",
|
||||
dataType: "json",
|
||||
data: { ids: ids.join( "," ), states: states.join( "," ) },
|
||||
success : function ( data ) {
|
||||
$.each( data, function( id, val ) {
|
||||
// Replace HTML
|
||||
var container = $("#historyItemContainer-" + id);
|
||||
container.html( val.html );
|
||||
setupHistoryItem( container.children( ".historyItemWrapper" ) );
|
||||
initShowHide();
|
||||
// If new state was terminal, stop tracking
|
||||
if (( val.state == "ok") || ( val.state == "error") || ( val.state == "empty") || ( val.state == "deleted" ) || ( val.state == "discarded" )) {
|
||||
if ( val.force_history_refresh ){
|
||||
force_history_refresh = true;
|
||||
}
|
||||
delete tracked_datasets[ parseInt(id) ];
|
||||
} else {
|
||||
tracked_datasets[ parseInt(id) ] = val.state;
|
||||
}
|
||||
});
|
||||
if ( force_history_refresh ) {
|
||||
parent.frames.galaxy_history.location.reload();
|
||||
} else {
|
||||
// Keep going (if there are still any items to track)
|
||||
updater( tracked_datasets );
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
// Just retry, like the old method, should try to be smarter
|
||||
updater( tracked_datasets );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// Function provides text for tagging toggle link.
|
||||
//
|
||||
var get_toggle_link_text = function(tags)
|
||||
{
|
||||
var text = "";
|
||||
var num_tags = array_length(tags);
|
||||
if (num_tags != 0)
|
||||
{
|
||||
text = num_tags + (num_tags != 1 ? " Tags" : " Tag");
|
||||
}
|
||||
else
|
||||
{
|
||||
// No tags.
|
||||
text = "Add tags to history";
|
||||
}
|
||||
return text;
|
||||
};
|
||||
|
||||
//
|
||||
// Handle click on community tag.
|
||||
//
|
||||
function community_tag_click(tag_name, tag_value)
|
||||
{
|
||||
var href = '${h.url_for( controller='/history', action='list_published')}';
|
||||
href = href + "?f-tags=" + tag_name;
|
||||
if (tag_value != undefined && tag_value != "")
|
||||
href = href + ":" + tag_value;
|
||||
self.location = href;
|
||||
}
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
@@ -343,6 +91,7 @@
|
||||
%if show_deleted:
|
||||
| <a href="${h.url_for('history', show_deleted=False)}">${_('hide deleted')}</a>
|
||||
%endif
|
||||
| <a href="#" class="toggle">collapse all</a>
|
||||
</div>
|
||||
|
||||
<div id="history-name-area" class="historyLinks" style="color: gray; font-weight: bold; padding: 0px 0px 5px 0px">
|
||||
|
||||
+68
-206
@@ -3,222 +3,84 @@
|
||||
<%def name="javascripts()">
|
||||
${parent.javascripts()}
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
// Load jStore for local storage
|
||||
$.extend(jQuery.jStore.defaults, { project: 'galaxy', flash: '/static/jStore.Flash.html' })
|
||||
$.jStore.load(); // Auto-select best storage
|
||||
|
||||
$(function() {
|
||||
|
||||
$.jStore.ready(function(engine) {
|
||||
engine.ready(function() {
|
||||
// Init stuff that requires the local storage to be running
|
||||
//initShowHide();
|
||||
setupHistoryItem( $("div.historyItemWrapper") );
|
||||
|
||||
// Hide all for now.
|
||||
$( "div.historyItemBody:visible" ).each( function() {
|
||||
if ( $.browser.mozilla ) {
|
||||
$(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
// Setup embedded content:
|
||||
// (a) toggles for showing/hiding embedded content;
|
||||
// (b) ...
|
||||
$('.embedded-item').each( function() {
|
||||
var container = $(this);
|
||||
|
||||
// Show embedded item.
|
||||
var show_embedded_item = function() {
|
||||
var ajax_url = container.find("input[type=hidden]").val();
|
||||
// Only get item content if it's not already there.
|
||||
var item_content = $.trim(container.find(".item-content").text());
|
||||
if (!item_content) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
error: function() { alert("Getting item content failed."); },
|
||||
success: function( item_content ) {
|
||||
container.find(".summary-content").hide("fast");
|
||||
container.find(".item-content").html(item_content).show("fast");
|
||||
container.find(".toggle-expand").hide();
|
||||
container.find(".toggle-contract").show();
|
||||
|
||||
// Init needed for history items.
|
||||
init_history_items( container.find("div.historyItemWrapper"), true );
|
||||
container.find( "div.historyItemBody:visible" ).each( function() {
|
||||
if ( $.browser.mozilla ) {
|
||||
$(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
}
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
container.find(".summary-content").hide("fast");
|
||||
container.find(".item-content").show("fast");
|
||||
container.find(".toggle-expand").hide();
|
||||
container.find(".toggle-contract").show();
|
||||
}
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Setup embedded content:
|
||||
// (a) toggles for showing/hiding embedded content;
|
||||
// (b) ...
|
||||
$('.embedded-item').each( function()
|
||||
{
|
||||
var container = $(this);
|
||||
};
|
||||
|
||||
// Show embedded item.
|
||||
var show_embedded_item = function() {
|
||||
var ajax_url = container.find("input[type=hidden]").val();
|
||||
// Only get item content if it's not already there.
|
||||
var item_content = $.trim(container.find(".item-content").text());
|
||||
if (item_content == "")
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
error: function() { alert("Getting item content failed."); },
|
||||
success: function( item_content ) {
|
||||
container.find(".summary-content").hide("fast");
|
||||
container.find(".item-content").html(item_content).show("fast");
|
||||
container.find(".toggle-expand").hide();
|
||||
container.find(".toggle-contract").show();
|
||||
|
||||
// Init needed for history items.
|
||||
setupHistoryItem( container.find("div.historyItemWrapper") );
|
||||
container.find( "div.historyItemBody:visible" ).each( function() {
|
||||
if ( $.browser.mozilla ) {
|
||||
$(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
}
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
else
|
||||
{
|
||||
container.find(".summary-content").hide("fast");
|
||||
container.find(".item-content").show("fast");
|
||||
container.find(".toggle-expand").hide();
|
||||
container.find(".toggle-contract").show();
|
||||
}
|
||||
};
|
||||
// Hide embedded item.
|
||||
var hide_embedded_item = function() {
|
||||
container.find(".item-content").hide("fast");
|
||||
container.find(".summary-content").show("fast");
|
||||
container.find(".toggle-contract").hide();
|
||||
container.find(".toggle-expand").show();
|
||||
};
|
||||
|
||||
// Hide embedded item.
|
||||
var hide_embedded_item = function() {
|
||||
container.find(".item-content").hide("fast");
|
||||
container.find(".summary-content").show("fast");
|
||||
container.find(".toggle-contract").hide();
|
||||
container.find(".toggle-expand").show();
|
||||
};
|
||||
|
||||
// Setup toggle expand.
|
||||
var toggle_expand = $(this).find('.toggle-expand');
|
||||
toggle_expand.click( function()
|
||||
{
|
||||
show_embedded_item();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Setup toggle contract.
|
||||
var toggle_contract = $(this).find('.toggle-contract');
|
||||
toggle_contract.click( function()
|
||||
{
|
||||
hide_embedded_item();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Setup toggle embed.
|
||||
var toggle_embed = $(this).find('.toggle-embed');
|
||||
toggle_embed.click( function()
|
||||
{
|
||||
if (container.find(".item-content").is(":visible"))
|
||||
hide_embedded_item();
|
||||
else
|
||||
// Setup toggle expand.
|
||||
var toggle_expand = $(this).find('.toggle-expand');
|
||||
toggle_expand.click( function() {
|
||||
show_embedded_item();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
// Functionized so AJAX'd datasets can call them
|
||||
function initShowHide() {
|
||||
|
||||
// Load saved state and show as necessary
|
||||
try {
|
||||
var stored = $.jStore.store("history_expand_state");
|
||||
if (stored) {
|
||||
var st = JSON.parse(stored);
|
||||
for (var id in st) {
|
||||
$("#" + id + " div.historyItemBody" ).show();
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
// Something was wrong with values in storage, so clear storage
|
||||
$.jStore.remove("history_expand_state");
|
||||
}
|
||||
|
||||
// If Mozilla, hide scrollbars in hidden items since they cause animation bugs
|
||||
if ( $.browser.mozilla ) {
|
||||
$( "div.historyItemBody" ).each( function() {
|
||||
if ( ! $(this).is( ":visible" ) ) $(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
})
|
||||
}
|
||||
}
|
||||
// Add show/hide link and delete link to a history item
|
||||
function setupHistoryItem( query ) {
|
||||
query.each( function() {
|
||||
var id = this.id;
|
||||
var body = $(this).children( "div.historyItemBody" );
|
||||
var peek = body.find( "pre.peek" )
|
||||
$(this).children( ".historyItemTitleBar" ).find( ".historyItemTitle" ).wrap( "<a href='#'></a>" ).click( function() {
|
||||
if ( body.is(":visible") ) {
|
||||
// Hiding stuff here
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "hidden" ) }
|
||||
body.slideUp( "fast" );
|
||||
|
||||
// Save setting
|
||||
var stored = $.jStore.store("history_expand_state")
|
||||
var prefs = stored ? JSON.parse(stored) : null
|
||||
if (prefs) {
|
||||
delete prefs[id];
|
||||
$.jStore.store("history_expand_state", JSON.stringify(prefs));
|
||||
return false;
|
||||
});
|
||||
|
||||
// Setup toggle contract.
|
||||
var toggle_contract = $(this).find('.toggle-contract');
|
||||
toggle_contract.click( function() {
|
||||
hide_embedded_item();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Setup toggle embed.
|
||||
var toggle_embed = $(this).find('.toggle-embed');
|
||||
toggle_embed.click( function() {
|
||||
if (container.find(".item-content").is(":visible")) {
|
||||
hide_embedded_item();
|
||||
} else {
|
||||
show_embedded_item();
|
||||
}
|
||||
} else {
|
||||
// Showing stuff here
|
||||
body.slideDown( "fast", function() {
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "auto" ); }
|
||||
});
|
||||
|
||||
// Save setting
|
||||
var stored = $.jStore.store("history_expand_state")
|
||||
var prefs = stored ? JSON.parse(stored) : new Object;
|
||||
prefs[id] = true;
|
||||
$.jStore.store("history_expand_state", JSON.stringify(prefs));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// Delete link
|
||||
$(this).find( "div.historyItemButtons > .delete" ).each( function() {
|
||||
var data_id = this.id.split( "-" )[1];
|
||||
$(this).click( function() {
|
||||
$( '#historyItem-' + data_id + "> div.historyItemTitleBar" ).addClass( "spinner" );
|
||||
$.ajax({
|
||||
url: "${h.url_for( action='delete_async', id='XXX' )}".replace( 'XXX', data_id ),
|
||||
error: function() { alert( "Delete failed" ) },
|
||||
success: function() {
|
||||
%if show_deleted:
|
||||
var to_update = {};
|
||||
to_update[data_id] = "none";
|
||||
updater( to_update );
|
||||
%else:
|
||||
$( "#historyItem-" + data_id ).fadeOut( "fast", function() {
|
||||
$( "#historyItemContainer-" + data_id ).remove();
|
||||
if ( $( "div.historyItemContainer" ).length < 1 ) {
|
||||
$( "#emptyHistoryMessage" ).show();
|
||||
}
|
||||
});
|
||||
%endif
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
// Undelete link
|
||||
$(this).find( "a.historyItemUndelete" ).each( function() {
|
||||
var data_id = this.id.split( "-" )[1];
|
||||
$(this).click( function() {
|
||||
$( '#historyItem-' + data_id + " > div.historyItemTitleBar" ).addClass( "spinner" );
|
||||
$.ajax({
|
||||
url: "${h.url_for( controller='dataset', action='undelete_async', id='XXX' )}".replace( 'XXX', data_id ),
|
||||
error: function() { alert( "Undelete failed" ) },
|
||||
success: function() {
|
||||
var to_update = {};
|
||||
to_update[data_id] = "none";
|
||||
updater( to_update );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//TODO: this function is a duplicate of array_length defined in galaxy.base.js ; not sure why it needs to be redefined here (due to streaming?).
|
||||
// Returns the number of keys (elements) in an array/dictionary.
|
||||
var array_length = function(an_array)
|
||||
{
|
||||
if (an_array.length)
|
||||
return an_array.length;
|
||||
|
||||
var count = 0;
|
||||
for (element in an_array)
|
||||
count++;
|
||||
return count;
|
||||
};
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
|
||||
+59
-163
@@ -15,129 +15,14 @@
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
|
||||
${h.css( "base", "history", "autocomplete_tagging" )}
|
||||
${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "jquery.jstore-all", "jquery.autocomplete", "autocomplete_tagging" )}
|
||||
${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "class", "jquery.jstore", "jquery.autocomplete", "autocomplete_tagging" )}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
// Load jStore for local storage
|
||||
$.extend(jQuery.jStore.defaults, { project: 'galaxy', flash: '${h.url_for("/static/jStore.Flash.html")}' })
|
||||
$.jStore.load(); // Auto-select best storage
|
||||
|
||||
$.jStore.ready(function(engine) {
|
||||
engine.ready(function() {
|
||||
// Init stuff that requires the local storage to be running
|
||||
initShowHide();
|
||||
setupHistoryItem( $("div.historyItemWrapper") );
|
||||
});
|
||||
});
|
||||
|
||||
// Generate 'collapse all' link
|
||||
$("#top-links > a.toggle").click( function() {
|
||||
$( "div.historyItemBody:visible" ).each( function() {
|
||||
if ( $.browser.mozilla ) {
|
||||
$(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
}
|
||||
$(this).slideUp( "fast" );
|
||||
});
|
||||
$.jStore.remove("history_expand_state");
|
||||
}).show();
|
||||
|
||||
// History rename functionality.
|
||||
async_save_text("history-name-container", "history-name", "${h.url_for( controller="/history", action="rename_async", id=trans.security.encode_id(history.id) )}", "new_name", 18);
|
||||
|
||||
// History tagging functionality.
|
||||
var historyTagArea = $('#history-tag-area');
|
||||
$('#history-tag').click( function()
|
||||
{
|
||||
if ( historyTagArea.is( ":hidden" ) ) {
|
||||
historyTagArea.slideDown("fast");
|
||||
} else {
|
||||
historyTagArea.slideUp("fast");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// History annotation functionality.
|
||||
var historyAnnotationArea = $('#history-annotation-area');
|
||||
$('#history-annotate').click( function() {
|
||||
if ( historyAnnotationArea.is( ":hidden" ) ) {
|
||||
historyAnnotationArea.slideDown("fast");
|
||||
} else {
|
||||
historyAnnotationArea.slideUp("fast");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
async_save_text("history-annotation-container", "history-annotation", "${h.url_for( controller="/history", action="annotate_async", id=trans.security.encode_id(history.id) )}", "new_annotation", 18, true, 4);
|
||||
|
||||
// Updater
|
||||
updater({
|
||||
<% updateable = [data for data in reversed( datasets ) if data.visible and data.state not in [ "deleted", "empty", "error", "ok" ]] %>
|
||||
${ ",".join( map(lambda data: "\"%s\" : \"%s\"" % (data.id, data.state), updateable) ) }
|
||||
});
|
||||
|
||||
// Navigate to a dataset.
|
||||
%if hda_id:
|
||||
self.location = "#${hda_id}";
|
||||
%endif
|
||||
});
|
||||
// Functionized so AJAX'd datasets can call them
|
||||
function initShowHide() {
|
||||
|
||||
// Load saved state and show as necessary
|
||||
try {
|
||||
var stored = $.jStore.store("history_expand_state");
|
||||
if (stored) {
|
||||
var st = JSON.parse(stored);
|
||||
for (var id in st) {
|
||||
$("#" + id + " div.historyItemBody" ).show();
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
// Something was wrong with values in storage, so clear storage
|
||||
$.jStore.remove("history_expand_state");
|
||||
}
|
||||
|
||||
// If Mozilla, hide scrollbars in hidden items since they cause animation bugs
|
||||
if ( $.browser.mozilla ) {
|
||||
$( "div.historyItemBody" ).each( function() {
|
||||
if ( ! $(this).is( ":visible" ) ) $(this).find( "pre.peek" ).css( "overflow", "hidden" );
|
||||
})
|
||||
}
|
||||
}
|
||||
// (a) Add show/hide link and delete link to a history item;
|
||||
// (b) handle tagging and annotation using jquery.
|
||||
function setupHistoryItem( query ) {
|
||||
query.each( function() {
|
||||
var id = this.id;
|
||||
var body = $(this).children( "div.historyItemBody" );
|
||||
var peek = body.find( "pre.peek" )
|
||||
$(this).children( ".historyItemTitleBar" ).find( ".historyItemTitle" ).wrap( "<a href='#'></a>" ).click( function() {
|
||||
if ( body.is(":visible") ) {
|
||||
// Hiding stuff here
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "hidden" ) }
|
||||
body.slideUp( "fast" );
|
||||
|
||||
// Save setting
|
||||
var stored = $.jStore.store("history_expand_state")
|
||||
var prefs = stored ? JSON.parse(stored) : null
|
||||
if (prefs) {
|
||||
delete prefs[id];
|
||||
$.jStore.store("history_expand_state", JSON.stringify(prefs));
|
||||
}
|
||||
} else {
|
||||
// Showing stuff here
|
||||
body.slideDown( "fast", function() {
|
||||
if ( $.browser.mozilla ) { peek.css( "overflow", "auto" ); }
|
||||
});
|
||||
|
||||
// Save setting
|
||||
var stored = $.jStore.store("history_expand_state")
|
||||
var prefs = stored ? JSON.parse(stored) : new Object;
|
||||
prefs[id] = true;
|
||||
$.jStore.store("history_expand_state", JSON.stringify(prefs));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
var historywrapper = $("div.historyItemWrapper");
|
||||
init_history_items(historywrapper);
|
||||
historywrapper.each( function() {
|
||||
// Delete link
|
||||
$(this).find( "div.historyItemButtons > .delete" ).each( function() {
|
||||
var data_id = this.id.split( "-" )[1];
|
||||
@@ -181,22 +66,19 @@ function setupHistoryItem( query ) {
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Tag handling.
|
||||
$(this).find( "a.icon-button.tags").each( function()
|
||||
{
|
||||
$(this).find( "a.icon-button.tags").each( function() {
|
||||
// Use links parameters but custom URL as ajax URL.
|
||||
$(this).click( function() {
|
||||
// Get tag area, tag element.
|
||||
var history_item = $(this).parents(".historyItem");
|
||||
var tag_area = history_item.find(".tag-area");
|
||||
var tag_elt = history_item.find(".tag-elt");
|
||||
|
||||
|
||||
// Show or hide tag area; if showing tag area and it's empty, fill it.
|
||||
if ( tag_area.is( ":hidden" ) )
|
||||
{
|
||||
if (tag_elt.html() == "" )
|
||||
{
|
||||
if ( tag_area.is( ":hidden" ) ) {
|
||||
if (!tag_elt.html()) {
|
||||
// Need to fill tag element.
|
||||
var href_parms = $(this).attr("href").split("?")[1];
|
||||
var ajax_url = "${h.url_for( controller='tag', action='get_tagging_elt_async' )}?" + href_parms;
|
||||
@@ -209,37 +91,30 @@ function setupHistoryItem( query ) {
|
||||
tag_area.slideDown("fast");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Tag element is filled; show.
|
||||
tag_area.slideDown("fast");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Hide.
|
||||
tag_area.slideUp("fast");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Annotation handling.
|
||||
$(this).find( "a.icon-button.annotate").each( function()
|
||||
{
|
||||
$(this).find( "a.icon-button.annotate").each( function() {
|
||||
// Use links parameters but custom URL as ajax URL.
|
||||
$(this).click( function() {
|
||||
// Get tag area, tag element.
|
||||
var history_item = $(this).parents(".historyItem");
|
||||
var annotation_area = history_item.find(".annotation-area");
|
||||
var annotation_elt = history_item.find(".annotation-elt");
|
||||
|
||||
|
||||
// Show or hide annotation area; if showing annotation area and it's empty, fill it.
|
||||
if ( annotation_area.is( ":hidden" ) )
|
||||
{
|
||||
if (annotation_elt.html() == "" )
|
||||
{
|
||||
if ( annotation_area.is( ":hidden" ) ) {
|
||||
if (!annotation_elt.html()) {
|
||||
// Need to fill annotation element.
|
||||
var href_parms = $(this).attr("href").split("?")[1];
|
||||
var ajax_url = "${h.url_for( controller='dataset', action='get_annotation_async' )}?" + href_parms;
|
||||
@@ -247,8 +122,9 @@ function setupHistoryItem( query ) {
|
||||
url: ajax_url,
|
||||
error: function() { alert( "Annotations failed" ) },
|
||||
success: function(annotation) {
|
||||
if (annotation == "")
|
||||
if (annotation == "") {
|
||||
annotation = "<i>Describe or add notes to dataset</i>";
|
||||
}
|
||||
annotation_elt.html(annotation);
|
||||
annotation_area.find(".tooltip").tipsy( { gravity: 's' } );
|
||||
async_save_text(
|
||||
@@ -258,24 +134,56 @@ function setupHistoryItem( query ) {
|
||||
annotation_area.slideDown("fast");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Annotation element is filled; show.
|
||||
annotation_area.slideDown("fast");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Hide.
|
||||
annotation_area.slideUp("fast");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
// History rename functionality.
|
||||
async_save_text("history-name-container", "history-name", "${h.url_for( controller="/history", action="rename_async", id=trans.security.encode_id(history.id) )}", "new_name", 18);
|
||||
|
||||
// History tagging functionality.
|
||||
var historyTagArea = $('#history-tag-area');
|
||||
$('#history-tag').click( function() {
|
||||
if ( historyTagArea.is( ":hidden" ) ) {
|
||||
historyTagArea.slideDown("fast");
|
||||
} else {
|
||||
historyTagArea.slideUp("fast");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// History annotation functionality.
|
||||
var historyAnnotationArea = $('#history-annotation-area');
|
||||
$('#history-annotate').click( function() {
|
||||
if ( historyAnnotationArea.is( ":hidden" ) ) {
|
||||
historyAnnotationArea.slideDown("fast");
|
||||
} else {
|
||||
historyAnnotationArea.slideUp("fast");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
async_save_text("history-annotation-container", "history-annotation", "${h.url_for( controller="/history", action="annotate_async", id=trans.security.encode_id(history.id) )}", "new_annotation", 18, true, 4);
|
||||
|
||||
// Updater
|
||||
updater(
|
||||
${ h.to_json_string( dict([(data.id, data.state) for data in reversed( datasets ) if data.visible and data.state not in [ "deleted", "empty", "error", "ok" ]]) ) }
|
||||
);
|
||||
|
||||
// Navigate to a dataset.
|
||||
%if hda_id:
|
||||
self.location = "#${hda_id}";
|
||||
%endif
|
||||
});
|
||||
|
||||
// Looks for changes in dataset state using an async request. Keeps
|
||||
// calling itself (via setTimeout) until all datasets are in a terminal
|
||||
// state.
|
||||
@@ -339,18 +247,6 @@ var updater_callback = function ( tracked_datasets ) {
|
||||
});
|
||||
};
|
||||
|
||||
//TODO: this function is a duplicate of array_length defined in galaxy.base.js ; not sure why it needs to be redefined here (due to streaming?).
|
||||
// Returns the number of keys (elements) in an array/dictionary.
|
||||
var array_length = function(an_array)
|
||||
{
|
||||
if (an_array.length)
|
||||
return an_array.length;
|
||||
|
||||
var count = 0;
|
||||
for (element in an_array)
|
||||
count++;
|
||||
return count;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -31,9 +31,10 @@
|
||||
"jquery.event.drag",
|
||||
"jquery.event.drop",
|
||||
"jquery.event.hover",
|
||||
"jquery.form",
|
||||
"jquery.jstore-all",
|
||||
"jquery.form",
|
||||
"class",
|
||||
"json2",
|
||||
"jquery.jstore",
|
||||
"galaxy.base",
|
||||
"galaxy.workflow_editor.canvas",
|
||||
"jquery.autocomplete",
|
||||
@@ -62,8 +63,7 @@
|
||||
}
|
||||
|
||||
// Load jStore for local storage
|
||||
$.extend(jQuery.jStore.defaults, { project: 'galaxy', flash: '${h.url_for("/static/jStore.Flash.html")}' })
|
||||
$.jStore.load(); // Auto-select best storage
|
||||
$.jStore.init("galaxy"); // Auto-select best storage
|
||||
|
||||
// Canvas overview management
|
||||
canvas_manager = new CanvasManager( $("#canvas-viewport"), $("#overview") );
|
||||
@@ -151,24 +151,22 @@
|
||||
$('#right-content').hide();
|
||||
};
|
||||
|
||||
$.jStore.ready(function(engine) {
|
||||
engine.ready(function() {
|
||||
// On load, set the size to the pref stored in local storage if it exists
|
||||
overview_size = $.jStore.store("overview-size");
|
||||
if (overview_size) {
|
||||
$("#overview-border").css( {
|
||||
width: overview_size,
|
||||
height: overview_size
|
||||
});
|
||||
}
|
||||
|
||||
// Show viewport on load unless pref says it's off
|
||||
if ($.jStore.store("overview-off")) {
|
||||
hide_overview();
|
||||
} else {
|
||||
show_overview();
|
||||
}
|
||||
});
|
||||
$.jStore.engineReady(function() {
|
||||
// On load, set the size to the pref stored in local storage if it exists
|
||||
overview_size = $.jStore.store("overview-size");
|
||||
if (overview_size !== undefined) {
|
||||
$("#overview-border").css( {
|
||||
width: overview_size,
|
||||
height: overview_size
|
||||
});
|
||||
}
|
||||
|
||||
// Show viewport on load unless pref says it's off
|
||||
if ($.jStore.store("overview-off")) {
|
||||
hide_overview();
|
||||
} else {
|
||||
show_overview();
|
||||
}
|
||||
});
|
||||
|
||||
// Stores the size of the overview into local storage when it's resized
|
||||
|
||||
Reference in New Issue
Block a user