From 9be236fc9a38fe95a99f9ff3721bf792b8a613cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 4 Aug 2025 14:33:26 +0200 Subject: [PATCH 01/29] fix: jquery-migrate 1.4.1 deprecations --- bower.json | 2 +- gruntfile.js | 1 + package-lock.json | 7 ++++++ package.json | 1 + src/init.js | 5 +++- .../types/chart/basic/scatter3D/view.js | 24 ------------------- src/modules/types/display/iframe/view.js | 18 +++++++------- 7 files changed, 22 insertions(+), 36 deletions(-) diff --git a/bower.json b/bower.json index 65fc16763..9071b387a 100644 --- a/bower.json +++ b/bower.json @@ -56,7 +56,7 @@ "nmr-simulation": "0.2.1", "notifyjs": "0.4.2", "numeral": "2.0.6", - "onde": "cheminfo/onde#126c1571a3b212abbefb5351ad9b192cef35e7a1", + "onde": "cheminfo/onde#9ed3407d02ca323b8dce8d2456eb54b49a804344", "papa-parse": "4.1.2", "pouchdb": "3.3.1", "requirejs": "2.3.6", diff --git a/gruntfile.js b/gruntfile.js index 5274dac12..2b7caf84e 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -291,6 +291,7 @@ module.exports = function (grunt) { src: [ './katex/dist/**', './angularplasmid/dist/**', + './jquery-migrate/dist/*', './mathjs/dist/math.min.js', './mathjs/dist/math.min.map', './openchemlib/dist/**', diff --git a/package-lock.json b/package-lock.json index c81339cbd..02f9b49e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "d3-hierarchy": "^1.1.9", "delay": "^4.4.1", "eslint-plugin-import": "^2.32.0", + "jquery-migrate": "^1.4.1", "katex": "^0.10.0", "mathjs": "^5.10.3", "mf-parser": "^1.5.0", @@ -6195,6 +6196,12 @@ "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", "license": "MIT" }, + "node_modules/jquery-migrate": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz", + "integrity": "sha512-RwIqqAaEC1gQ9KFtdw69wse2bUGQnGNwbkZBkCwSCYkAICMlpVxAbHmfvWaS7SfLGJrYd13FZTuuQgZ6gBotJQ==", + "license": "MIT" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/package.json b/package.json index bdf9ebf69..c8a8d0868 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,7 @@ "d3-hierarchy": "^1.1.9", "delay": "^4.4.1", "eslint-plugin-import": "^2.32.0", + "jquery-migrate": "^1.4.1", "katex": "^0.10.0", "mathjs": "^5.10.3", "mf-parser": "^1.5.0", diff --git a/src/init.js b/src/init.js index 07902ebc9..8da2855e9 100644 --- a/src/init.js +++ b/src/init.js @@ -27,6 +27,7 @@ require.config({ jsbarcode: 'components/jsbarcode/dist/JsBarcode.all.min', jquery: 'components/jquery/dist/jquery', 'jquery-cookie': 'components/jquery-cookie/jquery.cookie', + 'jquery-migrate': 'node_modules/jquery-migrate/dist/jquery-migrate', 'jquery-tmpl': 'components/jquery-tmpl/jquery.tmpl.min', 'jquery-ui': 'components/jquery-ui', jsgraph: 'components/jsgraph/dist/jsgraph-es6', @@ -130,6 +131,7 @@ require.config({ select2: ['jquery'], jsbarcode: ['jquery'], 'lib/threejs/TrackballControls': ['threejs'], + 'jquery-migrate': ['jquery'], jqgrid: ['jquery', 'components/jqgrid_edit/js/i18n/grid.locale-en'], 'lib/couchdb/jquery.couch': ['jquery'], slickgrid_core: ['jquery', 'jquery-ui/ui/widgets/sortable', 'jquery-tmpl'], @@ -219,8 +221,9 @@ require([ 'uri/URI.fragmentQuery', 'components/setImmediate/setImmediate', 'lib/regenerator/regenerator-runtime', + // Uncomment to enable jquery-migrate deprecations warnings. + // 'jquery-migrate', ], function (Version, $, Datas, EntryPoint, URI) { - $.browser = { msie: false }; // Property used by old libraries and not present in jQuery anymore $(document).ready(() => { const url = new URI(window.location.href); const type = diff --git a/src/modules/types/chart/basic/scatter3D/view.js b/src/modules/types/chart/basic/scatter3D/view.js index fb781e8a3..f764f23a0 100755 --- a/src/modules/types/chart/basic/scatter3D/view.js +++ b/src/modules/types/chart/basic/scatter3D/view.js @@ -113,26 +113,6 @@ define([ preloadImages(shapeImages); - $.fn.listHandlers = function (events, outputFunction) { - return this.each(function () { - var that = this, - dEvents = $(this).data('events'); - if (!dEvents) return; - $.each(dEvents, function (name, handler) { - if ( - new RegExp( - `^(${events === '*' ? '.+' : events.replace(',', '|').replace(/^on/i, '')})$`, - 'i', - ).test(name) - ) { - $.each(handler, function (i, handler) { - outputFunction(that, `\n${i}: [${name}] : ${handler}`); - }); - } - }); - }); - }; - function View() { this._firstLoad = true; } @@ -482,10 +462,6 @@ define([ _.throttle(hideProjection, 500), ); } - - $(that.renderer.domElement).listHandlers('mousemove', function () { - // List jquery handlers (to debug...) - }); } function onWindowResize() { diff --git a/src/modules/types/display/iframe/view.js b/src/modules/types/display/iframe/view.js index c219c89fb..9900b9506 100644 --- a/src/modules/types/display/iframe/view.js +++ b/src/modules/types/display/iframe/view.js @@ -7,12 +7,11 @@ define(['modules/default/defaultview'], function (Default) { init() { this.dom = $('\n" - ] - } - ] - } - }, - "layers": { - "Default layer": { - "position": { - "left": 51, - "top": 28 - }, - "size": { - "width": 96, - "height": 66 - }, - "zIndex": 0, - "display": true, - "title": "", - "bgColor": [255, 255, 255, 0], - "wrapper": true, - "created": true, - "name": "Default layer" - }, - "BrowseErrors": { - "position": { - "left": 0, - "top": 0 - }, - "size": { - "width": 20, - "height": 20 - }, - "zIndex": 0, - "display": false, - "title": "", - "bgColor": [255, 255, 255, 0], - "wrapper": true, - "created": true, - "name": "BrowseErrors" - }, - "Admin": { - "position": { - "left": 0, - "top": 0 - }, - "size": { - "width": 20, - "height": 20 - }, - "zIndex": 0, - "display": false, - "title": "", - "bgColor": [255, 255, 255, 0], - "wrapper": true, - "created": true, - "name": "Admin" - } - }, - "id": 15, - "vars_in": [ - { - "rel": "value", - "name": "url" - } - ], - "actions_in": [{}], - "title": "", - "vars_out": [ - { - "jpath": [] - } - ], - "actions_out": [ - { - "jpath": [] - } - ], - "toolbar": { - "custom": [ - [ - { - "title": "", - "icon": "", - "action": "", - "position": "begin" - } - ] - ], - "common": [ - { - "toolbar": [["Show fullscreen"]] - } - ] - } - } - ], - "variables": [ - { - "varname": "molecules", - "jpath": ["data", "molecules"] - }, - { - "varname": "queryOptions", - "jpath": ["queryOptions"] - }, - { - "varname": "query", - "jpath": ["query"] - }, - { - "varname": "errors", - "jpath": ["data", "errors"] - }, - { - "varname": "fullA", - "jpath": ["data", "nogood"] - }, - { - "varname": "dupA", - "jpath": ["data", "dup"] - }, - { - "varname": "notfoundA", - "jpath": ["data", "notfound"] - }, - { - "varname": "count", - "jpath": ["count"] - } - ], - "configuration": { - "title": "Search wikipedia by substructure and similarity" - }, - "actionscripts": [ - { - "sections": {}, - "groups": { - "action": [ - { - "name": ["openWikiID"], - "script": [ - "window.open('https://en.wikipedia.org/w/index.php?curid=' + value, '_blank')" - ] - } - ] - } - }, - { - "sections": {}, - "groups": { - "action": [ - { - "name": ["putMol"], - "script": [ - "require(['src/util/api', 'openchemlib/openchemlib-core'], function (API, OCL) {\n var hover = API.getData('hover');\n var act;\n if (hover && (act = hover.get('actID'))) {\n var mol = OCL.Molecule.fromIDCode(act.value + '', act.coordinates + '').toMolfile();\n API.createData('customQueryOpts', {searchMode: 'Similarity'});\n API.createData('queryOptions', {searchMode: 'Similarity'});\n API.createData('selectedMol', {type: 'mol2d', value: mol});\n API.createData('query', {type: 'mol2d', value: mol});\n }\n});" - ] - } - ] - } - }, - { - "sections": {}, - "groups": { - "action": [ - { - "name": ["viewDrug"], - "script": [ - "require(['src/util/api'], function (API) {\n var currentDrug = API.getData('hover');\n if (currentDrug) {\n var link = currentDrug.get('wiki').get() + '';\n window.open(link, '_blank')\n }\n});" - ] - } - ] - } - }, - { - "sections": {}, - "groups": { - "action": [ - { - "name": ["updateFragment"], - "script": [ - "require(['uri/URI'], function (URI) {\n var url = new URI(window.location.href);\n url.fragment(encodeURIComponent(value));\n window.history.pushState(null, '', url.href());\n});" - ] - } - ] - } - } - ], - "init_script": [ - { - "sections": {}, - "groups": { - "general": [ - { - "script": [ - "const response = await fetch('https://wikipedia.cheminfo.org/src/json/data.json');\nconst result = await response.json();\n\nAPI.createData('molecules',result.data.molecules);\nAPI.createData('errors',result.data.errors);\nAPI.createData('fullA',result.data.nogood);\nAPI.createData('notfoundA',result.data.notfound);\nAPI.createData('dupA',result.data.dup);\n\nrequire([\n 'src/util/api',\n 'src/util/debug',\n 'openchemlib//openchemlib-core',\n 'components/async/dist/async.min',\n 'uri/URI'\n], function (API, Debug, OCL, async, URI) {\n if (API.cache('db')) {\n return;\n }\n\n var url = new URI(window.location.href);\n\n function getName(value) {\n value = value.replace(/_/g, ' ');\n value = decodeURIComponent(value);\n return value;\n }\n\n function toObj(val) {\n return {id: val};\n }\n\n var errors = API.getData('errors');\n\n var fullA = API.getData('fullA');\n var full = fullA.map(toObj);\n\n var el = errors.length;\n var hid = 0;\n\n for (var k = 0; k < el; k++) {\n var id = errors[k].id;\n var idx = fullA.indexOf(id);\n if (idx > -1) {\n var error = full[idx];\n if (!error._highlight) {\n error._highlight = [++hid];\n } else {\n error._highlight.push(++hid);\n }\n errors[k]._highlight = [hid];\n } else {\n errors[k]._highlight = [];\n }\n }\n\n API.createData('full', full);\n API.createData('dup', API.getData('dupA').map(toObj));\n API.createData('notfound', API.getData('notfoundA').map(toObj));\n\n var molecules = API.getData('molecules');\n if (molecules && molecules.length) {\n // ?mini=true => only 500 molecules for testing\n var l = molecules.length;\n if(document.location.search.indexOf('mini') > -1) {\n l = Math.min(l, 500);\n }\n var db = new Array(l);\n API.cache('db', db);\n var timer = Debug.timer();\n var i = 0, ii, molecule;\n\n async.whilst(function () {\n ii = Math.min(i + 1000, l);\n\n for (; i < ii; i++) {\n API.loading('mol', 'Loading molecules (' + (i + 1) + '/' + l + ')');\n molecule = molecules[i];\n // we will add the links in the molecules\n molecule.link = 'https://en.wikipedia.org/api/rest_v1/page/html/' + molecule.code;\n molecule.wiki = 'https://en.wikipedia.org/wiki/' + molecule.code;\n molecule.name = getName(molecule.code);\n molecule.lowName = molecule.name.toLowerCase();\n var newEntry = {};\n newEntry.molecule = OCL.Molecule.fromIDCode(molecule.actID.value, false);\n newEntry.molecule.ensureHelperArrays(3);\n newEntry.index = i;\n db[i] = newEntry;\n }\n\n return ii !== l\n }, function (callback) {\n setImmediate(callback);\n }, function () {\n Debug.debug(timer.time('ms'));\n var fragment = decodeURIComponent(url.fragment());\n var query = {\n type: 'mol2d',\n value: ''\n };\n if (fragment) {\n try {\n var mol = OCL.Molecule.fromSmiles(fragment);\n var molfile = mol.toMolfile();\n query.value = molfile;\n API.createData('selectedMol', {type: 'mol2d', value: molfile});\n API.createData('customQueryOpts', {searchMode: 'Similarity'});\n API.createData('queryOptions', {searchMode: 'Similarity'});\n } catch (e) {\n API.createData('customQueryOpts', {searchMode: 'Substructure'});\n API.createData('queryOptions',{searchMode: 'Substructure'}); \n }\n } else {\n API.createData('customQueryOpts', {searchMode: 'Substructure'});\n API.createData('queryOptions',{searchMode: 'Substructure'});\n }\n console.log(db);\n console.log(query);\n API.createData('query', query, 'searchFilter');\n API.stopLoading('mol');\n });\n\n }\n});\n\nAPI.require('vh/util/docs').then( Docs => {\n Docs.addPageHelp({iconSize:'fa-4x'});\n});\n" - ] - } - ] - } - } - ], - "custom_filters": [ - { - "sections": { - "modules": [ - { - "sections": {}, - "groups": { - "modules": [[{}]] - } - } - ], - "filtersLib": [ - { - "sections": {}, - "groups": { - "filters": [[{}]] - } - } - ], - "filters": [ - { - "sections": {}, - "groups": { - "filter": [ - { - "name": ["searchFilter"], - "script": [ - "return {\n filter: function (value, resolve, reject) {\n resolve(value);\n\n var molfile, options;\n if (value.__name === 'query') {\n molfile = value;\n options = API.getData('queryOptions');\n } else if (value.__name === 'queryOptions') {\n options = value;\n molfile = API.getData('query');\n }\n\n if (!options) {\n return;\n }\n\n var molecules = API.getData('molecules');\n\n var result = [],\n i, ii;\n \n var queryMol;\n if (molfile) {\n try {\n queryMol = OCL.Molecule.fromMolfile(molfile.get() + '');\n } catch (e) {}\n }\n\n if (!options || !queryMol || queryMol.getAllAtoms() === 0) {\n for (i = 0, ii = molecules.length; i < ii; i++) {\n result.push(molecules[i]);\n }\n return sendResult(result);\n }\n\n var mode = String(options.get('searchMode'));\n var targetMW;\n\n switch (mode) {\n case 'Exact structure':\n {\n var idcode = queryMol.getIDCode();\n for (i = 0, ii = molecules.length; i < ii; i++) {\n if (String(molecules[i].actID.value) === idcode) {\n result = [molecules[i]];\n break;\n }\n }\n break;\n }\n case 'Substructure':\n {\n targetMW = queryMol.getMolecularFormula().relativeWeight;\n queryMol.setFragment(true);\n console.time('search');\n var queryIndex = queryMol.getIndex();\n var searcher = new OCL.SSSearcherWithIndex();\n searcher.setFragment(queryMol, queryIndex);\n var db = API.cache('db');\n for (i = 0, ii = db.length; i < ii; i++) {\n var actmol = db[i].molecule,\n mol = molecules[db[i].index];\n searcher.setMolecule(actmol, mol.act_idx);\n if (searcher.isFragmentInMolecule()) {\n result.push(mol);\n }\n }\n console.timeEnd('search');\n result.sort(function (a, b) {\n return Math.abs(targetMW - a.mw) - Math.abs(targetMW - b.mw);\n });\n\n break;\n }\n case 'Similarity':\n {\n console.time('search');\n var index = queryMol.getIndex();\n targetMW = queryMol.getMolecularFormula().relativeWeight;\n var targetID = queryMol.getIDCode();\n var intermediate = [];\n var similarity;\n for (i = 0, ii = molecules.length; i < ii; i++) {\n if (String(molecules[i].actID.value) === targetID) {\n similarity = 1e10;\n } else {\n similarity = OCL.SSSearcherWithIndex.getSimilarityTanimoto(index, molecules[i].act_idx) * 100000 - Math.abs(targetMW - molecules[i].mw) / 1000;\n }\n intermediate.push([molecules[i], similarity]);\n }\n intermediate.sort(function (a, b) {\n return b[1] - a[1];\n });\n\n for (i = 0, ii = intermediate.length; i < ii; i++) {\n result.push(intermediate[i][0]);\n }\n console.timeEnd('search');\n break;\n }\n }\n\n sendResult(result);\n\n API.setVar('hover', ['searchResult', 0]);\n\n function sendResult(result) {\n var name = String(options.get('name')).toLowerCase();\n if (name != 'undefined') { // filter by name\n var oldResult = result;\n result = [];\n for (i = 0, ii = oldResult.length; i < ii; i++) {\n if (oldResult[i].lowName.indexOf(name) > -1) {\n result.push(oldResult[i]);\n }\n }\n }\n\n // if there is some result we change the link, otherwise we blank it\n if (result.length > 0) {\n API.createData('link', result[0].link + '');\n } else {\n API.createData('link', null);\n }\n\n API.createData('searchResult', result);\n }\n\n }\n};" - ] - } - ], - "libs": [ - [ - { - "lib": "openchemlib/openchemlib-core", - "alias": "OCL" - } - ] - ] - } - } - ] - }, - "groups": {} - } - ], - "actionfiles": [ - { - "sections": {}, - "groups": { - "action": [[{}]] - } - } - ], - "aliases": [ - { - "path": "../../github/cheminfo-js/visualizer-helper/54e4add31a2c55456d4595f34a4691b745f6206f/", - "alias": "vh" - } - ] -} diff --git a/testcase/index.html b/testcase/index.html index 494884a5f..3ffd6afc5 100644 --- a/testcase/index.html +++ b/testcase/index.html @@ -1,10 +1,10 @@ - + Visualizer Demo - + - * - * @requires jQuery UI 1.8.2 - * @dependency - * - * @requires jQuery UI CSS 1.8.2 - * @dependency - * - * @requires jquery.watcher.js - * @dependency - * - * @requires Selector CSS - * @dependency - * - * @param {Object} options An object with the options for the Chromosome component. - * - * @option {string} target - * Identifier of the DIV tag where the component should be displayed. - * - * @option {boolean} resize_left - * to indicate if the selector can be resizable from the left side. default value: true - * - * @option {boolean} resize_right - * to indicate if the selector can be resizable from the right side. default value: true - * - * @option {boolean} resize_top - * to indicate if the selector can be resizable from the top side. default value: true - * - * @option {boolean} resize_bottom - * to indicate if the selector can be resizable from the bottom side. default value: true - * - * @option {array} area - * an array with 4 elements(integers) to indicate the start position of the area selector. - * The first two elements indicate the X and Y position of the top-left corner, - * the last 2 elements indicate the bottom-right position. - * The position are relative to the target element. - * - * @example - * var instance = new Biojs.AreaSelector({ - * target: "YourOwnDivId", - * area: [10,10,40,40] - * }); - - * - */ - -Biojs.AreaSelector = Biojs.extend ( -/** @lends Biojs.AreaSelector# */ -{ - constructor: function (options) { - var self=this; - $("#"+self.opt.target).css("position","relative"); - var innerCode="
"; - if (self.opt.resize_left) innerCode += "
"; - if (self.opt.resize_right) innerCode += "
"; - if (self.opt.resize_top) innerCode += "
"; - if (self.opt.resize_bottom) innerCode += "
"; - innerCode += "
"; - $("#"+self.opt.target).append(innerCode); - - - $("#"+self.opt.target+" .selector .right").draggable({ - axis: "x", - start :function(event) { - self.updateScalers(); - $(this).parent().css('border-right-width',"0px"); - }, - stop :function(event) { - $("#"+self.opt.target+" .selector").width(self._removePx($(this).css('left'))+5); - $(this).parent().css('border-right-width',"1px"); - self.updateScalers(); - self.raiseEvent('onRegionChanged', { - region : self.getCoveredArea() - }); - } - }); - $("#"+self.opt.target+" .selector .left").draggable({ - axis: "x", - start :function(event) { - self.updateScalers(); - $(this).parent().css('border-left-width',"0px"); - }, - stop :function(event) { - var delta=$(this).position().left+5; - $("#"+self.opt.target+" .selector").width($("#"+self.opt.target+" .selector").width()-delta); - $("#"+self.opt.target+" .selector").css('left',($(this).parent().position().left+delta)+"px"); - $(this).parent().css('border-left-width',"1px"); - self.updateScalers(); - self.raiseEvent('onRegionChanged', { - region : self.getCoveredArea() - }); - } - }); - $("#"+self.opt.target+" .selector .bottom").draggable({ - axis: "y", - start :function(event) { - self.updateScalers(); - $(this).parent().css('border-bottom-width',"0px"); - }, - stop :function(event) { - $("#"+self.opt.target+" .selector").height(self._removePx($(this).css('top'))+5); - $(this).parent().css('border-bottom-width',"1px"); - self.updateScalers(); - self.raiseEvent('onRegionChanged', { - region : self.getCoveredArea() - }); - } - }); - $("#"+self.opt.target+" .selector .top").draggable({ - axis: "y", - start :function(event) { - self.updateScalers(); - $(this).parent().css('border-top-width',"0px"); - }, - stop :function(event) { - var delta=$(this).position().top+5; - $("#"+self.opt.target+" .selector").height($("#"+self.opt.target+" .selector").height()-delta); - $("#"+self.opt.target+" .selector").css('top',($(this).parent().position().top+delta)+"px"); - $(this).parent().css('border-top-width',"1px"); - self.updateScalers(); - self.raiseEvent('onRegionChanged', { - region : self.getCoveredArea() - }); - } - }); - - - $("#"+self.opt.target).watch("left,top,width,height,display", function() { - self.updateScalers(); - }, 100, "_containerMove"); - - self.updateScalers(); - self.setCoveredArea(self.opt.area); - }, - - /** - * Default values for the options - * @name Biojs.AreaSelector-opt - */ - opt: { - target: "YourOwnDivId", - resize_left: true, - resize_right: true, - resize_top: true, - resize_bottom: true, - area: [0,0,50,50] - }, - - /** - * Array containing the supported event names - * @name Biojs.AreaSelector-eventTypes - */ - eventTypes: [ - /** - * @name Biojs.AreaSelector#onRegionChanged - * @event - * @param {function} actionPerformed A function which receives an {@link Biojs.Event} object as argument. - * It gets activated when the covered area has changed - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} type The name of the event. - * @eventData {array} region A 4-element array indicating the current position of the selector. - * The first two elements indicate the X and Y position of the top-left corner, - * the last 2 elements indicate the bottom-right position. - * The position are relative to the target element. - * - * @example - * instance.onRegionChanged(function( objEvent ) { - * alert("The current area is from the point [" + objEvent.region[0] + "," + objEvent.region[1] + "] to the point [" + objEvent.region[2] + "," + objEvent.region[3] + "] "); - * }); - */ - "onRegionChanged" - ], - - /** - * get the current value of the area - * - * @example - * var area = instance.getCoveredArea(); - * alert("The current area is from the point [" + area.region[0] + "," + area.region[1] + "] to the point [" + area.region[2] + "," + area.region[3] + "] "); - * - */ - getCoveredArea: function(){ - var self=this; - return [ - $("#"+self.opt.target+" .selector").position().left, - $("#"+self.opt.target+" .selector").position().top, - $("#"+self.opt.target+" .selector").position().left + $("#"+self.opt.target+" .selector").width(), - $("#"+self.opt.target+" .selector").position().top + $("#"+self.opt.target+" .selector").height() - ]; - }, - /** - * set the value of the area - * - * @param {string} area A 4-element array indicating the position to locate the selector. - * The first two elements indicate the X and Y position of the top-left corner, - * the last 2 elements indicate the bottom-right position. - * The position are relative to the target element. - * - * @example - * instance.setCoveredArea([ 20,20,50,50]); - * - */ - setCoveredArea: function(area){ - var self=this; - $("#"+self.opt.target+" .selector").css('left',area[0]+"px"); - $("#"+self.opt.target+" .selector").css('top',area[1]+"px"); - $("#"+self.opt.target+" .selector").width(area[2]-area[0]); - $("#"+self.opt.target+" .selector").height(area[3]-area[1]); - self.updateScalers(); - self.raiseEvent('onRegionChanged', { - region : self.getCoveredArea() - }); - }, - - /** - * @private - * Private: update the positions and the limits of the scalers - */ - updateScalers: function(){ - var self=this; - $("#"+self.opt.target+" .selector .left").css("left","-5px"); - $("#"+self.opt.target+" .selector .left").css("top",($("#"+self.opt.target+" .selector").height()/2)-5); - $("#"+self.opt.target+" .selector .right").css("left",$("#"+self.opt.target+" .selector").width()-5); - $("#"+self.opt.target+" .selector .right").css("top",($("#"+self.opt.target+" .selector").height()/2)-5); - $("#"+self.opt.target+" .selector .top").css("left",($("#"+self.opt.target+" .selector").width()/2)-5); - $("#"+self.opt.target+" .selector .top").css("top","-5px"); - $("#"+self.opt.target+" .selector .bottom").css("left",($("#"+self.opt.target+" .selector").width()/2)-5); - $("#"+self.opt.target+" .selector .bottom").css("top",$("#"+self.opt.target+" .selector").height()-5); - $("#"+self.opt.target+" .selector .right").draggable("option","containment",[ - $("#"+self.opt.target+" .selector").offset().left-3, - $("#"+self.opt.target).offset().top, - $("#"+self.opt.target).offset().left+$("#"+self.opt.target).width()-4, - $("#"+self.opt.target).offset().top+$("#"+self.opt.target).height() - ]); - $("#"+self.opt.target+" .selector .left").draggable("option","containment",[ - $("#"+self.opt.target).offset().left-4, - $("#"+self.opt.target).offset().top, - $("#"+self.opt.target+" .selector").offset().left+$("#"+self.opt.target+" .selector").width()-5, - $("#"+self.opt.target).offset().top+$("#"+self.opt.target).height() - ]); - $("#"+self.opt.target+" .selector .bottom").draggable("option","containment",[ - $("#"+self.opt.target).offset().left, - $("#"+self.opt.target+" .selector").offset().top-3, - $("#"+self.opt.target).offset().left+$("#"+self.opt.target).width(), - $("#"+self.opt.target).offset().top+$("#"+self.opt.target).height()-4 - ]); - $("#"+self.opt.target+" .selector .top").draggable("option","containment",[ - $("#"+self.opt.target).offset().left, - $("#"+self.opt.target).offset().top-4, - $("#"+self.opt.target).offset().left+$("#"+self.opt.target).width()-4, - $("#"+self.opt.target+" .selector").offset().top+$("#"+self.opt.target+" .selector").height()-5 - ]); - }, - /** - * @private - * Private: remove the last two characters of a string and return its integer value - */ - _removePx: function(str){ - return 1*str.substr(0,str.length-2); - } -}); diff --git a/src/lib/biojs-1.0/src/main/javascript/Biojs.AutocompleteOLS.js b/src/lib/biojs-1.0/src/main/javascript/Biojs.AutocompleteOLS.js deleted file mode 100755 index 84c82769f..000000000 --- a/src/lib/biojs-1.0/src/main/javascript/Biojs.AutocompleteOLS.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * This is a component that provides autocomplete functionality for querying the Ontology Lookup Service (OLS) for any ontology or set of ontologies in this service. - * It is based on the jquery Autocomplete widget developed for ArrayExpress and was developed with support from the BioMedBridges project. - * - * - * @class - * @extends Biojs - * - * @author Dani Welter, Simon Jupp, Nikolay Kolesnikov - * @version 0.5.0_beta - * @category 1 - * - * @requires jQuery Core 1.8.2 - * @dependency - * - * @requires jQuery Caret-Range 1.0 - * @dependency - * - * @requires jQuery Autocomplete for OLS - * @dependency - * - * @requires AE Common CSS - * @dependency - * - * - * - * @param {Object} options An object with the options for the Autocomplete component. - * - * @option {string} target - * Identifier of the DIV tag where the component should be displayed. - * - * @option {string} [ontology="EFO"] - * The ontology to be queried via the component. - * - * @example - * var instance = new Biojs.AutocompleteOLS({ - * target: "YourOwnDivId", - * ontology: "EFO" - * }); - * - */ -Biojs.AutocompleteOLS = Biojs.extend ( - /** @lends Biojs.AutocompleteOLS# */ - { - constructor: function (options) { - var self = this; - - this._container = jQuery("#" + self.opt.target); - this._container.append(jQuery("")); - - if ($ == undefined) { - throw "jQuery not loaded"; - } - $(function() { - - var autoCompleteFixSet = function() { - $(this).attr('autocomplete', 'off'); - }; - var autoCompleteFixUnset = function() { - $(this).removeAttr('autocomplete'); - }; - - $("#local-searchbox").autocomplete( - "http://www.ebi.ac.uk/ontology-lookup/term.view" - , { matchContains: false - , selectFirst: false - , scroll: true - , max: 50 - , requestTreeUrl: "http://www.ebi.ac.uk/ontology-lookup/json/termchildren" - , ontologyId: self.opt.ontology -// change this to "all" to search all ontologies - dont do this for now! - } - ).focus(autoCompleteFixSet).blur(autoCompleteFixUnset).removeAttr('autocomplete'); - - - }); - - }, - - - /** - * Default values for the options - * @name Biojs.AutocompleteOLS-opt - */ - opt: { - target: "", - ontology: "EFO" - }, - - /** - * Array containing the supported event names - * @name Biojs.AutocompleteOLS-opt - */ - eventTypes: [] - - } - -); \ No newline at end of file diff --git a/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEBICompound.js b/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEBICompound.js deleted file mode 100755 index 1e5cfe49e..000000000 --- a/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEBICompound.js +++ /dev/null @@ -1,374 +0,0 @@ -/** - * - * - * @class - * @extends Biojs - * - * @author John Gomez-Carvajal - * @version 1.0.0 - * @category 2 - * - * @requires Server side proxy - * - * @requires ChEBICompound.css - * @dependency - * - * @requires jQuery Core 1.6.4 - * @dependency - * - * @param {Object} options An object with the options for the component. - * - * @option {string} [imageUrl="http://www.ebi.ac.uk/chebi/displayImage.do"] - * Url of the web service in order to require the compound image. - * To get a compound image, 'imageUrl + id' will be used as URI. - * - * @option {string} id - * ChEBI identifier of the compound to be displayed (i.e. '4991'). - * - * @option {int} [height=undefined] - * The height in pixels of how big this component should be displayed. If it's not specified, the CSS value will be used instead. - * - * @option {int} [width=undefined] - * The width in pixels of how big this image should be displayed. If it's not specified, the CSS value will be used instead. - * - * @example - * var instance = new Biojs.ChEBICompound({ - * target: 'YourOwnDivId', - * id: 'CHEBI:2922', - * width: 700, - * height: 400 - * }); - * - */ -Biojs.ChEBICompound = Biojs.extend( -/** @lends Biojs.ChEBICompound# */ -{ - constructor: function(options){ - - var self = this; - var width = this.opt.width; - var height = this.opt.height; - var imageWidth, imageHeight; - - if ( "string" == (typeof this.opt.target) ) { - this._container = jQuery( "#" + this.opt.target ); - - } else { - - this.opt.target = "biojs_ChEBICompound_" + this.getId(); - this._container = jQuery('
'); - } - - this._container.html('').addClass("ChEBICompound"); - - if ( width == undefined ) { - width = this._container.css('width'); - - } else { - this._container.width( width ); - } - - if ( height == undefined ) { - height = this._container.css('height'); - - } else { - this._container.height( height ); - } - - this._container.html(''); - this._imageContainer = jQuery('
').appendTo(this._container); - this._tabContainer = jQuery('
').appendTo(this._container); - - // Build the summary left panel - this._summaryContainer = this._buildTabPanel( - this._tabContainer, - function ( tabVisible, visibleWidth ) { - // Do nothing on tab visibility change - } - ); - - // Size of the image for the URL request - imageWidth = this._imageContainer.width(); - imageHeight = this._imageContainer.height(); - this.opt.imageDimension = (imageWidth < imageHeight)? imageWidth: imageHeight; - - if (this.opt.id !== undefined) { - this.setId(this.opt.id); - } - }, - - opt: { - target: 'YourOwnDivId', - id: undefined, - imageUrl: 'http://www.ebi.ac.uk/chebi/displayImage.do', - chebiDetailsUrl: 'http://www.ebi.ac.uk/webservices/chebi/2.0/test/getCompleteEntity?chebiId=', - proxyUrl: '../biojs/dependencies/proxy/proxy.php', - - height: undefined, - width: undefined, - scale: false, - imageIndex: 0 - }, - - eventTypes : [ - /** - * @name Biojs.ChEBICompound#onRequestError - * @event - * @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument. - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} file The name of the loaded file. - * @eventData {string} result A string with either value 'success' or 'failure'. - * @eventData {string} message Error message in case of result be 'failure'. - * - * @example - * instance.onRequestError( - * function( e ) { - * alert( e.message ); - * } - * ); - * - * */ - "onRequestError", - /** - * @name Biojs.ChEBICompound#onImageLoaded - * @event - * @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument. - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} id The identifier of the loaded file. - * - * @example - * instance.onImageLoaded( - * function( e ) { - * alert( e.id + " loaded." ); - * } - * ); - * - * */ - "onImageLoaded" - ], - - /** - * Set the identifier of the chemical component. - * Shows both information and image for the new identifier. - * - * @param {string} chebiId Chemical EBI's identifier for the compound to be displayed. - * - * @example - * instance.setId('CHEBI:4991'); - * - * @example - * // No image available - * instance.setId('CHEBI:60004'); - * - */ - setId: function( chebiId ) { - - var self = this; - var url; - var image; - - this._imageContainer.html(''); - this.opt.id = chebiId.replace('CHEBI:',''); - this._requestDetails( this.opt ); - - var params = { - defaultImage: true, - imageIndex: this.opt.imageIndex, - chebiId: chebiId, - dimensions: this.opt.imageDimension, - scaleMolecule: this.opt.scale - }; - - url = this.opt.imageUrl + '?' + jQuery.param(params); - image = jQuery('') - .load(function() { - self._imageContainer.removeClass("noImage"); - self._imageContainer.append(image).css({ - 'width': self.opt.imageDimension, - 'height': self.opt.imageDimension, - 'margin': 'auto' - }); - - self.raiseEvent( Biojs.ChEBICompound.EVT_ON_IMAGE_LOADED, { - id: chebiId, - url: url - }); - }) - .error(function() { - self._imageContainer.addClass("noImage"); - self.raiseEvent( Biojs.ChEBICompound.EVT_ON_REQUEST_ERROR, { - id: chebiId, - url: url, - message: "No image available" - }); - }) - .attr('src', url); - }, - - _requestDetails: function( opt ){ - var self = this; - - var urlSummary = opt.chebiDetailsUrl + opt.id; - - Biojs.console.log( "Requesting summary from: " + urlSummary ); - - var httpRequest = { - url: urlSummary, - method: "GET", - /** - * @ignore - */ - success: function(xml){ - self._dataReceived(xml); - }, - /** - * @ignore - */ - error: function(qXHR, textStatus, errorThrown) { - Biojs.console.log("ERROR requesting summary. Response: " + textStatus); - self.raiseEvent( Biojs.ChEBICompound.EVT_ON_REQUEST_ERROR, { - message: textStatus - }); - } - }; - - // Using proxy? - // Redirect using the proxy and encode all params as url data - if ( opt.proxyUrl != undefined ) { - - // Redirect to proxy url - httpRequest.url = opt.proxyUrl; - - // Encode both url and parameters under the param url - httpRequest.data = [{ name: "url", value: urlSummary }]; - - - } - // Data type - httpRequest.dataType = "text"; - jQuery.ajax(httpRequest); - - }, - - - // parses the xml file from the request and stores the information in an easy to access way - _dataReceived: function(xml){ - var data = {}; - var i = 0; - var self = this; - - Biojs.console.log("Data received"); - - if ( xml.length > 0 ) { - xmlDoc = jQuery.parseXML( xml ); - xmlResult = jQuery(xmlDoc).find('return'); - - data.chebiAsciiName = { name: "Name", value: xmlResult.find(' > chebiAsciiName').text() }; - data.chebiId = { name: "Identifier", value: xmlResult.find('> chebiId').text() }; - data.definition = { name: "Definition", value: xmlResult.find('> definition').text() }; - data.SecondaryChEBIIds = { name: "Other Identifiers", value: xmlResult.find(' > SecondaryChEBIIds').text() }; - data.entityStar = { name: "Stars", value: xmlResult.find(' > entityStar').text() }; - - } - - this._setSummary( data ); - - return data; - }, - - - _setSummary : function ( data ) { - Biojs.console.log("_setSummary()"); - - var container = this._summaryContainer; - - // Remove all elements in container - container.children().remove(); - - if ( Biojs.Utils.isEmpty(data) ) { - container.append('Not information available'); - - } else { - // Add the summary data - for (key in data) { - if ( data[key].value.length > 0 ) { - if ( key == 'entityStar' ) { - jQuery('

' + data[key].name + '

').appendTo( container ); - jQuery('
') - .appendTo( container ) - .css({ - 'width': parseInt(data[key].value) * 16, - 'padding': 0 - }); - } else { - container.append( '

' + data[key].name + '

' + data[key].value + '

' ); - } - } - } - - this.raiseEvent( Biojs.ChEBICompound.EVT_ON_SUMMARY_LOADED,{ - id: data.Identifier - }); - } - - Biojs.console.log("_setSummary done"); - }, - - _buildTabPanel: function( container, onVisibilityChangeCb ) { - - container.html(''); - - var content = jQuery('
').appendTo(container); - var expand = jQuery('').appendTo(container); - var collapse = jQuery('
').appendTo(container); - - var buttonsWidth = parseInt( jQuery('.toggle').css('width'), 10 ); - var contentWidth = container.width() - buttonsWidth; - - container.css( 'left', 0 ) - .find('.toggle') - .click( function(){ - // Animate show/hide this tab - container.animate({ - left: ( parseInt( container.css('left'), 10 ) == 0 ? buttonsWidth - container.outerWidth() : 0 ) + "px" - }, - // to call once the animation is complete - function() { - - var visibleWidth = parseInt( container.css('left'), 10 ) == 0 ? container.width() : buttonsWidth; - - container.find('.toggle').toggle(); - - if ( "function" == typeof onVisibilityChangeCb ) { - onVisibilityChangeCb.call( this, collapse.is(':visible'), visibleWidth ); - } - } - ); - }) - .css({ - 'float':'right', - 'position':'relative' - }); - - Biojs.console.log('content width '+ contentWidth); - - content.css({ - 'width': contentWidth + "px", - 'height': container.height() + "px", - 'word-wrap': 'break-word' - }); - - return content; - }, - - getHTML: function () { - return this._container; - } - -},{ - //Events - EVT_ON_IMAGE_LOADED: "onImageLoaded", - EVT_ON_SUMMARY_LOADED: "onSummaryLoaded", - EVT_ON_REQUEST_ERROR: "onRequestError" - -}); \ No newline at end of file diff --git a/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEMBLCompound.js b/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEMBLCompound.js deleted file mode 100755 index 6b20f71b2..000000000 --- a/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEMBLCompound.js +++ /dev/null @@ -1,297 +0,0 @@ -/** - * - * - * @class - * @extends Biojs - * - * @author John Gomez - * @version 1.0.0 - * @category 2 - * - * @requires Server side proxy - * - * @param {Object} options An object with the options for the component. - * - * @option {string} [imageUrl="http://www.ebi.ac.uk/chebi/displayImage.do"] - * Url of the web service in order to require the compound image. - * To get a compound image, 'imageUrl + id' will be used as URI. - * - * @option {string} id - * ChEBI identifier of the compound to be displayed (i.e. '4991'). - * - * @option {int} [height=400] - * The height in pixels of how big this image should be displayed. - * - * @option {int} [width=400] - * The width in pixels of how big this image should be displayed. - * - * @example - * var instance = new Biojs.ChEMBLCompound({ - * target: 'YourOwnDivId', - * id: 'CHEMBL67' - * }); - * - * - */ -Biojs.ChEMBLCompound = Biojs.extend( -/** @lends Biojs.ChEMBLCompound# */ -{ - constructor: function(options){ - Biojs.console.enable(); - //constructor of Biojs.ChEMBLCompound - - jQuery("#"+this.opt.target).css("padding","0px") - .css("width",this.opt.width) - .css("height",this.opt.height) - .css("overflow","hidden"); - - if (this.opt.id !== undefined) { - this.setId(this.opt.id); - } - }, - - opt: { - target: 'YourOwnDivId', - id: undefined, - imageUrl: 'https://www.ebi.ac.uk/chembldb/index.php/compound/displayimage/', - detailsUrl: 'https://www.ebi.ac.uk/chemblws/compounds/', - proxyUrl: '../biojs/dependencies/proxy/proxy.php', - - height: 400, - width: 597, - scale: false, - imageIndex: 0 - }, - - eventTypes : [ - /** - * @name Biojs.ChEMBLCompound#onRequestError - * @event - * @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument. - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} file The name of the loaded file. - * @eventData {string} result A string with either value 'success' or 'failure'. - * @eventData {string} message Error message in case of result be 'failure'. - * - * @example - * instance.onRequestError( - * function( e ) { - * alert( e.message ); - * } - * ); - * - * */ - "onRequestError", - /** - * @name Biojs.ChEMBLCompound#onLoadedImage - * @event - * @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument. - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} id The identifier of the loaded file. - * - * @example - * instance.onLoadedImage( - * function( e ) { - * alert( e.id + " loaded." ); - * } - * ); - * - * */ - "onLoadedImage" - ], - - /** - * - * - * @example - * instance.setId('4991'); - * - */ - setId: function(chEMBLId) { - self = this; - self.opt.id = chEMBLId; - - var dimension = Math.round(self.opt.width * 0.7); - var url = self.opt.imageUrl + chEMBLId; - var image = ''; - - jQuery("div#"+this.opt.target).html( - '
'+ image +'
'+ - '
' - ); - - jQuery('#image_' + chEMBLId ).load(function() { - self.raiseEvent('onLoadedImage', {id: chEMBLId}); - }) - .css('height',self.opt.height) - .css('width',dimension); - - this._requestDetails(chEMBLId); - }, - - _requestDetails: function(chEMBLId){ - var self = this; - - Biojs.console.log('url=' + self.opt.detailsUrl + chEMBLId + '.json' ); - - jQuery.ajax({ - url: self.opt.proxyUrl, - dataType: 'json', - data: 'url=' + self.opt.detailsUrl + chEMBLId + '.json', - success: function(json){ - Biojs.console.log("SUCCESS: data received from "+this.data); - self._buildPanel(json.compounds); - }, - async: false, - error: function(qXHR, textStatus, errorThrown){ - Biojs.console.log(textStatus); - self.raiseEvent('onRequestError', {message: textStatus}); - } - }); - }, - - -// // parses the xml file from the request and stores the information in an easy to access way -// _parseResponse: function(xml){ -// var data = {}; -// var i = 0; -// var self = this; -// -// xmlDoc = jQuery.parseXML( xml ); -// xmlResult = jQuery(xmlDoc).find('return'); -// -// data.Identifier = xmlResult.find('> chEMBLId').text(); -// data.Definition = xmlResult.find('> definition').text(); -// data.Name = xmlResult.find(' > chebiAsciiName').text(); -// data.Stars = xmlResult.find(' > entityStar').text(); -// data.SecondaryIds = xmlResult.find(' > SecondaryChEBIIds').text(); -//// data.Synonyms = xmlResult.find(' > Synonyms > data').map(function(){ -//// return jQuery(this).text(); -//// }).get().join(", "); -// -// Biojs.console.log("Details decoded:"); -// Biojs.console.log(data); -// return data; -// }, - - - _buildPanel : function (details) { - - this._controlsVisible = false; - - Biojs.console.log(details); - - var self = this; - var width = Math.round(self.opt.width * 0.3); - var height = self.opt.height; - - var controlSectionDiv = jQuery("#"+self.opt.target+" > div#controlSection"+self.opt.id); - - controlSectionDiv.append('
'+ - '
'+ - '<<'+ - '>>

') - .css("border", 0) - .css("margin", 0) - .css("width", "auto") - .css("height", "auto") - .css('float', 'left') - .css('font-family','"Heveltica Neue", Arial, "sans serif"') - .css('font-size','12px'); - - // Measurements - // - var padding = 5; - var tabWidth = 20, tabHeight = height; - var controlsWidth = width - (2*padding+tabWidth), controlsHeight = height - (padding*2); - - // - // Panel - // - var controlDiv = controlSectionDiv.find("div#controls"); - - var detailsHTML = ''; - for (key in details) { - if ( details[key].length > 0 ) { - detailsHTML += '' + key + ':
' + details[key] + '

'; - } - } - - controlDiv.css("position","relative") - .css("border", 0) - .css("margin", 0) - .css('background-color', "#000") - .css('color', "#fff" ) - .css('float', 'left') - .css("width", controlsWidth ) - .css("height", controlsHeight) - .css("padding", padding) - .append( detailsHTML ); - - // - // Tab - // - var showHideTab = controlSectionDiv.find('#controlTab'); - - showHideTab.css("border", 0) - .css("margin", 0) - .css("padding", 0) - .css("float", "left") - .css("width", tabWidth) - .css("height", tabHeight) - .css('background-color', "#000"); - - /** - * @private - * @function - */ - // This function will hide/show the control panel - var toggleControls = function (){ - - showHideTab.find("span").toggle(); - - if (self._controlsVisible) { - controlDiv.hide(); - //showHideTab.css('background-color', self.opt.backgroundColor); - self._controlsVisible = false; - } else { - controlDiv.show(); - //showHideTab.css('background-color', "#000"); - self._controlsVisible = true; - } - } - - self._toggleControls = toggleControls; - - showHideTab.find('#hideButton') - .click( self._toggleControls ) - .mouseover(function(){ - jQuery(this).css("color","#27C0FF"); - }) - .mouseout(function(){ - jQuery(this).css("color","#fff"); - }) - .css("color","#fff") - .css("display","none") - .css("cursor","pointer"); - - showHideTab.find('#showButton') - .click( self._toggleControls ) - .mouseover(function(){ - jQuery(this).css("color","#27C0FF"); - }) - .mouseout(function(){ - jQuery(this).css("color","#000"); - }) - .css("color","#000") - .css("cursor","pointer"); - - this._controlsReady = true; - - Biojs.console.log("_buildPanel done"); - } - - - - -}); \ No newline at end of file diff --git a/src/lib/biojs-1.0/src/main/javascript/Biojs.Chromosome.js b/src/lib/biojs-1.0/src/main/javascript/Biojs.Chromosome.js deleted file mode 100755 index eef4eb55e..000000000 --- a/src/lib/biojs-1.0/src/main/javascript/Biojs.Chromosome.js +++ /dev/null @@ -1,413 +0,0 @@ -/** - * This component allow to visualize a chromosome and its bands. - * The bands can be recovered from a DAS source or directly from a javascript model. - * - * @class - * @extends Biojs - * - * @author Gustavo A. Salazar - * @version 1.0.1 - * @category 2 - * - * @requires jQuery Core 1.7.2 - * @dependency - * - * @requires jsdas 0.1.6 - * @dependency - * - * @requires Chromosome CSS - * @dependency - * - * - * @requires Biojs AreaSelector - * @dependency - * - * @requires jQuery UI 1.8.2 - * @dependency - * - * @requires jQuery UI CSS 1.8.2 - * @dependency - * - * @requires jquery.watcher.js - * @dependency - * - * @requires Selector CSS - * @dependency - * - * - * - * - * @param {Object} options An object with the options for the Chromosome component. - * - * @option {string} target - * Identifier of the DIV tag where the component should be displayed. - * - * @option {string} dasSource - * URL of the DAS source to obtain the band's information. - * For example Ensembl provides the human chromosome information as a DAS source in the - * URL http://www.ensembl.org/das/Homo_sapiens.NCBI36.karyotype/ - * - * @option {string} dasSegment - * DAS segment to query, in case of chromosomes is the chromosome id (eg. 8). - * Optionally DAS sources can be queried for a spwcific region of the chromosome(eg. 8:43100000,49100001) - * - * @option {Object} model - * Alternatively to DAS, This component can receive directly a javascript object containing the relevant information. - * Here is an example of the object structure using JSON notation: - * { - * "id": "8", - * "start": 1, - * "stop": 199999, - * "bands": [ - * { - * "label": "p11", - * "type": "acen", - * "start": 1, - * "stop": "100000" - * }, - * { - * "label": "q11", - * "type": "gpos75", - * "start": 100001, - * "stop": "199999" - * } - * ] - * } - * - * @option {boolean} [includeSelector] - * Include an area selector that interacts with the coordinate position of the chromosome. default true. - * - * @example - * var instance= new Biojs.Chromosome({ - * target: "YourOwnDivId", - * dasSource: "http://www.ensembl.org/das/Homo_sapiens.NCBI36.karyotype/", - * dasSegment: "8" - * }); - * - */ -Biojs.Chromosome = Biojs.extend ( -/** @lends Biojs.Chromosome# */ -{ - constructor: function (options) { - var self = this; - $("#"+self.opt.target).html('
'); - $("#"+self.opt.target+'_chr').css('position','relative'); - if (self.opt.dasSource!=null){ - var client = JSDAS.Simple.getClient(self.opt.dasSource); - client.features({segment: self.opt.dasSegment}, function(res){ - self._modelFromDAS(res,self); - }, self._error_response); - }else if (self.opt.model!=null){ - this._process_model(self.opt.model,self); - } - }, - - /** - * Default values for the options - * @name Biojs.Chromosome-opt - */ - opt: { - target: "chromosome", - model: null, - dasSource: null, - dasSegment: null, - includeSelector: true - }, - - /** - * Array containing the supported event names - * @name Biojs.Chromosome-eventTypes - */ - eventTypes: [ - /** - * @name Biojs.Chromosome#onBandSelection - * @event - * @param {function} actionPerformed A function which receives an {@link Biojs.Event} - * object as argument. - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} type The name of the event. - * @eventData {string} chromosome_id Id of the chromosome that the selected band belongs. - * @eventData {string} band_id Id of the band that has been selected. - * @eventData {integer} band_start Coordinate of the first nucleotide of the selected band - * @eventData {integer} band_stop Coordinate of the last nucleotide of the selected band - * @eventData {string} band_type type of the band selected (eg. acen, gpos50, gneg). - * @example - * instance.onBandSelection(function( objEvent ) { - * alert("The band " + objEvent.band_id + " of the chromosome " + objEvent.chromosome_id + " has been selected\n[" + objEvent.band_start + "," + objEvent.band_stop + "]"); - * }); - */ - "onBandSelection", - /** - * @name Biojs.Chromosome#onSelectorChanged - * @event - * @param {function} actionPerformed A function which receives an {@link Biojs.Event} - * object as argument. Is triggered when the the coordinates of the selector have been changed. - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} type The name of the event. - * @eventData {string} chromosome_id Id of the chromosome that the selected band belongs. - * @eventData {integer} selector_start Coordinate of the left side of the selector - * @eventData {integer} selector_stop Coordinate of the right side of the selector - * @example - * instance.onSelectorChanged(function( objEvent ) { - * alert("The selector has move to the region \n[" + objEvent.selector_start + "," + objEvent.selector_stop + "]"); - * }); - */ - "onSelectorChanged", - /** - * @name Biojs.Chromosome#onModelLoaded - * @event - * @param {function} actionPerformed A function which receives an {@link Biojs.Event} - * object as argument. Triggered when he model has been loaded - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} type The name of the event. - * @eventData {Object} model The model after been displayed - * @example - * instance.onModelLoaded(function( objEvent ) { - * alert("The model for the chromosome "+objEvent.model.id+" has been loaded"); - * }); - */ - "onModelLoaded", - /** - * @name Biojs.Chromosome#onDASLoadFail - * @event - * @param {function} actionPerformed A function which receives an {@link Biojs.Event} - * object as argument. Triggered when the model couldn't be loaded - * @eventData {Object} source The component which did triggered the event. - * @eventData {string} type The name of the event. - * @eventData {string} dasSource URL of the DAS source queried - * @eventData {string} dasSegment URL of the DAS source queried - * @example - * instance.onDASLoadFail(function( objEvent ) { - * alert("The DAS source "+objEvent.dasSource+" with information of the segment "+objEvent.dasSegment+" couldn't be loaded"); - * }); - */ - "onDASLoadFail" - ], - - /** - * @private - * Private: Callback function in case of an error in the DAS query. - */ - _error_response: function(){ - var self=this; - $("#"+self.opt.target).append("ERROR querying the DAS source."); - self.raiseEvent('onDASLoadFail', { - dasSource: self.opt.dasSource, - dasSegment: self.opt.dasSegment - }); - }, - - /** - * @private - * Private: Callback function when the DAS response is captured. - * It maps the response into the internal model for bands. - */ - _modelFromDAS: function(res,parent){ - if(typeof parent != "undefined") - var self=parent; - var annotations = res.GFF.SEGMENT[0].FEATURE, chr_start=res.GFF.SEGMENT[0].start, chr_stop=res.GFF.SEGMENT[0].stop; - var model = { - id: res.GFF.SEGMENT[0].id, - start: res.GFF.SEGMENT[0].start*1, - stop: res.GFF.SEGMENT[0].stop, - bands:null - }; - var bands=[]; - var first="first",last=""; - for (var i in annotations){ - var ann = annotations[i],type=ann.TYPE.id.substr(5); - if (type=="acen"){ - if (ann.id[0]=="p") type="p_acen"; - else if (ann.id[0]=="q") type="q_acen"; - } - bands.push({start:ann.START.textContent*1,stop:ann.END.textContent*1,label:ann.id,type:type}); - } - model.bands=bands; - self.opt.model=model; - self._process_model(model,self); - }, - - /** - * @private - * Private: Creates a div element for each band in the model; the width of the band is calculated as a percentage - * of the relationship between the number of nucleotides in the band and the number of nucleotides of the chromosome. - */ - _process_model: function(model,self){ - //Sorting the bands by the start coordinate - model.bands.sort( - /** - * @ignore - **/ - function sortfunc(a,b){ - return a.start-b.start; - }); - var first="first",last="",firstid=null,firstW=null; - for (var i in model.bands){ - var band = model.bands[i]; - if (i*1+1==model.bands.length) - last="last"; - var percentage=94*(band.stop-band.start)/model.stop;// no using the 100% of the width, so there is an extra space for the borders - var band_id=model.id+"_"+band.label; - $("#"+self.opt.target+'_chr').append("
"); - band_id=band_id.replace(/\./gi, "\\."); - $("#"+band_id).click(function (){ - //Finding the band in the model - var band={} - for (var j in model.bands){ - if ($(this).attr("title")==model.bands[j].label) - band=model.bands[j]; - } - //arising an event with the ban info - self.raiseEvent('onBandSelection', { - chromosome_id : model.id, - band_id: band.label, - band_start: band.start, - band_stop: band.stop, - band_type: band.type - }); - //If the selector is included then its position gets updated to the selected band - if (self.opt.includeSelector){ - self.opt.selector.from=band.start; - self.opt.selector.to=band.stop; - self.raiseEvent('onSelectorChanged', { - chromosome_id : model.id, - selector_start: band.stop, - selector_stop: band.type - }); - self._moveSelectorToDivCoordinates($(this).position().left,$(this).position().left+$(this).width()); - } - }); - if(first!="") { - firstid=band_id; //id of the first band - firstW=band.stop; - } - first=""; - } - //Setting up the selector in case is included - if (self.opt.includeSelector){ - //The selector just allows horizontal interaction and is preseted in the first band - self.opt.selector = new Biojs.AreaSelector({ - target: self.opt.target+'_chr', - resize_top: false, - resize_bottom: false, - area:[0,-5,$('#'+firstid).width(),20] - }); - //Creating two more attributes in the object to save chromosome coordinates where is visible, starting in the first band - self.opt.selector.from = 0; - self.opt.selector.to = firstW; - self.opt.selector.fromWatcher=false; - //When the selector change its position the chromosome coordinates have to be updated - self.opt.selector.onRegionChanged(function( objEvent ) { - if (!self.opt.selector.fromWatcher){ - self.opt.selector.from = self._getCoordinateFromLeft(objEvent.region[0]); - self.opt.selector.to = self._getCoordinateFromLeft(objEvent.region[2]); - self.raiseEvent('onSelectorChanged', { - chromosome_id : self.opt.model.id, - selector_start: self.opt.selector.from, - selector_stop: self.opt.selector.to - }); - } - }); - //if the div containing the chromosome is resized or moved the selector is modified with - $("#"+self.opt.target).watch("left,top,width,height,display", function() { - self.opt.selector.fromWatcher=true; - if (self.opt.selector.from!=null && self.opt.selector.to!=null ) - self.moveSelectorToCoordinates(self.opt.selector.from,self.opt.selector.to); - self.opt.selector.fromWatcher=false; - }, 100, "_containerMove"); - } - self.raiseEvent('onModelLoaded', { - model: model - }); - - }, - /** - * AreaSelector component that allows to interact with the chromosome. - * Optional feature, that can be disable in the options object by setting the feature includeSelector to false - * @private - * @name Biojs.Chromosome-selector - */ - selector:null, - /** - * Move the Selector to a specific place in the chromosome - * - * @param {integer} from initial chromosome coordinate to locate the selector - * @param {integer} to final chromosome coordinate to locate the selector - * - * @example - * instance.moveSelectorToCoordinates(10000000,20000000); - * - */ - moveSelectorToCoordinates: function(from, to){ - var self=this; - if(self.opt.selector!=null){ - self.opt.selector.from=from; - self.opt.selector.to=to; - self._moveSelectorToDivCoordinates(self._getLeftFromCoordinate(from),self._getLeftFromCoordinate(to)); - }else - return false; - }, - - /** - * Gives the corresponding value for left in respect of the parent component from a chromosome coordinate - * @private - * @name Biojs.Chromosome-_getLeftFromCoordinate - */ - _getLeftFromCoordinate: function(coordinate){ - var self=this; - var band=null - for (var j in self.opt.model.bands){ - var b=self.opt.model.bands[j]; - if (coordinate>=b.start && coordinate<=b.stop){ - band=b; - break; - } - } - if (band!=null){ - var band_id=self.opt.model.id+"_"+band.label; - band_id=band_id.replace(/\./gi, "\\."); - var leftDiv = $("#"+band_id).position().left, - widthDiv= $("#"+band_id).width(), - leftBand=band.start, - widthBand=band.stop-band.start; - return leftDiv+ (((coordinate-leftBand)*widthDiv)/widthBand); - }else - return false; - - }, - /** - * Gives the corresponding value for a chromosome coordinate from the left value in respect of the parent component - * @private - * @name Biojs.Chromosome-_getCoordinateFromLeft - */ - _getCoordinateFromLeft: function(left){ - var self=this; - var band=null - for (var j in self.opt.model.bands){ - var b=self.opt.model.bands[j]; - var band_id=self.opt.model.id+"_"+b.label; - band_id=band_id.replace(/\./gi, "\\."); - - if (left>=$("#"+band_id).position().left && left<=$("#"+band_id).position().left + $("#"+band_id).width()){ - var leftDiv = $("#"+band_id).position().left, - widthDiv= $("#"+band_id).width(), - leftBand=b.start, - widthBand=b.stop-b.start; - return leftBand+ (((left-leftDiv)*widthBand)/widthDiv); - } - } - return false; - - }, - - /** - * moves the selector to a position in the div using the div relative coordinates - * @private - * @name Biojs.Chromosome-_moveSelectorToDivCoordinates - */ - _moveSelectorToDivCoordinates: function(from, to){ - var self=this; - if (self.opt.includeSelector && self.opt.selector!=null) - self.opt.selector.setCoveredArea([from,-5,to,20]); - } -}); diff --git a/src/lib/biojs-1.0/src/main/javascript/Biojs.Cytoscape.js b/src/lib/biojs-1.0/src/main/javascript/Biojs.Cytoscape.js deleted file mode 100755 index dd2b2340b..000000000 --- a/src/lib/biojs-1.0/src/main/javascript/Biojs.Cytoscape.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * The Cytoscape.js component is a wrapper that allows you to use Cytoscape.js in BioJS. - * - * @class - * @extends Biojs - * - * @author Max Franz - * @version 1.0.0 - * @category 1 - * - * @requires Cytoscape.js (latest version strongly recommended) - * @dependency - * - * @param {Object} options An object with the options for Cytoscape.js. - * - * @option {string} container - * The ID of the HTML DOM element in which Cytoscape.js will be placed. - * - * - * @example - * var cy; - * var instance = new Biojs.Cytoscape({ - * container: window.document.getElementById('some-div-id'), - * ready: function(){ - * cy = this; // now you can use cytoscape.js as normal - * } - * }); - * - * - */ -Biojs.Cytoscape = Biojs.extend( -/** @lends Biojs.Cytoscape# */ -{ - constructor: function(options){ - cytoscape( options ); - }, - - /** - * Default values for the options - * @name Biojs.Cytoscape-opt - */ - opt: { - container: undefined - }, - - /** - * Array containing the supported event names - * @name Biojs.Cytoscape-eventTypes - */ - eventTypes: [ - ] - -}); diff --git a/src/lib/biojs-1.0/src/main/javascript/Biojs.DNAContentViewer.js b/src/lib/biojs-1.0/src/main/javascript/Biojs.DNAContentViewer.js deleted file mode 100755 index 7c159a5bb..000000000 --- a/src/lib/biojs-1.0/src/main/javascript/Biojs.DNAContentViewer.js +++ /dev/null @@ -1,1024 +0,0 @@ -/** - * This component uses the D3 library to visualise contents of a DNA sequence, with panning and zooming functionality. - * - * @class - * @extends Biojs - * - * @author Anil Thanki, Shabhonam Caim - * @version 1.0.0 - * @category 2 - * - * - * @requires D3 - * @dependency - * - * - * @requires jQuery UI 1.8.2+ - * @dependency - * - * @requires jQuery Core 1.6.4 - * @dependency - * - * @requires biojs.DNAContentViewer.css - * @dependency - * - * - * @requires jQuery UI CSS 1.8.2 - * @dependency - * - * - * @param {Object} options An object with the options for DNAContentViewer component. - * - * @option {string} target - * Identifier of the DIV tag where the component should be displayed. - * - * @option {string} [fontFamily='"Andale mono", courier, monospace'] - * Font list to be applied to the component content. - * - * @option {string} [fontColor="white"] - * HTML color code for the font. - * - * @option {string} [backgroundColor="#7BBFE9"] - * Background color for the entire div content. - * - * @option {Object} [selectionFontColor="white"] - * This color will be used to change the font color of selected text. - * - * @option {Object} [selectionBackgroundColor="yellow"] - * This color will be used to change the background of selected text. - * - * @option {string} dataSet - * File in text format including input sequence data in raw format. Example of text file ...
- *
ACGACTAGCATCAGCATCGACACGACTAGCACTGGACTGAATCGACATCGACATGC
- *  ...
- * - * @example - * var instance = new Biojs.DNAContentViewer({ - * target: "YourOwnDivId", - * selectionBackgroundColor: '#99FF00', - * dataSet: "../biojs/data/DNAContentViewerData.txt" - * }); - * - */ - - -Biojs.DNAContentViewer = Biojs.extend( - /** @lends Biojs.DNAContentViewer# */ - - - { - zoomSlider: '', - slider_stop: 0, - slider_start: 0, - track: [], - track_bins: [], - width: 1, - height: 1, - data_last_start: 1, - data_first_start: 1, - max: 0, - data: [], - main_data: [], - - - constructor: function (options) { - - var self = this; - self.vis = null; - self.color = null; - self.foci = []; - - - this.track; // data - this.track_bins; // data - - - this._container = $("#DNAContentFeaturePainter-holder"); - $(this._container).addClass("graph"); - - - // Apply options values - this._container.css({ - 'font-family': self.opt.fontFamily, // this is one example of the use of self instead of this - 'background-color': self.opt.backgroundColor, - 'color': self.opt.fontColor, - 'font-size': '36px', - 'text-align': 'center', - 'vertical-align': 'middle', -// 'left':'10px', - 'width': '600px', - 'height': '100px', - 'bottom': '0px' - - }); - - // Disable text selection and - // Change the selection mouse pointer - // from text to hand. - this._container.css({ - '-moz-user-select': 'none', - '-webkit-user-select': 'none', - 'user-select': 'none' - }); - - this.paintDNAContentContent(self.opt.dataSet); - - }, - - /** - * Default values for the options - * @name Biojs.DNAContentViewer-opt - */ - opt: { - target: "YourOwnDivId", - dataSet: "", - fontFamily: '"Andale mono", courier, monospace', - fontColor: "white", - backgroundColor: "#7BBFE9", - selectionFontColor: "black", - selectionBackgroundColor: "yellow", - width: "100%", - height: "130", - radius: 10 - }, - - /** - * Array containing the supported event names - * @name Biojs.DNAContentViewer-eventTypes - */ - eventTypes: [ - /** - * No events added for now but can be added in future - */ - ], - - - /** - * Repaints everything: ruler, shapes, and legend. - * @param {boolean} [withoutZoom=false] When false, it zooms according to the slider values. - * @param {int} [newStart] Zoom from this sequence start value. - * @param {int} [newStop] Zoom to this sequence end value. - * - * @example - * instance._updateDraw(); - * - */ - _updateDraw: function (withoutZoom, newStart, newStop) { - //recalculate start and stop - - if (newStart && newStop) { - - this.slider_start += newStart; - this.slider_stop += newStop; - this._calculateContent(this.slider_start, this.slider_stop); - } - else { - this._calculateContent(); - - } - - if (this.slider_start < this.data_first_start) { - if (newStart == newStop) { - this.slider_stop += this.data_first_start - this.slider_start; - } - this.slider_start = this.data_first_start; - - } - - if (this.slider_stop > this.data_last_start) { - if (newStart == newStop) { - this.slider_start += this.data_last_start - this.slider_stop; - } - this.slider_stop = this.data_last_start; - } - - this._paintDNAContentGraph(undefined, this.slider_start, this.slider_stop); - }, - - /** - * Paint the features according to the values specified in the json object defined when creating the object. - * This method initializes the holder, paints the slider and print button depending on the options, and - * paints the features and legend. - * - * @example - * instance.paintDNAContentContent("../biojs/data/DNAContentViewerData.txt"); - * - * @param {string} dataSet Location of the file with the input text file in raw sequence format. - *
ACGACTACGACTAGCATCAGCATCAGCACTAGCATCAGCACTAGCACTAGCACTAGCATCAGCACTAGCACTAGCACTGACACT...
- */ - paintDNAContentContent: function (dataSet) { - if (dataSet != undefined) { - this._setDataSource(dataSet); - this._init(); - } else { - this.$errorMsg = jQuery('
') - .html('There was an unexpected failure, the image cannot be displayed. data is undefined.') - .dialog({ - autoOpen: true, - title: 'Error', - modal: true - }); - throw "Error"; - } - - }, - - /** - * Private: Initializes the component. - */ - _init: function () { - Biojs.DNAContentViewer.myself = this; - //First create the slider, button, and holder - var painter_div = jQuery("#" + this.opt.target); - painter_div.text(''); - painter_div.append(this._withSliderOnly(100)); - - painter_div.append('
'); - - var holder = document.getElementById("DNAContentPainter-holder"); - if (!holder) { - this.$errorMsg = jQuery('
') - .html('There was an unexpected failure, the image cannot be displayed.') - .dialog({ - autoOpen: true, - title: 'Error', - modal: true - }); - throw "Error"; - } - holder.innerHTML = ""; - holder.style.height = "200px"; - holder.style.width = "700px"; - var self = this; - this.width = $("#DNAContentPainter-holder").width(), - this.height = $("#DNAContentPainter-holder").height(), - this.r = self.opt.radius; - - self.opt.width = self.opt.width.toString(); - if (self.opt.width.indexOf("%") != -1) - this.width = this.width * (self.opt.width.substring(0, self.opt.width.length - 1) * 1) / 100.0; - else - this.width = self.opt.width * 1; - self.opt.width = parseInt(this.width); - - self.opt.height = self.opt.height.toString(); - if (self.opt.height.indexOf("%") != -1) - this.height = this.height * (self.opt.height.substring(0, self.opt.height.length - 1) * 1) / 100.0; - else - this.height = self.opt.height * 1; - self.opt.height = parseInt(this.height); - - - self.color = function () { - return d3.scale.ordinal().range(self.colors); - }(); - - d3.text(self.opt.dataSet, function (data, error) { - self.track = data; - var length = data.length - 1; - self._paintLegend(); - self._updateLegend(self._Statsforchunk(self.track)); - self.slider_start = 0; - self.slider_stop = length; - self.data_last_start = length; - self.data_first_start = 0; - - self._paintSlider(); - self._paintMarkersGraph(); - self._updateDraw(); - }); - - }, - - /** - * Private: Function to create slider only. - * @param {int} sizeX Width. - * @ignore - */ - _withSliderOnly: function (sizeX) { - var text = - '' + - '' + - '' + - '' + - '' + - '' + - '
' + - '' + - '' + - '
' + - '
'; - return text; - }, - - - /** - * Private: Function to calculate AT/GC content for given positions. - * @param {string} newStart start position. - * @param {string} newStop stop position. - * @ignore - */ - _calculateContent: function (newStart, newStop) { - var sequence = this.track; - if (newStart && newStop) { - if (newStart < 0) { - newStart = 0; - } - if (newStop > this.slider_stop) { - newStop = this.slider_stop; - } - - sequence = sequence.substring(newStart, newStop) - - } else { - newStart = 0; - } - - var DNAContent_content = [] - var seq_len = sequence.length; - var i = 0; - if (seq_len > 100) { - while (i <= seq_len) { - var chunk = sequence.substr(i, Math.floor(seq_len / 100)); - DNAContent_content.push({start: parseInt(newStart) + parseInt(i), gc_value: this._GCforchunk(chunk), at_value: this._ATforchunk(chunk)}); - i += Math.floor(seq_len / 100); - } - if (i < seq_len) { - var chunk = sequence.substr(i); - DNAContent_content.push({start: parseInt(newStart) + parseInt(i), gc_value: this._GCforchunk(chunk), at_value: this._ATforchunk(chunk)}); - } - } else { - while (i <= seq_len) { - var chunk = sequence.substr(i, 10); - DNAContent_content.push({start: parseInt(newStart) + parseInt(i), gc_value: this._GCforchunk(chunk), at_value: this._ATforchunk(chunk)}); - i += 1; - } - } - - this.max = 100; - this.track_bins = DNAContent_content; - }, - - - - /** - * Private: Function to calculate AT/GC stats for chunk.. - * @param {string} chunk sequence. - * Returns: (int) gc - * @ignore - */ - _Statsforchunk: function (chunk) { - var chunk_array = chunk.split(""); - var gc = 0; - var at = 0; - var ot = 0; - var total = 0; - for (var a = 0; a < chunk_array.length; a++) { - if (chunk_array[a].toLocaleLowerCase() == "g" || chunk_array[a].toLocaleLowerCase() == "c") { - gc++; - } - else if (chunk_array[a].toLocaleLowerCase() == "a" || chunk_array[a].toLocaleLowerCase() == "t") { - at++; - } - else { - ot++; - } - total++; - } - return ({total: total, gc: gc, at: at, ot: ot}); - }, - - - /** - * Private: Function to calculate AT % for chunk. - * @param {string} chunk sequence. - * Returns: (int) gc - * @ignore - */ - _GCforchunk: function (chunk) { - var chunk_array = chunk.split(""); - var gc = 0; - var total = 0; - for (var a = 0; a < chunk_array.length; a++) { - if (chunk_array[a].toLocaleLowerCase() == "g" || chunk_array[a].toLocaleLowerCase() == "c") { - gc++; - } - total++; - } - return gc * 100 / total; - }, - - /** - * Private: Function to calculate AT % for chunk. - * @param {string} chunk sequence. - * Returns: (int) at - * @ignore - */ - _ATforchunk: function (chunk) { - var chunk_array = chunk.split(""); - var at = 0; - var total = 0; - - for (var a = 0; a < chunk_array.length; a++) { - if (chunk_array[a].toLocaleLowerCase() == "a" || chunk_array[a].toLocaleLowerCase() == "t") { - at++; - } - total++; - } - return at * 100 / total; - }, - - - /** - * Private: Paints the slider - * Purpose: set up slider buttons - * Returns: - - * @ignore - */ - _paintSlider: function () {//holder size, left and right margins of the holder, and number of amino acids - var sequenceLength = 100;//config.sequenceLength; - if (!document.getElementById("DNAContentPainter-slider")) { - return; - } - - var slider_div = jQuery("#DNAContentPainter-slider"); - slider_div.text(''); - slider_div.append(''); - slider_div.append('
'); - var self = this; - var diff = parseInt(self.track.length / 100); - this.zoomSlider = jQuery('
').appendTo(slider_div); - - - slider_div.html('Controls:
' + - '
' + - '
' + - '
') - }, - - /** - * Private: Paints the AT/GC Legengd and MArker radio buttons - * Returns: - - * @ignore - */ - _paintLegend: function () {//holder size, left and right margins of the holder, and number of amino acids - var self = this; - - if (!document.getElementById("DNAContentPainter-slider")) { - return; - } - - var slider_div_legend = jQuery("#DNAContentPainter-Legend"); - - slider_div_legend.html('
GC Content
' + - '
AT Content
') - - $("#at_checkbox").change(function () { - self._toggleAT(); - }); - - - $("#gc_checkbox").change(function () { - self._toggleGC(); - }); - - - var marker_legend = jQuery("#Marker-Legend"); - - marker_legend.html('
Marker Position:
Left Centre Right
') - - $(".marker-pos").change(function () { - self._toggleMarker(this); - }); - }, - - /** - * Private: Updates percentage values in AT/GC legends - * Returns: - - * @ignore - */ - _updateLegend: function (stats) {//holder size, left and right margins of the holder, and number of amino acids - - if (!document.getElementById("DNAContentPainter-slider")) { - return; - } - - var at_perc = parseFloat(stats.at * 100 / stats.total).toFixed(2); - var gc_perc = parseFloat(stats.gc * 100 / stats.total).toFixed(2); - - - var gc_perc_div = jQuery("#gc_perc"); - var at_perc_div = jQuery("#at_perc"); - - - gc_perc_div.html(gc_perc + '%') - at_perc_div.html(at_perc + '%') - }, - - - /** - * Private: Draws area chart from DNA string using D3.js - * @param {boolean} [withoutZoom=false] When true, this method recalculates the total for each feature type. - * @param {int} [start=0] When true, this method recalculates the total for each feature type. - * @param {int} [end=max] When true, this method recalculates the total for each feature type. - * @ignore - */ - _paintDNAContentGraph: function (withoutZoom, start, end) { - var self = this; - var left = "50px"; - var top = "0px"; - var filtered_track = this.track_bins; - - // filter data if start and end positions are defined - if (start && end) { - filtered_track = jQuery.grep(self.track_bins, function (element) { - return element.start >= start && element.start <= end; // retain appropriate elements - }); - } - - - var height = this.height; - var width = this.width; - var max = Math.ceil(this.max / 100) * 100 - var length = filtered_track.length - 1; - - var space = parseInt(width) / (filtered_track[length].start - filtered_track[0].start); - - if (length > 0) { - - this._clear(); - - var svg = d3.select("#DNAContentPainter-holder").select("svg") - .append("g") - .attr("width", this.width) - .attr("height", this.height + 30) - .attr("class", "redrawn-path") - .attr("transform", "translate(" + left + "," + top + ")"); - - this._container = jQuery("#DNAContentPainter-holder"); - - var d3line2 = d3.svg.line() - .x(function (d) { - return d.x; - }) - .y(function (d) { - return d.y; - }) - .interpolate("linear"); - - - var gc_pathinfo = []; - var at_pathinfo = []; - - var last_start = 0; - // check for average difference between each positions - var diff = parseInt(filtered_track[1].start - filtered_track[0].start); - - - // loop through each element and calculate x and y axis for chart - for (var i = 0; i < filtered_track.length - 1;) { - - - var gc_tempx, at_tempx; - - if (start) { - gc_tempx = (filtered_track[i].start - start) * space; - at_tempx = (filtered_track[i].start - start) * space; - } else { - gc_tempx = (filtered_track[i].start) * space; - at_tempx = (filtered_track[i].start) * space; - - } - var gc_tempy = height - (filtered_track[i].gc_value * height / max); - var at_tempy = height - (filtered_track[i].at_value * height / max); - gc_pathinfo.push({ x: gc_tempx, y: gc_tempy}); - at_pathinfo.push({ x: at_tempx, y: at_tempy}); - - i++; - - last_start = filtered_track[i].start; - - } - - if (start) { - gc_tempx = (filtered_track[filtered_track.length - 1].start - start) * space; - at_tempx = (filtered_track[filtered_track.length - 1].start - start) * space; - } - - var gc_tempy = height - (filtered_track[filtered_track.length - 1].gc_value * height / max); - var at_tempy = height - (filtered_track[filtered_track.length - 1].at_value * height / max); - - gc_pathinfo.push({ x: gc_tempx, y: gc_tempy}); - at_pathinfo.push({ x: at_tempx, y: at_tempy}); - - var path = svg.selectAll("path") - .data([1]); - - //select 10 positions to be displayed on x axis - var filter_track_legend = []; - for (i = 0; i < filtered_track.length;) { - filter_track_legend.push(filtered_track[i]); - i += parseInt(length / 10); - } - - //draw selected 10 positions as legend - var legendtext = svg.selectAll('text.day') - .data(filter_track_legend); - - legendtext.enter().append('svg:text') - .attr('x', function (d) { - if (start) { - return (d.start - start) * space; - - } else { - return (d.start ) * space; - } - }) - .attr('y', 160) - .attr('text-anchor', 'middle') - .style("font-size", "10px") - .text(function (d) { - if (d.start > 1000000) { - return parseInt(d.start / 1000000) + "M"; - } else if (d.start > 1000) { - return parseInt(d.start / 1000) + "K"; - } else { - return d.start; - } - }); - - //select 10 positions to be displayed on x axis - var marker_legend = []; - - for (i = 1; i <= 10; i++) { - marker_legend.push((max / 10) * i); - - } - - // lines at bottom of diagram to show the positions - var line = svg.selectAll("line.bottom") - .data(filtered_track); - line.enter().insert("svg:line") - .attr("class", "line") - .attr("x1", function (d) { - if (start) { - return (d.start - start) * space; - - } else { - return (d.start ) * space; - } - }) - .attr("y1", 130) - .attr("x2",function (d) { - if (start) { - return (d.start - start) * space; - - } else { - return (d.start ) * space; - } - }).attr("y2", function (d, i) { - return 140; - }) - .attr('stroke', function () { - return "black"; - }); - - var line = svg.selectAll("line.bottom") - .data(filter_track_legend); - line.enter().insert("svg:line") - .attr("class", "line") - .attr("x1", function (d) { - if (start) { - return (d.start - start) * space; - - } else { - return (d.start ) * space; - } - }) - .attr("y1", 130) - .attr("x2",function (d) { - if (start) { - return (d.start - start) * space; - - } else { - return (d.start ) * space; - } - }).attr("y2", function (d, i) { - return 150; - }) - .attr('stroke', function () { - return "black"; - }); - - - var line_base = svg.selectAll("line.bottom") - .data([1]); - line_base.enter().insert("svg:line") - .attr("class", "line base") - .attr("x1", function (d) { - - return 0; - }) - .attr("y1", function (d) { - return height; - }) - .attr("x2",function (d) { - return width; - }).attr("y2", function (d) { - return height; - }) - .attr('stroke', function () { - return "black"; - }); - - - //draw path from calculated chart axis - path.enter().append("svg:path") - .attr("width", 200) - .attr("height", 200) - .attr("class", "path gc-path") - - .attr('stroke', function () { - return "blue"; - }) - .attr('stroke-width', function () { - return "2px"; - }) - .attr("fill", function () { - return "transparent"; - }) - .attr("d", d3line2(gc_pathinfo)); - - - //draw path from calculated chart axis - path.enter().append("svg:path") - .attr("width", 200) - .attr("height", 200) - .attr("class", "path at-path") - - .attr('stroke', function () { - return "red"; - }) - .attr('stroke-width', function () { - return "2px"; - }) - .attr("fill", function () { - return "transparent"; - }) - .attr("d", d3line2(at_pathinfo)); - } - }, - - /** - * Private: Draws percentage markers using D3.js - * @ignore - */ - _paintMarkersGraph: function () { - var left = "50px"; - var top = "0px"; - var height = this.height; - var width = this.width; - var max = 100 - - - this._clear(); - - var svg = d3.select("#DNAContentPainter-holder").append("svg") - .style("overflow", "visible") - .append("g") - .attr("class", "marker-base") - .attr("width", this.width) - .attr("height", this.height + 30) - .attr("transform", "translate(" + left + "," + top + ")"); - - this._container = jQuery("#DNAContentPainter-holder"); - - - //select 10 positions to be displayed on x axis - var marker_legend = []; - - for (var i = 1; i <= 10; i++) { - marker_legend.push((max / 10) * i); - - } - - - var markertext = svg.selectAll('text.marker') - .data(marker_legend); - - markertext.enter().append('svg:text') - .attr("class", "text marker") - .attr('x', function (d) { - return 10; - }) - .attr('y', function (d) { - return height - (d * height / max) + parseInt(5); - }) - .attr('text-anchor', 'begin') - .style("font-size", "10px") - .text(function (d, i) { - return ((i + 1) * 10) + "%"; - }); - - // lines at bottom of diagram to show the positions - var marker = svg.selectAll("tick.marker") - .data(marker_legend); - marker.enter().insert("svg:line") - .attr("class", "tick tickmarker") - .attr("x1", function (d) { - return 0; - }) - .attr("y1", function (d) { - return height - (d * height / max); - }) - .attr("x2",function (d) { - return 5; - }).attr("y2", function (d) { - return height - (d * height / max); - }) - .attr('stroke', function () { - return "black"; - }); - - var marker_base = svg.selectAll("line.bottom") - .data([1]); - marker_base.enter().insert("svg:line") - .attr("class", "line marker base") - .attr("x1", function (d) { - return 1; - }) - .attr("y1", function (d) { - return 0; - }) - .attr("x2",function (d) { - return 1; - }).attr("y2", function (d) { - return height; - }) - .attr('stroke', function () { - return "black"; - }); - }, - - /** - * Private: Paints the slider - * Purpose: set up slider buttons - * Returns: - - * @ignore - */ - _toggleAT: function () {//holder size, left and right margins of the holder, and number of amino acids - if (jQuery(".at-path").css('display') == 'none') { - jQuery(".at-path").show(); - } else { - jQuery(".at-path").hide(); - } - }, - - /** - * Private: Paints the slider - * Purpose: set up slider buttons - * Returns: - - * @ignore - */ - _toggleGC: function () {//holder size, left and right margins of the holder, and number of amino acids - - if (jQuery(".gc-path").css('display') == 'none') { - jQuery(".gc-path").show(); - } else { - jQuery(".gc-path").hide(); - } - }, - - /** - * Private: Paints the slider - * Purpose: set up slider buttons - * Returns: - - * @ignore - */ - _toggleMarker: function (self) {//holder size, left and right margins of the holder, and number of amino acids - console.log(self) - var svg = d3.select("#DNAContentPainter-holder") - var width = this.width; - var marker = svg.selectAll("line.marker"); - var marker_text = svg.selectAll("text.marker"); - var marker_tick = svg.selectAll("line.tick"); - - if (self.value == "left") { - marker.transition() - .duration(500) - .attr("x1", function (d) { - return 1; - }) - .attr("x2", function (d) { - return 1; - }); - - marker_text.transition() - .duration(500) - .attr('text-anchor', 'begin') - .attr('x', function (d) { - return 10; - }); - - marker_tick.transition() - .duration(500) - .attr("x1", function (d) { - return 0; - }) - .attr("x2", function (d) { - return 5; - }) - } else if (self.value == "centre") { - marker.transition() - .duration(500) - .attr("x1", function (d) { - return width / 2; - }) - .attr("x2", function (d) { - return width / 2; - }); - - marker_text.transition() - .duration(500) - .attr('text-anchor', 'begin') - .attr('x', function (d) { - return parseInt(width / 2) + parseInt(10); - }); - - marker_tick.transition() - .duration(500) - .attr("x1", function (d) { - return width / 2; - }) - .attr("x2", function (d) { - return parseInt(width / 2) + parseInt(5); - }) - } else { - marker.transition() - .duration(500) - .attr("x1", function (d) { - return width; - }) - .attr("x2", function (d) { - return width; - }); - - marker_text.transition() - .duration(500) - .attr('text-anchor', 'end') - .attr('x', function (d) { - return parseInt(width) - parseInt(10); - }); - - marker_tick.transition() - .duration(500) - .attr("x1", function (d) { - return (width - 5); - }) - .attr("x2", function (d) { - return width; - }) - } - }, - - /** - * Private: Clears all divs content. - * @ignore - */ - _clear: function () { - d3.select("#DNAContentPainter-holder").select("svg").select("g.redrawn-path").remove(); - }, - - /** - * Private: sets data source. - * @param {string} [dataset], it sets file path to this.opt.dataset. - * @ignore - */ - _setDataSource: function (dataSet) { - this.opt.dataSet = dataSet; - }, - - _addSimpleClickTrigger: function () { - - var self = this; - - // Add the click event to each character in the content - this._container.find('span') - .click(function (e) { - // A letter was clicked! - // Let's discover which one was it - // TIP: e.target contains the clicked DOM node - var selected = jQuery(e.target).text(); - - // Create an event object - var evtObject = { "selected": selected }; - - // We're ready to raise the event onClick of our component - self.raiseEvent('onClick', evtObject); - }); - } - - - }, { - myself: undefined - }); \ No newline at end of file diff --git a/src/lib/biojs-1.0/src/main/javascript/Biojs.DasProteinFeatureViewer.js b/src/lib/biojs-1.0/src/main/javascript/Biojs.DasProteinFeatureViewer.js deleted file mode 100755 index 4923bdbc9..000000000 --- a/src/lib/biojs-1.0/src/main/javascript/Biojs.DasProteinFeatureViewer.js +++ /dev/null @@ -1,341 +0,0 @@ -/** - * This component uses a DASProtein web service that builds the JSON data object used by FatureViewer component. - * - * @class - * @extends Biojs.FeatureViewer - * - * @author Leyla Jael Garcia Castro - * @version 1.0.0 - * @category 2 - * - * - * @param {Object} options An object with the options for DASProteinFeatureViewer component. - * - * @option {string} target - * Identifier of the DIV tag where the component should be displayed. - * - * @option {boolean} [showSlider=true] - * Should the slider for zooming be displayed? - * - * @option {boolean} [showPrintButton=true] - * Should the button for printing/exporting to image be displayed? - * - * @option {boolean} [showFeatureTooltipOnMouseOver=true] - * Should the tooltip for features be displayed? - * - * @option {boolean} [highlightFeatureOnMouseOver=true] - * Should the features be highlighted when mouse over? - * - * @option {boolean} [selectFeatureOnMouseClick=true] - * Should the features remain highlighted, i.e. being selected, after a mouse click, - * and deselected after a second click or whenever other feature is selected? - * - * @option {boolean} [dragSites=true] - * Should the sites be draggable? - * - * @option {string} segment - * Protein identifier or protein accession - * - * @option {string} [dasSources="http://www.ebi.ac.uk/das-srv/uniprot/das/uniprot"] - * DAS protein sources used to retrieved the features, if another one is needed, just add something like ",URL" - * - * @option {string} featureTypes - * In case of more than one source, it is possible to specify only one of them to retrieve a particular feature type. - * For instance "feature.DOMAIN=http://www.ebi.ac.uk/das-srv/interpro/das/InterPro-matches-overview", for more - * types just add something like "&feature.XXX=URL" - * Feature type should be capitalized and can be any of these: DOMAIN, CA_BIND, DNA_BIND, NP_BIND, INTRAMEM, TOPO_DOM, TRANSMEM, ZN_FING, PEPTIDE, - * PROPEP, SIGNAL, TRANSIT, ACT_SITE, METAL, CARBOHYD, LIPID, MOD_RES, COILED, COMPBIAS, CONSERVED_MOTIF, REGION, - * REPEAT, CHAIN, INIT_MET, BINDING, SITE, NON_STD, DISULFID, CROSSLINK, VAR_SEQ, VARIANT, MUTAGEN, UNSURE, - * CONFLICT, NON_CONS, NON_TER, HELIX, TURN, STRAND - * - * @option {string} featureNames - * Feature names are displayed as part of the legend. In case you want to modify the text associated to a feature - * type, you can use this option. For instance name.DOMAIN=Family domains, for more names just add something like - * "&name.XXX=any text" - * Feature type should be capitalized and can be any of these: DOMAIN, CA_BIND, DNA_BIND, NP_BIND, INTRAMEM, TOPO_DOM, TRANSMEM, ZN_FING, PEPTIDE, - * PROPEP, SIGNAL, TRANSIT, ACT_SITE, METAL, CARBOHYD, LIPID, MOD_RES, COILED, COMPBIAS, CONSERVED_MOTIF, REGION, - * REPEAT, CHAIN, INIT_MET, BINDING, SITE, NON_STD, DISULFID, CROSSLINK, VAR_SEQ, VARIANT, MUTAGEN, UNSURE, - * CONFLICT, NON_CONS, NON_TER, HELIX, TURN, STRAND - * - * @option {int} [imageWidth=700] - * Image width - * - * @option {string} [imageStyle="nonOverlapping"] - * Image style, a value from {nonOverlapping, centered, rows} - * - * @option {boolean} [hgrid=false] - * Should horizontal lines be shown? - * - * @option {boolean} [vgrid=false] - * Should vertical lines be shown? - * - * @option {boolean} [allFeatures=true] - * Should all feature types be displayed? or only those defined by default? - * Default feature types: DOMAIN, CA_BIND, DNA_BIND, NP_BIND, INTRAMEM, TOPO_DOM, TRANSMEM, ZN_FING, PEPTIDE, - * PROPEP, SIGNAL, TRANSIT, ACT_SITE, METAL, CARBOHYD, LIPID, MOD_RES - * Other features that will be displayed if allFeatures is true: COILED, COMPBIAS, CONSERVED_MOTIF, REGION, - * REPEAT, CHAIN, INIT_MET, BINDING, SITE, NON_STD, DISULFID, CROSSLINK, - * VAR_SEQ, VARIANT, MUTAGEN, UNSURE, CONFLICT, NON_CONS, NON_TER, HELIX, TURN, STRAND - * - * @option {boolean} [allRectangles=false] - * Should all features, including those involving just one amino acid be displayed as rectangles? - * If not, some predefined features will be use for ACT_SITE, METAL, CARBOHYD, LIPID, MOD_RES - * - * @option {boolean} [allSameSize=false] - * If "centered" is the image style option, should all rectangles have the same size? - * - * @option {string} [proxyUrl="../biojs/dependencies/proxy/proxy.php"] - * Server side proxy server. - * - * @example - * var myPainter = new Biojs.DasProteinFeatureViewer({ - * target: "YourOwnDivId", - * segment: "a4_human" - * }); - * - */ -Biojs.DasProteinFeatureViewer = Biojs.FeatureViewer.extend( - /** @lends Biojs.DasProteinFeatureViewer */ - { - /* - * Private variables - */ - _webservice:"http://wwwdev.ebi.ac.uk/uniprot/featureViewer/image", - _dasReference:"http://www.ebi.ac.uk/das-srv/uniprot/das/uniprot/", - /** - * Default values for the options - * @name Biojs.DasProteinFeatureViewer-constructor - */ - constructor:function (options) { - this.base(options); - var self = this; - //Biojs.console.enable(); - //create params from options - var params = "?"; - params = params + "&option=raphael"; - if (!Biojs.Utils.isEmpty(options.segment)) { - params = params + "&segment=" + options.segment; - } else { - throw "A UniProt accession or identifier is mandatory"; - } - if (!Biojs.Utils.isEmpty(options.dasSources)) { - params = params + "&dasSources=" + options.dasSources; - } - if (!Biojs.Utils.isEmpty(options.featureTypes)) { - params = params + "&" + options.featureTypes; - } - if (!Biojs.Utils.isEmpty(options.featureNames)) { - params = params + "&" + options.featureNames; - } - if ((options.imageWidth != undefined) && (!isNaN(options.imageWidth))) { - params = params + "&width=" + options.imageWidth; - } - if (!Biojs.Utils.isEmpty(options.imageStyle)) { - params = params + "&style=" + options.imageStyle; - } - if ((options.hgrid != undefined) && (options.hgrid == true)) { - params = params + "&hgrid"; - } - if ((options.vgrid != undefined) && (options.vgrid == true)) { - params = params + "&vgrid"; - } - if ((options.allFeatures != undefined) && (options.allFeatures == true)) { - params = params + "&allFeatures"; - } - if ((options.allRectangles != undefined) && (options.allRectangles == true)) { - params = params + "&allRectangles"; - } - if ((options.allSameSize != undefined) && (options.allSameSize == true)) { - params = params + "&allSameSize"; - } - //complete parent options with defaults defined by the children - this.opt.json = ""; - //Biojs.console.log("params: " + params); - //get the json from the web service - jQuery.ajax({ - //url:this._webservice + params, - url: self.opt.proxyUrl, - data: "url=" + this._webservice + params, - success:function (response, callOptions) { - json = jQuery.parseJSON(response); - //Biojs.console.log(response); - //Biojs.console.log(json); - try { - self.opt.json = json; - //jQuery.noConflict(); - //self.initRaphael(); - if (!Biojs.Utils.isEmpty(self.opt.json)) { - self.paintFeatures(self.opt.json) - } - } catch (err) { - Biojs.console.log(err); - document.getElementById(self.opt.target).innerHTML = ''; - document.getElementById(self.opt.target).innerHTML = 'No image available. Did you provide a valid UniProt accession or identifier, and valid limits?'; - } - }, - error:function (response, callOptions) { - Biojs.console.log(error); - document.getElementById(self.opt.target).innerHTML = ''; - document.getElementById(self.opt.target).innerHTML = 'No image available. Did you provide a valid UniProt accession or identifier, and valid limits?'; - } - }); - }, - - /** - * Default values for the options: - * target: "", - * segment: "", - * showSlider: true, - * showPrintButton: true, - * showFeatureTooltipOnMouseOver: true, - * highlightFeatureOnMouseOver: true, - * selectFeatureOnMouseClick: true, - * dragSites: true //beware that dragging implies a click on so the click event will be raised! - * selectionColor: "#ff8c00" - * dasSources: "http://www.ebi.ac.uk/das-srv/uniprot/das/uniprot", - * featureTypes: "", - * featureNames: "", - * imageWidth: 700, - * imageStyle: "nonOverlapping", - * optionResponse: "raphael", - * hgrid: false, - * vgrid: false, - * allFeatures: true, - * allRectangles:false, - * allSameSize: false, - * proxyUrl: "../biojs/dependencies/proxy/proxy.php" - * @name Biojs.DasProteinFeatureViewer-opt - */ - opt:{ - //Parent - /* target:"YourOwnDivId", - //json: {}, //is not an option here, it is fixed to _webservice response - showSlider:true, - showPrintButton:true, - showFeatureTooltipOnMouseOver:true, - highlightFeatureOnMouseOver:true, - selectFeatureOnMouseClick:true, - dragSites:true, - selectionColor:"#ff8c00", //make sure it does not exist at http://wwwdev.ebi.ac.uk/das-srv/uniprot/das/uniprot/stylesheet - */ - dasSources:"http://www.ebi.ac.uk/das-srv/uniprot/das/uniprot", - featureTypes:"", - featureNames:"", - imageWidth:700, - imageStyle:"nonOverlapping", - optionResponse:"raphael", - hgrid:false, - vgrid:false, - allFeatures:true, - allRectangles:false, - allSameSize:false, - proxyUrl: "../biojs/dependencies/proxy/proxy.php" - }, - - /** - * Array containing the supported event names - * @name Biojs.DasProteinFeatureViewer-eventTypes - */ - eventTypes : [], - - /** - * Opens a new window/tab in the browser with the graphical representation for all feature types. - * - * @example - * myPainter.showGeneralLegend(); - * - */ - showGeneralLegend: function() { - var config = this.opt.json.configuration; - var dataURL = this._webservice + "?"; - window.open(dataURL); //open generated image in new tab/window - }, - - /** - * Opens a new window/tab in the browser with the graphical representation as a plain image. - * Note: For IE it does not reflect the drags/drops on sites - * - * @example - * myPainter.exportFeaturesToImage(); - * - */ - exportFeaturesToImage: function() { -// if (typeof FlashCanvas != "undefined") { -// FlashCanvas.initElement(canvas); -// } - var config = this.opt.json.configuration; - var dataURL = ""; - if (jQuery.browser.msie) { //canvas does not work (not even with IE 9) - var arguments = "segment=" + this.opt.json.segment; - if ((config.requestedStart != 0) && (config.requestedStop != 0)) { - arguments = arguments + ":" + config.requestedStart + "," + config.requestedStop; - } - arguments = arguments + - "&dasReference=" + config.dasReference + - "&dasSources=" + config.dasSources + - "&width=" + config.sizeX + - "&option=image" + - "&hgrid=" + config.horizontalGrid + - "&vgrid=" + config.verticalGrid + - "&style=" + config.style; - dataURL = this._webservice + "?" + arguments; - window.open(dataURL); //open generated image in new tab/window - } else { - svg = document.getElementById('uniprotFeaturePainter-holder').innerHTML; - var canvas = document.createElement("canvas"); - canvg(canvas, svg); - dataURL = canvas.toDataURL(); - this.$imageExported = jQuery('
') - .html('exported image') - .dialog({ - autoOpen: true, - title: 'Exported image', - modal: true, - width: config.sizeX+20 - }); - } - }, - - /** - * Applies a style, either "centered", "nonOverlapping", or "rows". - * @param show - * - * @example - * myPainter.applyStyle("centered"); - */ - applyStyle: function(style) { - if ((style != undefined) && ((style == "centered") || (style == "nonOverlapping") || (style = "rows"))) { - var config = this.opt.json.configuration; - this.customize(style, config.horizontalGrid, config.verticalGrid); - } - }, - - /** - * Shows/hide the horizontal guide lines. - * @param show - * - * @example - * myPainter.showHideHorizontalGrid(true); - */ - showHideHorizontalGrid: function(show) { - if ((show != undefined) && ((show == true) || (show == false))) { - var config = this.opt.json.configuration; - this.customize(config.style, show, config.verticalGrid); - } - }, - - /** - * Shows/hide the horizontal guide lines. - * @param show - * - * @example - * myPainter.showHideVerticalGrid(true); - */ - showHideVerticalGrid: function(show) { - if ((show != undefined) && ((show == true) || (show == false))) { - var config = this.opt.json.configuration; - this.customize(config.style, config.horizontalGrid, show); - } - } - } -); \ No newline at end of file diff --git a/src/lib/biojs-1.0/src/main/javascript/Biojs.DetailsFrame.js b/src/lib/biojs-1.0/src/main/javascript/Biojs.DetailsFrame.js deleted file mode 100755 index f65109707..000000000 --- a/src/lib/biojs-1.0/src/main/javascript/Biojs.DetailsFrame.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * This component creates a floating div as a pop-up window to visualize a list of annotations on an entity. - * Eg. Protein, Interaction, Gene, etc - * - * @class - * @extends Biojs - * - * @author Gustavo A. Salazar - * @version 1.0.0 - * @category 1 - * - * @requires jQuery Core 1.7.2 - * @dependency - * - * @requires jQuery UI 1.8.2 - * @dependency - * - * @requires jQuery UI CSS 1.8.2 - * @dependency - * - * @requires Details frame CSS - * @dependency - * - * @param {Object} options An object with the options for the Details Frame component. - * - * @option {string} target - * Identifier of the DIV tag where the component should be displayed. - * - * @option {object} features - * Object with the features to display, every attribute is displayed as an item in the list. - * The attribute id, is used for the title of the frame. - * The attribute description has a different style at the beggining of the list - * - * @option {boolean} [minizable=true] - * to indicate if the window is minizable. default value: true - * - * @option {boolean} [draggable=true] - * to indicate if the window can be draggable. default value: true - * - * @example - * var instance = new Biojs.DetailsFrame({ - * target: "YourOwnDivId", - * features: { - * "id":"P64747", - * "description":"Uncharacterized protein Rv0893c/MT0917","Gene-Name":"Rv0893c", - * "%GC":" 60.63", - * "Location":" Unknown", - * "Chrom-Location":" 946", - * "Strand-Direction":" -1", - * "Cordon-Bias":" 0.07692", - * "Funct-Class":" unknown", - * "Degree":" 15", - * "Betweenness":" 784.68", - * "Closeness":" 0.24790", - * "Eigen":" 0.00003", - * "Hub":" N", - * "Sass-Infect":" 0", - * "Sass-Growth":" 0", - * "GO-Growth":" 0", - * "TDR":" 0", - * "UniProt":" 0", - * "DDTRP":" 0", - * "Gas-Nic":" 0", - * "#-Paralogs":" 11", - * "Mtb-cplx":" 11", - * "Mtb":" 7", - * "Corynebacterineae":" 0", - * "Actinomycetales":" 0", - * "Actinobacteridae":" 0", - * "Bacteria":"0", - * "Non-bacteria":"0", - * "H.sapiens":"0", - * "in_leprae":"0", - * "DN/DS":"0.48", - * "Codon-Volatility":"0.1" - * } - * }); - * - */ -Biojs.DetailsFrame = Biojs.extend ( -/** @lends Biojs.DetailsFrame# */ -{ - constructor: function (options) { - var self=this; - var target =self.opt.target; - var html = ''; - if (self.opt.minizable) - html += '
'; - if (self.opt.draggable) - html += '
'; - html += '
'; - html += '
")[0];a.nTable.parentNode.insertBefore(b,a.nTable);a.nTableWrapper=i('
')[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var c=a.nTableWrapper,d=a.sDom.split(""),f,h,g,e,q,m,o,l=0;l
")[0];q=d[l+1];if("'"==q||'"'==q){m="";for(o=2;d[l+o]!=q;)m+=d[l+o], -o++;"H"==m?m="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix":"F"==m&&(m="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix");-1!=m.indexOf(".")?(q=m.split("."),e.id=q[0].substr(1,q[0].length-1),e.className=q[1]):"#"==m.charAt(0)?e.id=m.substr(1,m.length-1):e.className=m;l+=o}c.appendChild(e);c=e}else if(">"==g)c=c.parentNode;else if("l"==g&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange)f=xa(a),h=1;else if("f"==g&&a.oFeatures.bFilter)f= -ya(a),h=1;else if("r"==g&&a.oFeatures.bProcessing)f=za(a),h=1;else if("t"==g)f=Aa(a),h=1;else if("i"==g&&a.oFeatures.bInfo)f=Ba(a),h=1;else if("p"==g&&a.oFeatures.bPaginate)f=Ca(a),h=1;else if(0!==j.ext.aoFeatures.length){e=j.ext.aoFeatures;o=0;for(q=e.length;o'):""===c?'':c+' ',d=k.createElement("div");d.className=a.oClasses.sFilter;d.innerHTML="";if(!a.aanFeatures.f)d.id=a.sTableId+"_filter";c=i("input", -d);c.val(b.sSearch.replace('"',"""));c.bind("keyup.DT",function(){for(var c=a.aanFeatures.f,d=0,g=c.length;d=b.length)a.aiDisplay.splice(0,a.aiDisplay.length),a.aiDisplay=a.aiDisplayMaster.slice();else if(a.aiDisplay.length==a.aiDisplayMaster.length|| -f.sSearch.length>b.length||1==c||0!==b.indexOf(f.sSearch)){a.aiDisplay.splice(0,a.aiDisplay.length);ia(a,1);for(b=0;b/g,""):"string"===typeof a?a.replace(/[\r\n]/g," "):null===a?"":a}function ma(a){return a.replace(RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^)","g"),"\\$1")}function Ba(a){var b=k.createElement("div");b.className=a.oClasses.sInfo;if(!a.aanFeatures.i)a.aoDrawCallback.push({fn:Ia,sName:"information"}),b.id=a.sTableId+"_info";a.nTable.setAttribute("aria-describedby", -a.sTableId+"_info");return b}function Ia(a){if(a.oFeatures.bInfo&&0!==a.aanFeatures.i.length){var b=a._iDisplayStart+1,c=a.fnDisplayEnd(),d=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),h=a.fnFormatNumber(b),g=a.fnFormatNumber(c),e=a.fnFormatNumber(d),q=a.fnFormatNumber(f);a.oScroll.bInfinite&&(h=a.fnFormatNumber(1));h=0===a.fnRecordsDisplay()&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:0===a.fnRecordsDisplay()?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_", -e)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",h).replace("_END_",g).replace("_TOTAL_",q)+a.oLanguage.sInfoPostFix:a.oLanguage.sInfo.replace("_START_",h).replace("_END_",g).replace("_TOTAL_",q)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix;null!==a.oLanguage.fnInfoCallback&&(h=a.oLanguage.fnInfoCallback.call(a.oInstance,a,b,c,d,f,h));a=a.aanFeatures.i;b=0;for(c=a.length;b",c,d,f=a.aLengthMenu;if(2==f.length&&"object"===typeof f[0]&&"object"===typeof f[1])for(c=0,d=f[0].length;c'+f[1][c]+"";else for(c=0,d=f.length;c'+f[c]+"";b+="";f=k.createElement("div");if(!a.aanFeatures.l)f.id=a.sTableId+"_length";f.className=a.oClasses.sLength;f.innerHTML=""; -i('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",!0);i("select",f).bind("change.DT",function(){var b=i(this).val(),f=a.aanFeatures.l;for(c=0,d=f.length;ca._iDisplayStart))a._iDisplayStart=0;if(-1==a._iDisplayLength)a._iDisplayStart=0;y(a)});i("select",f).attr("aria-controls",a.sTableId);return f} -function z(a){a._iDisplayEnd=!1===a.oFeatures.bPaginate?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength>a.aiDisplay.length||-1==a._iDisplayLength?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Ca(a){if(a.oScroll.bInfinite)return null;var b=k.createElement("div");b.className=a.oClasses.sPaging+a.sPaginationType;j.ext.oPagination[a.sPaginationType].fnInit(a,b,function(a){z(a);y(a)});a.aanFeatures.p||a.aoDrawCallback.push({fn:function(a){j.ext.oPagination[a.sPaginationType].fnUpdate(a, -function(a){z(a);y(a)})},sName:"pagination"});return b}function oa(a,b){var c=a._iDisplayStart;if("number"===typeof b){if(a._iDisplayStart=b*a._iDisplayLength,a._iDisplayStart>a.fnRecordsDisplay())a._iDisplayStart=0}else if("first"==b)a._iDisplayStart=0;else if("previous"==b){if(a._iDisplayStart=0<=a._iDisplayLength?a._iDisplayStart-a._iDisplayLength:0,0>a._iDisplayStart)a._iDisplayStart=0}else if("next"==b)0<=a._iDisplayLength?a._iDisplayStart+a._iDisplayLengthi(a.nTable).height()-a.oScroll.iLoadGap&&a.fnDisplayEnd()=i.browser.version;g=a.nTable.getElementsByTagName("thead");0d.offsetHeight||"scroll"==i(d).css("overflow-y")))a.nTable.style.width= -p(i(a.nTable).outerWidth()-a.oScroll.iBarWidth)}else if(""!==a.oScroll.sXInner)a.nTable.style.width=p(a.oScroll.sXInner);else if(f==i(d).width()&&i(d).height()f-a.oScroll.iBarWidth)a.nTable.style.width=p(f)}else a.nTable.style.width=p(f);f=i(a.nTable).outerWidth();h=a.nTHead.getElementsByTagName("tr");g=g.getElementsByTagName("tr");N(function(a,b){m=a.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth= -"0";m.borderBottomWidth="0";m.height=0;l=i(a).width();b.style.width=p(l);r.push(l)},g,h);i(g).height(0);null!==a.nTFoot&&(e=j.getElementsByTagName("tr"),j=a.nTFoot.getElementsByTagName("tr"),N(function(a,b){m=a.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;l=i(a).width();b.style.width=p(l);r.push(l)},e,j),i(e).height(0));N(function(a){a.innerHTML="";a.style.width=p(r.shift())},g);null!==a.nTFoot&&N(function(a){a.innerHTML="";a.style.width=p(r.shift())}, -e);if(i(a.nTable).outerWidth()d.offsetHeight||"scroll"==i(d).css("overflow-y")?f+a.oScroll.iBarWidth:f;if(k&&(d.scrollHeight>d.offsetHeight||"scroll"==i(d).css("overflow-y")))a.nTable.style.width=p(e-a.oScroll.iBarWidth);d.style.width=p(e);b.parentNode.style.width=p(e);if(null!==a.nTFoot)n.parentNode.style.width=p(e);""===a.oScroll.sX?F(a,1,"The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width."): -""!==a.oScroll.sXInner&&F(a,1,"The table cannot fit into the current element which will cause column misalignment. Increase the sScrollXInner value or remove it to allow automatic calculation")}else if(d.style.width=p("100%"),b.parentNode.style.width=p("100%"),null!==a.nTFoot)n.parentNode.style.width=p("100%");if(""===a.oScroll.sY&&k)d.style.height=p(a.nTable.offsetHeight+a.oScroll.iBarWidth);if(""!==a.oScroll.sY&&a.oScroll.bCollapse&&(d.style.height=p(a.oScroll.sY),k=""!==a.oScroll.sX&&a.nTable.offsetWidth> -d.offsetWidth?a.oScroll.iBarWidth:0,a.nTable.offsetHeighttd",b));g=O(a, -h);for(h=d=0;hc)return null;if(null===a.aoData[c].nTr){var d=k.createElement("td");d.innerHTML=w(a,c,b,"");return d}return L(a,c)[b]}function Na(a,b){for(var c=-1,d=-1,f=0;f/g,"");if(h.length>c)c=h.length,d=f}return d}function p(a){if(null===a)return"0px";if("number"==typeof a)return 0>a?"0px":a+"px";var b=a.charCodeAt(a.length-1);return 48>b||57=g)for(b=0;be&&e++}}}function pa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b,c;b=a.oScroll.bInfinite;var d={iCreate:(new Date).getTime(),iStart:b?0:a._iDisplayStart, -iEnd:b?a._iDisplayLength:a._iDisplayEnd,iLength:a._iDisplayLength,aaSorting:i.extend(!0,[],a.aaSorting),oSearch:i.extend(!0,{},a.oPreviousSearch),aoSearchCols:i.extend(!0,[],a.aoPreSearchCols),abVisCols:[]};for(b=0,c=a.aoColumns.length;b=d.aiDisplay.length&&(d._iDisplayStart-=d._iDisplayLength,0>d._iDisplayStart))d._iDisplayStart=0;if(c===l||c)z(d),y(d);return e};this.fnDestroy=function(a){var b=u(this[j.ext.iApiIndex]),c=b.nTableWrapper.parentNode,d=b.nTBody,f,e,a=a===l?!1:!0;b.bDestroying=!0;for(f=0,e=b.aoDestroyCallback.length;ftr>td."+b.oClasses.sRowEmpty,b.nTable).parent().remove();b.nTable!=b.nTHead.parentNode&&(i(b.nTable).children("thead").remove(),b.nTable.appendChild(b.nTHead));b.nTFoot&&b.nTable!=b.nTFoot.parentNode&&(i(b.nTable).children("tfoot").remove(),b.nTable.appendChild(b.nTFoot));b.nTable.parentNode.removeChild(b.nTable);i(b.nTableWrapper).remove();b.aaSorting= -[];b.aaSortingFixed=[];Q(b);i(S(b)).removeClass(b.asStripeClasses.join(" "));i("th, td",b.nTHead).removeClass([b.oClasses.sSortable,b.oClasses.sSortableAsc,b.oClasses.sSortableDesc,b.oClasses.sSortableNone].join(" "));b.bJUI&&(i("th span."+b.oClasses.sSortIcon+", td span."+b.oClasses.sSortIcon,b.nTHead).remove(),i("th, td",b.nTHead).each(function(){var a=i("div."+b.oClasses.sSortJUIWrapper,this),c=a.contents();i(this).append(c);a.remove()}));!a&&b.nTableReinsertBefore?c.insertBefore(b.nTable,b.nTableReinsertBefore): -a||c.appendChild(b.nTable);for(f=0,e=b.aoData.length;f=v(d);if(!m)for(f=a;ft<"F"ip>'}else i.extend(g.oClasses,j.ext.oStdClasses);i(this).addClass(g.oClasses.sTable);if(""!==g.oScroll.sX||""!==g.oScroll.sY)g.oScroll.iBarWidth=Oa();if(g.iInitDisplayStart===l)g.iInitDisplayStart=e.iDisplayStart,g._iDisplayStart=e.iDisplayStart;if(e.bStateSave)g.oFeatures.bStateSave=!0,Qa(g,e),A(g,"aoDrawCallback",pa,"state_save");if(null!==e.iDeferLoading)g.bDeferLoading=!0,g._iRecordsTotal=e.iDeferLoading, -g._iRecordsDisplay=e.iDeferLoading;null!==e.aaData&&(h=!0);""!==e.oLanguage.sUrl?(g.oLanguage.sUrl=e.oLanguage.sUrl,i.getJSON(g.oLanguage.sUrl,null,function(a){na(a);i.extend(!0,g.oLanguage,e.oLanguage,a);$(g)}),f=!0):i.extend(!0,g.oLanguage,e.oLanguage);c=!1;d=i(this).children("tbody").children("tr");for(a=0,b=g.asStripeClasses.length;a=g.aoColumns.length&&(g.aaSorting[a][0]=0);var r=g.aoColumns[g.aaSorting[a][0]];g.aaSorting[a][2]===l&&(g.aaSorting[a][2]=0);e.aaSorting===l&&g.saved_aaSorting===l&&(g.aaSorting[a][1]=r.asSorting[0]);for(c=0,d=r.asSorting.length;c< -d;c++)if(g.aaSorting[a][1]==r.asSorting[c]){g.aaSorting[a][2]=c;break}}Q(g);a=i(this).children("thead");0===a.length&&(a=[k.createElement("thead")],this.appendChild(a[0]));g.nTHead=a[0];a=i(this).children("tbody");0===a.length&&(a=[k.createElement("tbody")],this.appendChild(a[0]));g.nTBody=a[0];g.nTBody.setAttribute("role","alert");g.nTBody.setAttribute("aria-live","polite");g.nTBody.setAttribute("aria-relevant","all");a=i(this).children("tfoot");if(0=parseInt(k,10)},iApiIndex:0,ofnSearch:{},oApi:{}, -oStdClasses:{},oJUIClasses:{},oPagination:{},oSort:{},sVersion:j.version,sErrMode:"alert",_oExternConfig:{iNextUnique:0}};j.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};j.models.oRow={nTr:null,_aData:[],_aSortData:[],_anHidden:[],_sRowStripe:""};j.models.oColumn={aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bUseRendered:null,bVisible:null,_bAutoType:!0,fnCreatedCell:null,fnGetData:null,fnRender:null,fnSetData:null,mDataProp:null,nTh:null,nTf:null,sClass:null, -sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};j.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:["odd","even"],bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollAutoCss:!0,bScrollCollapse:!1, -bScrollInfinite:!1,bServerSide:!1,bSort:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCookieCallback:null,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(e){if(1E3>e)return e;for(var i=e+"",e=i.split(""),j="",i=i.length,l=0;l'+k.sPrevious+''+k.sNext+"":'';i(j).append(k);var t=i("a",j),k=t[0],t=t[1];e.oApi._fnBindAction(k,{action:"previous"},s);e.oApi._fnBindAction(t,{action:"next"},s);if(!e.aanFeatures.p)j.id=e.sTableId+"_paginate",k.id=e.sTableId+"_previous",t.id=e.sTableId+"_next",k.setAttribute("aria-controls",e.sTableId),t.setAttribute("aria-controls",e.sTableId)},fnUpdate:function(e){if(e.aanFeatures.p)for(var i=e.oClasses,j=e.aanFeatures.p,l=0, -k=j.length;l'+k.sFirst+ -''+k.sPrevious+''+k.sNext+''+k.sLast+"");var v=i("a",j),k=v[0],s=v[1],B=v[2],v=v[3];e.oApi._fnBindAction(k,{action:"first"},t);e.oApi._fnBindAction(s,{action:"previous"},t);e.oApi._fnBindAction(B,{action:"next"},t);e.oApi._fnBindAction(v,{action:"last"}, -t);if(!e.aanFeatures.p)j.id=e.sTableId+"_paginate",k.id=e.sTableId+"_first",s.id=e.sTableId+"_previous",B.id=e.sTableId+"_next",v.id=e.sTableId+"_last"},fnUpdate:function(e,l){if(e.aanFeatures.p){var k=j.ext.oPagination.iFullNumbersShowPages,r=Math.floor(k/2),s=Math.ceil(e.fnRecordsDisplay()/e._iDisplayLength),t=Math.ceil(e._iDisplayStart/e._iDisplayLength)+1,v="",B,D=e.oClasses,x,I=e.aanFeatures.p,G=function(i){e.oApi._fnBindAction(this,{page:i+B-1},function(i){e.oApi._fnPageChange(e,i.data.page); -l(e);i.preventDefault()})};s=s-r?(B=s-k+1,r=s):(B=t-Math.ceil(k/2)+1,r=B+k-1);for(k=B;k<=r;k++)v+=t!==k?''+e.fnFormatNumber(k)+"":''+e.fnFormatNumber(k)+"";for(k=0,r=I.length;ki?1:0},"string-desc":function(e,i){return ei?-1:0},"html-pre":function(e){return e.replace(/<.*?>/g,"").toLowerCase()}, -"html-asc":function(e,i){return ei?1:0},"html-desc":function(e,i){return ei?-1:0},"date-pre":function(e){e=Date.parse(e);if(isNaN(e)||""===e)e=Date.parse("01/01/1970 00:00:00");return e},"date-asc":function(e,i){return e-i},"date-desc":function(e,i){return i-e},"numeric-pre":function(e){return"-"==e||""===e?0:1*e},"numeric-asc":function(e,i){return e-i},"numeric-desc":function(e,i){return i-e}});i.extend(j.ext.aTypes,[function(e){if("number"===typeof e)return"numeric";if("string"!== -typeof e)return null;var i,j=!1;i=e.charAt(0);if(-1=="0123456789-".indexOf(i))return null;for(var k=1;k")?"html":null}]);i.fn.DataTable=j;i.fn.dataTable=j;i.fn.dataTableSettings=j.settings;i.fn.dataTableExt= -j.ext})(jQuery,window,document,void 0); diff --git a/src/lib/biojs-1.0/src/main/resources/dependencies/jquery.miniColors.min.js b/src/lib/biojs-1.0/src/main/resources/dependencies/jquery.miniColors.min.js deleted file mode 100755 index 25dcfa0e0..000000000 --- a/src/lib/biojs-1.0/src/main/resources/dependencies/jquery.miniColors.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * jQuery miniColors: A small color selector - * - * Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/) - * - * Dual licensed under the MIT or GPL Version 2 licenses - * -*/ -if(jQuery)(function($){$.extend($.fn,{miniColors:function(o,data){var create=function(input,o,data){var color=expandHex(input.val());if(!color)color='ffffff';var hsb=hex2hsb(color);var trigger=$('');trigger.insertAfter(input);input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase','uppercase').data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase));if(o.readonly)input.prop('readonly',true);if(o.disabled)disable(input);trigger.bind('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#');show(input)});input.bind('focus.miniColors',function(event){if(input.val()==='')input.val('#');show(input)});input.bind('blur.miniColors',function(event){var hex=expandHex(input.val());input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'')});input.bind('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.bind('keyup.miniColors',function(event){setColorFromInput(input)});input.bind('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').unbind('.miniColors');$(document).unbind('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').css('opacity',1)};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').css('opacity',0.5)};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('
');selector.append('
').append('
').css({top:input.is(':visible')?input.offset().top+input.outerHeight():input.data('trigger').offset().top+input.data('trigger').outerHeight(),left:input.is(':visible')?input.offset().left:input.data('trigger').offset().left,display:'none'}).addClass(input.attr('class'));var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition.y+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);selector.fadeIn(100);selector.bind('selectstart',function(){return false});$(document).bind('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);if($(event.target).parents().andSelf().hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if($(event.target).parents().andSelf().hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if($(event.target).parents().andSelf().hasClass('miniColors-selector')){event.preventDefault();return}if($(event.target).parents().andSelf().hasClass('miniColors'))return;hide(input)});$(document).bind('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).bind('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event)}})};var hide=function(input){if(!input)input='.miniColors';$(input).each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){$(this).remove()})});$(document).unbind('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-5;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-5;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position={y:event.pageY};if(event.originalEvent.changedTouches){position.y=event.originalEvent.changedTouches[0].pageY}position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-1;if(position.y<=-1)position.y=-1;if(position.y>=149)position.y=149;input.data('huePosition',position);huePicker.css('top',position.y).show();var h=Math.round((150-position.y-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb);if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase')));input.data('trigger').css('backgroundColor','#'+hex);if(input.data('selector'))input.data('selector').find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));if(input.data('change')){if(hex===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,hsb2rgb(hsb));input.data('lastChange',hex)}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val()));var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var currentHSB=input.data('hsb');if(hsb.h===currentHSB.h&&hsb.s===currentHSB.s&&hsb.b===currentHSB.b)return true;var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition.y+'px');input.data('huePosition',huePosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='lowercase')return string.toLowerCase();if(letterCase==='uppercase')return string.toUpperCase();return string};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return{y:y-1}};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data);setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery); \ No newline at end of file diff --git a/src/lib/biojs-1.0/src/main/resources/dependencies/jquery.multiselect.min.js b/src/lib/biojs-1.0/src/main/resources/dependencies/jquery.multiselect.min.js deleted file mode 100755 index 7f5ab9661..000000000 --- a/src/lib/biojs-1.0/src/main/resources/dependencies/jquery.multiselect.min.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * jQuery MultiSelect UI Widget 1.12 - * Copyright (c) 2011 Eric Hynds - * - * http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ - * - * Depends: - * - jQuery 1.4.2+ - * - jQuery UI 1.8 widget factory - * - * Optional: - * - jQuery UI effects - * - jQuery UI position utility - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ -(function(d){var j=0;d.widget("ech.multiselect",{options:{header:!0,height:175,minWidth:225,classes:"",checkAllText:"Check all",uncheckAllText:"Uncheck all",noneSelectedText:"Select options",selectedText:"# selected",selectedList:0,show:"",hide:"",autoOpen:!1,multiple:!0,position:{}},_create:function(){var a=this.element.hide(),b=this.options;this.speed=d.fx.speeds._default;this._isOpen=!1;a=(this.button=d('')).addClass("ui-multiselect ui-widget ui-state-default ui-corner-all").addClass(b.classes).attr({title:a.attr("title"), "aria-haspopup":!0,tabIndex:a.attr("tabIndex")}).insertAfter(a);(this.buttonlabel=d("")).html(b.noneSelectedText).appendTo(a);var a=(this.menu=d("
")).addClass("ui-multiselect-menu ui-widget ui-widget-content ui-corner-all").addClass(b.classes).appendTo(document.body),c=(this.header=d("
")).addClass("ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix").appendTo(a);(this.headerLinkContainer=d("
"+(i[0]>0&&G==i[1]-1?'
':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'': -"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
',o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&&l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b, -e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+ -(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input? -a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c, -e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a, -"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this; -if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a== -"string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.16";window["DP_jQuery_"+B]=d})(jQuery); -;/* - * jQuery UI Progressbar 1.8.16 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); -this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* -this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.16"})})(jQuery); -;/* - * jQuery UI Effects 1.8.16 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], -16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, -a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= -a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", -"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, -0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, -211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, -d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; -f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, -[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.16",save:function(c,a){for(var b=0;b
").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}), -d=document.activeElement;c.wrap(b);if(c[0]===d||f.contains(c[0],d))f(d).focus();b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(e,g){a[g]=c.css(g);if(isNaN(parseInt(a[g],10)))a[g]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){var a,b=document.activeElement; -if(c.parent().is(".ui-effects-wrapper")){a=c.parent().replaceWith(c);if(c[0]===b||f.contains(c[0],b))f(b).focus();return a}return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)}); -return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this, -arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/ -2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b, -d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c, -a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b, -d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h
").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ -e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); -;/* - * jQuery UI Effects Fade 1.8.16 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fade - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Fold 1.8.16 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fold - * - * Depends: - * jquery.effects.core.js - */ -(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], -10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); -;/* - * jQuery UI Effects Highlight 1.8.16 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Highlight - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& -this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Pulsate 1.8.16 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Pulsate - * - * Depends: - * jquery.effects.core.js - */ -(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c
').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); -b.dequeue()})})}})(jQuery); -; \ No newline at end of file diff --git a/src/lib/biojs-1.0/src/main/resources/dependencies/jquery/jQRangeSlider-5.1/demo/sliderDemo.js b/src/lib/biojs-1.0/src/main/resources/dependencies/jquery/jQRangeSlider-5.1/demo/sliderDemo.js deleted file mode 100755 index f0e7df703..000000000 --- a/src/lib/biojs-1.0/src/main/resources/dependencies/jquery/jQRangeSlider-5.1/demo/sliderDemo.js +++ /dev/null @@ -1,347 +0,0 @@ - -(function($, undefined){ - "use strict"; - - $.widget("ui.sliderDemo", { - options:{ - }, - - _title: "Float values", - _name: "rangeSlider", - - _create: function(){ - this.element.addClass("ui-sliderDemo"); - - this._elements = {}; - this._createTitle(); - this._createZones(); - this._createOptions(); - this._createSlider(); - this._createLog(); - this._createCode(); - }, - - destroy: function(){ - this.element.empty(); - }, - - _setOption: function(name, value){ - this._elements.slider[this._name]("option", name, value); - }, - - _getOption: function(name){ - return this._elements.slider[this._name]("option", name); - }, - - _easyOptionChange: function(e){ - var target = $(e.target), - value = target.val(), - name = target.attr("name"); - - if (value === "false"){ - value = false - } else if (value === "null"){ - value = null - } else if (!isNaN(parseFloat(value)) && parseFloat(value).toString() == value){ - value = parseFloat(value) - } - - this._setOption(name, value); - }, - - _createZones: function(){ - var wrapper = $("
").appendTo(this.element), - inputZone = $("
").appendTo(wrapper), - optionsZone = $("
").appendTo(this.element); - - this._elements.sliderZone = $("
").appendTo(inputZone); - this._elements.optionsZone = $("").appendTo(optionsZone); - this._elements.logZone = $("
").appendTo(wrapper); - }, - - _createTitle: function(){ - var title = $("

"); - title.text(this._title); - - this.element.append(title); - }, - - _createInputs: function(){ - var inputs = $("
"), - minInputContainer = $("
"), - maxInputContainer = $("
"); - - this._elements.minInput = $("").appendTo(minInputContainer); - this._elements.maxInput = $("").appendTo(maxInputContainer); - - inputs.append("
min
") - .append(minInputContainer) - .append("
max
") - .append(maxInputContainer) - .appendTo(this._elements.sliderZone); - }, - - _createSlider: function(){ - var slider = $("
").appendTo(this._elements.sliderZone); - slider[this._name](); - - this._elements.slider = slider; - }, - - _format: function(value){ - return value; - }, - - _createOptions: function(){ - this._elements.options = $("
").appendTo(this._elements.optionsZone); - - this._createBoundsOptions(); - this._createRangeOptions(); - this._createStepOption(); - this._createWheelModeOption(); - this._createWheelSpeedOption(); - this._createArrowsOption(); - this._createLabelsOption(); - }, - - _createBoundsOptions: function(){ - this._createDT("Bounds"); - - var minSelect = this._createSelect("min", "Bound"), - maxSelect = this._createSelect("max", "Bound"); - - this._addOption(minSelect, 0); - this._addOption(minSelect, 10); - this._addOption(minSelect, 20); - - this._addOption(maxSelect, 100); - this._addOption(maxSelect, 90); - this._addOption(maxSelect, 80); - - minSelect.bind("change", "min", $.proxy(this._changeBound, this)); - maxSelect.bind("change", "max", $.proxy(this._changeBound, this)); - }, - - _changeBound: function(event, ui){ - var value = $(event.target).val(), - bounds = this._getOption("bounds"); - - bounds[event.data] = parseFloat(value); - this._setOption("bounds", bounds); - }, - - _createRangeOptions: function(){ - this._createDT("Range limit"); - - var minSelect = this._createSelect("min", "RangeLimit"), - maxSelect = this._createSelect("max", "RangeLimit"); - - this._fillMinSelect(minSelect); - this._fillMaxSelect(maxSelect); - - minSelect.bind("change", $.proxy(this._minSelectChange, this)); - maxSelect.bind("change", $.proxy(this._maxSelectChange, this)); - }, - - _createStepOption: function(){ - this._createDT("Step"); - - var select = $("").attr("name", name + suffix); - - this._elements.options.append($("
") - .append(name + ":") - .append(select)); - - return select; - }, - - _fillMinSelect: function(select){ - this._addOption(select, "false"); - this._addOption(select, 10); - this._addOption(select, 20); - this._addOption(select, 30); - this._addOption(select, 40); - }, - - _fillMaxSelect: function(select){ - this._addOption(select, "false"); - this._addOption(select, 50); - this._addOption(select, 60); - this._addOption(select, 70); - this._addOption(select, 80); - }, - - _addOption: function(select, text, value){ - var value, - option = $("