Team:Heidelberg/js/toolboxguide
From 2014.igem.org
"use strict";jQuery.base64=(function($){var _PADCHAR="=",_ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_VERSION="1.0";function _getbyte64(s,i){var idx=_ALPHA.indexOf(s.charAt(i));if(idx===-1){throw"Cannot decode base64"}return idx}function _decode(s){var pads=0,i,b10,imax=s.length,x=[];s=String(s);if(imax===0){return s}if(imax%4!==0){throw"Cannot decode base64"}if(s.charAt(imax-1)===_PADCHAR){pads=1;if(s.charAt(imax-2)===_PADCHAR){pads=2}imax-=4}for(i=0;i<imax;i+=4){b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6)|_getbyte64(s,i+3);x.push(String.fromCharCode(b10>>16,(b10>>8)&255,b10&255))}switch(pads){case 1:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6);x.push(String.fromCharCode(b10>>16,(b10>>8)&255));break;case 2:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12);x.push(String.fromCharCode(b10>>16));break}return x.join("")}function _getbyte(s,i){var x=s.charCodeAt(i);if(x>255){throw"INVALID_CHARACTER_ERR: DOM Exception 5"}return x}function _encode(s){if(arguments.length!==1){throw"SyntaxError: exactly one argument required"}s=String(s);var i,b10,x=[],imax=s.length-s.length%3;if(s.length===0){return s}for(i=0;i<imax;i+=3){b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8)|_getbyte(s,i+2);x.push(_ALPHA.charAt(b10>>18));x.push(_ALPHA.charAt((b10>>12)&63));x.push(_ALPHA.charAt((b10>>6)&63));x.push(_ALPHA.charAt(b10&63))}switch(s.length-imax){case 1:b10=_getbyte(s,i)<<16;x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_PADCHAR+_PADCHAR);break;case 2:b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8);x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_ALPHA.charAt((b10>>6)&63)+_PADCHAR);break}return x.join("")}return{decode:_decode,encode:_encode,VERSION:_VERSION}}(jQuery));
ko.bindingHandlers.fadeVisible = {
init: function(element, valueAccessor) { // Initially set the element to be instantly visible/hidden depending on the value var value = valueAccessor(); $(element).toggle(ko.unwrap(value)); // Use "unwrapObservable" so we can handle values that may or may not be observable }, update: function(element, valueAccessor) { // Whenever the value subsequently changes, slowly fade the element in or out var value = valueAccessor(); var scroll = function() {$.scrollTo($(document).height(), {easing:'easeInOutCubic', duration: 800});}; ko.unwrap(value) ? $(element).slideDown(400, 'easeInOutCubic', scroll) : $(element).slideUp(400, 'easeInOutCubic'); }
};
$(document).ready(function() {
$('#pagename').text(wgPageName);
$('#copy-to-clip').click(function() {
window.prompt("Copy to clipboard: Ctrl+C, Enter", $('#comebackurl').text());
});
});
function CircularizationViewModel(hash) { var self = this; self.RFCnumber = '[???]'; self.softwareName = '[hoffentlich nicht LinkIT]'; self.availableExteins = [ { N: 'RGK', C: 'CWE', comment: , notes: ['Efficient, tested by us', 'Large scar'] }, { N: 'RGT', C: 'CWE', comment: , notes: ['Efficient, tested by us', 'Large scar'] }, { N: 'AEY', C: 'CFN' , comment: , notes: ['Efficient, native extein', 'Large scar'] }, { N: 'XXX', C: 'CXX', comment: 'X = native amino acids of the protein', notes: ['Probably less efficient (depends on the protein)', 'Small scar'] }, ];
var data = hash && $.parseJSON($.base64.decode(hash.substr(1))); self.data = { comingBack: data ? data.comingBack : false, q9A: ko.observable(data ? data.q9A : false), //Inserted Question at beginning gotProteinStructure: ko.observable(data && data.gotProteinStructure), q0A: ko.observable(data ? data.q0A : false), hasBsaI: ko.observable(data && data.hasBsaI), q1A: ko.observable(data ? data.q1A : false), useSortase: ko.observable(data && data.useSortase), q2A: ko.observable(data ? data.q2A : false), needsSmt3: ko.observable(data && data.needsSmt3), q3A: ko.observable(data ? data.q3A : false), exteins: ko.observable(data && data.exteins), q4A: ko.observable(data ? data.q4A : false), endsAreClose: ko.observable(data && data.endsAreClose), q5A: ko.observable(data ? data.q5A : false), linkerLength: ko.observable(data && data.linkerLength), q6A: ko.observable(data ? data.q6A : false), testSeveral: ko.observable(data && data.testSeveral), q7A: ko.observable(data ? data.q7A : false), proteinSize: ko.observable(data && data.proteinSize) };
self.hash = ko.computed(function () { self.data.q0A(); self.data.q1A(); self.data.q2A(); self.data.q3A(); self.data.q4A(); self.data.q5A(); self.data.q6A(); self.data.hasBsaI(); self.data.useSortase(); self.data.needsSmt3(); self.data.exteins(); self.data.endsAreClose(); self.data.linkerLength(); self.data.testSeveral();
window.location.hash = $.base64.encode(ko.toJSON(self.data)); console.log(window.location.hash, ko.toJSON(self.data)); return window.location.hash;
});
self.comeBackHash = ko.computed(function () { var tmp = self.data.comingBack; self.data.comingBack = true; var hash = $.base64.encode(ko.toJSON(self.data)); self.data.comingBack = tmp; return hash; }); }
function TaggingViewModel() { var self = this;
self.RFCNumber = "???"; self.EColiTags = [ { tagname: "MinD MTS", Biobrick: "BBa_K1362055", descr: "membrane localization", askFirstStop: true
}, { tagname: "OmpA", Biobrick: "BBa_K1362060", descr: "surface display", askFirstStop: false }, { tagname: "pelB", Biobrick: "BBa_K1362058", descr: "periplasmic localization", askFirstStop: false
} ];
self.EucarioticTags = [ { tagname: "myristoilation signal sequence", Biobrick: "BBa_K1362056", descr: "membrane localization", askFirstStop: false }, { tagname: "PKI-NES", Biobrick: "BBa_K1362059", descr: "cytoplasmic localization", askFirstStop: false }, { tagname: "NLS", Biobrick: "BBa_K1362057", descr: "nuclear localization", askFirstStop: false } ];
self.customTag = { tagname: "Custom", Biobrick: "none", descr: "Your personal tag", askFirstStop: true }; var data; self.data = { q0A: ko.observable(data ? data.q0A : false), hasBSAI: ko.observable(data && data.hasBSAI),
q1A: ko.observable(data ? data.q1A : false), isiGEMHD: ko.observable(data && data.isiGEMHD),
q2A: ko.observable(data ? data.q2A : false), inEColi: ko.observable(data && data.inEColi),
q3A: ko.observable(data ? data.q3A : false), selectedTag: ko.observable(data && data.selectedTag),
q4A: ko.observable(data ? data.q6A : false), addTag: ko.observable(data && data.addTag),
q5A: ko.observable(data ? data.q5A : false), terminus: ko.observable(data && data.terminus),
q6A: ko.observable(data ? data.q6A : false), methionin: ko.observable(data && data.methionin),
q7A: ko.observable(data ? data.q7A : false), stopCodon: ko.observable(data && data.stopCodon),
q8A: ko.observable(data ? data.q8A : false), lightInduced: ko.observable(data && data.lightInduced),
};
}