diff --git a/StarCellBio/jquery.simulate.drag-sortable.js b/StarCellBio/jquery.simulate.drag-sortable.js index 8ebf0739..69e4e08f 100644 --- a/StarCellBio/jquery.simulate.drag-sortable.js +++ b/StarCellBio/jquery.simulate.drag-sortable.js @@ -3,38 +3,46 @@ var opts = $.extend({}, $.fn.simulateDragSortable.defaults, options); applyDrag = function(options) { - var that = this, - options = options || opts, - handle = options.handle ? $(this).find(options.handle)[0] : $(this)[0], - listItem = options.listItem, - placeHolder = options.placeHolder, - sibling = $(this), - moveCounter = Math.floor(options.move), - direction = moveCounter > 0 ? 'down' : 'up', - moveVerticalAmount = 0, - initialVerticalPosition = 0, - extraDrag = !isNaN(parseInt(options.tolerance, 10)) ? function() { return Number(options.tolerance); } : function(obj) { return ($(obj).outerHeight() / 2) + 5; }, - dragPastBy = 0, - dropOn = options.dropOn ? $(options.dropOn) : false, - center = findCenter(handle), - x = Math.floor(center.x), - y = Math.floor(center.y), - mouseUpAfter = (opts.debug ? 2500 : 10); + var that = this; + var options = options || opts; + var handle = options.handle ? $(this).find(options.handle)[0] : $(this)[0]; + var listItem = options.listItem; + var placeHolder = options.placeHolder; + var sibling = $(this); + var moveCounter = Math.floor(options.move); + var direction = moveCounter > 0 ? 'down' : 'up'; + var moveVerticalAmount = 0; + var initialVerticalPosition = 0; + var extraDrag = !isNaN(parseInt(options.tolerance, 10)) ? function() { + return Number(options.tolerance); + } : function(obj) { + return ($(obj).outerHeight() / 2) + 5; + }; + var dragPastBy = 0; + var dropOn = options.dropOn ? $(options.dropOn) : false; + var center = findCenter(handle); + var x = Math.floor(center.x); + var y = Math.floor(center.y); + var mouseUpAfter = (opts.debug ? 2500 : 10); if (dropOn) { if (dropOn.length === 0) { - if (console && console.log) { console.log('simulate.drag-sortable.js ERROR: Drop on target could not be found'); console.log(options.dropOn); } + if (console && console.log) { + console.log('simulate.drag-sortable.js ERROR: Drop on target could not be found'); console.log(options.dropOn); + } return; } sibling = dropOn.find('>*:last'); - moveCounter = -(dropOn.find('>*').length + 1) + (moveCounter + 1); + moveCounter = -(dropOn.find('>*').length + 1) + (moveCounter + 1); if (dropOn.offset().top - $(this).offset().top < 0) { initialVerticalPosition = sibling.offset().top - $(this).offset().top - extraDrag(this); } else { initialVerticalPosition = sibling.offset().top - $(this).offset().top - $(this).height(); } } else if (moveCounter === 0) { - if (console && console.log) { console.log('simulate.drag-sortable.js WARNING: Drag with move set to zero has no effect'); } + if (console && console.log) { + console.log('simulate.drag-sortable.js WARNING: Drag with move set to zero has no effect'); + } return; } else { while (moveCounter !== 0) { @@ -54,22 +62,36 @@ } } - dispatchEvent(handle, 'mousedown', createEvent('mousedown', handle, { clientX: x, clientY: y })); - dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x+1, clientY: y+1 })); + dispatchEvent(handle, 'mousedown', createEvent('mousedown', handle, { + clientX: x, + clientY: y + })); + dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { + clientX: x + 1, + clientY: y + 1 + })); if (dropOn) { slideUpTo(x, y, initialVerticalPosition); y += initialVerticalPosition; - options = jQuery.extend(options, { move: moveCounter }); + options = jQuery.extend(options, { + move: moveCounter + }); delete options.dropOn; setTimeout(function() { - dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y })); + dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { + clientX: x, + clientY: y + })); }, 5); setTimeout(function() { - dispatchEvent(handle, 'mouseup', createEvent('mouseup', handle, { clientX: x, clientY: y })); + dispatchEvent(handle, 'mouseup', createEvent('mouseup', handle, { + clientX: x, + clientY: y + })); setTimeout(function() { if (options.move) { applyDrag.call(that, options); @@ -107,42 +129,71 @@ } setTimeout(function() { - dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y + moveVerticalAmount })); + dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { + clientX: x, + clientY: y + moveVerticalAmount + })); }, 5); setTimeout(function() { - dispatchEvent(handle, 'mouseup', createEvent('mouseup', handle, { clientX: x, clientY: y + moveVerticalAmount })); + dispatchEvent(handle, 'mouseup', createEvent('mouseup', handle, { + clientX: x, + clientY: y + moveVerticalAmount + })); }, mouseUpAfter); }; return this.each(applyDrag); }; function slideUpTo(x, y, targetOffset, goPastBy) { - var moveBy, offset; + var moveBy; + var offset; - if (!goPastBy) { goPastBy = 0; } - if ((targetOffset < 0) && (goPastBy > 0)) { goPastBy = -goPastBy; } + if (!goPastBy) { + goPastBy = 0; + } + if ((targetOffset < 0) && (goPastBy > 0)) { + goPastBy = -goPastBy; + } - for (offset = 0; Math.abs(offset) + 1 < Math.abs(targetOffset + goPastBy); offset += ((targetOffset + goPastBy - offset)/2) ) { - dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y + Math.ceil(offset) })); + for (offset = 0; Math.abs(offset) + 1 < Math.abs(targetOffset + goPastBy); offset += ((targetOffset + goPastBy - offset) / 2)) { + dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { + clientX: x, + clientY: y + Math.ceil(offset) + })); } offset = targetOffset + goPastBy; - dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y + offset })); - for (; Math.abs(offset) - 1 >= Math.abs(targetOffset); offset += ((targetOffset - offset)/2) ) { - dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y + Math.ceil(offset) })); + dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { + clientX: x, + clientY: y + offset + })); + for (; Math.abs(offset) - 1 >= Math.abs(targetOffset); offset += ((targetOffset - offset) / 2)) { + dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { + clientX: x, + clientY: y + Math.ceil(offset) + })); } - dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y + targetOffset })); + dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { + clientX: x, + clientY: y + targetOffset + })); } function createEvent(type, target, options) { var evt; var e = $.extend({ target: target, - preventDefault: function() { }, - stopImmediatePropagation: function() { }, - stopPropagation: function() { }, - isPropagationStopped: function() { return true; }, - isImmediatePropagationStopped: function() { return true; }, - isDefaultPrevented: function() { return true; }, + preventDefault: function() {}, + stopImmediatePropagation: function() {}, + stopPropagation: function() {}, + isPropagationStopped: function() { + return true; + }, + isImmediatePropagationStopped: function() { + return true; + }, + isDefaultPrevented: function() { + return true; + }, bubbles: true, cancelable: (type != 'mousemove'), view: window, @@ -168,7 +219,11 @@ } else if (document.createEventObject) { evt = document.createEventObject(); $.extend(evt, e); - evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button; + evt.button = { + 0: 1, + 1: 4, + 2: 2 + }[evt.button] || evt.button; } return evt; } @@ -183,8 +238,8 @@ } function findCenter(el) { - var elm = $(el), - o = elm.offset(); + var elm = $(el); + var o = elm.offset(); return { x: o.left + elm.outerWidth() / 2, y: o.top + elm.outerHeight() / 2 diff --git a/html_app/assignments/decusability/AddMultipleDialog.js b/html_app/assignments/decusability/AddMultipleDialog.js index 19551087..b1942217 100644 --- a/html_app/assignments/decusability/AddMultipleDialog.js +++ b/html_app/assignments/decusability/AddMultipleDialog.js @@ -1,103 +1,105 @@ var decusability = decusability || {}; decusability.static = decusability.static || {}; -decusability.static.scb_mit706s16_inner_dialog_add = function (element, dialog, state) { +decusability.static.scb_mit706s16_inner_dialog_add = function(element, dialog, state) { - $('input[type="checkbox"]:checked', dialog).each(function (e) { - var element = $(this); - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var treatment_id = $(element).attr('treatment_id'); - var cell_line = $(element).attr('cell_line'); - var name = $(element).attr('name'); - $(element).attr('aria-checked',true); - var parsed = scb.ui.static.MainFrame.validate_state({ - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'add_many_dialog_box', - skip_hash_update: true - }); + $('input[type="checkbox"]:checked', dialog).each(function(e) { + var element = $(this); + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var treatment_id = $(element).attr('treatment_id'); + var cell_line = $(element).attr('cell_line'); + var name = $(element).attr('name'); + $(element).attr('aria-checked', true); + var parsed = scb.ui.static.MainFrame.validate_state({ + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'add_many_dialog_box', + skip_hash_update: true + }); - var template = parsed.assignment.template; - var rows = template.ui.add_multiple_dialog[cell_line].rows; - var row = _.find(rows, function (eh) { - return eh.treatment_id == treatment_id; - }); - var cell_treatments_array = row.cell_treatments[name]; - _.each(cell_treatments_array, function (eh) { - parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); - }); + var template = parsed.assignment.template; + var rows = template.ui.add_multiple_dialog[cell_line].rows; + var row = _.find(rows, function(eh) { + return eh.treatment_id == treatment_id; + }); + var cell_treatments_array = row.cell_treatments[name]; + _.each(cell_treatments_array, function(eh) { + parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); }); + }); - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); } -decusability.register = function (dialog, state) { - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_dialog', function (e) { - var container = dialog; - if (container.has(e.target).length === 0) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - } - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_cancel', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_add', function (e) { - decusability.static.scb_mit706s16_inner_dialog_add(this, dialog, state); - $(this).focus(); - }); +decusability.register = function(dialog, state) { + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_dialog', function(e) { + var container = dialog; + if (container.has(e.target).length === 0) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + } + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_cancel', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_add', function(e) { + decusability.static.scb_mit706s16_inner_dialog_add(this, dialog, state); + $(this).focus(); + }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select_all', function (e) { - $('input[type=checkbox]' , dialog).attr('checked','checked'); - $('input[type=checkbox]' , dialog).attr('aria-checked',true); - }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select_all', function(e) { + $('input[type=checkbox]', dialog).attr('checked', 'checked'); + $('input[type=checkbox]', dialog).attr('aria-checked', true); + }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_title_close', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - }); - scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function (e) { - $(this, dialog).attr('aria-checked',$(this, dialog).attr('aria-checked') =='false' ? true : false); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select', function (e) { - var cell_line = $(this).attr('cell_line'); - var name = $(this).attr('name'); - $('input[type=checkbox][name="'+name+'"][cell_line="'+cell_line+'"]' , dialog).attr('checked','checked'); - $('input[type=checkbox][name="'+name+'"][cell_line="'+cell_line+'"]' , dialog).attr('aria-checked',true); - }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_title_close', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + }); + scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function(e) { + $(this, dialog).attr('aria-checked', $(this, dialog).attr('aria-checked') == 'false' ? true : false); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select', function(e) { + var cell_line = $(this).attr('cell_line'); + var name = $(this).attr('name'); + $('input[type=checkbox][name="' + name + '"][cell_line="' + cell_line + '"]', dialog).attr('checked', 'checked'); + $('input[type=checkbox][name="' + name + '"][cell_line="' + cell_line + '"]', dialog).attr('aria-checked', true); + }); } -decusability.setup = function (state) { - var workarea = state.workarea; - var assignment = state.assignment; - var experiment = state.experiment; - var template = state.assignment.template; - var onClose = state.close; +decusability.setup = function(state) { + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.assignment.template; + var onClose = state.close; - var dialog = $("
"); - dialog.html(decusability.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); + var dialog = $("
"); + dialog.html(decusability.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); - dialog.appendTo($(workarea)); - decusability.register($(dialog), state); + dialog.appendTo($(workarea)); + decusability.register($(dialog), state); - var css = scb.utils.get(state, ['source_state', 'css']); - _.each( css , function(v,k){ - dialog.css(k,v); - }); + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); - $('.scb_mit706s16_dialog').draggable({handle:'.scb_mit706s16_inner_dialog_title'}) + $('.scb_mit706s16_dialog').draggable({ + handle: '.scb_mit706s16_inner_dialog_title' + }) } diff --git a/html_app/assignments/decusability/assignment.js b/html_app/assignments/decusability/assignment.js index 9e377578..d4f6e2c9 100644 --- a/html_app/assignments/decusability/assignment.js +++ b/html_app/assignments/decusability/assignment.js @@ -1,402 +1,569 @@ var __decusability = { - id: 'decusability', - name: 'StarCellBio Usability Test', - course: 'usability', - course_name: 'December 2013 Usability Testing', - description: 'FACS and Western Blot for temperature sensitive mutants', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal & Introduction', 'Here come instructions when we build them'] + id: 'decusability', + name: 'StarCellBio Usability Test', + course: 'usability', + course_name: 'December 2013 Usability Testing', + description: 'FACS and Western Blot for temperature sensitive mutants', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal & Introduction', 'Here come instructions when we build them'] + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs'], + gel_types: ['.10', '.12', '.15'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: false + } + ] + }, + { + kind: 'temperature', + title: 'Temperature', + editable: false + }, + { + kind: 'actions', + title: 'Actions' + } ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs'], - gel_types: ['.10', '.12', '.15'] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: false} - ] - }, - {kind: 'temperature', title: 'Temperature', editable: false}, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%, %PP1% %TEMPERATURE%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + '%CONCENTRATION%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], + map: ['concentrations', '%KEY%', 'name'] + }, + '%TEMPERATURE%': { + attr: ['treatment_list', 'list', '0', 'temperature'], + map: ['experiment_temperatures', '%KEY%', 'name'] + }, + '%PP1%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '1', 'drug_id'], + map: ['drugs', '%KEY%', 'short_name'], + default: '' + } + } + }, + add_multiple_dialog: { + 'wt': { + title: 'Strain: Wild Type', + headings: ['Treatment', 'Temperature', ''], + rows: [ + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,25', + cell_treatments: { + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' + } + ] + } + } ] + } }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%, %PP1% %TEMPERATURE%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']}, - '%CONCENTRATION%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], - map: ['concentrations', '%KEY%', 'name']}, - '%TEMPERATURE%': { - attr: ['treatment_list', 'list', '0', 'temperature'], - map: ['experiment_temperatures', '%KEY%', 'name']}, - '%PP1%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '1', 'drug_id'], - map: ['drugs', '%KEY%', 'short_name'], default: ''} + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' } - }, - add_multiple_dialog: { - 'wt': { - title: 'Strain: Wild Type', - headings: ['Treatment', 'Temperature', ''], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + ], + treatment_id: 'media_only,40', + cell_treatments: { + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '40' } + ] + } + } + ] + } + } - ] - }, - 'm1': { - title: 'Strain: Mutant 1', + ] + }, + 'm1': { + title: 'Strain: Mutant 1', - headings: ['Treatment', 'Temperature', ''], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - NOPP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + headings: ['Treatment', 'Temperature', ''], + rows: [ + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,25', + cell_treatments: { + NOPP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - NOPP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' } - ] - + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'text', + text: 'Growth Media' }, - 'm2': { - title: 'Strain: Mutant 2', - - headings: [ 'Treatment', 'Temperature', ''], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - NOPP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,40', + cell_treatments: { + NOPP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - NOPP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '40' } - ] - - } + ] + } + } + ] + } } - }, - add_new_row_instructions: 'add new row instructions', + ] - concentrations: { - '0': { - name: '', - value: 0 - } }, - drugs: { - 'nc': { - name: 'Growth Media', - concentrations: [0] - } + 'm2': { + title: 'Strain: Mutant 2', - }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" + headings: ['Treatment', 'Temperature', ''], + rows: [ + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,25', + cell_treatments: { + NOPP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } }, - '40': { - name: "37" + degreeEntity + "C" + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,40', + cell_treatments: { + NOPP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '40' + } + ] + } + } + ] + } } - }, + ] - cell_lines: { - 'wt': { - name: 'Wild Type' - }, - 'm1': { - name: 'Mutant 1' - }, - 'm2': { - name: 'Mutant 2' - } + } + } + }, + add_new_row_instructions: 'add new row instructions', - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['cdk2', 'cyclin', 'cyclinE', 'pgk1'], - 'cdk2': { - name: 'rabbit anti-cdk2', - secondary: ['r'], - marks: [ - {weight: 33, intensity: 0}, - {weight: 34, intensity: 0}, - {weight: 35, intensity: 0} - ], - gel_name: 'cdk2' - }, - 'cyclin': { - name: 'mouse anti-cyclin B', - secondary: ['m'], - marks: [ - {weight: 58, intensity: 0} - ], - gel_name: 'cyclin B' + concentrations: { + '0': { + name: '', + value: 0 + } + }, + drugs: { + 'nc': { + name: 'Growth Media', + concentrations: [0] + } + + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + }, + '40': { + name: "37" + degreeEntity + "C" + } + }, + + cell_lines: { + 'wt': { + name: 'Wild Type' + }, + 'm1': { + name: 'Mutant 1' + }, + 'm2': { + name: 'Mutant 2' + } + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['cdk2', 'cyclin', 'cyclinE', 'pgk1'], + 'cdk2': { + name: 'rabbit anti-cdk2', + secondary: ['r'], + marks: [ + { + weight: 33, + intensity: 0 + }, + { + weight: 34, + intensity: 0 + }, + { + weight: 35, + intensity: 0 + } + ], + gel_name: 'cdk2' + }, + 'cyclin': { + name: 'mouse anti-cyclin B', + secondary: ['m'], + marks: [ + { + weight: 58, + intensity: 0 + } + ], + gel_name: 'cyclin B' + }, + 'cyclinE': { + name: 'mouse anti-cyclin E', + secondary: ['m'], + marks: [ + { + weight: 48, + intensity: 0 + } + ], + gel_name: 'cyclin E' + }, + 'pgk1': { + name: 'rabbit anti-pgk1', + secondary: ['r'], + marks: [ + { + weight: 45, + intensity: 0 + } + ], + gel_name: 'pgk1' + } + }, + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'whole': { + name: 'PI', + conditions: { + 'whole': { + name: 'PI' + } + } + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '*ANY*', + marks: [ + { + name: 'Cyclin B', + weight: 58, + intensity: 2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 4, + primary_anti_body: ['cyclinE'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } + + ] }, - 'cyclinE': { - name: 'mouse anti-cyclin E', - secondary: ['m'], - marks: [ - {weight: 48, intensity: 0} - ], - gel_name: 'cyclin E' + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'wt', + marks: [] }, - 'pgk1': { - name: 'rabbit anti-pgk1', - secondary: ['r'], - marks: [ - {weight: 45, intensity: 0} - ], - gel_name: 'pgk1' - } - }, - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm1', + temperature: '40', + marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + } + ] }, - 'r': { - name: 'goat anti-rabbit' - } - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - } - }, - facs_kinds: { - 'whole': { - name: 'PI', - conditions: { - 'whole': {name: 'PI'} + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm2', + temperature: '40', + marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] } + ] } - }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '*ANY*', - marks: [ - { - name: 'Cyclin B', - weight: 58, - intensity: 2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } - - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'wt', - marks: [] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm1', - temperature: '40', - marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm2', - temperature: '40', - marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - } - ] - } + ] + } + }, + facs: { + 'dna': { + 'parser_simple': [ + { + match: [], + shape: 'normal' }, - facs: { - 'dna': { - 'parser_simple': [ - { - match: [], - shape: 'normal' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm1', - temperature: 40, - shape: 'g2-block' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm2', - temperature: 40, - shape: 'S-block' - } - ] - - } + { + match: ['cell_line', 'temperature'], + cell_line: 'm1', + temperature: 40, + shape: 'g2-block' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm2', + temperature: 40, + shape: 'S-block' } + ] + } + } } + } }; diff --git a/html_app/assignments/microscopy_usability/AddMultipleDialog.js b/html_app/assignments/microscopy_usability/AddMultipleDialog.js index 6eab9933..6477e20a 100644 --- a/html_app/assignments/microscopy_usability/AddMultipleDialog.js +++ b/html_app/assignments/microscopy_usability/AddMultipleDialog.js @@ -1,103 +1,105 @@ var microscopy_usability = microscopy_usability || {}; microscopy_usability.static = microscopy_usability.static || {}; -microscopy_usability.static.scb_mit706s16_inner_dialog_add = function (element, dialog, state) { +microscopy_usability.static.scb_mit706s16_inner_dialog_add = function(element, dialog, state) { - $('input[type="checkbox"]:checked', dialog).each(function (e) { - var element = $(this); - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var treatment_id = $(element).attr('treatment_id'); - var cell_line = $(element).attr('cell_line'); - var name = $(element).attr('name'); - $(element).attr('aria-checked',true); - var parsed = scb.ui.static.MainFrame.validate_state({ - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'add_many_dialog_box', - skip_hash_update: true - }); + $('input[type="checkbox"]:checked', dialog).each(function(e) { + var element = $(this); + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var treatment_id = $(element).attr('treatment_id'); + var cell_line = $(element).attr('cell_line'); + var name = $(element).attr('name'); + $(element).attr('aria-checked', true); + var parsed = scb.ui.static.MainFrame.validate_state({ + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'add_many_dialog_box', + skip_hash_update: true + }); - var template = parsed.assignment.template; - var rows = template.ui.add_multiple_dialog[cell_line].rows; - var row = _.find(rows, function (eh) { - return eh.treatment_id == treatment_id; - }); - var cell_treatments_array = row.cell_treatments[name]; - _.each(cell_treatments_array, function (eh) { - parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); - }); + var template = parsed.assignment.template; + var rows = template.ui.add_multiple_dialog[cell_line].rows; + var row = _.find(rows, function(eh) { + return eh.treatment_id == treatment_id; + }); + var cell_treatments_array = row.cell_treatments[name]; + _.each(cell_treatments_array, function(eh) { + parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); }); + }); - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); } -microscopy_usability.register = function (dialog, state) { - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_dialog', function (e) { - var container = dialog; - if (container.has(e.target).length === 0) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - } - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_cancel', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_add', function (e) { - microscopy_usability.static.scb_mit706s16_inner_dialog_add(this, dialog, state); - $(this).focus(); - }); +microscopy_usability.register = function(dialog, state) { + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_dialog', function(e) { + var container = dialog; + if (container.has(e.target).length === 0) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + } + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_cancel', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_add', function(e) { + microscopy_usability.static.scb_mit706s16_inner_dialog_add(this, dialog, state); + $(this).focus(); + }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select_all', function (e) { - $('input[type=checkbox]' , dialog).attr('checked','checked'); - $('input[type=checkbox]' , dialog).attr('aria-checked',true); - }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select_all', function(e) { + $('input[type=checkbox]', dialog).attr('checked', 'checked'); + $('input[type=checkbox]', dialog).attr('aria-checked', true); + }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_title_close', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - }); - scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function (e) { - $(this, dialog).attr('aria-checked',$(this, dialog).attr('aria-checked') =='false' ? true : false); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select', function (e) { - var cell_line = $(this).attr('cell_line'); - var name = $(this).attr('name'); - $('input[type=checkbox][name="'+name+'"][cell_line="'+cell_line+'"]' , dialog).attr('checked','checked'); - $('input[type=checkbox][name="'+name+'"][cell_line="'+cell_line+'"]' , dialog).attr('aria-checked',true); - }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_title_close', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + }); + scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function(e) { + $(this, dialog).attr('aria-checked', $(this, dialog).attr('aria-checked') == 'false' ? true : false); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select', function(e) { + var cell_line = $(this).attr('cell_line'); + var name = $(this).attr('name'); + $('input[type=checkbox][name="' + name + '"][cell_line="' + cell_line + '"]', dialog).attr('checked', 'checked'); + $('input[type=checkbox][name="' + name + '"][cell_line="' + cell_line + '"]', dialog).attr('aria-checked', true); + }); } -microscopy_usability.setup = function (state) { - var workarea = state.workarea; - var assignment = state.assignment; - var experiment = state.experiment; - var template = state.assignment.template; - var onClose = state.close; +microscopy_usability.setup = function(state) { + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.assignment.template; + var onClose = state.close; - var dialog = $("
"); - dialog.html(microscopy_usability.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); + var dialog = $("
"); + dialog.html(microscopy_usability.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); - dialog.appendTo($(workarea)); - microscopy_usability.register($(dialog), state); + dialog.appendTo($(workarea)); + microscopy_usability.register($(dialog), state); - var css = scb.utils.get(state, ['source_state', 'css']); - _.each( css , function(v,k){ - dialog.css(k,v); - }); + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); - $('.scb_mit706s16_dialog').draggable({handle:'.scb_mit706s16_inner_dialog_title'}) + $('.scb_mit706s16_dialog').draggable({ + handle: '.scb_mit706s16_inner_dialog_title' + }) } diff --git a/html_app/assignments/microscopy_usability/assignment.js b/html_app/assignments/microscopy_usability/assignment.js index 1b2948bc..a38e932d 100644 --- a/html_app/assignments/microscopy_usability/assignment.js +++ b/html_app/assignments/microscopy_usability/assignment.js @@ -1,1095 +1,1649 @@ var __june_2014_usability = { - id: 'microscopy_usability', - name: 'Microscopy Usability Test', - course: 'usability', - course_name: 'StarCellBio Usability Testing', - description: 'Microscopy Test of images', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal & Introduction', 'Here come instructions when we build them'] + id: 'microscopy_usability', + name: 'Microscopy Usability Test', + course: 'usability', + course_name: 'StarCellBio Usability Testing', + description: 'Microscopy Test of images', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal & Introduction', 'Here come instructions when we build them'] + ], + ui: { + experimental_design: { + techniques: ['micro'], + gel_types: ['.10', '.12', '.15'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: false + }, + { + kind: 'collection', + title: 'Timepoints', + editable: false + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } ], - ui: { - experimental_design: { - techniques: [ 'micro'], - gel_types: ['.10', '.12', '.15'] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: false}, - {kind: 'collection', title: 'Timepoints', editable: false} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ + actions: [] + }, + microscopy: { + disable_blur: false, + disable_brightness: false + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%, %COLLECTION%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + '%COLLECTION%': { + attr: ['treatment_list', 'list', '0', 'collection_id'], + map: ['collections', '%KEY%', 'name'] + } + } + }, + add_multiple_dialog: { + order: ['wt', 'cko'], + headings: [ + '', 'Strains', 'Treatments', 'Timepoints' + ], + 'wt': { + rows: [ + { + cells: [ + { + kind: 'checkbox', + name: "control", + treatment_id: 'controlV3' + }, + { + kind: 'text', + text: 'Wild type' + }, + { + kind: 'text', + text: 'Control Virus' + }, + { + kind: 'text', + text: "3 months" + } + ], + treatment_id: 'controlV3', + cell_treatments: { + control: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + collection_id: '3 m', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ae', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } ] + } }, - microscopy: { - disable_blur: false, - disable_brightness: false - }, - western_blot: { - format: "%CELL_LINE%, %TREATMENT%, %COLLECTION%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']}, - '%COLLECTION%': { - attr: ['treatment_list', 'list', '0', 'collection_id'], - map: ['collections', '%KEY%', 'name']} + { + cells: [ + { + kind: 'checkbox', + name: "control", + treatment_id: 'controlV6' + }, + { + kind: 'text', + text: 'Wild type' + }, + { + kind: 'text', + text: 'Control Virus' + }, + { + kind: 'text', + text: "6 months" } - }, - add_multiple_dialog: { - order: ['wt', 'cko'], - headings: [ - '', 'Strains', 'Treatments', 'Timepoints' - ], - 'wt': { - rows: [ + ], + treatment_id: 'controlV6', + cell_treatments: { + control: [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "control", treatment_id: 'controlV3'}, - {kind: 'text', text: 'Wild type'}, - {kind: 'text', text: 'Control Virus'}, - {kind: 'text', text: "3 months"} - ], - treatment_id: 'controlV3', - cell_treatments: { - control: [ - {cell_line: 'wt', - treatment_list: {list: [ - {collection_id: '3 m', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ae', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'checkbox', name: "control", treatment_id: 'controlV6'}, - {kind: 'text', text: 'Wild type'}, - {kind: 'text', text: 'Control Virus'}, - {kind: 'text', text: "6 months"} - ], - treatment_id: 'controlV6', - cell_treatments: { - control: [ - {cell_line: 'wt', - treatment_list: {list: [ - {collection_id: '6 m', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ae', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } + collection_id: '6 m', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ae', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } - }, + }, + { + cells: [ + { + kind: 'checkbox', + name: "control", + treatment_id: 'controlV1' + }, + { + kind: 'text', + text: 'Wild type' + }, + { + kind: 'text', + text: 'Control Virus' + }, + { + kind: 'text', + text: "1 year" + } + ], + treatment_id: 'controlV1', + cell_treatments: { + control: [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "control", treatment_id: 'controlV1'}, - {kind: 'text', text: 'Wild type'}, - {kind: 'text', text: 'Control Virus'}, - {kind: 'text', text: "1 year"} - ], - treatment_id: 'controlV1', - cell_treatments: { - control: [ - {cell_line: 'wt', - treatment_list: {list: [ - {collection_id: '1 yr', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ae', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } + collection_id: '1 yr', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ae', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } - }, + }, + { + cells: [ + { + kind: 'checkbox', + name: "cre", + treatment_id: 'creV3' + }, + { + kind: 'text', + text: 'Wild type' + }, + { + kind: 'text', + text: 'Cre Virus' + }, + { + kind: 'text', + text: "3 months" + } + ], + treatment_id: 'creV3', + cell_treatments: { + cre: [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "cre", treatment_id: 'creV3'}, - {kind: 'text', text: 'Wild type'}, - {kind: 'text', text: 'Cre Virus'}, - {kind: 'text', text: "3 months"} - ], - treatment_id: 'creV3', - cell_treatments: { - cre: [ - {cell_line: 'wt', - treatment_list: {list: [ - {collection_id: '3 m', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ac', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } + collection_id: '3 m', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ac', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } - }, + }, + { + + cells: [ + { + kind: 'checkbox', + name: "cre", + treatment_id: 'creV6' + }, + { + kind: 'text', + text: 'Wild type' + }, + { + kind: 'text', + text: 'Cre Virus' + }, + { + kind: 'text', + text: "6 months" + } + ], + treatment_id: 'creV6', + cell_treatments: { + cre: [ + { + cell_line: 'wt', + treatment_list: { + list: [ { + collection_id: '6 m', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ac', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } + + }, + { - cells: [ - {kind: 'checkbox', name: "cre", treatment_id: 'creV6'}, - {kind: 'text', text: 'Wild type'}, - {kind: 'text', text: 'Cre Virus'}, - {kind: 'text', text: "6 months"} - ], - treatment_id: 'creV6', - cell_treatments: { - cre: [ - {cell_line: 'wt', - treatment_list: {list: [ - {collection_id: '6 m', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ac', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } - }, + cells: [ + { + kind: 'checkbox', + name: "cre", + treatment_id: 'creV1' + }, + { + kind: 'text', + text: 'Wild type' + }, + { + kind: 'text', + text: 'Cre Virus' + }, + { + kind: 'text', + text: "1 year" + } + ], + treatment_id: 'creV1', + cell_treatments: { + cre: [ + { + cell_line: 'wt', + treatment_list: { + list: [ { + collection_id: '1 yr', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ac', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } + } - cells: [ - {kind: 'checkbox', name: "cre", treatment_id: 'creV1'}, - {kind: 'text', text: 'Wild type'}, - {kind: 'text', text: 'Cre Virus'}, - {kind: 'text', text: "1 year"} - ], - treatment_id: 'creV1', - cell_treatments: { - cre: [ - {cell_line: 'wt', - treatment_list: {list: [ - {collection_id: '1 yr', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ac', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } + ] + }, + 'cko': { + rows: [ + { + cells: [ + { + kind: 'checkbox', + name: "control", + treatment_id: 'controlV3' + }, + { + kind: 'text', + text: 'Conditional KO' + }, + { + kind: 'text', + text: 'Control Virus' + }, + { + kind: 'text', + text: "3 months" + } + ], + treatment_id: 'controlV3', + cell_treatments: { + control: [ + { + cell_line: 'cko', + treatment_list: { + list: [ + { + collection_id: '3 m', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ae', + concentration_id: '108' + } + ] + }, + temperature: '22' } + ] + } + } + ] + } - ] + }, + { + + cells: [ + { + kind: 'checkbox', + name: "control", + treatment_id: 'controlV6' + }, + { + kind: 'text', + text: 'Conditional KO' }, - 'cko': { - rows: [ + { + kind: 'text', + text: 'Control Virus' + }, + { + kind: 'text', + text: "6 months" + } + ], + treatment_id: 'controlV6', + cell_treatments: { + control: [ + { + cell_line: 'cko', + treatment_list: { + list: [ { + collection_id: '6 m', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ae', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } + - cells: [ - {kind: 'checkbox', name: "control", treatment_id: 'controlV3'}, - {kind: 'text', text: 'Conditional KO'}, - {kind: 'text', text: 'Control Virus'}, - {kind: 'text', text: "3 months"} - ], - treatment_id: 'controlV3', - cell_treatments: { - control: [ - {cell_line: 'cko', - treatment_list: {list: [ - {collection_id: '3 m', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ae', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } - }, + }, + { + + cells: [ + { + kind: 'checkbox', + name: "control", + treatment_id: 'controlV1' + }, + { + kind: 'text', + text: 'Conditional KO' + }, + { + kind: 'text', + text: 'Control Virus' + }, + { + kind: 'text', + text: "1 year" + } + ], + treatment_id: 'controlV1', + cell_treatments: { + control: [ + { + cell_line: 'cko', + treatment_list: { + list: [ { + collection_id: '1 yr', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ae', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } - cells: [ - {kind: 'checkbox', name: "control", treatment_id: 'controlV6'}, - {kind: 'text', text: 'Conditional KO'}, - {kind: 'text', text: 'Control Virus'}, - {kind: 'text', text: "6 months"} - ], - treatment_id: 'controlV6', - cell_treatments: { - control: [ - {cell_line: 'cko', - treatment_list: {list: [ - {collection_id: '6 m', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ae', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } - }, + + }, + { + + cells: [ + { + kind: 'checkbox', + name: "cre", + treatment_id: 'creV3' + }, + { + kind: 'text', + text: 'Conditional KO' + }, + { + kind: 'text', + text: 'Cre Virus' + }, + { + kind: 'text', + text: "3 months" + } + ], + treatment_id: 'creV3', + cell_treatments: { + cre: [ + { + cell_line: 'cko', + treatment_list: { + list: [ { + collection_id: '3 m', + microscope: ['HnE'], + conditions: { + 'Dye': ['HnE'] + }, + drug_list: { + list: [ + { + drug_id: 'ac', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } - cells: [ - {kind: 'checkbox', name: "control", treatment_id: 'controlV1'}, - {kind: 'text', text: 'Conditional KO'}, - {kind: 'text', text: 'Control Virus'}, - {kind: 'text', text: "1 year"} - ], - treatment_id: 'controlV1', - cell_treatments: { - control: [ - {cell_line: 'cko', - treatment_list: {list: [ - {collection_id: '1 yr', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ae', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } + }, + { - }, + cells: [ + { + kind: 'checkbox', + name: "cre", + treatment_id: 'creV6' + }, + { + kind: 'text', + text: 'Conditional KO' + }, + { + kind: 'text', + text: 'Cre Virus' + }, + { + kind: 'text', + text: "6 months" + } + ], + treatment_id: 'creV6', + cell_treatments: { + cre: [ + { + cell_line: 'cko', + treatment_list: { + list: [ { + collection_id: '6 m', + microscope: ['HnE', 'ki67', 'cgrp'], + conditions: { + 'Dye': ['HnE'], + 'IHC': ['cgrp', 'ki67'] + }, + drug_list: { + list: [ + { + drug_id: 'ac', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } - cells: [ - {kind: 'checkbox', name: "cre", treatment_id: 'creV3'}, - {kind: 'text', text: 'Conditional KO'}, - {kind: 'text', text: 'Cre Virus'}, - {kind: 'text', text: "3 months"} - ], - treatment_id: 'creV3', - cell_treatments: { - cre: [ - {cell_line: 'cko', - treatment_list: {list: [ - {collection_id: '3 m', microscope: ['HnE'], - conditions: { - 'Dye': ['HnE'] - }, - drug_list: {list: [ - {drug_id: 'ac', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } - }, + }, + { + + + cells: [ + { + kind: 'checkbox', + name: "cre", + treatment_id: 'creV1' + }, + { + kind: 'text', + text: 'Conditional KO' + }, + { + kind: 'text', + text: 'Cre Virus' + }, + { + kind: 'text', + text: "1 year" + } + ], + treatment_id: 'creV1', + cell_treatments: { + cre: [ + { + cell_line: 'cko', + treatment_list: { + list: [ { + collection_id: '1 yr', + microscope: ['HnE', 'cgrp', 'rgb'], + conditions: { + 'Dye': ['HnE'], + 'IHC': ['cgrp'], + 'IF': ['rgb'] + }, + drug_list: { + list: [ + { + drug_id: 'ac', + concentration_id: '108' + } + ] + }, + temperature: '22' + } + ] + } + } + ] + } + } + ] + } - cells: [ - {kind: 'checkbox', name: "cre", treatment_id: 'creV6'}, - {kind: 'text', text: 'Conditional KO'}, - {kind: 'text', text: 'Cre Virus'}, - {kind: 'text', text: "6 months"} - ], - treatment_id: 'creV6', - cell_treatments: { - cre: [ - {cell_line: 'cko', - treatment_list: {list: [ - {collection_id: '6 m', microscope: ['HnE', 'ki67', 'cgrp'], - conditions: { - 'Dye': ['HnE'], - 'IHC': ['cgrp', 'ki67'] - }, - drug_list: {list: [ - {drug_id: 'ac', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } + } + }, + add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs', + collections: { + '3 m': { + name: '3 months' + }, + '6 m': { + name: '6 months' + }, + '1 yr': { + name: '1 year' + } + }, + concentrations: { - }, - { + '108': { + name: '10^8 PFU', + value: 1000 + } + }, + drugs: { + 'ac': { + name: 'Cre Virus', + concentrations: ['108'] + }, + 'ae': { + name: 'Control Virus', + concentrations: ['108'] + } + }, + experiment_temperatures: { + '22': { + name: "22" + degreeEntity + "C" + } + }, + cell_lines: { + 'wt': { + name: 'Wild Type', + full_name: 'Wild Type' + }, + 'cko': { + name: 'Conditional KO', + full_name: 'Conditional KO' + } - cells: [ - {kind: 'checkbox', name: "cre", treatment_id: 'creV1'}, - {kind: 'text', text: 'Conditional KO'}, - {kind: 'text', text: 'Cre Virus'}, - {kind: 'text', text: "1 year"} - ], - treatment_id: 'creV1', - cell_treatments: { - cre: [ - {cell_line: 'cko', - treatment_list: {list: [ - {collection_id: '1 yr', microscope: ['HnE', 'cgrp', 'rgb'], - conditions: { - 'Dye': ['HnE'], - 'IHC': ['cgrp'], - 'IF': ['rgb'] - }, - drug_list: {list: [ - {drug_id: 'ac', concentration_id: '108'} - ]}, temperature: '22' - } - ]}} - ] - } - } + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['cdk2', 'cyclin', 'cyclinE', 'pgk1'], + 'cdk2': { + name: 'rabbit anti-cdk2', + secondary: ['r'], + marks: [ + { + weight: 33, + intensity: 0 + }, + { + weight: 34, + intensity: 0 + }, + { + weight: 35, + intensity: 0 + } + ], + gel_name: 'cdk2' + }, + 'cyclin': { + name: 'mouse anti-cyclin B', + secondary: ['m'], + marks: [ + { + weight: 58, + intensity: 0 + } + ], + gel_name: 'cyclin B' + }, + 'cyclinE': { + name: 'mouse anti-cyclin E', + secondary: ['m'], + marks: [ + { + weight: 48, + intensity: 0 + } + ], + gel_name: 'cyclin E' + }, + 'pgk1': { + name: 'rabbit anti-pgk1', + secondary: ['r'], + marks: [ + { + weight: 45, + intensity: 0 + } + ], + gel_name: 'pgk1' + } + }, // + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, // + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'whole': { + name: 'PI', + conditions: { + 'whole': { + name: 'PI' + } + } + } + }, + micro_kinds: { + 'IF': { + name: 'Antibody-labeling IF', + conditions: { + 'rgb': { + name: 'Nfib (red), DAPI (blue), control (green)', + short_name: 'R:Nfib, G:control, B:DAPI' + } + } + }, + 'IHC': { + name: 'Antibody-labeling IHC', + conditions: { + 'ki67': { + name: 'Ki-67 (brown), hematoxylin (blue)', + short_name: 'IHC: Ki-67' + }, + 'cgrp': { + name: 'CGRP (brown), hematoxylin (blue)', + short_name: 'IHC: CGRP' + } + } + }, + 'Dye': { + name: 'Dye/Stain', + conditions: { + 'HnE': { + name: 'Hematoxylin and Eosin (H&E)', + short_name: 'Dye: H&E' + } + } - ] - } + }, + 'na': { + name: 'None' + } + }, + slides: { + 'img1': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_1/AD20E1_20x.jpg', + 'img2': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_2/AD20E2_20x.jpg', + 'img3': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_3/AD22E1_20x.jpg', + 'img4': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_3/AD22E1_40x.jpg', + 'img5': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_4/AD27E2_20x.jpg', + 'img6': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_5/AD1024E_3_20x.jpg', + 'img7': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_6/AD901_8_4x.jpg', + 'img8': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_7/AD901_50_4x.jpg', + 'img9': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_8/AD901_52_4x.jpg', + 'img10': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_9/AD1021E_20x.jpg', - } + 'img11': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_1/AD1024E_2_20x.jpg', + 'img12': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_2/AD1024E_10x.jpeg', + 'img13': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_2/AD1024E_20x.jpeg', - }, + 'img14': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_1/AD900E1_40x.jpg', + 'img15': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_2/AD900E3_20x.jpg', + 'img16': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_2/AD900E3_40x.jpg', + 'img17': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_3/AD987E1_40x-3.jpg', + 'img18': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_4m/AD901E25-1_he_20x.jpg', + 'img19': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_4m/AD901E25-1_he_40x.jpg', + 'img20': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_5m/AD901E25-2_he_40x-2.jpg', + 'img21': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_6m/AD901E25-3_he_20x.jpg', + 'img22': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_6m/AD901E25-3_he_40x.jpg', + 'img23': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_2only_20x.jpeg', + 'img24': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_2only_40x.jpeg', + 'img25': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_ki-67_20x.jpeg', + 'img26': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_ki-67_40xadj.jpg', + 'img27': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_2/AD901E25-2_2only_40x.jpg', + 'img28': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_2/AD901E25-2_ki-67_40xadj.jpg', + 'img29': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_2only_20x-2.jpeg', + 'img30': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_2only_40x-2.jpeg', + 'img31': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_ki-67_20x-2.jpeg', + 'img32': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_ki-67_40x-2.jpeg', - add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs', - collections: { - '3 m': { - name: '3 months' - }, - '6 m': { - name: '6 months' - }, - '1 yr': { - name: '1 year' - } - }, + 'img33': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_1/AD985E-1_20x-2.jpg', + 'img34': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_2/AD985E-1_20x.jpg', + 'img35': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_4X-2.jpg', + 'img36': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_10X.jpg', + 'img37': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_20X.jpg', + 'img38': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_4/AD990E-1_20x.jpg', + 'img39': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_5m/AD1017_HE_20X.jpg', + 'img40': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_6m/AD3587E_HE_20X-1-2.jpg', + 'img41': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_blue_advanced4.jpeg', + 'img42': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_green_advanced4.jpeg', + 'img43': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_merge_advanced4.jpeg', + 'img44': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_red_advanced4.jpeg', + 'img45': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_2/AD3172E-02_60X_merge.jpg', + 'img46': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_3/AD984E2-01_R3D_D3D_PRJ_617_528_457_60X_merge.jpg', + 'img47': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_blue.jpeg', + 'img48': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_green.jpeg', + 'img49': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_merge.jpeg', + 'img50': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_red.jpeg', + 'img51': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_blue.jpeg', + 'img52': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_green.jpeg', + 'img53': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_merge.jpeg', + 'img54': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_red.jpeg', + 'img55': 'images/microscopy/microscopy_test/lung_1yr/match/Sample_1/AD1017_NFIB_20X.jpg', + 'img56': 'images/microscopy/microscopy_test/lung_1yr/match/Sample_2/AD3587E_NFIB_20X-1.jpg', + 'img60': 'images/microscopy/microscopy_test/lung_1yr/CGRP_IHC/35873587E_advanced_strong_10X.jpg', + 'img61': 'images/microscopy/microscopy_test/lung_1yr/CGRP_IHC/AD3172E_Nfib_10X_strong-2-0001.jpg', + 'img62': 'images/microscopy/microscopy_test/lung_1yr/CGRP_IHC/35883588E_advanced_strong_20X.jpg', - concentrations: { + 'img63': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/31723172E_early_strong_20X-2.jpg', + 'img64': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/AD1017_NFIB_20X.jpg', + 'img65': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/35253525E_early_weak_20X.jpg', + 'img66': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/35873587E_early_strong_20X.jpg', + 'img67': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/AD3587E_NFIB_20X-1.jpg' - '108': { - name: '10^8 PFU', - value: 1000 - } - }, - drugs: { - 'ac': { - name: 'Cre Virus', - concentrations: ['108'] - }, - 'ae': { - name: 'Control Virus', - concentrations: ['108'] - } - }, - experiment_temperatures: { - '22': { - name: "22" + degreeEntity + "C" - } - }, - cell_lines: { - 'wt': { - name: 'Wild Type', - full_name: 'Wild Type' - }, - 'cko': { - name: 'Conditional KO', - full_name: 'Conditional KO' - } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '*ANY*', + marks: [ + { + name: 'Cyclin B', + weight: 58, + intensity: 2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 4, + primary_anti_body: ['cyclinE'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['cdk2', 'cyclin', 'cyclinE', 'pgk1'], - 'cdk2': { - name: 'rabbit anti-cdk2', - secondary: ['r'], - marks: [ - {weight: 33, intensity: 0}, - {weight: 34, intensity: 0}, - {weight: 35, intensity: 0} - ], - gel_name: 'cdk2' + ] }, - 'cyclin': { - name: 'mouse anti-cyclin B', - secondary: ['m'], - marks: [ - {weight: 58, intensity: 0} - ], - gel_name: 'cyclin B' + { + transfer_function: 'delta', + cutoff: 1, + drug: 'pp1', + cell_line: '*ANY*', + above_marks: [ + { + name: 'Cdk2', + weight: 33, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + } + ], + below_marks: [ + { + name: 'Cdk2', + weight: 34, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + } + ] }, - 'cyclinE': { - name: 'mouse anti-cyclin E', - secondary: ['m'], - marks: [ - {weight: 48, intensity: 0} - ], - gel_name: 'cyclin E' + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'wt', + marks: [] }, - 'pgk1': { - name: 'rabbit anti-pgk1', - secondary: ['r'], - marks: [ - {weight: 45, intensity: 0} - ], - gel_name: 'pgk1' - } - },// - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm1', + temperature: '40', + marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + } + ] }, - 'r': { - name: 'goat anti-rabbit' - } - },// - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - } - }, - facs_kinds: { - 'whole': { - name: 'PI', - conditions: { - 'whole': {name: 'PI'} + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm2', + temperature: '40', + marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] } - } - }, - micro_kinds: { - 'IF': { - name: 'Antibody-labeling IF', - conditions: { - 'rgb': {name: 'Nfib (red), DAPI (blue), control (green)', - short_name: 'R:Nfib, G:control, B:DAPI'} + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Nocodazole', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] } + ] }, - 'IHC': { - name: 'Antibody-labeling IHC', - conditions: { - 'ki67': {name: 'Ki-67 (brown), hematoxylin (blue)', - short_name: 'IHC: Ki-67'}, - 'cgrp': {name: 'CGRP (brown), hematoxylin (blue)', - short_name: 'IHC: CGRP'} + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Hydroxyurea', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] } + ] }, - 'Dye': { - name: 'Dye/Stain', - conditions: { - 'HnE': {name: 'Hematoxylin and Eosin (H&E)', - short_name: 'Dye: H&E'} + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Alpha', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 34, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] } - + ] + } + ] + } + }, + facs: { + 'dna': { + 'parser_simple': [ + { + match: [], + shape: 'normal' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm1', + temperature: 40, + shape: 'g2-block' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm2', + temperature: 40, + shape: 'S-block' }, - 'na': { - name: 'None' + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Nocodazole', + shape: 'g2-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Alpha', + shape: 'alpha-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Hydroxyurea', + shape: 'S-block' } - }, - slides: { - 'img1': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_1/AD20E1_20x.jpg', - 'img2': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_2/AD20E2_20x.jpg', - 'img3': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_3/AD22E1_20x.jpg', - 'img4': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_3/AD22E1_40x.jpg', - 'img5': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_4/AD27E2_20x.jpg', - 'img6': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_5/AD1024E_3_20x.jpg', - 'img7': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_6/AD901_8_4x.jpg', - 'img8': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_7/AD901_50_4x.jpg', - 'img9': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_8/AD901_52_4x.jpg', - 'img10': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_9/AD1021E_20x.jpg', - - 'img11': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_1/AD1024E_2_20x.jpg', - 'img12': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_2/AD1024E_10x.jpeg', - 'img13': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_2/AD1024E_20x.jpeg', + ] - 'img14': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_1/AD900E1_40x.jpg', - 'img15': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_2/AD900E3_20x.jpg', - 'img16': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_2/AD900E3_40x.jpg', - 'img17': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_3/AD987E1_40x-3.jpg', - 'img18': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_4m/AD901E25-1_he_20x.jpg', - 'img19': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_4m/AD901E25-1_he_40x.jpg', - 'img20': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_5m/AD901E25-2_he_40x-2.jpg', - 'img21': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_6m/AD901E25-3_he_20x.jpg', - 'img22': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_6m/AD901E25-3_he_40x.jpg', - 'img23': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_2only_20x.jpeg', - 'img24': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_2only_40x.jpeg', - 'img25': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_ki-67_20x.jpeg', - 'img26': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_ki-67_40xadj.jpg', - 'img27': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_2/AD901E25-2_2only_40x.jpg', - 'img28': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_2/AD901E25-2_ki-67_40xadj.jpg', - 'img29': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_2only_20x-2.jpeg', - 'img30': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_2only_40x-2.jpeg', - 'img31': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_ki-67_20x-2.jpeg', - 'img32': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_ki-67_40x-2.jpeg', - - 'img33': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_1/AD985E-1_20x-2.jpg', - 'img34': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_2/AD985E-1_20x.jpg', - 'img35': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_4X-2.jpg', - 'img36': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_10X.jpg', - 'img37': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_20X.jpg', - 'img38': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_4/AD990E-1_20x.jpg', - 'img39': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_5m/AD1017_HE_20X.jpg', - 'img40': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_6m/AD3587E_HE_20X-1-2.jpg', - 'img41': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_blue_advanced4.jpeg', - 'img42': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_green_advanced4.jpeg', - 'img43': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_merge_advanced4.jpeg', - 'img44': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_red_advanced4.jpeg', - 'img45': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_2/AD3172E-02_60X_merge.jpg', - 'img46': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_3/AD984E2-01_R3D_D3D_PRJ_617_528_457_60X_merge.jpg', - 'img47': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_blue.jpeg', - 'img48': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_green.jpeg', - 'img49': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_merge.jpeg', - 'img50': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_red.jpeg', - 'img51': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_blue.jpeg', - 'img52': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_green.jpeg', - 'img53': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_merge.jpeg', - 'img54': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_red.jpeg', - 'img55': 'images/microscopy/microscopy_test/lung_1yr/match/Sample_1/AD1017_NFIB_20X.jpg', - 'img56': 'images/microscopy/microscopy_test/lung_1yr/match/Sample_2/AD3587E_NFIB_20X-1.jpg', - - 'img60': 'images/microscopy/microscopy_test/lung_1yr/CGRP_IHC/35873587E_advanced_strong_10X.jpg', - 'img61': 'images/microscopy/microscopy_test/lung_1yr/CGRP_IHC/AD3172E_Nfib_10X_strong-2-0001.jpg', - 'img62': 'images/microscopy/microscopy_test/lung_1yr/CGRP_IHC/35883588E_advanced_strong_20X.jpg', - - 'img63': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/31723172E_early_strong_20X-2.jpg', - 'img64': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/AD1017_NFIB_20X.jpg', - 'img65': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/35253525E_early_weak_20X.jpg', - 'img66': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/35873587E_early_strong_20X.jpg', - 'img67': 'images/microscopy/microscopy_test/lung_6m/CGRP_IHC/AD3587E_NFIB_20X-1.jpg' - - - }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '*ANY*', - marks: [ - { - name: 'Cyclin B', - weight: 58, - intensity: 2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } - - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'pp1', - cell_line: '*ANY*', - above_marks: [ - { - name: 'Cdk2', - weight: 33, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - } - ], - below_marks: [ - { - name: 'Cdk2', - weight: 34, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'wt', - marks: [ - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm1', - temperature: '40', - marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm2', - temperature: '40', - marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Nocodazole', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Hydroxyurea', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Alpha', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 34, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - } - ] - } + } + }, + microscopy: { + 'valid': ['cko', 'ac'], + 'slide': { + 'parser_simple': [ + { + match: ['cell_line'], + cell_line: 'wt', + imgs_hash: [ + [ + { + hash: 'img2', + mag: '20x' + } + ], + [ + { + hash: 'img3', + mag: '20x' + } + ], + [ + { + hash: 'img4', + mag: '40x' + } + ], + [ + { + hash: 'img5', + mag: '20x' + } + ], + [ + { + hash: 'img6', + mag: '20x' + } + ], + [ + { + hash: 'img7', + mag: '4x' + } + ], + [ + { + hash: 'img8', + mag: '4x' + } + ], + [ + { + hash: 'img9', + mag: '4x' + } + ] + ] }, - facs: { - 'dna': { - 'parser_simple': [ - { - match: [], - shape: 'normal' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm1', - temperature: 40, - shape: 'g2-block' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm2', - temperature: 40, - shape: 'S-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Nocodazole', - shape: 'g2-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Alpha', - shape: 'alpha-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Hydroxyurea', - shape: 'S-block' - } - ] - - } + /* Conditional KO */ + { + match: ['cell_line', 'drug_id'], + cell_line: 'cko', + drug_id: 'ae', + imgs_hash: [ + [ + { + hash: 'img2', + mag: '20x' + } + ], + [ + { + hash: 'img3', + mag: '20x' + } + ], + [ + { + hash: 'img4', + mag: '40x' + } + ], + [ + { + hash: 'img5', + mag: '20x' + } + ], + [ + { + hash: 'img6', + mag: '20x' + } + ], + [ + { + hash: 'img7', + mag: '4x' + } + ], + [ + { + hash: 'img8', + mag: '4x' + } + ], + [ + { + hash: 'img9', + mag: '4x' + } + ] + ] }, - microscopy: { - 'valid': ['cko', 'ac'], - 'slide': { - 'parser_simple': [ - { - match: ['cell_line'], - cell_line: 'wt', - imgs_hash: [ - [ - {hash: 'img2', mag: '20x' } - ], - [ - {hash: 'img3', mag: '20x' } - ], - [ - {hash: 'img4', mag: '40x' } - ], - [ - {hash: 'img5', mag: '20x' } - ], - [ - {hash: 'img6', mag: '20x' } - ], - [ - {hash: 'img7', mag: '4x' } - ], - [ - {hash: 'img8', mag: '4x' } - ], - [ - {hash: 'img9', mag: '4x' } - ] - ] - }, - /* Conditional KO */ - { - match: ['cell_line', 'drug_id'], - cell_line: 'cko', - drug_id: 'ae', - imgs_hash: [ - [ - {hash: 'img2', mag: '20x' } - ], - [ - {hash: 'img3', mag: '20x' } - ], - [ - {hash: 'img4', mag: '40x' } - ], - [ - {hash: 'img5', mag: '20x' } - ], - [ - {hash: 'img6', mag: '20x' } - ], - [ - {hash: 'img7', mag: '4x' } - ], - [ - {hash: 'img8', mag: '4x' } - ], - [ - {hash: 'img9', mag: '4x' } - ] - ] - }, - - { /* 3 months*/ - match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], - cell_line: 'cko', - drug_id: 'ac', - collection_id: '3 m', - kind: 'Dye', - conditions: 'HnE', - imgs_hash: [ - [ - {hash: 'img11', mag: '20x' } - ], - [ - {hash: 'img12', mag: '10x' } - ], - [ - {hash: 'img13', mag: '20x' } - ] - ] - }, - { /* 6 months*/ - match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], - cell_line: 'cko', - drug_id: 'ac', - collection_id: '6 m', - kind: 'Dye', - conditions: 'HnE', - imgs_hash: [ - [ - {hash: 'img14', mag: '40x' } - ], - [ - {hash: 'img15', mag: '20x' } - ], - [ - {hash: 'img16', mag: '40x' } - ], - [ - {hash: 'img17', mag: '40x' } - ], - [ - {hash: 'img18', mag: '20x' } - ], - [ - {hash: 'img19', mag: '40x' } - ], - [ - {hash: 'img20', mag: '40x' } - ], - [ - {hash: 'img21', mag: '20x' } - ], - [ - {hash: 'img22', mag: '40x' } - ] - ] - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], - cell_line: 'cko', - drug_id: 'ac', - collection_id: '6 m', - kind: 'IHC', - conditions: 'cgrp', - imgs_hash: [ - [ - {hash: 'img63', mag: '20x' } - ], - [ - {hash: 'img64', mag: '20x' } - ], - [ - {hash: 'img65', mag: '20x' } - ], - [ - {hash: 'img66', mag: '20x' } - ], - [ - {hash: 'img67', mag: '20x' } - ] - ] - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], - cell_line: 'cko', - drug_id: 'ac', - collection_id: '6 m', - kind: 'IHC', - conditions: 'ki67', - imgs_hash: [ - [ - {hash: 'img25', mag: '20x' } - ], - [ - {hash: 'img26', mag: '40x' } - ], - [ - {hash: 'img28', mag: '40x' } - ], - [ - {hash: 'img31', mag: '20x' } - ], - [ - {hash: 'img32', mag: '40x' } - ] - ] - }, - /* 1 year */ - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], - cell_line: 'cko', - drug_id: 'ac', - collection_id: '1 yr', - kind: 'IHC', - conditions: 'cgrp', - imgs_hash: [ - [ - {hash: 'img60', mag: '10x' } - ], - [ - {hash: 'img61', mag: '10x' } - ], - [ - {hash: 'img62', mag: '20x' } - ] - ] - }, - - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], - cell_line: 'cko', - drug_id: 'ac', - collection_id: '1 yr', - kind: 'Dye', - conditions: 'HnE', - imgs_hash: [ - [ - {hash: 'img33', mag: '20x' } - ], - [ - {hash: 'img34', mag: '20x' } - ], - [ - {hash: 'img35', mag: '4x' } - ], - [ - {hash: 'img36', mag: '10x' } - ], - [ - {hash: 'img37', mag: '20x' } - ], - [ - {hash: 'img38', mag: '20x' } - ], - [ - {hash: 'img39', mag: '20x' } - ], - [ - {hash: 'img40', mag: '20x' } - ] - ] - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], - cell_line: 'cko', - drug_id: 'ac', - collection_id: '1 yr', - kind: 'IF', - conditions: 'rgb', - imgs_hash: [ - [ - {hash: 'img41', mag: '60x', if_type: 'blue' }, - {hash: 'img42', mag: '60x', if_type: 'green' }, - {hash: 'img43', mag: '60x', if_type: 'merge' }, - {hash: 'img44', mag: '60x', if_type: 'red' } - ], - [ - {hash: 'img45', mag: '60x', if_type: 'merge' } - ], - [ - {hash: 'img46', mag: '60x', if_type: 'merge' } - ], - [ - {hash: 'img47', mag: '60x', if_type: 'blue' }, - {hash: 'img48', mag: '60x', if_type: 'green' }, - {hash: 'img49', mag: '60x', if_type: 'merge' }, - {hash: 'img50', mag: '60x', if_type: 'red' } - ], - [ - {hash: 'img51', mag: '60x', if_type: 'blue' }, - {hash: 'img52', mag: '60x', if_type: 'green' }, - {hash: 'img53', mag: '60x', if_type: 'merge' }, - {hash: 'img54', mag: '60x', if_type: 'red' } - ] - ] - } + { /* 3 months*/ + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'cko', + drug_id: 'ac', + collection_id: '3 m', + kind: 'Dye', + conditions: 'HnE', + imgs_hash: [ + [ + { + hash: 'img11', + mag: '20x' + } + ], + [ + { + hash: 'img12', + mag: '10x' + } + ], + [ + { + hash: 'img13', + mag: '20x' + } + ] + ] + }, + { /* 6 months*/ + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'cko', + drug_id: 'ac', + collection_id: '6 m', + kind: 'Dye', + conditions: 'HnE', + imgs_hash: [ + [ + { + hash: 'img14', + mag: '40x' + } + ], + [ + { + hash: 'img15', + mag: '20x' + } + ], + [ + { + hash: 'img16', + mag: '40x' + } + ], + [ + { + hash: 'img17', + mag: '40x' + } + ], + [ + { + hash: 'img18', + mag: '20x' + } + ], + [ + { + hash: 'img19', + mag: '40x' + } + ], + [ + { + hash: 'img20', + mag: '40x' + } + ], + [ + { + hash: 'img21', + mag: '20x' + } + ], + [ + { + hash: 'img22', + mag: '40x' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'cko', + drug_id: 'ac', + collection_id: '6 m', + kind: 'IHC', + conditions: 'cgrp', + imgs_hash: [ + [ + { + hash: 'img63', + mag: '20x' + } + ], + [ + { + hash: 'img64', + mag: '20x' + } + ], + [ + { + hash: 'img65', + mag: '20x' + } + ], + [ + { + hash: 'img66', + mag: '20x' + } + ], + [ + { + hash: 'img67', + mag: '20x' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'cko', + drug_id: 'ac', + collection_id: '6 m', + kind: 'IHC', + conditions: 'ki67', + imgs_hash: [ + [ + { + hash: 'img25', + mag: '20x' + } + ], + [ + { + hash: 'img26', + mag: '40x' + } + ], + [ + { + hash: 'img28', + mag: '40x' + } + ], + [ + { + hash: 'img31', + mag: '20x' + } + ], + [ + { + hash: 'img32', + mag: '40x' + } + ] + ] + }, + /* 1 year */ + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'cko', + drug_id: 'ac', + collection_id: '1 yr', + kind: 'IHC', + conditions: 'cgrp', + imgs_hash: [ + [ + { + hash: 'img60', + mag: '10x' + } + ], + [ + { + hash: 'img61', + mag: '10x' + } + ], + [ + { + hash: 'img62', + mag: '20x' + } + ] + ] + }, - ] + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'cko', + drug_id: 'ac', + collection_id: '1 yr', + kind: 'Dye', + conditions: 'HnE', + imgs_hash: [ + [ + { + hash: 'img33', + mag: '20x' + } + ], + [ + { + hash: 'img34', + mag: '20x' + } + ], + [ + { + hash: 'img35', + mag: '4x' + } + ], + [ + { + hash: 'img36', + mag: '10x' + } + ], + [ + { + hash: 'img37', + mag: '20x' + } + ], + [ + { + hash: 'img38', + mag: '20x' + } + ], + [ + { + hash: 'img39', + mag: '20x' + } + ], + [ + { + hash: 'img40', + mag: '20x' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'cko', + drug_id: 'ac', + collection_id: '1 yr', + kind: 'IF', + conditions: 'rgb', + imgs_hash: [ + [ + { + hash: 'img41', + mag: '60x', + if_type: 'blue' + }, + { + hash: 'img42', + mag: '60x', + if_type: 'green' + }, + { + hash: 'img43', + mag: '60x', + if_type: 'merge' + }, + { + hash: 'img44', + mag: '60x', + if_type: 'red' + } + ], + [ + { + hash: 'img45', + mag: '60x', + if_type: 'merge' + } + ], + [ + { + hash: 'img46', + mag: '60x', + if_type: 'merge' + } + ], + [ + { + hash: 'img47', + mag: '60x', + if_type: 'blue' + }, + { + hash: 'img48', + mag: '60x', + if_type: 'green' + }, + { + hash: 'img49', + mag: '60x', + if_type: 'merge' + }, + { + hash: 'img50', + mag: '60x', + if_type: 'red' + } + ], + [ + { + hash: 'img51', + mag: '60x', + if_type: 'blue' + }, + { + hash: 'img52', + mag: '60x', + if_type: 'green' + }, + { + hash: 'img53', + mag: '60x', + if_type: 'merge' + }, + { + hash: 'img54', + mag: '60x', + if_type: 'red' + } + ] - } + ] } + ] + } + } + } + } }; diff --git a/html_app/assignments/mit706s14/AddMultipleDialog.js b/html_app/assignments/mit706s14/AddMultipleDialog.js index 76caeb34..664aa7c3 100644 --- a/html_app/assignments/mit706s14/AddMultipleDialog.js +++ b/html_app/assignments/mit706s14/AddMultipleDialog.js @@ -1,100 +1,102 @@ var mit706s14 = mit706s14 || {}; mit706s14.static = mit706s14.static || {}; -mit706s14.static.scb_mit706s16_inner_dialog_add = function (element, dialog, state) { +mit706s14.static.scb_mit706s16_inner_dialog_add = function(element, dialog, state) { - $('input[type="checkbox"]:checked', dialog).each(function (e) { - var element = $(this); - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var treatment_id = $(element).attr('treatment_id'); - var cell_line = $(element).attr('cell_line'); - var name = $(element).attr('name'); - $(element).attr('aria-checked',true); - var parsed = scb.ui.static.MainFrame.validate_state({ - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'add_many_dialog_box', - skip_hash_update: true - }); + $('input[type="checkbox"]:checked', dialog).each(function(e) { + var element = $(this); + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var treatment_id = $(element).attr('treatment_id'); + var cell_line = $(element).attr('cell_line'); + var name = $(element).attr('name'); + $(element).attr('aria-checked', true); + var parsed = scb.ui.static.MainFrame.validate_state({ + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'add_many_dialog_box', + skip_hash_update: true + }); - var template = parsed.assignment.template; - var rows = template.ui.add_multiple_dialog[cell_line].rows; -// var row = _.find(rows[0].cell_treatments, function (eh) { -// return eh[0].treatment_id == treatment_id; -// }); - var cell_treatments_array = rows[0].cell_treatments[name]; - _.each(cell_treatments_array, function (eh) { - parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); - }); + var template = parsed.assignment.template; + var rows = template.ui.add_multiple_dialog[cell_line].rows; + // var row = _.find(rows[0].cell_treatments, function (eh) { + // return eh[0].treatment_id == treatment_id; + // }); + var cell_treatments_array = rows[0].cell_treatments[name]; + _.each(cell_treatments_array, function(eh) { + parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); }); + }); - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); } -mit706s14.register = function (dialog, state) { - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s14_dialog', function (e) { - var container = dialog; - if (container.has(e.target).length === 0) { - $(dialog).detach(); - $('.contact_overlay').remove(); - } - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_cancel', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_add', function (e) { - mit706s14.static.scb_mit706s16_inner_dialog_add(this, dialog, state); - $(this).focus(); - }); +mit706s14.register = function(dialog, state) { + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s14_dialog', function(e) { + var container = dialog; + if (container.has(e.target).length === 0) { + $(dialog).detach(); + $('.contact_overlay').remove(); + } + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_cancel', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_add', function(e) { + mit706s14.static.scb_mit706s16_inner_dialog_add(this, dialog, state); + $(this).focus(); + }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select_all', function (e) { - $('input[type=checkbox]' , dialog).attr('checked','checked'); - $('input[type=checkbox]' , dialog).attr('aria-checked',true); - }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select_all', function(e) { + $('input[type=checkbox]', dialog).attr('checked', 'checked'); + $('input[type=checkbox]', dialog).attr('aria-checked', true); + }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_title_close', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - }); - scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function (e) { - $(this, dialog).attr('aria-checked',$(this, dialog).attr('aria-checked') =='false' ? true : false); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select', function (e) { - var cell_line = $(this).attr('cell_line'); - var name = $(this).attr('name'); - $('input[type=checkbox][name="'+name+'"]' , dialog).attr('checked','checked'); - $('input[type=checkbox][name="'+name+'"]' , dialog).attr('aria-checked',true); - }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_title_close', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + }); + scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function(e) { + $(this, dialog).attr('aria-checked', $(this, dialog).attr('aria-checked') == 'false' ? true : false); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select', function(e) { + var cell_line = $(this).attr('cell_line'); + var name = $(this).attr('name'); + $('input[type=checkbox][name="' + name + '"]', dialog).attr('checked', 'checked'); + $('input[type=checkbox][name="' + name + '"]', dialog).attr('aria-checked', true); + }); } -mit706s14.setup = function (state) { - var workarea = state.workarea; - var assignment = state.assignment; - var experiment = state.experiment; - var template = state.assignment.template; - var onClose = state.close; +mit706s14.setup = function(state) { + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.assignment.template; + var onClose = state.close; - var dialog = $("
"); - dialog.html(mit706s14.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); + var dialog = $("
"); + dialog.html(mit706s14.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); - dialog.appendTo($(workarea)); - mit706s14.register($(dialog), state); + dialog.appendTo($(workarea)); + mit706s14.register($(dialog), state); - var css = scb.utils.get(state, ['source_state', 'css']); - _.each( css , function(v,k){ - dialog.css(k,v); - }); + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); - $('.scb_mit706s14_dialog').draggable({handle:'.scb_mit706s16_inner_dialog_title'}) + $('.scb_mit706s14_dialog').draggable({ + handle: '.scb_mit706s16_inner_dialog_title' + }) } diff --git a/html_app/assignments/mit706s14/assignment.js b/html_app/assignments/mit706s14/assignment.js index 5b1dcfa9..9d7c0424 100644 --- a/html_app/assignments/mit706s14/assignment.js +++ b/html_app/assignments/mit706s14/assignment.js @@ -1,2318 +1,2946 @@ var __assignment_706_2014 = { - id: 'assignment_706_2014', - name: 'StarCellBio Problem 1', - course: '7.06_Spring_2014', - course_name: 'Class', - description: 'Microscopy Test of images', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal & Introduction', 'Here come instructions when we build them'] + id: 'assignment_706_2014', + name: 'StarCellBio Problem 1', + course: '7.06_Spring_2014', + course_name: 'Class', + description: 'Microscopy Test of images', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal & Introduction', 'Here come instructions when we build them'] + ], + ui: { + experimental_design: { + techniques: ['wb', 'micro'], + gel_types: ['.10', '.12', '.15'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: true + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: true + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'micro'], - gel_types: ['.10', '.12', '.15'] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: true}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: true} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - ] - }, - western_blot: { - format: "%CELL_LINE%, %TREATMENT%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']} + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + } + } + }, + microscopy: { + disable_blur: true, + disable_brightness: true + }, + add_multiple_dialog: { + order: ['gfp', 'gfp1', 'gfp2', 'gfp3', 'gfp4', 'gfp5', 'gfpH', 'gfp100', 'gfpTD'], + headings: [ + 'Strain', 'Growth media only', 'Growth media + ligand', 'Growth media + inhibitor', + 'Growth media + ligand + inhibitor' + ], + 'gfp': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' } - }, - microscopy: { - disable_blur: true, - disable_brightness: true - }, - add_multiple_dialog: { - order: ['gfp', 'gfp1', 'gfp2', 'gfp3', 'gfp4', 'gfp5', 'gfpH', 'gfp100', 'gfpTD'], - headings: [ - 'Strain', 'Growth media only', 'Growth media + ligand', 'Growth media + inhibitor', - 'Growth media + ligand + inhibitor' - ], - 'gfp': { - rows: [ - { - cells: [ - {kind: 'text', text: 'GFP'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], + ], - cell_treatments: { - G: [ - {cell_line: 'gfp', - treatment_id: 'media_only', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, - temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp', - treatment_id: 'ligand_media', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, - temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, - temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - }} - ]}} - ] - } - } - ] - }, - 'gfp1': { - rows: [ + cell_treatments: { + G: [ + { + cell_line: 'gfp', + treatment_id: 'media_only', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Protein A'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp1', - treatment_id: 'media_only', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp1', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp1', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp1', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - }, - 'gfp2': { - rows: [ + ] + } + } + ], + L: [ + { + cell_line: 'gfp', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Protein B'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp2', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp2', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp2', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp2', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - }, - 'gfp3': { - rows: [ + ] + } + } + ], + I: [ + { + cell_line: 'gfp', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Protein C'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp3', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp3', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - }} - ]}} - ], I: [ - {cell_line: 'gfp3', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp3', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - }, - 'gfp4': { - rows: [ + ] + } + } + ], + A: [ + { + cell_line: 'gfp', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Protein D'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp4', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp4', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp4', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp4', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] + ] + } + } + ] + } + } + ] + }, + 'gfp1': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein A' }, - 'gfp5': { - rows: [ - { - cells: [ - {kind: 'text', text: 'GFP-Protein E'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], - cell_treatments: { - G: [ - {cell_line: 'gfp5', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp5', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp5', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp5', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + cell_treatments: { + G: [ + { + cell_line: 'gfp1', + treatment_id: 'media_only', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - }, - 'gfpH': { - rows: [ + ] + } + } + ], + L: [ + { + cell_line: 'gfp1', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Histone H2B'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfpH', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfpH', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfpH', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfpH', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - - }, - 'gfp100': { - rows: [ + ] + } + } + ], + I: [ + { + cell_line: 'gfp1', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-p100'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp100', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp100', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp100', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp100', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - - }, - 'gfpTD': { - rows: [ + ] + } + } + ], + A: [ + { + cell_line: 'gfp1', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-pTD'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfpTD', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfpTD', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - }} - ]}} - ], I: [ - {cell_line: 'gfpTD', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfpTD', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - - ] - - } - - } - - }, - - add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs', - collections: { - '': { - name: '' - } - }, - concentrations: { - 100: { - name: '', - value: 100 - } - }, - drugs: { - 'gm': { - name: 'Growth media only', - concentrations: ['100'] - }, - 'gml': { - name: 'Growth media + ligand', - concentrations: ['100'] - }, - 'gmi': { - name: 'Growth media + inhibitor', - concentrations: ['100'] - }, - 'gmil': { - name: 'Growth media + ligand + inhibitor', - concentrations: ['100'] - } - }, - experiment_temperatures: { - '22': { - name: "22" + degreeEntity + "C" + ] + } + } + ] + } } + ] }, - cell_lines: { - 'gfp': { - name: 'GFP' - }, - 'gfp1': { - name: 'GFP-Protein A' - }, - 'gfp2': { - name: 'GFP-Protein B' - }, - 'gfp3': { - name: 'GFP-Protein C' - }, - 'gfp4': { - name: 'GFP-Protein D' - }, - 'gfp5': { - name: 'GFP-Protein E' - }, - 'gfpH': { - name: 'GFP-Histone H2B' - }, - 'gfp100': { - name: 'GFP-p100' - }, - 'gfpTD': { - name: 'GFP-pTD' - } + 'gfp2': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein B' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['mp1', 'mp2', 'mp3', 'mp4', 'mp5', 'mpAG'], - 'mp1': { - name: 'mouse anti-phospho-protein A', - secondary: ['m'], - marks: [ - {weight: 46, intensity: 0} - ], - gel_name: 'P-Protein A' - }, - 'mp2': { - name: 'mouse anti-phospho-protein B', - secondary: ['m'], - marks: [ - {weight: 134, intensity: 0} - ], - gel_name: 'P-Protein B' - }, - 'mp3': { - name: 'mouse anti-phospho-protein C', - secondary: ['m'], - marks: [ - {weight: 44, intensity: 0} - ], - gel_name: 'P-Protein C' - }, - 'mp4': { - name: 'mouse anti-phospho-protein D', - secondary: ['m'], - marks: [ - {weight: 67, intensity: 0} + cell_treatments: { + G: [ + { + cell_line: 'gfp2', + treatment_id: 'media_only', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } ], - gel_name: 'P-Protein D' - }, - 'mp5': { - name: 'mouse anti-phospho-protein E', - secondary: ['m'], - marks: [ - {weight: 74, intensity: 0} + L: [ + { + cell_line: 'gfp2', + treatment_id: 'ligand_media', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } ], - gel_name: 'P-Protein E' - }, - 'mpAG': { - name: 'rabbit anti-GAPDH', - secondary: ['r'], - marks: [ - {weight: 37, intensity: 0} + I: [ + { + cell_line: 'gfp2', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } ], - gel_name: 'GAPDH' - } - },// - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' - }, - 'r': { - name: 'goat anti-rabbit' - } - },// - lysate_kinds: { - 'whole': { - name: 'Whole Cell' + A: [ + { + cell_line: 'gfp2', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } } + ] }, - micro_kinds: { - 'IF': { - name: 'Fluorescence', - conditions: { - 'rgb': {name: 'GFP (green)', - short_name: 'G:GFP'} + 'gfp3': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein C' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' } - }, - 'na': { - name: 'None' - } - }, - slides: { - 'img1': 'images/microscopy/assignment_706_2014/c1.jpg', - 'img2': 'images/microscopy/assignment_706_2014/c4.jpg', - 'img3': 'images/microscopy/assignment_706_2014/c7.jpg', - 'img4': 'images/microscopy/assignment_706_2014/c10.jpg', - 'img40': 'images/microscopy/assignment_706_2014/c15-1.jpg', - 'img41': 'images/microscopy/assignment_706_2014/c15-2.jpg', - 'img6': 'images/microscopy/assignment_706_2014/c17.jpg', - 'img42': 'images/microscopy/assignment_706_2014/c25.jpg', - 'img7': 'images/microscopy/assignment_706_2014/c26.jpg', - 'img8': 'images/microscopy/assignment_706_2014/c29.jpg', - + ], - 'img9': 'images/microscopy/assignment_706_2014/cn2.jpg', - 'img10': 'images/microscopy/assignment_706_2014/cn3.jpg', - 'img11': 'images/microscopy/assignment_706_2014/cn5.jpg', - 'img12': 'images/microscopy/assignment_706_2014/cn6.jpg', - 'img13': 'images/microscopy/assignment_706_2014/cn7.jpg', - 'img14': 'images/microscopy/assignment_706_2014/cn8.jpg', - 'img16': 'images/microscopy/assignment_706_2014/cn11.jpg', - 'img17': 'images/microscopy/assignment_706_2014/cn12.jpg', - 'img18': 'images/microscopy/assignment_706_2014/cn15.jpg', - 'img19': 'images/microscopy/assignment_706_2014/cn17.jpg', - 'img20': 'images/microscopy/assignment_706_2014/cn20.jpg', - - 'img21': 'images/microscopy/assignment_706_2014/n1.jpg', - 'img22': 'images/microscopy/assignment_706_2014/n2.jpg', - 'img23': 'images/microscopy/assignment_706_2014/n8.jpg', - 'img24': 'images/microscopy/assignment_706_2014/n9.jpg', - 'img26': 'images/microscopy/assignment_706_2014/n18.jpg', - 'img29': 'images/microscopy/assignment_706_2014/n34.jpg', - 'img30': 'images/microscopy/assignment_706_2014/n43.jpg', - 'img31': 'images/microscopy/assignment_706_2014/n47.jpg', - 'img32': 'images/microscopy/assignment_706_2014/n60.jpg', - 'img46': 'images/microscopy/assignment_706_2014/n64.jpg', - - - 'img36': 'images/microscopy/assignment_706_2014/pm2.jpg', - 'img37': 'images/microscopy/assignment_706_2014/pm3.jpg', - 'img44': 'images/microscopy/assignment_706_2014/pm34-1.jpg', - 'img45': 'images/microscopy/assignment_706_2014/pm34-2.jpg' - }, - slide_parser: { - 'default': { - 'IF': { - 'rgb': { - 'cytoplasm': [ - [ - { - hash: 'img1', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img2', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img3', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img4', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img40', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img41', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img6', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img42', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img7', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img8', - mag: 'N/A', - if_type: 'green' - } + cell_treatments: { + G: [ + { + cell_line: 'gfp3', + treatment_id: 'media_only', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } ] - ], - 'plasma_membrane': [ - [ - { - hash: 'img36', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img37', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img44', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img45', - mag: 'N/A', - if_type: 'green' - } + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfp3', + treatment_id: 'ligand_media', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } ] - - ], - 'nucleus': [ - [ - { - hash: 'img21', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img22', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img23', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img24', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img26', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img29', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img30', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img31', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img32', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img46', - mag: 'N/A', - if_type: 'green' - } + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfp3', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } ] - - - ], - 'cytoplasm_nucleus': [ - [ - { - hash: 'img9', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img10', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img11', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img12', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img13', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img14', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img16', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img17', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img18', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img19', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img20', - mag: 'N/A', - if_type: 'green' - } + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfp3', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } ] - - ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] } - } + } + ] + } } + ] }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - //CELL GFP - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP H - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfpH', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfpH', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfpH', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfpH', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP p100 - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp100', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + 'gfp4': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein D' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfp4', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp100', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfp4', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp100', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfp4', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp100', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP TD + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfp4', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfpTD', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } + } + ] + }, + 'gfp5': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein E' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfp5', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfpTD', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfp5', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfpTD', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfp5', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfpTD', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP A + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfp5', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp1', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } + } + ] + }, + 'gfpH': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Histone H2B' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfpH', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp1', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfpH', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp1', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfpH', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp1', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL LINE GFPB + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfpH', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp2', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } + } + ] + + }, + 'gfp100': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-p100' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfp100', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp2', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein B', - weight: 161, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfp100', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp2', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfp100', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp2', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein B', - weight: 161, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFPC + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfp100', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp3', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein C', - weight: 71, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp3', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein C', - weight: 71, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp3', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein C', - weight: 71, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp3', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein C', - weight: 71, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP D - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp4', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp4', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein D', - weight: 94, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp4', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp4', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP E + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } + } + ] + + }, + 'gfpTD': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-pTD' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfpTD', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp5', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfpTD', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp5', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'protein E', - weight: 101, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfpTD', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp5', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfpTD', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp5', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'protein E', - weight: 101, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } + ] + } + } + ] + } + } + ] - ] + } + + } + + }, + + add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs', + collections: { + '': { + name: '' + } + }, + concentrations: { + 100: { + name: '', + value: 100 + } + }, + drugs: { + 'gm': { + name: 'Growth media only', + concentrations: ['100'] + }, + 'gml': { + name: 'Growth media + ligand', + concentrations: ['100'] + }, + 'gmi': { + name: 'Growth media + inhibitor', + concentrations: ['100'] + }, + 'gmil': { + name: 'Growth media + ligand + inhibitor', + concentrations: ['100'] + } + }, + experiment_temperatures: { + '22': { + name: "22" + degreeEntity + "C" + } + }, + cell_lines: { + 'gfp': { + name: 'GFP' + }, + 'gfp1': { + name: 'GFP-Protein A' + }, + 'gfp2': { + name: 'GFP-Protein B' + }, + 'gfp3': { + name: 'GFP-Protein C' + }, + 'gfp4': { + name: 'GFP-Protein D' + }, + 'gfp5': { + name: 'GFP-Protein E' + }, + 'gfpH': { + name: 'GFP-Histone H2B' + }, + 'gfp100': { + name: 'GFP-p100' + }, + 'gfpTD': { + name: 'GFP-pTD' + } + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['mp1', 'mp2', 'mp3', 'mp4', 'mp5', 'mpAG'], + 'mp1': { + name: 'mouse anti-phospho-protein A', + secondary: ['m'], + marks: [ + { + weight: 46, + intensity: 0 + } + ], + gel_name: 'P-Protein A' + }, + 'mp2': { + name: 'mouse anti-phospho-protein B', + secondary: ['m'], + marks: [ + { + weight: 134, + intensity: 0 + } + ], + gel_name: 'P-Protein B' + }, + 'mp3': { + name: 'mouse anti-phospho-protein C', + secondary: ['m'], + marks: [ + { + weight: 44, + intensity: 0 + } + ], + gel_name: 'P-Protein C' + }, + 'mp4': { + name: 'mouse anti-phospho-protein D', + secondary: ['m'], + marks: [ + { + weight: 67, + intensity: 0 + } + ], + gel_name: 'P-Protein D' + }, + 'mp5': { + name: 'mouse anti-phospho-protein E', + secondary: ['m'], + marks: [ + { + weight: 74, + intensity: 0 + } + ], + gel_name: 'P-Protein E' + }, + 'mpAG': { + name: 'rabbit anti-GAPDH', + secondary: ['r'], + marks: [ + { + weight: 37, + intensity: 0 + } + ], + gel_name: 'GAPDH' + } + }, // + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, // + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + micro_kinds: { + 'IF': { + name: 'Fluorescence', + conditions: { + 'rgb': { + name: 'GFP (green)', + short_name: 'G:GFP' + } + } + }, + 'na': { + name: 'None' + } + }, + slides: { + 'img1': 'images/microscopy/assignment_706_2014/c1.jpg', + 'img2': 'images/microscopy/assignment_706_2014/c4.jpg', + 'img3': 'images/microscopy/assignment_706_2014/c7.jpg', + 'img4': 'images/microscopy/assignment_706_2014/c10.jpg', + 'img40': 'images/microscopy/assignment_706_2014/c15-1.jpg', + 'img41': 'images/microscopy/assignment_706_2014/c15-2.jpg', + 'img6': 'images/microscopy/assignment_706_2014/c17.jpg', + 'img42': 'images/microscopy/assignment_706_2014/c25.jpg', + 'img7': 'images/microscopy/assignment_706_2014/c26.jpg', + 'img8': 'images/microscopy/assignment_706_2014/c29.jpg', + + + 'img9': 'images/microscopy/assignment_706_2014/cn2.jpg', + 'img10': 'images/microscopy/assignment_706_2014/cn3.jpg', + 'img11': 'images/microscopy/assignment_706_2014/cn5.jpg', + 'img12': 'images/microscopy/assignment_706_2014/cn6.jpg', + 'img13': 'images/microscopy/assignment_706_2014/cn7.jpg', + 'img14': 'images/microscopy/assignment_706_2014/cn8.jpg', + 'img16': 'images/microscopy/assignment_706_2014/cn11.jpg', + 'img17': 'images/microscopy/assignment_706_2014/cn12.jpg', + 'img18': 'images/microscopy/assignment_706_2014/cn15.jpg', + 'img19': 'images/microscopy/assignment_706_2014/cn17.jpg', + 'img20': 'images/microscopy/assignment_706_2014/cn20.jpg', + + 'img21': 'images/microscopy/assignment_706_2014/n1.jpg', + 'img22': 'images/microscopy/assignment_706_2014/n2.jpg', + 'img23': 'images/microscopy/assignment_706_2014/n8.jpg', + 'img24': 'images/microscopy/assignment_706_2014/n9.jpg', + 'img26': 'images/microscopy/assignment_706_2014/n18.jpg', + 'img29': 'images/microscopy/assignment_706_2014/n34.jpg', + 'img30': 'images/microscopy/assignment_706_2014/n43.jpg', + 'img31': 'images/microscopy/assignment_706_2014/n47.jpg', + 'img32': 'images/microscopy/assignment_706_2014/n60.jpg', + 'img46': 'images/microscopy/assignment_706_2014/n64.jpg', + + + 'img36': 'images/microscopy/assignment_706_2014/pm2.jpg', + 'img37': 'images/microscopy/assignment_706_2014/pm3.jpg', + 'img44': 'images/microscopy/assignment_706_2014/pm34-1.jpg', + 'img45': 'images/microscopy/assignment_706_2014/pm34-2.jpg' + }, + slide_parser: { + 'default': { + 'IF': { + 'rgb': { + 'cytoplasm': [ + [ + { + hash: 'img1', + mag: 'N/A', + if_type: 'green' } - }, - microscopy: { - 'valid': ['pfl', 'ac'], - 'slide': { + ], + [ + { + hash: 'img2', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img3', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img4', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img40', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img41', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img6', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img42', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img7', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img8', + mag: 'N/A', + if_type: 'green' + } + ] + ], + 'plasma_membrane': [ + [ + { + hash: 'img36', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img37', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img44', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img45', + mag: 'N/A', + if_type: 'green' + } + ] - 'complex_parser': [ - { - match: [] + ], + 'nucleus': [ + [ + { + hash: 'img21', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img22', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img23', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img24', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img26', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img29', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img30', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img31', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img32', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img46', + mag: 'N/A', + if_type: 'green' + } + ] - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'cytoplasm_nucleus' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfpH', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'nucleus' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp100', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'cytoplasm' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfpTD', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'plasma_membrane' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp1', - drug_id: ['gm', 'gmi'], - phenotype: 'cytoplasm' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp1', - drug_id: ['gml', 'gmil'], - phenotype: 'plasma_membrane' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp2', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'plasma_membrane' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp3', - drug_id: ['gm', 'gmi', 'gmil'], - phenotype: 'cytoplasm' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp3', - drug_id: ['gml'], - phenotype: 'nucleus' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp4', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'cytoplasm' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp5', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'cytoplasm' - } - ] + ], + 'cytoplasm_nucleus': [ + [ + { + hash: 'img9', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img10', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img11', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img12', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img13', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img14', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img16', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img17', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img18', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img19', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img20', + mag: 'N/A', + if_type: 'green' + } + ] + ] + } + } + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + //CELL GFP + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP H + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfpH', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfpH', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfpH', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfpH', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP p100 + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp100', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp100', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp100', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp100', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP TD + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfpTD', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfpTD', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfpTD', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfpTD', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP A + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp1', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp1', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp1', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp1', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL LINE GFPB + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp2', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp2', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein B', + weight: 161, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp2', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp2', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein B', + weight: 161, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFPC + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp3', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein C', + weight: 71, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp3', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein C', + weight: 71, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp3', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein C', + weight: 71, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp3', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein C', + weight: 71, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP D + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp4', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp4', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein D', + weight: 94, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp4', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp4', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP E + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp5', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp5', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'protein E', + weight: 101, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp5', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp5', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'protein E', + weight: 101, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] } + + ] } + }, + microscopy: { + 'valid': ['pfl', 'ac'], + 'slide': { + + 'complex_parser': [ + { + match: [] + + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'cytoplasm_nucleus' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfpH', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'nucleus' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp100', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'cytoplasm' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfpTD', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'plasma_membrane' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp1', + drug_id: ['gm', 'gmi'], + phenotype: 'cytoplasm' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp1', + drug_id: ['gml', 'gmil'], + phenotype: 'plasma_membrane' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp2', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'plasma_membrane' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp3', + drug_id: ['gm', 'gmi', 'gmil'], + phenotype: 'cytoplasm' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp3', + drug_id: ['gml'], + phenotype: 'nucleus' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp4', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'cytoplasm' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp5', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'cytoplasm' + } + + ] + + } + } + } + } }; diff --git a/html_app/assignments/mit706s14ps2/AddMultipleDialog.js b/html_app/assignments/mit706s14ps2/AddMultipleDialog.js index 73ba463e..fcd9dfd1 100644 --- a/html_app/assignments/mit706s14ps2/AddMultipleDialog.js +++ b/html_app/assignments/mit706s14ps2/AddMultipleDialog.js @@ -1,99 +1,101 @@ var mit706s14ps2 = mit706s14ps2 || {}; mit706s14ps2.static = mit706s14ps2.static || {}; -mit706s14ps2.static.scb_mit706s16_inner_dialog_add = function (element, dialog, state) { +mit706s14ps2.static.scb_mit706s16_inner_dialog_add = function(element, dialog, state) { - $('input[type="checkbox"]:checked', dialog).each(function (e) { - var element = $(this); - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var treatment_id = $(element).attr('treatment_id'); - var cell_line = $(element).attr('cell_line'); - var name = $(element).attr('name'); - $(element).attr('aria-checked',true); - var parsed = scb.ui.static.MainFrame.validate_state({ - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'add_many_dialog_box', - skip_hash_update: true - }); + $('input[type="checkbox"]:checked', dialog).each(function(e) { + var element = $(this); + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var treatment_id = $(element).attr('treatment_id'); + var cell_line = $(element).attr('cell_line'); + var name = $(element).attr('name'); + $(element).attr('aria-checked', true); + var parsed = scb.ui.static.MainFrame.validate_state({ + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'add_many_dialog_box', + skip_hash_update: true + }); - var template = parsed.assignment.template; - var rows = template.ui.add_multiple_dialog[cell_line].rows; - var row = _.find(rows, function (eh) { - return eh.treatment_id == treatment_id; - }); - var cell_treatments_array = row.cell_treatments[name]; - _.each(cell_treatments_array, function (eh) { - parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); - }); + var template = parsed.assignment.template; + var rows = template.ui.add_multiple_dialog[cell_line].rows; + var row = _.find(rows, function(eh) { + return eh.treatment_id == treatment_id; + }); + var cell_treatments_array = row.cell_treatments[name]; + _.each(cell_treatments_array, function(eh) { + parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); }); + }); - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); } -mit706s14ps2.register = function (dialog, state) { - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s14ps2_dialog', function (e) { - var container = dialog; - if (container.has(e.target).length === 0) { - $(dialog).detach(); - $('.contact_overlay').remove(); - } - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_cancel', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_add', function (e) { - mit706s14ps2.static.scb_mit706s16_inner_dialog_add(this, dialog, state); - $(this).focus(); - }); - scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function (e) { - $(this, dialog).attr('aria-checked',$(this, dialog).attr('aria-checked') =='false' ? true : false); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select_all', function (e) { - $('input[type=checkbox]' , dialog).attr('checked','checked'); - $('input[type=checkbox]' , dialog).attr('aria-checked',true); - }); +mit706s14ps2.register = function(dialog, state) { + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s14ps2_dialog', function(e) { + var container = dialog; + if (container.has(e.target).length === 0) { + $(dialog).detach(); + $('.contact_overlay').remove(); + } + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_cancel', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_add', function(e) { + mit706s14ps2.static.scb_mit706s16_inner_dialog_add(this, dialog, state); + $(this).focus(); + }); + scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function(e) { + $(this, dialog).attr('aria-checked', $(this, dialog).attr('aria-checked') == 'false' ? true : false); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select_all', function(e) { + $('input[type=checkbox]', dialog).attr('checked', 'checked'); + $('input[type=checkbox]', dialog).attr('aria-checked', true); + }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_title_close', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select', function (e) { - var cell_line = $(this).attr('cell_line'); - var name = $(this).attr('name'); - $('input[type=checkbox][name="'+name+'"]' , dialog).attr('checked','checked'); - $('input[type=checkbox][name="'+name+'"]' , dialog).attr('aria-checked',true); - }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_title_close', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_mit706s16_inner_dialog_select', function(e) { + var cell_line = $(this).attr('cell_line'); + var name = $(this).attr('name'); + $('input[type=checkbox][name="' + name + '"]', dialog).attr('checked', 'checked'); + $('input[type=checkbox][name="' + name + '"]', dialog).attr('aria-checked', true); + }); } -mit706s14ps2.setup = function (state) { - var workarea = state.workarea; - var assignment = state.assignment; - var experiment = state.experiment; - var template = state.assignment.template; - var onClose = state.close; +mit706s14ps2.setup = function(state) { + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.assignment.template; + var onClose = state.close; - var dialog = $("
"); - dialog.html(mit706s14ps2.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); + var dialog = $("
"); + dialog.html(mit706s14ps2.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); - dialog.appendTo($(workarea)); - mit706s14ps2.register($(dialog), state); + dialog.appendTo($(workarea)); + mit706s14ps2.register($(dialog), state); - var css = scb.utils.get(state, ['source_state', 'css']); - _.each( css , function(v,k){ - dialog.css(k,v); - }); + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); - $('.scb_mit706s14ps2_dialog').draggable({handle:'.scb_mit706s16_inner_dialog_title'}) + $('.scb_mit706s14ps2_dialog').draggable({ + handle: '.scb_mit706s16_inner_dialog_title' + }) } diff --git a/html_app/assignments/mit706s14ps2/assignment.js b/html_app/assignments/mit706s14ps2/assignment.js index a92b875a..2627cc28 100644 --- a/html_app/assignments/mit706s14ps2/assignment.js +++ b/html_app/assignments/mit706s14ps2/assignment.js @@ -1,1428 +1,1943 @@ var __assignment_706_2014_ps2 = { - id: 'assignment_706_2014_ps2', - name: 'StarCellBio Problem 2', - course: '7.06_Spring_2014', - course_name: 'Class2', - description: 'FACS and Western Blot for temperature sensitive mutants', - notebook: {}, - experiments: {}, - template: { - random_choose: true, - randomize_all: false, - random_order: [], - finished_random: false, - instructions: [ - ['Goal & Introduction', 'Here come instructions when we build them'] + id: 'assignment_706_2014_ps2', + name: 'StarCellBio Problem 2', + course: '7.06_Spring_2014', + course_name: 'Class2', + description: 'FACS and Western Blot for temperature sensitive mutants', + notebook: {}, + experiments: {}, + template: { + random_choose: true, + randomize_all: false, + random_order: [], + finished_random: false, + instructions: [ + ['Goal & Introduction', 'Here come instructions when we build them'] + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs', 'micro'], + gel_types: ['.10', '.12', '.15'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: false + }, + { + kind: 'duration', + title: 'Time', + editable: false + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs', 'micro' ], - gel_types: ['.10', '.12', '.15'] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: false}, - {kind: 'duration', title: 'Time', editable: false} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + } + } + }, + microscopy: { + disable_blur: true, + disable_brightness: true + }, + add_multiple_dialog: { + order: ['S2'], + headings: [ + '', 'Strain', 'Treatment', 'Treatment Duration' + ], + 'S2': { + rows: [ + { + cells: [ + { + kind: 'checkbox', + name: "B", + treatment_id: 'buffer' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'Control siRNA' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'buffer', + cell_treatments: { + B: [ + { + cell_line: 'S2', + treatment_list: { + list: [ + { + collection_id: 'default', + microscope: ['rgb', 'g', 'gr', 'rb'], + conditions: { + 'IF': ['rgb', 'g', 'gr', 'rb'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } ] + } }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']} + { + cells: [ + { + kind: 'checkbox', + name: "R1", + treatment_id: 'rna1' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'siRNA #1' + }, + { + kind: 'text', + text: "3 days" } - }, - microscopy: { - disable_blur: true, - disable_brightness: true - }, - add_multiple_dialog: { - order: ['S2'], - headings: [ - '', 'Strain', 'Treatment', 'Treatment Duration' - ], - 'S2': { - rows: [ - { - cells: [ - {kind: 'checkbox', name: "B", treatment_id: 'buffer'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'Control siRNA'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'buffer', - cell_treatments: { - B: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['rgb', 'g', 'gr', 'rb'], - conditions: { - 'IF': ['rgb', 'g', 'gr', 'rb'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '100'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + ], + treatment_id: 'rna1', + cell_treatments: { + R1: [ + { + cell_line: 'S2', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "R1", treatment_id: 'rna1'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'siRNA #1'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'rna1', - cell_treatments: { - R1: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['g'], - conditions: { - 'IF': ['g'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'rna1', concentration_id: '100'} - ]}, temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'checkbox', name: "R2", treatment_id: 'rna2'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'siRNA #2'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'rna2', - cell_treatments: { - R2: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['g', 'gr', 'rb'], - conditions: { - 'IF': ['g', 'gr', 'rb'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'rna2', concentration_id: '100'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + collection_id: 'default', + microscope: ['g'], + conditions: { + 'IF': ['g'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'rna1', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'checkbox', + name: "R2", + treatment_id: 'rna2' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'siRNA #2' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'rna2', + cell_treatments: { + R2: [ + { + cell_line: 'S2', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "R3", treatment_id: 'rna3'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'siRNA #3'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'rna3', - cell_treatments: { - R3: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['rgb', 'g', 'rb'], - conditions: { - 'IF': ['rgb', 'g', 'rb'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'rna3', concentration_id: '100'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + collection_id: 'default', + microscope: ['g', 'gr', 'rb'], + conditions: { + 'IF': ['g', 'gr', 'rb'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'rna2', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'checkbox', + name: "R3", + treatment_id: 'rna3' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'siRNA #3' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'rna3', + cell_treatments: { + R3: [ + { + cell_line: 'S2', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "R4", treatment_id: 'rna4'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'siRNA #4'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'rna4', - cell_treatments: { - R4: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['na'], - conditions: { - 'na': ['None'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'rna4', concentration_id: '100'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + collection_id: 'default', + microscope: ['rgb', 'g', 'rb'], + conditions: { + 'IF': ['rgb', 'g', 'rb'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'rna3', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'checkbox', + name: "R4", + treatment_id: 'rna4' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'siRNA #4' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'rna4', + cell_treatments: { + R4: [ + { + cell_line: 'S2', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "R5", treatment_id: 'rna5'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'siRNA #5'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'rna5', - cell_treatments: { - R5: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['rgb', 'g'], - conditions: { - 'IF': ['rgb', 'g'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'rna5', concentration_id: '100'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + collection_id: 'default', + microscope: ['na'], + conditions: { + 'na': ['None'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'rna4', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'checkbox', + name: "R5", + treatment_id: 'rna5' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'siRNA #5' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'rna5', + cell_treatments: { + R5: [ + { + cell_line: 'S2', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "GM", treatment_id: 'serum_growth_media'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'Serum-free media'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'serum_growth_media', - cell_treatments: { - GM: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['na'], - conditions: { - 'na': ['None'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'Serum', concentration_id: '100'} - ]}, temperature: '25' - } - ]}} - ] - } - }, + collection_id: 'default', + microscope: ['rgb', 'g'], + conditions: { + 'IF': ['rgb', 'g'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'rna5', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'checkbox', + name: "GM", + treatment_id: 'serum_growth_media' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'Serum-free media' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'serum_growth_media', + cell_treatments: { + GM: [ + { + cell_line: 'S2', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "H", treatment_id: 'hydroxyurea'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'Hydroxyurea'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'hydroxyurea', - cell_treatments: { - H: [ - {cell_line: 'S2', - treatment_list: { - list: [ - { - collection_id: 'default', - microscope: ['na'], - conditions: { - 'na': ['None'] - }, - duration_value: 3600 * 24 * 3, - duration: '3 d', - drug_list: { - list: [ - {drug_id: 'Hydroxyurea', concentration_id: '100'} - ] - }, - temperature: '25' - } - ] - - }} - ] - } - }, + collection_id: 'default', + microscope: ['na'], + conditions: { + 'na': ['None'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'Serum', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'checkbox', + name: "H", + treatment_id: 'hydroxyurea' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'Hydroxyurea' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'hydroxyurea', + cell_treatments: { + H: [ + { + cell_line: 'S2', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "C", treatment_id: 'colchicine'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'Colchicine'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'colchicine', - cell_treatments: { - C: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['na'], - conditions: { - 'na': ['None'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'Colchicine', concentration_id: '100'} - ]}, temperature: '25' - } - ]}} - ] - } + collection_id: 'default', + microscope: ['na'], + conditions: { + 'na': ['None'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'Hydroxyurea', + concentration_id: '100' + } + ] + }, + temperature: '25' } + ] - ] - } - } - }, - add_new_row_instructions: 'add new row instructions', - collections: { - '': { - name: '' - } - }, - concentrations: { - 100: { - name: '', - value: 100 - } - }, - drugs: { - 'nc': { - name: 'Control siRNA', - concentrations: [100] - }, - 'rna1': { - name: 'siRNA #1', - concentrations: [100] - }, - 'rna2': { - name: 'siRNA #2', - concentrations: [100] - }, - 'rna3': { - name: 'siRNA #3', - concentrations: [100] - }, - 'rna4': { - name: 'siRNA #4', - concentrations: [100] - }, - 'rna5': { - name: 'siRNA #5', - concentrations: [100] - }, - 'Colchicine': { - name: 'Colchicine', - concentrations: [100] - }, - 'Serum': { - name: 'Serum-free media', - concentrations: [100] + } + } + ] + } }, - 'Hydroxyurea': { - name: 'Hydroxyurea', - concentrations: [100] + { + cells: [ + { + kind: 'checkbox', + name: "C", + treatment_id: 'colchicine' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'Colchicine' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'colchicine', + cell_treatments: { + C: [ + { + cell_line: 'S2', + treatment_list: { + list: [ + { + collection_id: 'default', + microscope: ['na'], + conditions: { + 'na': ['None'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'Colchicine', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } } - }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" - } - }, - cell_lines: { - 'S2': { - name: 'S2' - } + ] + } + } + }, + add_new_row_instructions: 'add new row instructions', + collections: { + '': { + name: '' + } + }, + concentrations: { + 100: { + name: '', + value: 100 + } + }, + drugs: { + 'nc': { + name: 'Control siRNA', + concentrations: [100] + }, + 'rna1': { + name: 'siRNA #1', + concentrations: [100] + }, + 'rna2': { + name: 'siRNA #2', + concentrations: [100] + }, + 'rna3': { + name: 'siRNA #3', + concentrations: [100] + }, + 'rna4': { + name: 'siRNA #4', + concentrations: [100] + }, + 'rna5': { + name: 'siRNA #5', + concentrations: [100] + }, + 'Colchicine': { + name: 'Colchicine', + concentrations: [100] + }, + 'Serum': { + name: 'Serum-free media', + concentrations: [100] + }, + 'Hydroxyurea': { + name: 'Hydroxyurea', + concentrations: [100] + } - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['chk1', 'rad21', 'cyclin', 'cyclinE', 'mad2', 'pgk1'], - 'chk1': { - name: 'rabbit anti-chk1', - secondary: ['r'], - marks: [ - {weight: 54, intensity: 0}, - {weight: 55, intensity: 0}, - {weight: 58, intensity: 0} - ], - gel_name: 'chk1' - }, - 'cyclin': { - name: 'mouse anti-cyclin B', - secondary: ['m'], - marks: [ - {weight: 58, intensity: 0} - ], - gel_name: 'cyclin B' - }, - 'cyclinE': { - name: 'mouse anti-cyclin E', - secondary: ['m'], - marks: [ - {weight: 48, intensity: 0} - ], - gel_name: 'cyclin E' - }, - 'mad2': { - name: 'rabbit anti-Mad2', - secondary: ['r'], - marks: [ - {weight: 25, intensity: 0} - ], - gel_name: 'mad2' - }, - 'pgk1': { - name: 'rabbit anti-pgk1', - secondary: ['r'], - marks: [ - {weight: 45, intensity: 0} - ], - gel_name: 'pgk1' - }, - 'rad21': { - name: 'rabbit anti-rad21/scc1', - secondary: ['r'], - marks: [ - {weight: 68, intensity: 0}, - {weight: 29.5, intensity: 0}, - {weight: 19.9, intensity: 0} - ], - gel_name: 'rad21' - } - },// - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' - }, - 'r': { - name: 'goat anti-rabbit' - } - },// - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - } - }, - facs_kinds: { - 'whole': { - name: 'PI', - conditions: { - 'whole': {name: 'PI'} - } - } - }, - micro_kinds: { - 'IF': { - name: 'Antibody-labeling IF', - conditions: { - 'rgb': {name: 'γ-tubulin (red), α-tubulin (green), DAPI (blue)', - short_name: 'R:γ-tub, G:α-tub, B:DAPI'}, - 'g': {name: 'H2B (green)', - short_name: 'G:H2B'}, - 'gr': {name: 'H2B (green), α-tubulin(red)', - short_name: 'G:H2B, R:α-tub'}, - 'rb': {name: 'Mad2 (red), DAPI (blue)', - short_name: 'R:Mad2, B:DAPI'}, - 'na': {name: 'None', - short_name: 'None'} - } - }, - 'na': { - name: 'None' - } - }, - slides: { - 'img0001': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_DNA-blue_Mad2-red/Mad2_off_kinetochores/Mad2_Cytoplasm_cropped.jpg', - 'img0002': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_DNA-blue_Mad2-red/Mad2_on_kinetochore/Mad2_kinetochore_2_cropped.jpg', - 'img0003': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_DNA-blue_Mad2-red/Mad2_on_kinetochore/Mad2_kinetochore_cropped.jpg', + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + } + }, + cell_lines: { + 'S2': { + name: 'S2' + } - 'img0004': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Interphase_10.jpg', - 'img0005': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Interphase_12.jpg', - 'img0006': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Interphase_13.jpg', - 'img0007': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Maybe_Interphase_1.jpg', - 'img0008': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Maybe_Interphase_2.jpg', - 'img0009': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Maybe_Interphase_3.jpg', + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['chk1', 'rad21', 'cyclin', 'cyclinE', 'mad2', 'pgk1'], + 'chk1': { + name: 'rabbit anti-chk1', + secondary: ['r'], + marks: [ + { + weight: 54, + intensity: 0 + }, + { + weight: 55, + intensity: 0 + }, + { + weight: 58, + intensity: 0 + } + ], + gel_name: 'chk1' + }, + 'cyclin': { + name: 'mouse anti-cyclin B', + secondary: ['m'], + marks: [ + { + weight: 58, + intensity: 0 + } + ], + gel_name: 'cyclin B' + }, + 'cyclinE': { + name: 'mouse anti-cyclin E', + secondary: ['m'], + marks: [ + { + weight: 48, + intensity: 0 + } + ], + gel_name: 'cyclin E' + }, + 'mad2': { + name: 'rabbit anti-Mad2', + secondary: ['r'], + marks: [ + { + weight: 25, + intensity: 0 + } + ], + gel_name: 'mad2' + }, + 'pgk1': { + name: 'rabbit anti-pgk1', + secondary: ['r'], + marks: [ + { + weight: 45, + intensity: 0 + } + ], + gel_name: 'pgk1' + }, + 'rad21': { + name: 'rabbit anti-rad21/scc1', + secondary: ['r'], + marks: [ + { + weight: 68, + intensity: 0 + }, + { + weight: 29.5, + intensity: 0 + }, + { + weight: 19.9, + intensity: 0 + } + ], + gel_name: 'rad21' + } + }, // + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, // + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'whole': { + name: 'PI', + conditions: { + 'whole': { + name: 'PI' + } + } + } + }, + micro_kinds: { + 'IF': { + name: 'Antibody-labeling IF', + conditions: { + 'rgb': { + name: 'γ-tubulin (red), α-tubulin (green), DAPI (blue)', + short_name: 'R:γ-tub, G:α-tub, B:DAPI' + }, + 'g': { + name: 'H2B (green)', + short_name: 'G:H2B' + }, + 'gr': { + name: 'H2B (green), α-tubulin(red)', + short_name: 'G:H2B, R:α-tub' + }, + 'rb': { + name: 'Mad2 (red), DAPI (blue)', + short_name: 'R:Mad2, B:DAPI' + }, + 'na': { + name: 'None', + short_name: 'None' + } + } + }, + 'na': { + name: 'None' + } + }, + slides: { + 'img0001': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_DNA-blue_Mad2-red/Mad2_off_kinetochores/Mad2_Cytoplasm_cropped.jpg', + 'img0002': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_DNA-blue_Mad2-red/Mad2_on_kinetochore/Mad2_kinetochore_2_cropped.jpg', + 'img0003': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_DNA-blue_Mad2-red/Mad2_on_kinetochore/Mad2_kinetochore_cropped.jpg', - 'img0010': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Metaphase_arrest/Metaphase_arrest_1.jpg', - 'img0011': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Metaphase_arrest/metaphase_arrest_4.jpg', - 'img0012': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Metaphase_arrest/metaphase_arrest_5.jpg', + 'img0004': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Interphase_10.jpg', + 'img0005': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Interphase_12.jpg', + 'img0006': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Interphase_13.jpg', + 'img0007': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Maybe_Interphase_1.jpg', + 'img0008': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Maybe_Interphase_2.jpg', + 'img0009': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Interphase/Maybe_Interphase_3.jpg', - 'img0013': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Nocodazole_treated_cells/nocodazole_treated_1.jpg', - 'img0014': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Nocodazole_treated_cells/nocodazole_treated_2.jpg', - 'img0015': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Nocodazole_treated_cells/nocodazole_treated_3.jpg', - 'img0016': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Nocodazole_treated_cells/nocodazole_treated_4.jpg', + 'img0010': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Metaphase_arrest/Metaphase_arrest_1.jpg', + 'img0011': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Metaphase_arrest/metaphase_arrest_4.jpg', + 'img0012': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Metaphase_arrest/metaphase_arrest_5.jpg', - 'img0017': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_1.jpg', - 'img0018': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_2.jpg', - 'img0019': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_3.jpg', - 'img0020': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_4.jpg', - 'img0021': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_5.jpg', - 'img0022': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_6.jpg', + 'img0013': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Nocodazole_treated_cells/nocodazole_treated_1.jpg', + 'img0014': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Nocodazole_treated_cells/nocodazole_treated_2.jpg', + 'img0015': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Nocodazole_treated_cells/nocodazole_treated_3.jpg', + 'img0016': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Nocodazole_treated_cells/nocodazole_treated_4.jpg', - 'img0024': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_4.jpg', - 'img0025': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_5.jpg', - 'img0027': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_7.jpg', - 'img0028': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_8.jpg', - 'img0029': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_9.jpg', + 'img0017': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_1.jpg', + 'img0018': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_2.jpg', + 'img0019': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_3.jpg', + 'img0020': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_4.jpg', + 'img0021': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_5.jpg', + 'img0022': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Anaphase/Normal_Anaphase_6.jpg', - 'img0034': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green/Normal_Metaphase/PSSC_control_Barren.jpg', + 'img0024': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_4.jpg', + 'img0025': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_5.jpg', + 'img0027': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_7.jpg', + 'img0028': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_8.jpg', + 'img0029': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Normal_Metaphase/Normal_Metaphase_9.jpg', - 'img0035': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green/Premature_Sister_Chromatid_Separation/PSSC_1.jpg', - 'img0036': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green/Premature_Sister_Chromatid_Separation/PSSC_2.jpg', + 'img0034': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green/Normal_Metaphase/PSSC_control_Barren.jpg', - 'img0037': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Anaphase/Normal_Anaphase.jpg', + 'img0035': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green/Premature_Sister_Chromatid_Separation/PSSC_1.jpg', + 'img0036': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green/Premature_Sister_Chromatid_Separation/PSSC_2.jpg', - 'img0038': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Chromosome_Bridges/Chromosome_Bridges_Color.jpg', + 'img0037': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Anaphase/Normal_Anaphase.jpg', - 'img0039': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Interphase/Normal_Interphase_2_Color.jpg', - 'img0040': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Interphase/Normal_Interphase_Color.jpg', + 'img0038': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Chromosome_Bridges/Chromosome_Bridges_Color.jpg', - 'img0041': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Metaphase/Normal_Metaphase_2.jpg', + 'img0039': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Interphase/Normal_Interphase_2_Color.jpg', + 'img0040': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Interphase/Normal_Interphase_Color.jpg', - 'img0042': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Unequal_Chromosome_Distribution/Unequal_chromosome_distribution_2.jpg', + 'img0041': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Metaphase/Normal_Metaphase_2.jpg', + 'img0042': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_H2B-green_tubulin-red/Unequal_Chromosome_Distribution/Unequal_chromosome_distribution_2.jpg', - 'img0049': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_1_composite.jpg', - 'img0050': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_2_composite.jpg', - 'img0051': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_3_composite.jpg', - 'img0052': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_4_composite.jpg', - 'img0053': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_5_composite.jpg', - 'img0054': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_6_composite.jpg', - 'img0055': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_1_composite.jpg', - 'img0056': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_2_composite.jpg', - 'img0057': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_3_composite.jpg', - 'img0058': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_4_composite.jpg', - 'img0059': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_5_composite.jpg', - 'img0060': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_6_composite.jpg', - 'img0067': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_1_composite.jpg', - 'img0068': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_2_composite.jpg', - 'img0069': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_3_composite.jpg', - 'img0070': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_4_composite.jpg', - 'img0071': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_5_composite.jpg', - 'img0072': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_6_composite.jpg', - 'img0073': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_1_composite.jpg', - 'img0074': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_2_composite.jpg', - 'img0075': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_3_composite.jpg', - 'img0076': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_4_composite.jpg', - 'img0077': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_5_composite.jpg', - 'img0078': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_6_composite.jpg', - 'img0079': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_1_composite.jpg', - 'img0080': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_2_composite.jpg', - 'img0081': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_3_composite.jpg', - 'img0082': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_4_composite.jpg', - 'img0083': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_5_composite.jpg', - 'img0084': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_6_composite.jpg', - 'img0085': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Unequal_Chromosome_Distribution/Unequal_Chromosome_Distribution_2.jpg', - 'img0087': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Unequal_Chromosome_Distribution/Unequal_Chromosome_Distribution_6.jpg' - }, - slide_parser: { - 'default': { - 'IF': { - 'rgb': { - 'interphase': [ - [ - {'hash': 'img0004', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0005', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0006', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0007', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0008', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0009', 'if_type': 'merge', 'mag': 'N/A'} - ] - ], - 'metaphase_arrest': [ - [ - {'hash': 'img0010', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0011', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0012', 'if_type': 'merge', 'mag': 'N/A'} - ] - ], - 'normal_metaphase': [ - [ - {'hash': 'img0024', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0025', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0027', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0028', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0029', 'if_type': 'merge', 'mag': 'N/A'} - ] - ], - 'nocodazole': [ - [ - {'hash': 'img0013', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0014', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0015', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0016', 'if_type': 'merge', 'mag': 'N/A'} - ] - ], - 'anaphase': [ - [ - {'hash': 'img0017', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0018', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0019', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0020', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0021', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0022', 'if_type': 'merge', 'mag': 'N/A'} - ] - ], - 'unequal': [ - [ - {'hash': 'img0085', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0087', 'if_type': 'merge', 'mag': 'N/A'} - ] - ], - 'composite5': [ - [ - {'hash': 'img0052', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0053', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0054', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0055', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0056', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0057', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0058', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0059', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0060', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0067', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0068', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0069', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0070', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0071', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0072', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0073', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0074', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0075', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0076', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0077', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0078', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0079', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0080', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0081', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0082', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0083', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0084', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0049', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0050', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0051', 'if_type': 'merge', 'mag': 'N/A'} - ] - ] - }, - 'g': { - 'premature': [ - [ - { - hash: 'img0035', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img0036', - mag: 'N/A', - if_type: 'green' - } - ] - ], - 'normal_metaphase': [ - [ - { - hash: 'img0034', - mag: 'N/A', - if_type: 'green' - } - ] - ] - }, - 'gr': { - 'interphase': [ - [ - { - hash: 'img0039', - mag: 'N/A', - if_type: 'merge' - } - ], - [ - { - hash: 'img0040', - mag: 'N/A', - if_type: 'merge' - } - ] - ], - 'metaphase': [ - [ - { - hash: 'img0041', - mag: 'N/A', - if_type: 'merge' - } - ] - ], - 'anaphase': [ - [ - { - hash: 'img0037', - mag: 'N/A', - if_type: 'merge' - } - ] - ], - 'unequal': [ - [ - { - hash: 'img0042', - mag: 'N/A', - if_type: 'merge' - } - ] - ], - 'bridges': [ - [ - { - hash: 'img0038', - mag: 'N/A', - if_type: 'merge' - } - ] - ] - }, - 'rb': { - 'off': [ - [ - { - hash: 'img0001', - mag: 'N/A', - if_type: 'merge' - } - ] - ], - 'on': [ - [ - { - hash: 'img0002', - mag: 'N/A', - if_type: 'merge' - } - ], - [ - { - hash: 'img0003', - mag: 'N/A', - if_type: 'merge' - } - ] - ] - } + 'img0049': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_1_composite.jpg', + 'img0050': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_2_composite.jpg', + 'img0051': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_3_composite.jpg', + 'img0052': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_4_composite.jpg', + 'img0053': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_5_composite.jpg', + 'img0054': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_4Normal_Anaphase_6_composite.jpg', + 'img0055': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_1_composite.jpg', + 'img0056': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_2_composite.jpg', + 'img0057': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_3_composite.jpg', + 'img0058': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_4_composite.jpg', + 'img0059': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_5_composite.jpg', + 'img0060': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_5Normal_Anaphase_6_composite.jpg', + 'img0067': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_1_composite.jpg', + 'img0068': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_2_composite.jpg', + 'img0069': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_3_composite.jpg', + 'img0070': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_4_composite.jpg', + 'img0071': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_5_composite.jpg', + 'img0072': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_7Normal_Anaphase_6_composite.jpg', + 'img0073': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_1_composite.jpg', + 'img0074': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_2_composite.jpg', + 'img0075': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_3_composite.jpg', + 'img0076': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_4_composite.jpg', + 'img0077': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_5_composite.jpg', + 'img0078': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_6_composite.jpg', + 'img0079': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_1_composite.jpg', + 'img0080': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_2_composite.jpg', + 'img0081': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_3_composite.jpg', + 'img0082': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_4_composite.jpg', + 'img0083': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_5_composite.jpg', + 'img0084': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_6_composite.jpg', + + 'img0085': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Unequal_Chromosome_Distribution/Unequal_Chromosome_Distribution_2.jpg', + 'img0087': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Unequal_Chromosome_Distribution/Unequal_Chromosome_Distribution_6.jpg' + }, + slide_parser: { + 'default': { + 'IF': { + 'rgb': { + 'interphase': [ + [ + { + 'hash': 'img0004', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0005', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0006', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0007', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0008', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0009', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] + ], + 'metaphase_arrest': [ + [ + { + 'hash': 'img0010', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0011', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0012', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] + ], + 'normal_metaphase': [ + [ + { + 'hash': 'img0024', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0025', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0027', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0028', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0029', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] + ], + 'nocodazole': [ + [ + { + 'hash': 'img0013', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0014', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0015', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0016', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] + ], + 'anaphase': [ + [ + { + 'hash': 'img0017', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0018', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0019', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0020', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0021', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0022', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] + ], + 'unequal': [ + [ + { + 'hash': 'img0085', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0087', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] + ], + 'composite5': [ + [ + { + 'hash': 'img0052', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0053', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0054', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0055', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0056', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0057', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0058', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0059', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0060', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0067', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0068', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0069', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0070', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0071', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0072', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0073', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0074', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0075', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0076', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0077', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0078', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0079', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0080', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0081', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0082', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0083', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0084', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0049', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0050', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0051', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] + ] + }, + 'g': { + 'premature': [ + [ + { + hash: 'img0035', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img0036', + mag: 'N/A', + if_type: 'green' + } + ] + ], + 'normal_metaphase': [ + [ + { + hash: 'img0034', + mag: 'N/A', + if_type: 'green' + } + ] + ] + }, + 'gr': { + 'interphase': [ + [ + { + hash: 'img0039', + mag: 'N/A', + if_type: 'merge' + } + ], + [ + { + hash: 'img0040', + mag: 'N/A', + if_type: 'merge' + } + ] + ], + 'metaphase': [ + [ + { + hash: 'img0041', + mag: 'N/A', + if_type: 'merge' + } + ] + ], + 'anaphase': [ + [ + { + hash: 'img0037', + mag: 'N/A', + if_type: 'merge' + } + ] + ], + 'unequal': [ + [ + { + hash: 'img0042', + mag: 'N/A', + if_type: 'merge' + } + ] + ], + 'bridges': [ + [ + { + hash: 'img0038', + mag: 'N/A', + if_type: 'merge' + } + ] + ] + }, + 'rb': { + 'off': [ + [ + { + hash: 'img0001', + mag: 'N/A', + if_type: 'merge' + } + ] + ], + 'on': [ + [ + { + hash: 'img0002', + mag: 'N/A', + if_type: 'merge' + } + ], + [ + { + hash: 'img0003', + mag: 'N/A', + if_type: 'merge' + } + ] + ] + } + } + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + { + transfer_function: 'delta', + cutoff: 1, + drug: 'nc', + cell_line: 'S2', + above_marks: [ + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 29.5, + intensity: 0.5, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 19.9, + intensity: 0.5, + primary_anti_body: ['rad21'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 1, + primary_anti_body: ['cyclin'] + }, + { + name: 'Mad2', + weight: 25, + intensity: 2, + primary_anti_body: ['mad2'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 2, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Chk1', + weight: 54, + intensity: 2, + primary_anti_body: ['chk1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] } - } - }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - { - transfer_function: 'delta', - cutoff: 1, - drug: 'nc', - cell_line: 'S2', - above_marks: [ - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 29.5, - intensity: 0.5, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, - intensity: 0.5, - primary_anti_body: ['rad21'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 1, - primary_anti_body: ['cyclin'] - }, - { - name: 'Mad2', - weight: 25, - intensity: 2, - primary_anti_body: ['mad2'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 2, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Chk1', - weight: 54, - intensity: 2, - primary_anti_body: ['chk1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'rna1', - cell_line: 'S2', - above_marks: [ - { - name: 'Rad21', - weight: 29.5, - intensity: 2, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, - intensity: 2, - primary_anti_body: ['rad21'] - }, - { - name: 'Mad2', - weight: 25, - intensity: 2, - primary_anti_body: ['mad2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 25, - primary_anti_body: ['cyclin'] - }, - { - name: 'Chk1', - weight: 54, - intensity: 2, - primary_anti_body: ['chk1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'rna1', + cell_line: 'S2', + above_marks: [ + { + name: 'Rad21', + weight: 29.5, + intensity: 2, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 19.9, + intensity: 2, + primary_anti_body: ['rad21'] + }, + { + name: 'Mad2', + weight: 25, + intensity: 2, + primary_anti_body: ['mad2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 25, + primary_anti_body: ['cyclin'] + }, + { + name: 'Chk1', + weight: 54, + intensity: 2, + primary_anti_body: ['chk1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'rna2', - cell_line: 'S2', - above_marks: [ - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 29.5, - intensity: 0.5, - primary_anti_body: ['rad21'] - }, - { - name: 'Mad2', - weight: 25, - intensity: 2, - primary_anti_body: ['mad2'] - }, - { - name: 'Rad21', - weight: 19.9, - intensity: 0.5, - primary_anti_body: ['rad21'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 1, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 2, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Chk1', - weight: 59, - intensity: 4, - primary_anti_body: ['chk1'] - }, - { - name: 'Chk1', - weight: 54, - intensity: 0.5, - primary_anti_body: ['chk1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'rna2', + cell_line: 'S2', + above_marks: [ + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 29.5, + intensity: 0.5, + primary_anti_body: ['rad21'] + }, + { + name: 'Mad2', + weight: 25, + intensity: 2, + primary_anti_body: ['mad2'] + }, + { + name: 'Rad21', + weight: 19.9, + intensity: 0.5, + primary_anti_body: ['rad21'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 1, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 2, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Chk1', + weight: 59, + intensity: 4, + primary_anti_body: ['chk1'] + }, + { + name: 'Chk1', + weight: 54, + intensity: 0.5, + primary_anti_body: ['chk1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'rna3', - cell_line: 'S2', - above_marks: [ - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 25, - primary_anti_body: ['cyclin'] - }, - { - name: 'Mad2', - weight: 25, - intensity: 2, - primary_anti_body: ['mad2'] - }, - { - name: 'Chk1', - weight: 54, - intensity: 2, - primary_anti_body: ['chk1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'rna3', + cell_line: 'S2', + above_marks: [ + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 25, + primary_anti_body: ['cyclin'] + }, + { + name: 'Mad2', + weight: 25, + intensity: 2, + primary_anti_body: ['mad2'] + }, + { + name: 'Chk1', + weight: 54, + intensity: 2, + primary_anti_body: ['chk1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'rna4', - cell_line: 'S2', - above_marks: [ - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - }, - { - name: 'Chk1', - weight: 54, - intensity: 2, - primary_anti_body: ['chk1'] - }, - { - name: 'Mad2', - weight: 25, - intensity: 2, - primary_anti_body: ['mad2'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 32, - primary_anti_body: ['cyclinE'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'rna4', + cell_line: 'S2', + above_marks: [ + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] + }, + { + name: 'Chk1', + weight: 54, + intensity: 2, + primary_anti_body: ['chk1'] + }, + { + name: 'Mad2', + weight: 25, + intensity: 2, + primary_anti_body: ['mad2'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 32, + primary_anti_body: ['cyclinE'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'rna5', - cell_line: 'S2', - above_marks: [ - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 29.5, - intensity: 0.5, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, - intensity: 0.5, - primary_anti_body: ['rad21'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 1, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 2, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Chk1', - weight: 54, - intensity: 2, - primary_anti_body: ['chk1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'rna5', + cell_line: 'S2', + above_marks: [ + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 29.5, + intensity: 0.5, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 19.9, + intensity: 0.5, + primary_anti_body: ['rad21'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 1, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 2, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Chk1', + weight: 54, + intensity: 2, + primary_anti_body: ['chk1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Colchicine', - cell_line: 'S2', - above_marks: [ - { - name: 'Pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - }, - { - name: 'Chk1', - weight: 54, - intensity: 2, - primary_anti_body: ['chk1'] - }, - { - name: 'Mad2', - weight: 25, - intensity: 2, - primary_anti_body: ['mad2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 25, - primary_anti_body: ['cyclin'] - }, - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Hydroxyurea', - cell_line: 'S2', - above_marks: [ - { - name: 'Pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 2, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Mad2', - weight: 25, - intensity: 2, - primary_anti_body: ['mad2'] - }, - { - name: 'Chk1', - weight: 57, - intensity: 2, - primary_anti_body: ['chk1'] - }, - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Serum', - cell_line: 'S2', - above_marks: [ - { - name: 'Pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - }, - { - name: 'Chk1', - weight: 54, - intensity: 2, - primary_anti_body: ['chk1'] - }, - { - name: 'Mad2', - weight: 25, - intensity: 2, - primary_anti_body: ['mad2'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 32, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - } - ] - } - ] + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Colchicine', + cell_line: 'S2', + above_marks: [ + { + name: 'Pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + }, + { + name: 'Chk1', + weight: 54, + intensity: 2, + primary_anti_body: ['chk1'] + }, + { + name: 'Mad2', + weight: 25, + intensity: 2, + primary_anti_body: ['mad2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 25, + primary_anti_body: ['cyclin'] + }, + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] } + ] }, - facs: { - 'ticks': [50, 100, 150, 250], - 'max': 250, - 'dna': { - 'parser_simple': [ - { - match: [], - shape: '2-peak-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'nc', - shape: '2-peak-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'rna1', - shape: 'peak-100-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'rna2', - shape: '2-peak-uneven-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'rna3', - shape: 'peak-100-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'rna4', - shape: 'peak-50-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'rna5', - shape: '4-peak-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'Hydroxyurea', - shape: 's-block-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'Nocodazole', - shape: 'peak-100-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'Serum', - shape: 'peak-50-normal-400' - } - ] - + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Hydroxyurea', + cell_line: 'S2', + above_marks: [ + { + name: 'Pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 2, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Mad2', + weight: 25, + intensity: 2, + primary_anti_body: ['mad2'] + }, + { + name: 'Chk1', + weight: 57, + intensity: 2, + primary_anti_body: ['chk1'] + }, + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] } + ] }, - microscopy: { - 'valid': ['S2', 'nc'], - 'slide': { - - 'conditions_parser': [ - { - match: [] + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Serum', + cell_line: 'S2', + above_marks: [ + { + name: 'Pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + }, + { + name: 'Chk1', + weight: 54, + intensity: 2, + primary_anti_body: ['chk1'] + }, + { + name: 'Mad2', + weight: 25, + intensity: 2, + primary_anti_body: ['mad2'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 32, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] + } + ] + } + ] + } + }, + facs: { + 'ticks': [50, 100, 150, 250], + 'max': 250, + 'dna': { + 'parser_simple': [ + { + match: [], + shape: '2-peak-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'nc', + shape: '2-peak-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'rna1', + shape: 'peak-100-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'rna2', + shape: '2-peak-uneven-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'rna3', + shape: 'peak-100-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'rna4', + shape: 'peak-50-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'rna5', + shape: '4-peak-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'Hydroxyurea', + shape: 's-block-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'Nocodazole', + shape: 'peak-100-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'Serum', + shape: 'peak-50-normal-400' + } + ] - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['nc'], - conditions: 'rgb', - phenotype: 'composite3' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['nc'], - conditions: 'rb', - phenotype: 'composite' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna1'], - conditions: 'g', - phenotype: 'premature' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna2'], - conditions: 'gr', - phenotype: 'composite' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna2'], - conditions: 'rb', - phenotype: 'composite' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna3'], - conditions: 'rgb', - phenotype: 'metaphase' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna3'], - conditions: 'rb', - phenotype: 'on' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna4'], - conditions: 'rgb', - phenotype: 'interphase' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna5'], - conditions: 'rgb', - phenotype: 'composite4' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna5'], - conditions: 'rb', - phenotype: 'off' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['Serum'], - conditions: 'rgb', - phenotype: 'interphase' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['Hydroxyurea'], - conditions: 'rgb', - phenotype: 'interphase' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['Nocodazole'], - conditions: 'rgb', - phenotype: 'metaphase' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['Nocodazole'], - conditions: 'rb', - phenotype: 'on' - } + } + }, + microscopy: { + 'valid': ['S2', 'nc'], + 'slide': { - ] + 'conditions_parser': [ + { + match: [] - } + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['nc'], + conditions: 'rgb', + phenotype: 'composite3' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['nc'], + conditions: 'rb', + phenotype: 'composite' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna1'], + conditions: 'g', + phenotype: 'premature' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna2'], + conditions: 'gr', + phenotype: 'composite' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna2'], + conditions: 'rb', + phenotype: 'composite' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna3'], + conditions: 'rgb', + phenotype: 'metaphase' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna3'], + conditions: 'rb', + phenotype: 'on' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna4'], + conditions: 'rgb', + phenotype: 'interphase' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna5'], + conditions: 'rgb', + phenotype: 'composite4' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna5'], + conditions: 'rb', + phenotype: 'off' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['Serum'], + conditions: 'rgb', + phenotype: 'interphase' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['Hydroxyurea'], + conditions: 'rgb', + phenotype: 'interphase' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['Nocodazole'], + conditions: 'rgb', + phenotype: 'metaphase' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['Nocodazole'], + conditions: 'rb', + phenotype: 'on' } + ] + } + } + } + } }; diff --git a/html_app/assignments/scb_ex/AddMultipleDialog.js b/html_app/assignments/scb_ex/AddMultipleDialog.js index b2b52643..fa4fcf3e 100644 --- a/html_app/assignments/scb_ex/AddMultipleDialog.js +++ b/html_app/assignments/scb_ex/AddMultipleDialog.js @@ -1,252 +1,262 @@ if (typeof (scb_ex1) == 'undefined') { - scb_ex1 = {}; + scb_ex1 = {}; } if (typeof (scb_ex1.static) == 'undefined') { - scb_ex1.static = {}; + scb_ex1.static = {}; } -scb_ex1.static.scb_ex_inner_dialog_add_assignment_builder = function (element, dialog, state) { +scb_ex1.static.scb_ex_inner_dialog_add_assignment_builder = function(element, dialog, state) { - $('input[type="checkbox"]:checked', dialog).each(function (e) { - var element = $(this); - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var spid = $(element).attr('spid'); - $(element).attr('aria-checked', true); + $('input[type="checkbox"]:checked', dialog).each(function(e) { + var element = $(this); + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var spid = $(element).attr('spid'); + $(element).attr('aria-checked', true); - var parsed = scb.ui.static.MainFrame.validate_state({ - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'add_many_dialog_box', - skip_hash_update: true - }); + var parsed = scb.ui.static.MainFrame.validate_state({ + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'add_many_dialog_box', + skip_hash_update: true + }); - var template = parsed.assignment.template; + var template = parsed.assignment.template; - var cell_treatments_array = [_.find( template.ui.add_multiple_dialog.rows , function(e) {return e.id == spid })]; + var cell_treatments_array = [_.find(template.ui.add_multiple_dialog.rows, function(e) { + return e.id == spid + })]; - _.each(cell_treatments_array, function (eh) { - parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); - }); + _.each(cell_treatments_array, function(eh) { + parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); }); + }); - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); } if (typeof (scb_ex2) == 'undefined') { - scb_ex2 = {}; + scb_ex2 = {}; } if (typeof (scb_ex2.static) == 'undefined') { - scb_ex2.static = {}; + scb_ex2.static = {}; } if (typeof (scb_ex3) == 'undefined') { - scb_ex3 = {}; + scb_ex3 = {}; } if (typeof (scb_ex3.static) == 'undefined') { - scb_ex3.static = {}; + scb_ex3.static = {}; } -scb_ex1.static.scb_ex_inner_dialog_add = function (element, dialog, state) { - - $('input[type="checkbox"]:checked', dialog).each(function (e) { - var element = $(this); - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var cell_line = $(element).attr('cell_line'); - var name = $(element).attr('name'); - $(element).attr('aria-checked', true); - var parsed = scb.ui.static.MainFrame.validate_state({ - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'add_many_dialog_box', - skip_hash_update: true - }); - - var template = parsed.assignment.template; - -// var cell_treatments_array = [ -// { -// cell_line: cell_line, -// treatment_list: {list: [ -// {drug_list: {list: [ -// {drug_id: 'nc', concentration_id: '0'} -// ]}, temperature: '40', collection_id: state.source_state.collection_id, condition: state.source_state.condition} -// ]}} -// ]; -// - - - var treatment_id=$(element).attr('treatment_id'); - /*'rows' listed under each cell line, has a list of all treatments for this cell line*/ - /* each entry under 'rows' has treatment_id attribute*/ - /* treatment_id has to be unique for each entry under 'rows' - * otherwise only the first one will be displayed in the setup table*/ - var rows = template.ui.add_multiple_dialog[cell_line].rows; - var row = _.find(rows, function (eh) { - return eh.treatment_id == treatment_id; - }); - - var cell_treatments_array = row.cell_treatments[name]; - - _.each(cell_treatments_array, function (eh) { - parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); - }); - +scb_ex1.static.scb_ex_inner_dialog_add = function(element, dialog, state) { + + $('input[type="checkbox"]:checked', dialog).each(function(e) { + var element = $(this); + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var cell_line = $(element).attr('cell_line'); + var name = $(element).attr('name'); + $(element).attr('aria-checked', true); + var parsed = scb.ui.static.MainFrame.validate_state({ + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'add_many_dialog_box', + skip_hash_update: true }); - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - -} - -scb_ex1.register = function (dialog, state) { - scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_dialog', function (e) { - var container = dialog; - if (container.has(e.target).length === 0) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - } - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_cancel', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_add', function (e) { - scb_ex1.static.scb_ex_inner_dialog_add(this, dialog, state); - $(this).focus(); + var template = parsed.assignment.template; + + // var cell_treatments_array = [ + // { + // cell_line: cell_line, + // treatment_list: {list: [ + // {drug_list: {list: [ + // {drug_id: 'nc', concentration_id: '0'} + // ]}, temperature: '40', collection_id: state.source_state.collection_id, condition: state.source_state.condition} + // ]}} + // ]; + // + + + var treatment_id = $(element).attr('treatment_id'); + /*'rows' listed under each cell line, has a list of all treatments for this cell line*/ + /* each entry under 'rows' has treatment_id attribute*/ + /* treatment_id has to be unique for each entry under 'rows' + * otherwise only the first one will be displayed in the setup table*/ + var rows = template.ui.add_multiple_dialog[cell_line].rows; + var row = _.find(rows, function(eh) { + return eh.treatment_id == treatment_id; }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_select_all', function (e) { - $('input[type=checkbox]', dialog).attr('checked', 'checked'); - $('input[type=checkbox]', dialog).attr('aria-checked', true); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_clear_all', function (e) { - $('input[type=checkbox]', dialog).attr('checked', false); - }); - scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function (e) { - $(this, dialog).attr('aria-checked', $(this, dialog).attr('aria-checked') == 'false' ? true : false); - }); + var cell_treatments_array = row.cell_treatments[name]; - scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_title_close', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); - }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_select', function (e) { - var cell_line = $(this).attr('cell_line'); - var name = $(this).attr('name'); - $('input[type=checkbox][name="' + name + '"][cell_line="' + cell_line + '"]', dialog).attr('checked', 'checked'); - $('input[type=checkbox][name="' + name + '"][cell_line="' + cell_line + '"]', dialog).attr('aria-checked', true); + _.each(cell_treatments_array, function(eh) { + parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); }); - scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_add_assignment_builder', function (e) { - scb_ex1.static.scb_ex_inner_dialog_add_assignment_builder(this, dialog, state); - $(this).focus(); - }); + }); -} + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); -scb_ex1.setup = function (state) { - console.info(state); - var workarea = state.workarea; - var assignment = state.assignment; - var experiment = state.experiment; - var template = state.template; - var onClose = state.close; - - var dialog = $("
"); - dialog.html(scb_ex.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); - - dialog.appendTo($(workarea)); - scb_ex1.register($(dialog), state); - - var css = scb.utils.get(state, ['source_state', 'css']); - _.each(css, function (v, k) { - dialog.css(k, v); - }); +} - $('.scb_ex_dialog').draggable({handle: '.scb_ex_inner_dialog_title'}) +scb_ex1.register = function(dialog, state) { + scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_dialog', function(e) { + var container = dialog; + if (container.has(e.target).length === 0) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + } + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_cancel', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_add', function(e) { + scb_ex1.static.scb_ex_inner_dialog_add(this, dialog, state); + $(this).focus(); + }); + + scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_select_all', function(e) { + $('input[type=checkbox]', dialog).attr('checked', 'checked'); + $('input[type=checkbox]', dialog).attr('aria-checked', true); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_clear_all', function(e) { + $('input[type=checkbox]', dialog).attr('checked', false); + }); + scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function(e) { + $(this, dialog).attr('aria-checked', $(this, dialog).attr('aria-checked') == 'false' ? true : false); + }); + + scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_title_close', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); + }); + scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_select', function(e) { + var cell_line = $(this).attr('cell_line'); + var name = $(this).attr('name'); + $('input[type=checkbox][name="' + name + '"][cell_line="' + cell_line + '"]', dialog).attr('checked', 'checked'); + $('input[type=checkbox][name="' + name + '"][cell_line="' + cell_line + '"]', dialog).attr('aria-checked', true); + }); + + scb.utils.off_on(dialog.parent(), 'click', '.scb_ex_inner_dialog_add_assignment_builder', function(e) { + scb_ex1.static.scb_ex_inner_dialog_add_assignment_builder(this, dialog, state); + $(this).focus(); + }); } -scb_ex2.setup=function(state){ - var workarea = state.workarea; - var assignment=state.assignment; - var experiment=state.experiment; - var template = state.template; - var dialog=$("
"); - dialog.html(scb_ex.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); - dialog.appendTo($(workarea)); - scb_ex1.register($(dialog), state); - - var css = scb.utils.get(state, ['source_state', 'css']); - _.each(css, function (v, k) { - dialog.css(k, v); - }); - - $('.scb_ex_dialog').draggable({handle: '.scb_ex_inner_dialog_title'}); +scb_ex1.setup = function(state) { + console.info(state); + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.template; + var onClose = state.close; + + var dialog = $("
"); + dialog.html(scb_ex.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); + + dialog.appendTo($(workarea)); + scb_ex1.register($(dialog), state); + + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); + + $('.scb_ex_dialog').draggable({ + handle: '.scb_ex_inner_dialog_title' + }) } -scb_ex3.setup=function(state) { - var workarea = state.workarea; - var assignment = state.assignment; - var experiment = state.experiment; - var template = state.template; - var dialog = $("
"); - dialog.html(scb_ex.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); - dialog.appendTo($(workarea)); - scb_ex1.register($(dialog), state); - - var css = scb.utils.get(state, ['source_state', 'css']); - _.each(css, function (v, k) { - dialog.css(k, v); - }); - $('.scb_ex_dialog').draggable({handle: '.scb_ex_inner_dialog_title'}); +scb_ex2.setup = function(state) { + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.template; + var dialog = $("
"); + dialog.html(scb_ex.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); + dialog.appendTo($(workarea)); + scb_ex1.register($(dialog), state); + + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); + + $('.scb_ex_dialog').draggable({ + handle: '.scb_ex_inner_dialog_title' + }); } -scb_ex1.assignment_builder_add_multiple = function (state) { - console.info(state); - var workarea = state.workarea; - var assignment = state.assignment; - var experiment = state.experiment; - var template = state.template; - var onClose = state.close; - - var dialog = $("
"); - dialog.html(scb_ex.dialog_assignment_builder({ - assignment: assignment, - experiment: experiment, - template: template - })); - - dialog.appendTo($(workarea)); - scb_ex1.register($(dialog), state); - - var css = scb.utils.get(state, ['source_state', 'css']); - _.each(css, function (v, k) { - dialog.css(k, v); - }); +scb_ex3.setup = function(state) { + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.template; + var dialog = $("
"); + dialog.html(scb_ex.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); + dialog.appendTo($(workarea)); + scb_ex1.register($(dialog), state); + + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); + + $('.scb_ex_dialog').draggable({ + handle: '.scb_ex_inner_dialog_title' + }); - $('.scb_ex_dialog').draggable({handle: '.scb_ex_inner_dialog_title'}) +} +scb_ex1.assignment_builder_add_multiple = function(state) { + console.info(state); + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.template; + var onClose = state.close; + + var dialog = $("
"); + dialog.html(scb_ex.dialog_assignment_builder({ + assignment: assignment, + experiment: experiment, + template: template + })); + + dialog.appendTo($(workarea)); + scb_ex1.register($(dialog), state); + + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); + + $('.scb_ex_dialog').draggable({ + handle: '.scb_ex_inner_dialog_title' + }) } diff --git a/html_app/assignments/scb_ex/assignment.js b/html_app/assignments/scb_ex/assignment.js index 273d8f61..af1d0c74 100644 --- a/html_app/assignments/scb_ex/assignment.js +++ b/html_app/assignments/scb_ex/assignment.js @@ -1,5897 +1,7997 @@ degreeEntity = $('
').html('°').text(); var __scb_sample_1 = { - id: 'scb_ex1', - name: 'Exercise 1', - course: 'SCB_SampleExercises', - course_name: 'Sample Exercises', - description: 'StarCellBio Exercise 1 – Protein localization', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ["Goal & Learning Objectives", scb_ex1_text.goal({})], - ["Introduction", scb_ex1_text.intro({})], - ["Background Information", scb_ex1_text.bg_info({})], - ["Questions", scb_ex1_text.questions({})] + id: 'scb_ex1', + name: 'Exercise 1', + course: 'SCB_SampleExercises', + course_name: 'Sample Exercises', + description: 'StarCellBio Exercise 1 – Protein localization', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ["Goal & Learning Objectives", scb_ex1_text.goal({})], + ["Introduction", scb_ex1_text.intro({})], + ["Background Information", scb_ex1_text.bg_info({})], + ["Questions", scb_ex1_text.questions({})] + ], + ui: { + experimental_design: { + techniques: ['micro'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: false + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } ], - ui: { - experimental_design: { - techniques: [ 'micro' ] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: false} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - { - kind: "add_many", name: "ADD SAMPLES", open: 'scb_ex1.setup', - 'collection_id': '%CELL_LINE%' - } + actions: [ + { + kind: "add_many", + name: "ADD SAMPLES", + open: 'scb_ex1.setup', + 'collection_id': '%CELL_LINE%' + } - ] - }, - microscopy: { - disable_blur: false, - disable_brightness: false - }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']} + ] + }, + microscopy: { + disable_blur: false, + disable_brightness: false + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + } + } + }, + add_multiple_dialog: { + order: ['no-gfp', 'gfp', 'gfp-pa', 'gfp-pb', 'gfp-pc', 'gfp-pd', 'gfp-ma', 'gfp-mb', 'gfp-nuc', 'gfp-cyto', 'gfp-pm', + 'gfp-er', 'gfp-nm'], + headings: [ + '', 'Strains', 'Treatments' + ], + 'no-gfp': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' + }, + { + kind: 'text', + text: 'No-GFP' + }, + { + kind: 'text', + text: 'Growth Media' } - }, - add_multiple_dialog: { - order: ['no-gfp', 'gfp', 'gfp-pa', 'gfp-pb', 'gfp-pc', 'gfp-pd', 'gfp-ma', 'gfp-mb', 'gfp-nuc', 'gfp-cyto', 'gfp-pm', - 'gfp-er', 'gfp-nm'], - headings: [ - '', 'Strains', 'Treatments' - ], - 'no-gfp': { - rows: [ + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'no-gfp', + treatment_list: { + list: [ { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'No-GFP'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'no-gfp', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } + ] + } + } + ] + } + } - ] + ] + }, + 'gfp': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' }, - 'gfp': { - rows: [ - { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } - } - - ] + { + kind: 'text', + text: 'GFP' }, - 'gfp-pa': { - rows: [ + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp', + treatment_list: { + list: [ { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-ProA'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-pa', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } + ] + } + } + ] + } + } - ] + ] + }, + 'gfp-pa': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' }, - 'gfp-pb': { - rows: [ - { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-ProB'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-pb', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } - } - - ] + { + kind: 'text', + text: 'GFP-ProA' }, - 'gfp-pc': { - rows: [ + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-pa', + treatment_list: { + list: [ { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-ProC'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-pc', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } + ] + } + } + ] + } + } - ] + ] + }, + 'gfp-pb': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' }, - 'gfp-pd': { - rows: [ - { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-ProD'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-pd', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } - } - - ] + { + kind: 'text', + text: 'GFP-ProB' }, - 'gfp-ma': { - rows: [ + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-pb', + treatment_list: { + list: [ { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-Mut ProA'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-ma', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } + ] + } + } + ] + } + } - ] + ] + }, + 'gfp-pc': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' }, - 'gfp-mb': { - rows: [ - { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-Mut ProB'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-mb', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } - } - - ] + { + kind: 'text', + text: 'GFP-ProC' }, - 'gfp-nuc': { - rows: [ + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-pc', + treatment_list: { + list: [ { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-Nuc'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-nuc', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } + ] + } + } + ] + } + } - ] + ] + }, + 'gfp-pd': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' }, - 'gfp-cyto': { - rows: [ - { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-Cyto'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-cyto', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } - } - - ] + { + kind: 'text', + text: 'GFP-ProD' }, - 'gfp-pm': { - rows: [ + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-pd', + treatment_list: { + list: [ { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-PM'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-pm', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } + ] + } + } + ] + } + } - ] + ] + }, + 'gfp-ma': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' + }, + { + kind: 'text', + text: 'GFP-Mut ProA' }, - 'gfp-er': { - rows: [ + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-ma', + treatment_list: { + list: [ { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-ER'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-er', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } + ] + } + } + ] + } + } - ] + ] + }, + 'gfp-mb': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' }, - 'gfp-nm': { - rows: [ + { + kind: 'text', + text: 'GFP-Mut ProB' + }, + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-mb', + treatment_list: { + list: [ { - treatment_id: 'nc', - cells: [ - {kind: 'checkbox', name: "growth_media", treatment_id: 'nc'}, - {kind: 'text', text: 'GFP-NM'}, - {kind: 'text', text: 'Growth Media'} - ], - cell_treatments: { - growth_media: [ - { - cell_line: 'gfp-nm', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, - temperature: '0', - conditions: { - 'FLUOR': ['gfp'] - } - } - ] - } - } - ] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } - - ] - } - - - } - }, - add_new_row_instructions: 'add new row instructions', - experiment_setup: scb_ex1_text.experiment_setup({}), - collections: { - '6 m': { - name: '6 months' + ] + } + } + ] + } } - }, - concentrations: { - '0': { - name: '', - value: 0 - } + ] }, - drugs: { - 'nc': { - name: 'Growth Media', - concentrations: [0] + 'gfp-nuc': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' + }, + { + kind: 'text', + text: 'GFP-Nuc' + }, + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-nuc', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } + } + ] + } + } + ] + } } + ] }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" - }, - '40': { - name: "37" + degreeEntity + "C" + 'gfp-cyto': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' + }, + { + kind: 'text', + text: 'GFP-Cyto' + }, + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-cyto', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } + } + ] + } + } + ] + } } - }, - cell_lines: { - 'no-gfp': { - name: 'No-GFP' - }, - 'gfp': { - name: 'GFP' - }, - 'gfp-pa': { - name: 'GFP-ProA' - }, - 'gfp-pb': { - name: 'GFP-ProB' - }, - 'gfp-pc': { - name: 'GFP-ProC' - }, - 'gfp-pd': { - name: 'GFP-ProD' - }, - 'gfp-ma': { - name: 'GFP-Mut ProA' - }, - 'gfp-mb': { - name: 'GFP-Mut ProB' - }, - 'gfp-nuc': { - name: 'GFP-Nuc' - }, - 'gfp-cyto': { - name: 'GFP-Cyto' - }, - 'gfp-pm': { - name: 'GFP-PM' - }, - 'gfp-er': { - name: 'GFP-ER' - }, - 'gfp-nm': { - name: 'GFP-NM' - } + ] }, - time_unit: { - kind: 'minutes' - }, - micro_kinds: { - 'FLUOR': { - name: 'Fluorescence', - conditions: { - 'gfp': {name: 'GFP (green)', - short_name: 'G:GFP'} + 'gfp-pm': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' + }, + { + kind: 'text', + text: 'GFP-PM' + }, + { + kind: 'text', + text: 'Growth Media' } - }, - 'na': { - name: 'None' + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-pm', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } + } + ] + } + } + ] + } } - }, - /* for microscopy only*/ - slides: { - '1': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn2.jpg', - '2': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn3.jpg', - '3': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn5.jpg', - '4': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn6.jpg', - '5': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn7.jpg', - '6': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn8.jpg', - '7': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn11.jpg', - '8': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn12.jpg', - '9': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn15.jpg', - '10': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn17.jpg', - '11': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn20.jpg', - - '12': 'images/microscopy/SCB_EX1/er_final/er1crop.jpg', - '13': 'images/microscopy/SCB_EX1/er_final/er2crop.jpg', - '14': 'images/microscopy/SCB_EX1/er_final/er3crop1.jpg', - '15': 'images/microscopy/SCB_EX1/er_final/er3crop2.jpg', - '16': 'images/microscopy/SCB_EX1/er_final/er5crop1.jpg', - - '17': 'images/microscopy/SCB_EX1/nucleus_final/n2.jpg', - '18': 'images/microscopy/SCB_EX1/nucleus_final/n8.jpg', - '19': 'images/microscopy/SCB_EX1/nucleus_final/n9.jpg', - '20': 'images/microscopy/SCB_EX1/nucleus_final/n18.jpg', - '21': 'images/microscopy/SCB_EX1/nucleus_final/n34.jpg', - '22': 'images/microscopy/SCB_EX1/nucleus_final/n43.jpg', - '23': 'images/microscopy/SCB_EX1/nucleus_final/n47.jpg', - '25': 'images/microscopy/SCB_EX1/nucleus_final/n64.jpg', - '26': 'images/microscopy/SCB_EX1/nucleus_final/nuc-a.jpg', - '27': 'images/microscopy/SCB_EX1/nucleus_final/nuc-b.jpg', - '28': 'images/microscopy/SCB_EX1/nucleus_final/nuc-c.jpg', - '29': 'images/microscopy/SCB_EX1/pm_final/pm-b.jpg', - '30': 'images/microscopy/SCB_EX1/pm_final/pm-c.jpg', - '31': 'images/microscopy/SCB_EX1/pm_final/pm2b.jpg', - '33': 'images/microscopy/SCB_EX1/pm_final/pm3b.jpg', - '34': 'images/microscopy/SCB_EX1/pm_final/pm34-1.jpg', - '35': 'images/microscopy/SCB_EX1/pm_final/pm34-2.jpg', - - '36': 'images/microscopy/SCB_EX1/cyto_final/c-a.jpg', - '37': 'images/microscopy/SCB_EX1/cyto_final/c-b.jpg', - '38': 'images/microscopy/SCB_EX1/cyto_final/c-c.jpg', - '39': 'images/microscopy/SCB_EX1/cyto_final/c-d.jpg', - '40': 'images/microscopy/SCB_EX1/cyto_final/c1.jpg', - '41': 'images/microscopy/SCB_EX1/cyto_final/c7.jpg', - '42': 'images/microscopy/SCB_EX1/cyto_final/c15-1.jpg', - '43': 'images/microscopy/SCB_EX1/cyto_final/c15-2.jpg', - '44': 'images/microscopy/SCB_EX1/cyto_final/c17.jpg', - '45': 'images/microscopy/SCB_EX1/cyto_final/c29.jpg', - - '46': 'images/microscopy/SCB_EX1/nm_final/NM1crop.jpg', - '47': 'images/microscopy/SCB_EX1/nm_final/nm2crop.jpg', - '48': 'images/microscopy/SCB_EX1/nm_final/nm3crop1.jpg', - '49': 'images/microscopy/SCB_EX1/nm_final/nm3crop2.jpg', - '50': 'images/microscopy/SCB_EX1/nm_final/nm5crop.jpg', - - 'bo': 'images/microscopy/SCB_EX1/negative_control.jpg', - 'dummy': 'dummy' + ] }, - model: { - microscopy: { - 'slide': { - 'parser_simple': [ + 'gfp-er': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' + }, + { + kind: 'text', + text: 'GFP-ER' + }, + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-er', + treatment_list: { + list: [ { - match: ['cell_line'], - cell_line: 'no-gfp', - imgs_hash: [ - [ - {hash: 'bo', if_type: 'green'} - ] - ] - }, - { //nuc and cyto - match: ['cell_line'], - cell_line: 'gfp', - imgs_hash: [ - [ - {hash: '1', if_type: 'green'} - ], - [ - {hash: '2', if_type: 'green'} - ], - [ - {hash: '3', if_type: 'green'} - ], - [ - {hash: '4', if_type: 'green'} - ], - [ - {hash: '5', if_type: 'green'} - ], - [ - {hash: '6', if_type: 'green'} - ], - [ - {hash: '7', if_type: 'green'} - ], - [ - {hash: '8', if_type: 'green'} - ], - [ - {hash: '9', if_type: 'green'} - ], - [ - {hash: '10', if_type: 'green'} - ], - [ - {hash: '11', if_type: 'green'} - ] - ] - }, - {//er - match: ['cell_line'], - cell_line: 'gfp-pa', - imgs_hash: [ - [ - {hash: '12', if_type: 'green'} - ], - [ - {hash: '13', if_type: 'green'} - ], - [ - {hash: '14', if_type: 'green'} - ], - [ - {hash: '15', if_type: 'green'} - ], - [ - {hash: '16', if_type: 'green'} - ] - ] - }, - {//nucleus - match: ['cell_line'], - cell_line: 'gfp-pb', - imgs_hash: [ - [ - {hash: '17', if_type: 'green'} - ], - [ - {hash: '18', if_type: 'green'} - ], - [ - {hash: '19', if_type: 'green'} - ], - [ - {hash: '20', if_type: 'green'} - ], - [ - {hash: '21', if_type: 'green'} - ], - [ - {hash: '22', if_type: 'green'} - ], - [ - {hash: '23', if_type: 'green'} - ], - [ - {hash: '25', if_type: 'green'} - ], - [ - {hash: '26', if_type: 'green'} - ], - [ - {hash: '27', if_type: 'green'} - ], - [ - {hash: '28', if_type: 'green'} - ] - ] - }, - {//pm - match: ['cell_line'], - cell_line: 'gfp-pc', - imgs_hash: [ - [ - {hash: '29', if_type: 'green'} - ], - [ - {hash: '30', if_type: 'green'} - ], - [ - {hash: '31', if_type: 'green'} - ], - [ - {hash: '32', if_type: 'green'} - ], - [ - {hash: '33', if_type: 'green'} - ], - [ - {hash: '34', if_type: 'green'} - ], - [ - {hash: '35', if_type: 'green'} - ] - ] - }, - {//cyto - match: ['cell_line'], - cell_line: 'gfp-pd', - imgs_hash: [ - [ - {hash: '36', if_type: 'green'} - ], - [ - {hash: '37', if_type: 'green'} - ], - [ - {hash: '38', if_type: 'green'} - ], - [ - {hash: '39', if_type: 'green'} - ], - [ - {hash: '40', if_type: 'green'} - ], - [ - {hash: '41', if_type: 'green'} - ], - [ - {hash: '42', if_type: 'green'} - ], - [ - {hash: '45', if_type: 'green'} - ] - ] - }, - {//pm - match: ['cell_line'], - cell_line: 'gfp-ma', - imgs_hash: [ - [ - {hash: '29', if_type: 'green'} - ], - [ - {hash: '30', if_type: 'green'} - ], - [ - {hash: '31', if_type: 'green'} - ], - [ - {hash: '32', if_type: 'green'} - ], - [ - {hash: '33', if_type: 'green'} - ], - [ - {hash: '34', if_type: 'green'} - ], - [ - {hash: '35', if_type: 'green'} - ] - ] - }, - {//nucleus - match: ['cell_line'], - cell_line: 'gfp-mb', - imgs_hash: [ - [ - {hash: '17', if_type: 'green'} - ], - [ - {hash: '18', if_type: 'green'} - ], - [ - {hash: '19', if_type: 'green'} - ], - [ - {hash: '20', if_type: 'green'} - ], - [ - {hash: '21', if_type: 'green'} - ], - [ - {hash: '22', if_type: 'green'} - ], - [ - {hash: '23', if_type: 'green'} - ], - [ - {hash: '25', if_type: 'green'} - ], - [ - {hash: '26', if_type: 'green'} - ], - [ - {hash: '27', if_type: 'green'} - ], - [ - {hash: '28', if_type: 'green'} - ] - ] - }, - {//nucleus - match: ['cell_line'], - cell_line: 'gfp-nuc', - imgs_hash: [ - [ - {hash: '17', if_type: 'green'} - ], - [ - {hash: '18', if_type: 'green'} - ], - [ - {hash: '19', if_type: 'green'} - ], - [ - {hash: '20', if_type: 'green'} - ], - [ - {hash: '21', if_type: 'green'} - ], - [ - {hash: '22', if_type: 'green'} - ], - [ - {hash: '23', if_type: 'green'} - ], - [ - {hash: '25', if_type: 'green'} - ], - [ - {hash: '26', if_type: 'green'} - ], - [ - {hash: '27', if_type: 'green'} - ], - [ - {hash: '28', if_type: 'green'} - ] - ] - }, - {//cyto - match: ['cell_line'], - cell_line: 'gfp-cyto', - imgs_hash: [ - [ - {hash: '36', if_type: 'green'} - ], - [ - {hash: '37', if_type: 'green'} - ], - [ - {hash: '38', if_type: 'green'} - ], - [ - {hash: '39', if_type: 'green'} - ], - [ - {hash: '40', if_type: 'green'} - ], - [ - {hash: '41', if_type: 'green'} - ], - [ - {hash: '42', if_type: 'green'} - ], - [ - {hash: '45', if_type: 'green'} - ] - ] - }, - {//pm - match: ['cell_line'], - cell_line: 'gfp-pm', - imgs_hash: [ - [ - {hash: '29', if_type: 'green'} - ], - [ - {hash: '30', if_type: 'green'} - ], - [ - {hash: '31', if_type: 'green'} - ], - [ - {hash: '32', if_type: 'green'} - ], - [ - {hash: '33', if_type: 'green'} - ], - [ - {hash: '34', if_type: 'green'} - ], - [ - {hash: '35', if_type: 'green'} - ] - ] - }, - {//er - match: ['cell_line'], - cell_line: 'gfp-er', - imgs_hash: [ - [ - {hash: '12', if_type: 'green'} - ], - [ - {hash: '13', if_type: 'green'} - ], - [ - {hash: '14', if_type: 'green'} - ], - [ - {hash: '15', if_type: 'green'} - ], - [ - {hash: '16', if_type: 'green'} - ] - ] - }, - {//nm - match: ['cell_line'], - cell_line: 'gfp-nm', - imgs_hash: [ - [ - {hash: '46', if_type: 'green'} - ], - [ - {hash: '47', if_type: 'green'} - ], - [ - {hash: '48', if_type: 'green'} - ], - [ - {hash: '49', if_type: 'green'} - ], - [ - {hash: '50', if_type: 'green'} - ] + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } } - - ] - } - } - - } - } -}; -var __scb_sample_2 = { - id: 'scb_ex2', - name: 'Exercise 2', - course: 'SCB_SampleExercises', - course_name: 'Sample Exercises', - description: 'StarCellBio Exercise 2 – Orientation of Transmembrane Proteins', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ["Goal & Learning Objectives", scb_ex2_text.goal({})], - ["Introduction", scb_ex2_text.intro({})], - ["Background Information", scb_ex2_text.bg_info({})], - ["Questions", scb_ex2_text.questions({})] - - ], - ui: { - experimental_design: { - techniques: [ 'facs', 'wb'], - gel_types: ['.10', '.12', '.15'] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: false} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - { - kind: "add_many", name: "ADD SAMPLES", open: 'scb_ex2.setup', - 'collection_id': '%CELL_LINE%' + ] } - + } ] - }, - microscopy: { - disable_blur: false, - disable_brightness: false - }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']} - } - }, - add_multiple_dialog: { - order: ['nt', 'proX-Null', 'proY-Null', 'HproX-FLAG', 'HproY-FLAG'], - headings: [ - '', 'Strains', 'Treatments' - ], - 'nt': { - rows: [ - { - treatment_id: 'gmBuf', - cells: [ - {kind: 'checkbox', name: "GrowthMediaBuffer", treatment_id: 'gmBuf'}, - {kind: 'text', text: 'NoTags'}, - {kind: 'text', text: 'Growth Media + Buffer'} - ], - cell_treatments: { - GrowthMediaBuffer: [ - { - cell_line: 'nt', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'gmBuf', concentration_id: '0'} - ]}, - temperature: '0' - } - ] - } - } - ] - } - }, - { - treatment_id: 'gmProK', - cells: [ - {kind: 'checkbox', name: "GrowthMediaProK", treatment_id: 'gmProK'}, - {kind: 'text', text: 'NoTags'}, - {kind: 'text', text: 'Growth Media + ProK'} - ], - - cell_treatments: { - GrowthMediaProK: [ - { - cell_line: 'nt', - treatment_list: {list: [ - { - drug_list: {list: [ - {drug_id: 'gmProK', concentration_id: '0'} - ]}, - temperature: '0' - } - ]} - } - - ] + } + } - } - } - ] + ] + }, + 'gfp-nm': { + rows: [ + { + treatment_id: 'nc', + cells: [ + { + kind: 'checkbox', + name: "growth_media", + treatment_id: 'nc' }, - 'proX-Null': { - rows: [ - { - treatment_id: 'gmBuf', - cells: [ - {kind: 'checkbox', name: "GrowthMediaBuffer", treatment_id: 'gmBuf'}, - {kind: 'text', text: 'ProX-Null'}, - {kind: 'text', text: 'Growth Media + Buffer'} - ], - cell_treatments: { - GrowthMediaBuffer: [ - { - cell_line: 'proX-Null', - treatment_list: { - list: [ - { - drug_list: {list: [ - {drug_id: 'gmBuf', concentration_id: '0'} - ]}, - temperature: '0' - - } - ] - } - } - ] - } - }, - { - treatment_id: 'gmProK', - cells: [ - {kind: 'checkbox', name: "GrowthMediaProK", treatment_id: 'gmProK'}, - {kind: 'text', text: 'ProX-Null'}, - {kind: 'text', text: 'Growth Media + ProK'} - ], - cell_treatments: { - GrowthMediaProK: [ - { - cell_line: 'proX-Null', - treatment_list: { - list: [ - { - drug_list: {list: [ - {drug_id: 'gmProK', concentration_id: '0'} - ]}, - temperature: '0' - - } - ] - } - } - ] - } - } - ] + { + kind: 'text', + text: 'GFP-NM' }, - 'proY-Null': { - rows: [ + { + kind: 'text', + text: 'Growth Media' + } + ], + cell_treatments: { + growth_media: [ + { + cell_line: 'gfp-nm', + treatment_list: { + list: [ { - treatment_id: 'gmBuf', - cells: [ - {kind: 'checkbox', name: "GrowthMediaBuffer", treatment_id: 'gmBuf'}, - {kind: 'text', text: 'ProY-Null'}, - {kind: 'text', text: 'Growth Media + Buffer'} - ], - cell_treatments: { - GrowthMediaBuffer: [ - { - cell_line: 'proY-Null', - treatment_list: { - list: [ - { - drug_list: {list: [ - {drug_id: 'gmBuf', concentration_id: '0'} - ]}, - temperature: '0' + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '0', + conditions: { + 'FLUOR': ['gfp'] + } + } + ] + } + } + ] + } + } - } - ] - } - } - ] - } - }, - { - treatment_id: 'gmProK', - cells: [ - {kind: 'checkbox', name: "GrowthMediaProK", treatment_id: 'gmProK'}, - {kind: 'text', text: 'ProY-Null'}, - {kind: 'text', text: 'Growth Media + ProK'} - ], - cell_treatments: { - GrowthMediaProK: [ - { - cell_line: 'proY-Null', - treatment_list: { - list: [ - { - drug_list: {list: [ - {drug_id: 'gmProK', concentration_id: '0'} - ]}, - temperature: '0' + ] + } - } - ] - } - } - ] - } - } - ] - }, - 'HproX-FLAG': { - rows: [ - { - treatment_id: 'gmBuf', - cells: [ - {kind: 'checkbox', name: "GrowthMediaBuffer", treatment_id: 'gmBuf'}, - {kind: 'text', text: 'His-ProX-FLAG'}, - {kind: 'text', text: 'Growth Media + Buffer'} - ], - cell_treatments: { - GrowthMediaBuffer: [ - { - cell_line: 'HproX-FLAG', - treatment_list: { - list: [ - { - drug_list: {list: [ - {drug_id: 'gmBuf', concentration_id: '0'} - ]}, - temperature: '0' - } - ] - } - } - ] - } - }, - { - treatment_id: 'gmProK', - cells: [ - {kind: 'checkbox', name: "GrowthMediaProK", treatment_id: 'gmProK'}, - {kind: 'text', text: 'His-ProX-FLAG'}, - {kind: 'text', text: 'Growth Media + ProK'} - ], - cell_treatments: { - GrowthMediaProK: [ - { - cell_line: 'HproX-FLAG', - treatment_list: { - list: [ - { - drug_list: {list: [ - {drug_id: 'gmProK', concentration_id: '0'} - ]}, - temperature: '0' + } + }, + add_new_row_instructions: 'add new row instructions', + experiment_setup: scb_ex1_text.experiment_setup({}), + collections: { + '6 m': { + name: '6 months' + } + }, - } - ] - } - } - ] - } - } - ] - }, - 'HproY-FLAG': { - rows: [ - { - treatment_id: 'gmBuf', - cells: [ - {kind: 'checkbox', name: "GrowthMediaBuffer", treatment_id: 'gmBuf'}, - {kind: 'text', text: 'His-ProY-FLAG'}, - {kind: 'text', text: 'Growth Media + Buffer'} - ], - cell_treatments: { - GrowthMediaBuffer: [ - { - cell_line: 'HproY-FLAG', - treatment_list: { - list: [ - { - drug_list: {list: [ - {drug_id: 'gmBuf', concentration_id: '0'} - ]}, - temperature: '0' + concentrations: { + '0': { + name: '', + value: 0 + } + }, + drugs: { + 'nc': { + name: 'Growth Media', + concentrations: [0] + } - } - ] - } - } - ] - } - }, - { - treatment_id: 'gmProK', - cells: [ - {kind: 'checkbox', name: "GrowthMediaProK", treatment_id: 'gmProK'}, - {kind: 'text', text: 'His-ProY-FLAG'}, - {kind: 'text', text: 'Growth Media + ProK'} - ], - cell_treatments: { - GrowthMediaProK: [ - { - cell_line: 'HproY-FLAG', - treatment_list: { - list: [ - { - drug_list: {list: [ - {drug_id: 'gmProK', concentration_id: '0'} - ]}, - temperature: '0' + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + }, + '40': { + name: "37" + degreeEntity + "C" + } + }, - } - ] - } - } - ] - } - } - ] - } + cell_lines: { + 'no-gfp': { + name: 'No-GFP' + }, + 'gfp': { + name: 'GFP' + }, + 'gfp-pa': { + name: 'GFP-ProA' + }, + 'gfp-pb': { + name: 'GFP-ProB' + }, + 'gfp-pc': { + name: 'GFP-ProC' + }, + 'gfp-pd': { + name: 'GFP-ProD' + }, + 'gfp-ma': { + name: 'GFP-Mut ProA' + }, + 'gfp-mb': { + name: 'GFP-Mut ProB' + }, + 'gfp-nuc': { + name: 'GFP-Nuc' + }, + 'gfp-cyto': { + name: 'GFP-Cyto' + }, + 'gfp-pm': { + name: 'GFP-PM' + }, + 'gfp-er': { + name: 'GFP-ER' + }, + 'gfp-nm': { + name: 'GFP-NM' + } + }, + time_unit: { + kind: 'minutes' + }, + micro_kinds: { + 'FLUOR': { + name: 'Fluorescence', + conditions: { + 'gfp': { + name: 'GFP (green)', + short_name: 'G:GFP' + } + } + }, + 'na': { + name: 'None' + } + }, + /* for microscopy only*/ + slides: { + '1': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn2.jpg', + '2': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn3.jpg', + '3': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn5.jpg', + '4': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn6.jpg', + '5': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn7.jpg', + '6': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn8.jpg', + '7': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn11.jpg', + '8': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn12.jpg', + '9': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn15.jpg', + '10': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn17.jpg', + '11': 'images/microscopy/SCB_EX1/nuc_and_cyto/cn20.jpg', - } - }, - add_new_row_instructions: 'add new row instructions', - experiment_setup: scb_ex2_text.experiment_setup({}), + '12': 'images/microscopy/SCB_EX1/er_final/er1crop.jpg', + '13': 'images/microscopy/SCB_EX1/er_final/er2crop.jpg', + '14': 'images/microscopy/SCB_EX1/er_final/er3crop1.jpg', + '15': 'images/microscopy/SCB_EX1/er_final/er3crop2.jpg', + '16': 'images/microscopy/SCB_EX1/er_final/er5crop1.jpg', - concentrations: { - '0': { - name: '', - value: 0 - } - }, - drugs: { - 'gmBuf': { - name: 'Growth Media + Buffer' + '17': 'images/microscopy/SCB_EX1/nucleus_final/n2.jpg', + '18': 'images/microscopy/SCB_EX1/nucleus_final/n8.jpg', + '19': 'images/microscopy/SCB_EX1/nucleus_final/n9.jpg', + '20': 'images/microscopy/SCB_EX1/nucleus_final/n18.jpg', + '21': 'images/microscopy/SCB_EX1/nucleus_final/n34.jpg', + '22': 'images/microscopy/SCB_EX1/nucleus_final/n43.jpg', + '23': 'images/microscopy/SCB_EX1/nucleus_final/n47.jpg', + '25': 'images/microscopy/SCB_EX1/nucleus_final/n64.jpg', + '26': 'images/microscopy/SCB_EX1/nucleus_final/nuc-a.jpg', + '27': 'images/microscopy/SCB_EX1/nucleus_final/nuc-b.jpg', + '28': 'images/microscopy/SCB_EX1/nucleus_final/nuc-c.jpg', - }, - 'gmProK': { - name: 'Growth Media + ProK' - } + '29': 'images/microscopy/SCB_EX1/pm_final/pm-b.jpg', + '30': 'images/microscopy/SCB_EX1/pm_final/pm-c.jpg', + '31': 'images/microscopy/SCB_EX1/pm_final/pm2b.jpg', + '33': 'images/microscopy/SCB_EX1/pm_final/pm3b.jpg', + '34': 'images/microscopy/SCB_EX1/pm_final/pm34-1.jpg', + '35': 'images/microscopy/SCB_EX1/pm_final/pm34-2.jpg', - }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" - }, - '40': { - name: "37" + degreeEntity + "C" - }, - '0': { - name: '' - } - }, + '36': 'images/microscopy/SCB_EX1/cyto_final/c-a.jpg', + '37': 'images/microscopy/SCB_EX1/cyto_final/c-b.jpg', + '38': 'images/microscopy/SCB_EX1/cyto_final/c-c.jpg', + '39': 'images/microscopy/SCB_EX1/cyto_final/c-d.jpg', + '40': 'images/microscopy/SCB_EX1/cyto_final/c1.jpg', + '41': 'images/microscopy/SCB_EX1/cyto_final/c7.jpg', + '42': 'images/microscopy/SCB_EX1/cyto_final/c15-1.jpg', + '43': 'images/microscopy/SCB_EX1/cyto_final/c15-2.jpg', + '44': 'images/microscopy/SCB_EX1/cyto_final/c17.jpg', + '45': 'images/microscopy/SCB_EX1/cyto_final/c29.jpg', - cell_lines: { - 'nt': { - name: 'NoTags' - }, - 'proX-Null': { - name: 'ProX-Null' - }, - 'proY-Null': { - name: 'ProY-Null' + '46': 'images/microscopy/SCB_EX1/nm_final/NM1crop.jpg', + '47': 'images/microscopy/SCB_EX1/nm_final/nm2crop.jpg', + '48': 'images/microscopy/SCB_EX1/nm_final/nm3crop1.jpg', + '49': 'images/microscopy/SCB_EX1/nm_final/nm3crop2.jpg', + '50': 'images/microscopy/SCB_EX1/nm_final/nm5crop.jpg', + + 'bo': 'images/microscopy/SCB_EX1/negative_control.jpg', + 'dummy': 'dummy' + }, + model: { + microscopy: { + 'slide': { + 'parser_simple': [ + { + match: ['cell_line'], + cell_line: 'no-gfp', + imgs_hash: [ + [ + { + hash: 'bo', + if_type: 'green' + } + ] + ] }, - 'HproX-FLAG': { - name: 'His-ProX-FLAG' + { //nuc and cyto + match: ['cell_line'], + cell_line: 'gfp', + imgs_hash: [ + [ + { + hash: '1', + if_type: 'green' + } + ], + [ + { + hash: '2', + if_type: 'green' + } + ], + [ + { + hash: '3', + if_type: 'green' + } + ], + [ + { + hash: '4', + if_type: 'green' + } + ], + [ + { + hash: '5', + if_type: 'green' + } + ], + [ + { + hash: '6', + if_type: 'green' + } + ], + [ + { + hash: '7', + if_type: 'green' + } + ], + [ + { + hash: '8', + if_type: 'green' + } + ], + [ + { + hash: '9', + if_type: 'green' + } + ], + [ + { + hash: '10', + if_type: 'green' + } + ], + [ + { + hash: '11', + if_type: 'green' + } + ] + ] }, - 'HproY-FLAG': { - name: 'His-ProY-FLAG' - } - - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['1', '2', '3', '4', '5'], - '1': { - name: 'Mouse anti-Protein X', - secondary: ['r'], - marks: [ - {weight: 82, intensity: 0}, - {weight: 84, intensity: 0} + { //er + match: ['cell_line'], + cell_line: 'gfp-pa', + imgs_hash: [ + [ + { + hash: '12', + if_type: 'green' + } ], - gel_name: 'anti-Protein X' + [ + { + hash: '13', + if_type: 'green' + } + ], + [ + { + hash: '14', + if_type: 'green' + } + ], + [ + { + hash: '15', + if_type: 'green' + } + ], + [ + { + hash: '16', + if_type: 'green' + } + ] + ] }, - '2': { - name: 'Rabbit anti-Protein Y', - secondary: ['g'], - marks: [ - {weight: 58, intensity: 0} + { //nucleus + match: ['cell_line'], + cell_line: 'gfp-pb', + imgs_hash: [ + [ + { + hash: '17', + if_type: 'green' + } ], - gel_name: 'anti-Protein Y' + [ + { + hash: '18', + if_type: 'green' + } + ], + [ + { + hash: '19', + if_type: 'green' + } + ], + [ + { + hash: '20', + if_type: 'green' + } + ], + [ + { + hash: '21', + if_type: 'green' + } + ], + [ + { + hash: '22', + if_type: 'green' + } + ], + [ + { + hash: '23', + if_type: 'green' + } + ], + [ + { + hash: '25', + if_type: 'green' + } + ], + [ + { + hash: '26', + if_type: 'green' + } + ], + [ + { + hash: '27', + if_type: 'green' + } + ], + [ + { + hash: '28', + if_type: 'green' + } + ] + ] }, - '3': { - name: 'Mouse anti-6xHis', - secondary: ['r'], - marks: [ - {weight: 48, intensity: 0} + { //pm + match: ['cell_line'], + cell_line: 'gfp-pc', + imgs_hash: [ + [ + { + hash: '29', + if_type: 'green' + } + ], + [ + { + hash: '30', + if_type: 'green' + } + ], + [ + { + hash: '31', + if_type: 'green' + } ], - gel_name: 'anti-6xHis' + [ + { + hash: '32', + if_type: 'green' + } + ], + [ + { + hash: '33', + if_type: 'green' + } + ], + [ + { + hash: '34', + if_type: 'green' + } + ], + [ + { + hash: '35', + if_type: 'green' + } + ] + ] }, - '4': { - name: 'Rabbit anti-FLAG', - secondary: ['g'], - marks: [ - {weight: 45, intensity: 0} + { //cyto + match: ['cell_line'], + cell_line: 'gfp-pd', + imgs_hash: [ + [ + { + hash: '36', + if_type: 'green' + } ], - gel_name: 'anti-FLAG' + [ + { + hash: '37', + if_type: 'green' + } + ], + [ + { + hash: '38', + if_type: 'green' + } + ], + [ + { + hash: '39', + if_type: 'green' + } + ], + [ + { + hash: '40', + if_type: 'green' + } + ], + [ + { + hash: '41', + if_type: 'green' + } + ], + [ + { + hash: '42', + if_type: 'green' + } + ], + [ + { + hash: '45', + if_type: 'green' + } + ] + ] }, - '5': { - name: 'Mouse anti-PGK1', - secondary: ['r'], - marks: [ - {weight: 45, intensity: 0} + { //pm + match: ['cell_line'], + cell_line: 'gfp-ma', + imgs_hash: [ + [ + { + hash: '29', + if_type: 'green' + } ], - gel_name: 'anti-PGK1' - } - }, - secondary_anti_body: { - 'r': { - name: 'Rabbit anti-Mouse' + [ + { + hash: '30', + if_type: 'green' + } + ], + [ + { + hash: '31', + if_type: 'green' + } + ], + [ + { + hash: '32', + if_type: 'green' + } + ], + [ + { + hash: '33', + if_type: 'green' + } + ], + [ + { + hash: '34', + if_type: 'green' + } + ], + [ + { + hash: '35', + if_type: 'green' + } + ] + ] }, - 'g': { - name: 'Goat anti-Rabbit' - } - - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - } - }, - - facs_kinds: { - 'Anti': { - name: 'Antibody-labeling ', - conditions: { - 'His_488': {name: 'His 488'}, - 'FLAG_488': {name: 'FLAG 488'}, - 'proX_488': {name: 'ProX 488'}, - 'proY_488': {name: 'ProY 488'} - } + { //nucleus + match: ['cell_line'], + cell_line: 'gfp-mb', + imgs_hash: [ + [ + { + hash: '17', + if_type: 'green' + } + ], + [ + { + hash: '18', + if_type: 'green' + } + ], + [ + { + hash: '19', + if_type: 'green' + } + ], + [ + { + hash: '20', + if_type: 'green' + } + ], + [ + { + hash: '21', + if_type: 'green' + } + ], + [ + { + hash: '22', + if_type: 'green' + } + ], + [ + { + hash: '23', + if_type: 'green' + } + ], + [ + { + hash: '25', + if_type: 'green' + } + ], + [ + { + hash: '26', + if_type: 'green' + } + ], + [ + { + hash: '27', + if_type: 'green' + } + ], + [ + { + hash: '28', + if_type: 'green' + } + ] + ] + }, + { //nucleus + match: ['cell_line'], + cell_line: 'gfp-nuc', + imgs_hash: [ + [ + { + hash: '17', + if_type: 'green' + } + ], + [ + { + hash: '18', + if_type: 'green' + } + ], + [ + { + hash: '19', + if_type: 'green' + } + ], + [ + { + hash: '20', + if_type: 'green' + } + ], + [ + { + hash: '21', + if_type: 'green' + } + ], + [ + { + hash: '22', + if_type: 'green' + } + ], + [ + { + hash: '23', + if_type: 'green' + } + ], + [ + { + hash: '25', + if_type: 'green' + } + ], + [ + { + hash: '26', + if_type: 'green' + } + ], + [ + { + hash: '27', + if_type: 'green' + } + ], + [ + { + hash: '28', + if_type: 'green' + } + ] + ] + }, + { //cyto + match: ['cell_line'], + cell_line: 'gfp-cyto', + imgs_hash: [ + [ + { + hash: '36', + if_type: 'green' + } + ], + [ + { + hash: '37', + if_type: 'green' + } + ], + [ + { + hash: '38', + if_type: 'green' + } + ], + [ + { + hash: '39', + if_type: 'green' + } + ], + [ + { + hash: '40', + if_type: 'green' + } + ], + [ + { + hash: '41', + if_type: 'green' + } + ], + [ + { + hash: '42', + if_type: 'green' + } + ], + [ + { + hash: '45', + if_type: 'green' + } + ] + ] + }, + { //pm + match: ['cell_line'], + cell_line: 'gfp-pm', + imgs_hash: [ + [ + { + hash: '29', + if_type: 'green' + } + ], + [ + { + hash: '30', + if_type: 'green' + } + ], + [ + { + hash: '31', + if_type: 'green' + } + ], + [ + { + hash: '32', + if_type: 'green' + } + ], + [ + { + hash: '33', + if_type: 'green' + } + ], + [ + { + hash: '34', + if_type: 'green' + } + ], + [ + { + hash: '35', + if_type: 'green' + } + ] + ] + }, + { //er + match: ['cell_line'], + cell_line: 'gfp-er', + imgs_hash: [ + [ + { + hash: '12', + if_type: 'green' + } + ], + [ + { + hash: '13', + if_type: 'green' + } + ], + [ + { + hash: '14', + if_type: 'green' + } + ], + [ + { + hash: '15', + if_type: 'green' + } + ], + [ + { + hash: '16', + if_type: 'green' + } + ] + ] + }, + { //nm + match: ['cell_line'], + cell_line: 'gfp-nm', + imgs_hash: [ + [ + { + hash: '46', + if_type: 'green' + } + ], + [ + { + hash: '47', + if_type: 'green' + } + ], + [ + { + hash: '48', + if_type: 'green' + } + ], + [ + { + hash: '49', + if_type: 'green' + } + ], + [ + { + hash: '50', + if_type: 'green' + } + ] + ] } - }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - - { - transfer_function: 'static', - drug: 'gmBuf', - cell_line: 'nt', - marks: [ - { //antibody 1 - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0.5,//none - primary_anti_body: ['1'] - }, - - { //antibody 2 - name: 'Rabbit anti-Protein Y', - weight: 210,//230 - intensity: 0.5, - primary_anti_body: ['2'] - }, - { //antibody 3 - name: 'Mouse anti-6xHis', - weight: 40,//84,232 - intensity: 0, - primary_anti_body: ['3'] - }, - { //antibody 4 - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//none - primary_anti_body: ['4'] - }, - { //antibody 5 - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + ] + } + } - ] - }, + } + } +}; +var __scb_sample_2 = { + id: 'scb_ex2', + name: 'Exercise 2', + course: 'SCB_SampleExercises', + course_name: 'Sample Exercises', + description: 'StarCellBio Exercise 2 – Orientation of Transmembrane Proteins', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ["Goal & Learning Objectives", scb_ex2_text.goal({})], + ["Introduction", scb_ex2_text.intro({})], + ["Background Information", scb_ex2_text.bg_info({})], + ["Questions", scb_ex2_text.questions({})] + ], + ui: { + experimental_design: { + techniques: ['facs', 'wb'], + gel_types: ['.10', '.12', '.15'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: false + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } + ], + actions: [ + { + kind: "add_many", + name: "ADD SAMPLES", + open: 'scb_ex2.setup', + 'collection_id': '%CELL_LINE%' + } + ] + }, + microscopy: { + disable_blur: false, + disable_brightness: false + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + } + } + }, + add_multiple_dialog: { + order: ['nt', 'proX-Null', 'proY-Null', 'HproX-FLAG', 'HproY-FLAG'], + headings: [ + '', 'Strains', 'Treatments' + ], + 'nt': { + rows: [ + { + treatment_id: 'gmBuf', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaBuffer", + treatment_id: 'gmBuf' + }, + { + kind: 'text', + text: 'NoTags' + }, + { + kind: 'text', + text: 'Growth Media + Buffer' + } + ], + cell_treatments: { + GrowthMediaBuffer: [ + { + cell_line: 'nt', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmProK', - cell_line: 'nt', - marks: [ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0,//none - primary_anti_body: ['1'] - }, - { - name: 'Rabbit anti-Protein Y', - weight: 230,//232 - intensity: 0,//none - primary_anti_body: ['2'] - }, - { - name: 'Mouse anti-6xHis', - weight: 40,//84,232 - intensity: 0, - primary_anti_body: ['3'] - }, - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//none - primary_anti_body: ['4'] - }, - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmBuf', + concentration_id: '0' + } ] - }, + }, + temperature: '0' + } + ] + } + } + ] + } + }, + { + treatment_id: 'gmProK', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaProK", + treatment_id: 'gmProK' + }, + { + kind: 'text', + text: 'NoTags' + }, + { + kind: 'text', + text: 'Growth Media + ProK' + } + ], + + cell_treatments: { + GrowthMediaProK: [ + { + cell_line: 'nt', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmBuf', - cell_line: 'proX-Null', - marks: [ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0,//none - primary_anti_body: ['1'] - }, - { - name: 'Rabbit anti-Protein Y', - weight: 210,//232 - intensity: 0.5,//none - primary_anti_body: ['2'] - }, - { - name: 'Mouse anti-6xHis', - weight: 40,//84,323 - intensity: 0,//none,none - primary_anti_body: ['3'] - }, - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//none - primary_anti_body: ['4'] - }, - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmProK', + concentration_id: '0' + } ] - }, + }, + temperature: '0' + } + ] + } + } + + ] + + } + } + ] + }, + 'proX-Null': { + rows: [ + { + treatment_id: 'gmBuf', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaBuffer", + treatment_id: 'gmBuf' + }, + { + kind: 'text', + text: 'ProX-Null' + }, + { + kind: 'text', + text: 'Growth Media + Buffer' + } + ], + cell_treatments: { + GrowthMediaBuffer: [ + { + cell_line: 'proX-Null', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmProK', - cell_line: 'proX-Null', - marks: [ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0,//none - primary_anti_body: ['1'] - }, - { - name: 'Rabbit anti-Protein Y', - weight: 230,//232 - intensity: 0,//none - primary_anti_body: ['2'] - }, - { - name: 'Mouse anti-6xHis', - weight: 40,//84,232 - intensity: 0,//none,none - primary_anti_body: ['3'] - }, - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//none - primary_anti_body: ['4'] - }, - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmBuf', + concentration_id: '0' + } ] - }, + }, + temperature: '0' + + } + ] + } + } + ] + } + }, + { + treatment_id: 'gmProK', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaProK", + treatment_id: 'gmProK' + }, + { + kind: 'text', + text: 'ProX-Null' + }, + { + kind: 'text', + text: 'Growth Media + ProK' + } + ], + cell_treatments: { + GrowthMediaProK: [ + { + cell_line: 'proX-Null', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmBuf', - cell_line: 'proY-Null', - marks: [ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0.5,//none - primary_anti_body: ['1'] - }, - { - name: 'Rabbit anti-Protein Y', - weight: 230,//232 - intensity: 0,//none - primary_anti_body: ['2'] - }, - { - name: 'Mouse anti-6xHis', - weight: 40,//84,323 - intensity: 0,//none, none - primary_anti_body: ['3'] - }, - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//none - primary_anti_body: ['4'] - }, - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmProK', + concentration_id: '0' + } ] - }, + }, + temperature: '0' + + } + ] + } + } + ] + } + } + ] + }, + 'proY-Null': { + rows: [ + { + treatment_id: 'gmBuf', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaBuffer", + treatment_id: 'gmBuf' + }, + { + kind: 'text', + text: 'ProY-Null' + }, + { + kind: 'text', + text: 'Growth Media + Buffer' + } + ], + cell_treatments: { + GrowthMediaBuffer: [ + { + cell_line: 'proY-Null', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmProK', - cell_line: 'proY-Null', - marks: [ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0,//none - primary_anti_body: ['1'] - }, - { - name: 'Rabbit anti-Protein Y', - weight: 230,//232 - intensity: 0,//none - primary_anti_body: ['2'] - }, - { - name: 'Mouse anti-6xHis', - weight: 40,//84,232 - intensity: 0,//none,none - primary_anti_body: ['3'] - }, - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//none - primary_anti_body: ['4'] - }, - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmBuf', + concentration_id: '0' + } ] - }, + }, + temperature: '0' + + } + ] + } + } + ] + } + }, + { + treatment_id: 'gmProK', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaProK", + treatment_id: 'gmProK' + }, + { + kind: 'text', + text: 'ProY-Null' + }, + { + kind: 'text', + text: 'Growth Media + ProK' + } + ], + cell_treatments: { + GrowthMediaProK: [ + { + cell_line: 'proY-Null', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmBuf', - cell_line: 'HproX-FLAG', - marks: [ - /* Antibody 1 */ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0.5,//high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-Protein X', - weight: 88, - intensity: 2, - primary_anti_body: ['1'] - }, - /* Antibody 2 */ - { - name: 'Rabbit anti-Protein Y', - weight: 210,//230 - intensity: 0.5, - primary_anti_body: ['2'] - }, - /* Antibody 3 */ - { - name: 'Mouse anti-6xHis', - weight: 40,//84, 232 - intensity: 0,//high, none - primary_anti_body: ['3'] - }, - { - name: 'Mouse anti-6xHis', - weight: 84, - intensity: 2, - primary_anti_body: ['3'] - }, - /* Antibody 4 */ - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 2,//none - primary_anti_body: ['4'] - }, - /* Antibody 5 */ - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmProK', + concentration_id: '0' + } ] - }, + }, + temperature: '0' + + } + ] + } + } + ] + } + } + ] + }, + 'HproX-FLAG': { + rows: [ + { + treatment_id: 'gmBuf', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaBuffer", + treatment_id: 'gmBuf' + }, + { + kind: 'text', + text: 'His-ProX-FLAG' + }, + { + kind: 'text', + text: 'Growth Media + Buffer' + } + ], + cell_treatments: { + GrowthMediaBuffer: [ + { + cell_line: 'HproX-FLAG', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmProK', - cell_line: 'HproX-FLAG', - marks: [ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0,//none - primary_anti_body: ['1'] - }, - { - name: 'Rabbit anti-Protein Y', - weight: 230,//232 - intensity: 0,//none - primary_anti_body: ['2'] - }, - { - name: 'Mouse anti-6xHis', - weight: 40,//84,232 - intensity: 1,//none,none - primary_anti_body: ['3'] - }, - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//none - primary_anti_body: ['4'] - }, - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmBuf', + concentration_id: '0' + } ] - }, + }, + temperature: '0' + + } + ] + } + } + ] + } + }, + { + treatment_id: 'gmProK', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaProK", + treatment_id: 'gmProK' + }, + { + kind: 'text', + text: 'His-ProX-FLAG' + }, + { + kind: 'text', + text: 'Growth Media + ProK' + } + ], + cell_treatments: { + GrowthMediaProK: [ + { + cell_line: 'HproX-FLAG', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmBuf', - cell_line: 'HproY-FLAG', - marks: [ - /* Antibody 1 */ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0.5,//none - primary_anti_body: ['1'] - }, - /* Antibody 2 */ - { - name: 'Rabbit anti-Protein Y', - weight: 210,//230 - intensity: 0.5, - primary_anti_body: ['2'] - }, - { - name: 'Rabbit anti-Protein Y', - weight: 240,//232 - intensity: 2, - primary_anti_body: ['2'] - }, - /* Antibody 3 */ - { - name: 'Mouse anti-6xHis', - weight: 40,//84, 232 - intensity: 0,//none, high - primary_anti_body: ['3'] - }, - { - name: 'Mouse anti-6xHis', - weight: 232, - intensity: 2, - primary_anti_body: ['3'] - }, - /* Antibody 4 */ - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//high - primary_anti_body: ['4'] - }, - { - name: 'Rabbit anti-FLAG', - weight: 232, - intensity: 2, - primary_anti_body: ['4'] - }, - /* Antibody 5 */ - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmProK', + concentration_id: '0' + } ] - }, + }, + temperature: '0' + + } + ] + } + } + ] + } + } + ] + }, + 'HproY-FLAG': { + rows: [ + { + treatment_id: 'gmBuf', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaBuffer", + treatment_id: 'gmBuf' + }, + { + kind: 'text', + text: 'His-ProY-FLAG' + }, + { + kind: 'text', + text: 'Growth Media + Buffer' + } + ], + cell_treatments: { + GrowthMediaBuffer: [ + { + cell_line: 'HproY-FLAG', + treatment_list: { + list: [ { - transfer_function: 'static', - drug: 'gmProK', - cell_line: 'HproY-FLAG', - marks: [ - /* Antibody 1 */ - { - name: 'Mouse anti-Protein X', - weight: 82,//84 - intensity: 0,//none - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-Protein X', - weight: 84, - intensity: 0, - primary_anti_body: ['1'] - }, - /* Antibody 2 */ - { - name: 'Rabbit anti-Protein Y', - weight: 230,//232 - intensity: 0,//none - primary_anti_body: ['2'] - }, - { - name: 'Rabbit anti-Protein Y', - weight: 232, - intensity: 0, - primary_anti_body: ['2'] - }, - /* Antibody 3 */ - { - name: 'Mouse anti-6xHis', - weight: 40,//84,232 - intensity: 0,//none,none - primary_anti_body: ['3'] - }, - /* Antibody 4 */ - { - name: 'Rabbit anti-FLAG', - weight: 84,//232 - intensity: 0,//none - primary_anti_body: ['4'] - }, - /* Antibody 5 */ - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, - primary_anti_body: ['5'] - } + drug_list: { + list: [ + { + drug_id: 'gmBuf', + concentration_id: '0' + } ] - } + }, + temperature: '0' - ] - } + } + ] + } + } + ] + } }, - facs: { - 'ticks': [50, 100 , 150], - 'max': 200, - 'scale': 'pseudo', - 'dna': { - 'parser_simple': [ - { - match: [], - shape: 'normal' - }, - { - match: ['drug_id'], - drug_id: 'gmProK', - shape: 'graph-b' - }, - { //His 488 - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'nt', - drug_id: 'gmBuf', - condition: 'His_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'proX-Null', - drug_id: 'gmBuf', - condition: 'His_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'proY-Null', - drug_id: 'gmBuf', - condition: 'His_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'HproX-FLAG', - drug_id: 'gmBuf', - condition: 'His_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'HproY-FLAG', - drug_id: 'gmBuf', - condition: 'His_488', - shape: 'scaled-peak-3' - }, - //FLAG 488 - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'nt', - drug_id: 'gmBuf', - condition: 'FLAG_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'proX-Null', - drug_id: 'gmBuf', - condition: 'FLAG_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'proY-Null', - drug_id: 'gmBuf', - condition: 'FLAG_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'HproX-FLAG', - drug_id: 'gmBuf', - condition: 'FLAG_488', - shape: 'scaled-peak-3' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'HproY-FLAG', - drug_id: 'gmBuf', - condition: 'FLAG_488', - shape: 'scaled-peak-3' - }, - //ProX 488 - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'nt', - drug_id: 'gmBuf', - condition: 'proX_488', - shape: 'graph-c' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'proX-Null', - drug_id: 'gmBuf', - condition: 'proX_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'proY-Null', - drug_id: 'gmBuf', - condition: 'proX_488', - shape: 'graph-c' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'HproX-FLAG', - drug_id: 'gmBuf', - condition: 'proX_488', - shape: 'scaled-peak-3' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'HproY-FLAG', - drug_id: 'gmBuf', - condition: 'proX_488', - shape: 'graph-c' - }, - //ProY 488 - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'nt', - drug_id: 'gmBuf', - condition: 'proY_488', - shape: 'graph-c' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'proX-Null', - drug_id: 'gmBuf', - condition: 'proY_488', - shape: 'graph-c' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'proY-Null', - drug_id: 'gmBuf', - condition: 'proY_488', - shape: 'graph-b' - }, - { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'HproX-FLAG', - drug_id: 'gmBuf', - condition: 'proY_488', - shape: 'graph-c' - }, + { + treatment_id: 'gmProK', + cells: [ + { + kind: 'checkbox', + name: "GrowthMediaProK", + treatment_id: 'gmProK' + }, + { + kind: 'text', + text: 'His-ProY-FLAG' + }, + { + kind: 'text', + text: 'Growth Media + ProK' + } + ], + cell_treatments: { + GrowthMediaProK: [ + { + cell_line: 'HproY-FLAG', + treatment_list: { + list: [ { - match: ['cell_line', 'drug_id', 'condition'], - cell_line: 'HproY-FLAG', - drug_id: 'gmBuf', - condition: 'proY_488', - shape: 'scaled-peak-3' - } - - ] + drug_list: { + list: [ + { + drug_id: 'gmProK', + concentration_id: '0' + } + ] + }, + temperature: '0' - } + } + ] + } + } + ] + } } + ] } - } -}; + } + }, + add_new_row_instructions: 'add new row instructions', + experiment_setup: scb_ex2_text.experiment_setup({}), -var __scb_sample_3 = { - id: 'scb_ex3', - name: 'Exercise 3', - course: 'SCB_SampleExercises', - course_name: 'Sample Exercises', - description: 'StarCellBio Exercise 3', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ["Goal & Learning Objectives", scb_ex3_text.goal({})], - ["Introduction", scb_ex3_text.intro({})], - ["Background Information", scb_ex3_text.bg_info({})], - ["Questions", scb_ex3_text.questions({})] - ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs', 'micro' ], - gel_types: ['.10', '.12', '.15'] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: false}, - {kind: 'duration', title: 'Time', editable: false} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - { - kind: "add_many", name: "ADD SAMPLES", open: 'scb_ex3.setup', - 'collection_id': '%CELL_LINE%' - } + concentrations: { + '0': { + name: '', + value: 0 + } + }, + drugs: { + 'gmBuf': { + name: 'Growth Media + Buffer' - ] - }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%, %COLLECTION%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']}, - '%COLLECTION%': { - attr: ['treatment_list', 'list', '0', 'duration'], - map: ['durations', '%KEY%', 'name']} - } - }, - microscopy: { - disable_blur: false, - disable_brightness: false - }, - add_multiple_dialog: { - order: ['WT-EGFR', 'EGFR Null', 'EGFR-M1', 'EGFR-M2', 'NoUB', - 'ConstActive', 'His-EGFR-FLAG', 'His-EGFR-M1-FLAG', 'His-EGFR-M2-FLAG'], - headings: ['', 'Strain', 'Treatment', 'Treatment Duration'], - 'WT-EGFR': { - rows: [ - { 'cell_treatments': { 'gm30': [ - { - 'cell_line': 'WT-EGFR', - 'treatment_list': { 'list': [ - { - 'collection_id': 'default', - 'drug_list': { 'list': [ - { - 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'], - 'conditions': { - 'IF': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', 'name': 'gm30', 'treatment_id': 'growth_media30'}, - {'kind': 'text', 'text': 'WT-EGFR'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_media30'}, - { 'cell_treatments': { 'gm60': [ - { 'cell_line': 'WT-EGFR', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'], - 'conditions': { - 'IF': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm60', - 'treatment_id': 'growth_media60'}, - {'kind': 'text', 'text': 'WT-EGFR'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_media60'}, - { 'cell_treatments': { 'gm6': [ - { 'cell_line': 'WT-EGFR', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'], - 'conditions': { - 'IF': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm6', - 'treatment_id': 'growth_media6'}, - {'kind': 'text', 'text': 'WT-EGFR'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_media6'}, - { 'cell_treatments': { 'gmEGF30': [ - { 'cell_line': 'WT-EGFR', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF30', - 'treatment_id': 'growth_mediaEGF30'}, - {'kind': 'text', 'text': 'WT-EGFR'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_mediaEGF30'}, - { 'cell_treatments': { 'gmEGF60': [ - { 'cell_line': 'WT-EGFR', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF60', - 'treatment_id': 'growth_mediaEGF60'}, - {'kind': 'text', 'text': 'WT-EGFR'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_mediaEGF60'}, - { 'cell_treatments': { 'gmEGF6': [ - { 'cell_line': 'WT-EGFR', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF6', - 'treatment_id': 'growth_mediaEGF6'}, - {'kind': 'text', 'text': 'WT-EGFR'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_mediaEGF6'}, - { 'cell_treatments': { 'gmBuff': [ - { 'cell_line': 'WT-EGFR', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaBuff'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmBuff', - 'treatment_id': 'growth_mediaBuff'}, - {'kind': 'text', 'text': 'WT-EGFR'}, - {'kind': 'text', 'text': 'Growth media + buffer'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaBuff'}, - { 'cell_treatments': { 'gmProK': [ - { 'cell_line': 'WT-EGFR', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaProK'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmProK', - 'treatment_id': 'growth_mediaProK'}, - {'kind': 'text', 'text': 'WT-EGFR'}, - {'kind': 'text', 'text': 'Growth media + ProK'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaProK'} - ] - }, - 'EGFR Null': { - rows: [ - { 'cell_treatments': { 'gm30': [ - { 'cell_line': 'EGFR Null', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm30', - 'treatment_id': 'growth_media30'}, - {'kind': 'text', 'text': 'EGFR Null'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_media30'}, - { 'cell_treatments': { 'gm60': [ - { 'cell_line': 'EGFR Null', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm60', - 'treatment_id': 'growth_media60'}, - {'kind': 'text', 'text': 'EGFR Null'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_media60'}, - { 'cell_treatments': { 'gm6': [ - { 'cell_line': 'EGFR Null', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm6', - 'treatment_id': 'growth_media6'}, - {'kind': 'text', 'text': 'EGFR Null'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_media6'}, - { 'cell_treatments': { 'gmEGF30': [ - { 'cell_line': 'EGFR Null', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF30', - 'treatment_id': 'growth_mediaEGF30'}, - {'kind': 'text', 'text': 'EGFR Null'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_mediaEGF30'}, - { 'cell_treatments': { 'gmEGF60': [ - { 'cell_line': 'EGFR Null', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF60', - 'treatment_id': 'growth_mediaEGF60'}, - {'kind': 'text', 'text': 'EGFR Null'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_mediaEGF60'}, - { 'cell_treatments': { 'gmEGF6': [ - { 'cell_line': 'EGFR Null', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF6', - 'treatment_id': 'growth_mediaEGF6'}, - {'kind': 'text', 'text': 'EGFR Null'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_mediaEGF6'}, - { 'cell_treatments': { 'gmBuff': [ - { 'cell_line': 'EGFR Null', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaBuff'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmBuff', - 'treatment_id': 'growth_mediaBuff'}, - {'kind': 'text', 'text': 'EGFR Null'}, - {'kind': 'text', 'text': 'Growth media + buffer'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaBuff'}, - { 'cell_treatments': { 'gmProK': [ - { 'cell_line': 'EGFR Null', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaProK'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmProK', - 'treatment_id': 'growth_mediaProK'}, - {'kind': 'text', 'text': 'EGFR Null'}, - {'kind': 'text', 'text': 'Growth media + ProK'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaProK'} + }, + 'gmProK': { + name: 'Growth Media + ProK' + } + + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + }, + '40': { + name: "37" + degreeEntity + "C" + }, + '0': { + name: '' + } + }, + + cell_lines: { + 'nt': { + name: 'NoTags' + }, + 'proX-Null': { + name: 'ProX-Null' + }, + 'proY-Null': { + name: 'ProY-Null' + }, + 'HproX-FLAG': { + name: 'His-ProX-FLAG' + }, + 'HproY-FLAG': { + name: 'His-ProY-FLAG' + } + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['1', '2', '3', '4', '5'], + '1': { + name: 'Mouse anti-Protein X', + secondary: ['r'], + marks: [ + { + weight: 82, + intensity: 0 + }, + { + weight: 84, + intensity: 0 + } + ], + gel_name: 'anti-Protein X' + }, + '2': { + name: 'Rabbit anti-Protein Y', + secondary: ['g'], + marks: [ + { + weight: 58, + intensity: 0 + } + ], + gel_name: 'anti-Protein Y' + }, + '3': { + name: 'Mouse anti-6xHis', + secondary: ['r'], + marks: [ + { + weight: 48, + intensity: 0 + } + ], + gel_name: 'anti-6xHis' + }, + '4': { + name: 'Rabbit anti-FLAG', + secondary: ['g'], + marks: [ + { + weight: 45, + intensity: 0 + } + ], + gel_name: 'anti-FLAG' + }, + '5': { + name: 'Mouse anti-PGK1', + secondary: ['r'], + marks: [ + { + weight: 45, + intensity: 0 + } + ], + gel_name: 'anti-PGK1' + } + }, + secondary_anti_body: { + 'r': { + name: 'Rabbit anti-Mouse' + }, + 'g': { + name: 'Goat anti-Rabbit' + } - ] - }, - 'EGFR-M1': { - rows: [ - { 'cell_treatments': { 'gm30': [ - { 'cell_line': 'EGFR-M1', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm30', - 'treatment_id': 'growth_media30'}, - {'kind': 'text', 'text': 'EGFR-M1'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_media30'}, - { 'cell_treatments': { 'gm60': [ - { 'cell_line': 'EGFR-M1', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm60', - 'treatment_id': 'growth_media60'}, - {'kind': 'text', 'text': 'EGFR-M1'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_media60'}, - { 'cell_treatments': { 'gm6': [ - { 'cell_line': 'EGFR-M1', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm6', - 'treatment_id': 'growth_media6'}, - {'kind': 'text', 'text': 'EGFR-M1'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_media6'}, - { 'cell_treatments': { 'gmEGF30': [ - { 'cell_line': 'EGFR-M1', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF30', - 'treatment_id': 'growth_mediaEGF30'}, - {'kind': 'text', 'text': 'EGFR-M1'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_mediaEGF30'}, - { 'cell_treatments': { 'gmEGF60': [ - { 'cell_line': 'EGFR-M1', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF60', - 'treatment_id': 'growth_mediaEGF60'}, - {'kind': 'text', 'text': 'EGFR-M1'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_mediaEGF60'}, - { 'cell_treatments': { 'gmEGF6': [ - { 'cell_line': 'EGFR-M1', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF6', - 'treatment_id': 'growth_mediaEGF6'}, - {'kind': 'text', 'text': 'EGFR-M1'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_mediaEGF6'} - ] - }, - 'EGFR-M2': { - rows: [ - { 'cell_treatments': { 'gm30': [ - { 'cell_line': 'EGFR-M2', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm30', - 'treatment_id': 'growth_media30'}, - {'kind': 'text', 'text': 'EGFR-M2'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_media30'}, - { 'cell_treatments': { 'gm60': [ - { 'cell_line': 'EGFR-M2', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm60', - 'treatment_id': 'growth_media60'}, - {'kind': 'text', 'text': 'EGFR-M2'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_media60'}, - { 'cell_treatments': { 'gm6': [ - { 'cell_line': 'EGFR-M2', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['egfr'], - 'conditions': { - 'IF': ['egfr'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm6', - 'treatment_id': 'growth_media6'}, - {'kind': 'text', 'text': 'EGFR-M2'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_media6'}, - { 'cell_treatments': { 'gmEGF30': [ - { 'cell_line': 'EGFR-M2', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF30', - 'treatment_id': 'growth_mediaEGF30'}, - {'kind': 'text', 'text': 'EGFR-M2'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_mediaEGF30'}, - { 'cell_treatments': { 'gmEGF60': [ - { 'cell_line': 'EGFR-M2', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF60', - 'treatment_id': 'growth_mediaEGF60'}, - {'kind': 'text', 'text': 'EGFR-M2'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_mediaEGF60'}, - { 'cell_treatments': { 'gmEGF6': [ - { 'cell_line': 'EGFR-M2', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF6', - 'treatment_id': 'growth_mediaEGF6'}, - {'kind': 'text', 'text': 'EGFR-M2'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_mediaEGF6'} - ] - }, - 'NoUB': { - rows: [ - { 'cell_treatments': { 'gm30': [ - { 'cell_line': 'NoUB', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm30', - 'treatment_id': 'growth_media30'}, - {'kind': 'text', 'text': 'NoUB'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_media30'}, - { 'cell_treatments': { 'gm60': [ - { 'cell_line': 'NoUB', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm60', - 'treatment_id': 'growth_media60'}, - {'kind': 'text', 'text': 'NoUB'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_media60'}, - { 'cell_treatments': { 'gm6': [ - { 'cell_line': 'NoUB', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm6', - 'treatment_id': 'growth_media6'}, - {'kind': 'text', 'text': 'NoUB'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_media6'}, - { 'cell_treatments': { 'gmEGF30': [ - { 'cell_line': 'NoUB', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF30', - 'treatment_id': 'growth_mediaEGF30'}, - {'kind': 'text', 'text': 'NoUB'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_mediaEGF30'}, - { 'cell_treatments': { 'gmEGF60': [ - { 'cell_line': 'NoUB', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF60', - 'treatment_id': 'growth_mediaEGF60'}, - {'kind': 'text', 'text': 'NoUB'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_mediaEGF60'}, - { 'cell_treatments': { 'gmEGF6': [ - { 'cell_line': 'NoUB', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF6', - 'treatment_id': 'growth_mediaEGF6'}, - {'kind': 'text', 'text': 'NoUB'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_mediaEGF6'} + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, - ] - }, - 'ConstActive': { - rows: [ - { 'cell_treatments': { 'gm30': [ - { 'cell_line': 'ConstActive', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm30', - 'treatment_id': 'growth_media30'}, - {'kind': 'text', 'text': 'ConstActive'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_media30'}, - { 'cell_treatments': { 'gm60': [ - { 'cell_line': 'ConstActive', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm60', - 'treatment_id': 'growth_media60'}, - {'kind': 'text', 'text': 'ConstActive'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_media60'}, - { 'cell_treatments': { 'gm6': [ - { 'cell_line': 'ConstActive', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_media'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gm6', - 'treatment_id': 'growth_media6'}, - {'kind': 'text', 'text': 'ConstActive'}, - {'kind': 'text', 'text': 'Growth media only'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_media6'}, - { 'cell_treatments': { 'gmEGF30': [ - { 'cell_line': 'ConstActive', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '30 sec', - 'duration_value': 30, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF30', - 'treatment_id': 'growth_mediaEGF30'}, - {'kind': 'text', 'text': 'ConstActive'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '30 sec'} - ], - 'treatment_id': 'growth_mediaEGF30'}, - { 'cell_treatments': { 'gmEGF60': [ - { 'cell_line': 'ConstActive', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '1 min', - 'duration_value': 60, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF60', - 'treatment_id': 'growth_mediaEGF60'}, - {'kind': 'text', 'text': 'ConstActive'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '1 min'} - ], - 'treatment_id': 'growth_mediaEGF60'}, - { 'cell_treatments': { 'gmEGF6': [ - { 'cell_line': 'ConstActive', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaEGF'} - ]}, - 'duration': '6 hrs', - 'duration_value': 21600, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmEGF6', - 'treatment_id': 'growth_mediaEGF6'}, - {'kind': 'text', 'text': 'ConstActive'}, - {'kind': 'text', 'text': 'Growth media + EGF'}, - {'kind': 'text', 'text': '6 hrs'} - ], - 'treatment_id': 'growth_mediaEGF6'} - ] - }, - 'His-EGFR-FLAG': { - rows: [ - { 'cell_treatments': { 'gmBuff': [ - { 'cell_line': 'His-EGFR-FLAG', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaBuff'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmBuff', - 'treatment_id': 'growth_mediaBuff'}, - {'kind': 'text', 'text': 'His-EGFR-FLAG'}, - {'kind': 'text', 'text': 'Growth media + buffer'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaBuff'}, - { 'cell_treatments': { 'gmProK': [ - { 'cell_line': 'His-EGFR-FLAG', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaProK'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmProK', - 'treatment_id': 'growth_mediaProK'}, - {'kind': 'text', 'text': 'His-EGFR-FLAG'}, - {'kind': 'text', 'text': 'Growth media + ProK'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaProK'} + facs_kinds: { + 'Anti': { + name: 'Antibody-labeling ', + conditions: { + 'His_488': { + name: 'His 488' + }, + 'FLAG_488': { + name: 'FLAG 488' + }, + 'proX_488': { + name: 'ProX 488' + }, + 'proY_488': { + name: 'ProY 488' + } + } + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ - ] - }, - 'His-EGFR-M1-FLAG': { - rows: [ - { 'cell_treatments': { 'gmBuff': [ - { 'cell_line': 'His-EGFR-M1-FLAG', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaBuff'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmBuff', - 'treatment_id': 'growth_mediaBuff'}, - {'kind': 'text', 'text': 'His-EGFR-M1-FLAG'}, - {'kind': 'text', 'text': 'Growth media + buffer'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaBuff'}, - { 'cell_treatments': { 'gmProK': [ - { 'cell_line': 'His-EGFR-M1-FLAG', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaProK'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmProK', - 'treatment_id': 'growth_mediaProK'}, - {'kind': 'text', 'text': 'His-EGFR-M1-FLAG'}, - {'kind': 'text', 'text': 'Growth media + ProK'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaProK'} + { + transfer_function: 'static', + drug: 'gmBuf', + cell_line: 'nt', + marks: [ + { //antibody 1 + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0.5, //none + primary_anti_body: ['1'] + }, - ] - }, - 'His-EGFR-M2-FLAG': { - rows: [ - { 'cell_treatments': { 'gmBuff': [ - { 'cell_line': 'His-EGFR-M2-FLAG', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaBuff'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmBuff', - 'treatment_id': 'growth_mediaBuff'}, - {'kind': 'text', 'text': 'His-EGFR-M2-FLAG'}, - {'kind': 'text', 'text': 'Growth media + buffer'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaBuff'}, - { 'cell_treatments': { 'gmProK': [ - { 'cell_line': 'His-EGFR-M2-FLAG', - 'treatment_list': { 'list': [ - { 'collection_id': 'default', - 'drug_list': { 'list': [ - { 'concentration_id': '100', - 'drug_id': 'growth_mediaProK'} - ]}, - 'duration': '30 min', - 'duration_value': 1800, - 'microscope': ['na'], - 'conditions': { - 'na': ['None'] - }, - 'temperature': '25'} - ]}} - ]}, - 'cells': [ - { 'kind': 'checkbox', - 'name': 'gmProK', - 'treatment_id': 'growth_mediaProK'}, - {'kind': 'text', 'text': 'His-EGFR-M2-FLAG'}, - {'kind': 'text', 'text': 'Growth media + ProK'}, - {'kind': 'text', 'text': '30 min'} - ], - 'treatment_id': 'growth_mediaProK'} + { //antibody 2 + name: 'Rabbit anti-Protein Y', + weight: 210, //230 + intensity: 0.5, + primary_anti_body: ['2'] + }, + { //antibody 3 + name: 'Mouse anti-6xHis', + weight: 40, //84,232 + intensity: 0, + primary_anti_body: ['3'] + }, - ] + { //antibody 4 + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //none + primary_anti_body: ['4'] + }, + { //antibody 5 + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] } - } - }, - add_new_row_instructions: 'add new row instructions', - experiment_setup: scb_ex3_text.experiment_setup({}), - collections: { - '30 s': { - name: '30 sec' - }, - '60 s': { - name: '1 min' - }, - '6 h': { - name: '6 hrs' - }, - '30 m': { - name: '30 min' - } - }, - durations: { - '30 sec': { - name: '30 sec' - }, - '1 min': { - name: '1 min' - }, - '6 h': { - name: '6 hrs' + + ] }, - '30 min': { - name: '30 min' - } - }, - concentrations: { - 100: { - name: '', - value: 100 - } - }, - drugs: { - 'growth_media': { - name: 'Growth media only', - concentrations: [100] - }, - 'growth_mediaEGF': { - name: 'Growth media + EGF', - concentrations: [100] - }, - 'growth_mediaBuff': { - name: 'Growth media + buffer', - concentrations: [100] - }, - 'growth_mediaProK': { - name: 'Growth media + ProK', - concentrations: [100] - } - }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" - } - }, - cell_lines: { - 'WT-EGFR': { - name: 'WT-EGFR' + + { + transfer_function: 'static', + drug: 'gmProK', + cell_line: 'nt', + marks: [ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0, //none + primary_anti_body: ['1'] + }, + { + name: 'Rabbit anti-Protein Y', + weight: 230, //232 + intensity: 0, //none + primary_anti_body: ['2'] + }, + { + name: 'Mouse anti-6xHis', + weight: 40, //84,232 + intensity: 0, + primary_anti_body: ['3'] + }, + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //none + primary_anti_body: ['4'] + }, + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] }, - 'EGFR Null': { - name: 'EGFR Null' + { + transfer_function: 'static', + drug: 'gmBuf', + cell_line: 'proX-Null', + marks: [ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0, //none + primary_anti_body: ['1'] + }, + { + name: 'Rabbit anti-Protein Y', + weight: 210, //232 + intensity: 0.5, //none + primary_anti_body: ['2'] + }, + { + name: 'Mouse anti-6xHis', + weight: 40, //84,323 + intensity: 0, //none,none + primary_anti_body: ['3'] + }, + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //none + primary_anti_body: ['4'] + }, + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] }, - 'EGFR-M1': { - name: 'EGFR-M1' + { + transfer_function: 'static', + drug: 'gmProK', + cell_line: 'proX-Null', + marks: [ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0, //none + primary_anti_body: ['1'] + }, + { + name: 'Rabbit anti-Protein Y', + weight: 230, //232 + intensity: 0, //none + primary_anti_body: ['2'] + }, + { + name: 'Mouse anti-6xHis', + weight: 40, //84,232 + intensity: 0, //none,none + primary_anti_body: ['3'] + }, + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //none + primary_anti_body: ['4'] + }, + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] }, - 'EGFR-M2': { - name: 'EGFR-M2' + { + transfer_function: 'static', + drug: 'gmBuf', + cell_line: 'proY-Null', + marks: [ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0.5, //none + primary_anti_body: ['1'] + }, + { + name: 'Rabbit anti-Protein Y', + weight: 230, //232 + intensity: 0, //none + primary_anti_body: ['2'] + }, + { + name: 'Mouse anti-6xHis', + weight: 40, //84,323 + intensity: 0, //none, none + primary_anti_body: ['3'] + }, + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //none + primary_anti_body: ['4'] + }, + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] }, - 'NoUB': { - name: 'NoUB' + { + transfer_function: 'static', + drug: 'gmProK', + cell_line: 'proY-Null', + marks: [ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0, //none + primary_anti_body: ['1'] + }, + { + name: 'Rabbit anti-Protein Y', + weight: 230, //232 + intensity: 0, //none + primary_anti_body: ['2'] + }, + { + name: 'Mouse anti-6xHis', + weight: 40, //84,232 + intensity: 0, //none,none + primary_anti_body: ['3'] + }, + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //none + primary_anti_body: ['4'] + }, + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] }, - 'ConstActive': { - name: 'ConstActive' + { + transfer_function: 'static', + drug: 'gmBuf', + cell_line: 'HproX-FLAG', + marks: [ + /* Antibody 1 */ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0.5, //high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-Protein X', + weight: 88, + intensity: 2, + primary_anti_body: ['1'] + }, + /* Antibody 2 */ + { + name: 'Rabbit anti-Protein Y', + weight: 210, //230 + intensity: 0.5, + primary_anti_body: ['2'] + }, + /* Antibody 3 */ + { + name: 'Mouse anti-6xHis', + weight: 40, //84, 232 + intensity: 0, //high, none + primary_anti_body: ['3'] + }, + { + name: 'Mouse anti-6xHis', + weight: 84, + intensity: 2, + primary_anti_body: ['3'] + }, + /* Antibody 4 */ + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 2, //none + primary_anti_body: ['4'] + }, + /* Antibody 5 */ + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] }, - 'His-EGFR-FLAG': { - name: 'His-EGFR-FLAG' + { + transfer_function: 'static', + drug: 'gmProK', + cell_line: 'HproX-FLAG', + marks: [ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0, //none + primary_anti_body: ['1'] + }, + { + name: 'Rabbit anti-Protein Y', + weight: 230, //232 + intensity: 0, //none + primary_anti_body: ['2'] + }, + { + name: 'Mouse anti-6xHis', + weight: 40, //84,232 + intensity: 1, //none,none + primary_anti_body: ['3'] + }, + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //none + primary_anti_body: ['4'] + }, + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] }, - 'His-EGFR-M1-FLAG': { - name: 'His-EGFR-M1-FLAG' + { + transfer_function: 'static', + drug: 'gmBuf', + cell_line: 'HproY-FLAG', + marks: [ + /* Antibody 1 */ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0.5, //none + primary_anti_body: ['1'] + }, + /* Antibody 2 */ + { + name: 'Rabbit anti-Protein Y', + weight: 210, //230 + intensity: 0.5, + primary_anti_body: ['2'] + }, + { + name: 'Rabbit anti-Protein Y', + weight: 240, //232 + intensity: 2, + primary_anti_body: ['2'] + }, + /* Antibody 3 */ + { + name: 'Mouse anti-6xHis', + weight: 40, //84, 232 + intensity: 0, //none, high + primary_anti_body: ['3'] + }, + { + name: 'Mouse anti-6xHis', + weight: 232, + intensity: 2, + primary_anti_body: ['3'] + }, + /* Antibody 4 */ + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //high + primary_anti_body: ['4'] + }, + { + name: 'Rabbit anti-FLAG', + weight: 232, + intensity: 2, + primary_anti_body: ['4'] + }, + /* Antibody 5 */ + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] }, - 'His-EGFR-M2-FLAG': { - name: 'His-EGFR-M2-FLAG' + { + transfer_function: 'static', + drug: 'gmProK', + cell_line: 'HproY-FLAG', + marks: [ + /* Antibody 1 */ + { + name: 'Mouse anti-Protein X', + weight: 82, //84 + intensity: 0, //none + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-Protein X', + weight: 84, + intensity: 0, + primary_anti_body: ['1'] + }, + /* Antibody 2 */ + { + name: 'Rabbit anti-Protein Y', + weight: 230, //232 + intensity: 0, //none + primary_anti_body: ['2'] + }, + { + name: 'Rabbit anti-Protein Y', + weight: 232, + intensity: 0, + primary_anti_body: ['2'] + }, + /* Antibody 3 */ + { + name: 'Mouse anti-6xHis', + weight: 40, //84,232 + intensity: 0, //none,none + primary_anti_body: ['3'] + }, + /* Antibody 4 */ + { + name: 'Rabbit anti-FLAG', + weight: 84, //232 + intensity: 0, //none + primary_anti_body: ['4'] + }, + /* Antibody 5 */ + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, + primary_anti_body: ['5'] + } + ] } - - - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['1', '2', '3', '4', '5', '6', '7'], - '1': { - name: 'Mouse anti-EGFR', - secondary: ['m'], - marks: [ - {weight: 54, intensity: 0} - ], - gel_name: 'anti-EGFR' + ] + } + }, + facs: { + 'ticks': [50, 100, 150], + 'max': 200, + 'scale': 'pseudo', + 'dna': { + 'parser_simple': [ + { + match: [], + shape: 'normal' }, - '2': { - name: 'Mouse anti-pEGFR', - secondary: ['m'], - marks: [ - {weight: 58, intensity: 0} - ], - gel_name: 'anti-pEGFR' + { + match: ['drug_id'], + drug_id: 'gmProK', + shape: 'graph-b' }, - '3': { - name: 'Mouse anti-pRAF', - secondary: ['m'], - marks: [ - {weight: 48, intensity: 0} - ], - gel_name: 'anti-pRAF' + { //His 488 + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'nt', + drug_id: 'gmBuf', + condition: 'His_488', + shape: 'graph-b' }, - '4': { - name: 'Mouse anti-pMEK', - secondary: ['m'], - marks: [ - {weight: 25, intensity: 0} - ], - gel_name: 'anti-pMEK' + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'proX-Null', + drug_id: 'gmBuf', + condition: 'His_488', + shape: 'graph-b' }, - '5': { - name: 'Mouse anti-PGK1', - secondary: ['m'], - marks: [ - {weight: 45, intensity: 0} - ], - gel_name: 'anti-PGK1' + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'proY-Null', + drug_id: 'gmBuf', + condition: 'His_488', + shape: 'graph-b' }, - '6': { - name: 'Rabbit anti-6xHis', - secondary: ['r'], - marks: [ - {weight: 68, intensity: 0} - ], - gel_name: 'anti-6xHis' + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'HproX-FLAG', + drug_id: 'gmBuf', + condition: 'His_488', + shape: 'graph-b' }, - '7': { - name: 'Rabbit anti-FLAG', - secondary: ['r'], - marks: [ - {weight: 68, intensity: 0} - ], - gel_name: 'anti-FLAG' - } - }, - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'HproY-FLAG', + drug_id: 'gmBuf', + condition: 'His_488', + shape: 'scaled-peak-3' }, - 'r': { - name: 'goat anti-rabbit' - } - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - } - }, - facs_kinds: { - 'Anti': { - name: 'Antibody-labeling', - conditions: { - 'EGFR': {name: 'EGFR A488'} - } - } - }, - micro_kinds: { - 'IF': { - name: 'Antibody-labeling IF', - conditions: { - 'egfr': { name: 'EGFR A488', short_name: 'EGFR'}, - 'pm': { name: 'PM A488', short_name: 'PM'}, - 'cyto': { name: 'Cyto A488', short_name: 'Cyto'}, - 'nuc': { name: 'Nuc A488', short_name: 'Nuc'}, - 'er': { name: 'ER A488', short_name: 'ER'}, - 'nm': { name: 'NM A488', short_name: 'NM'} - } - - + //FLAG 488 + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'nt', + drug_id: 'gmBuf', + condition: 'FLAG_488', + shape: 'graph-b' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'proX-Null', + drug_id: 'gmBuf', + condition: 'FLAG_488', + shape: 'graph-b' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'proY-Null', + drug_id: 'gmBuf', + condition: 'FLAG_488', + shape: 'graph-b' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'HproX-FLAG', + drug_id: 'gmBuf', + condition: 'FLAG_488', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'HproY-FLAG', + drug_id: 'gmBuf', + condition: 'FLAG_488', + shape: 'scaled-peak-3' + }, + //ProX 488 + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'nt', + drug_id: 'gmBuf', + condition: 'proX_488', + shape: 'graph-c' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'proX-Null', + drug_id: 'gmBuf', + condition: 'proX_488', + shape: 'graph-b' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'proY-Null', + drug_id: 'gmBuf', + condition: 'proX_488', + shape: 'graph-c' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'HproX-FLAG', + drug_id: 'gmBuf', + condition: 'proX_488', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'HproY-FLAG', + drug_id: 'gmBuf', + condition: 'proX_488', + shape: 'graph-c' }, - 'na': { - name: 'None' + //ProY 488 + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'nt', + drug_id: 'gmBuf', + condition: 'proY_488', + shape: 'graph-c' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'proX-Null', + drug_id: 'gmBuf', + condition: 'proY_488', + shape: 'graph-c' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'proY-Null', + drug_id: 'gmBuf', + condition: 'proY_488', + shape: 'graph-b' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'HproX-FLAG', + drug_id: 'gmBuf', + condition: 'proY_488', + shape: 'graph-c' + }, + { + match: ['cell_line', 'drug_id', 'condition'], + cell_line: 'HproY-FLAG', + drug_id: 'gmBuf', + condition: 'proY_488', + shape: 'scaled-peak-3' } - }, - slides: { - - '1': 'images/microscopy/scb_ex3/pm_final/pm-b.jpg', - '2': 'images/microscopy/scb_ex3/pm_final/pm-c.jpg', - '3': 'images/microscopy/scb_ex3/pm_final/pm2b.jpg', - '4': 'images/microscopy/scb_ex3/pm_final/pm3b.jpg', - '5': 'images/microscopy/scb_ex3/pm_final/pm34-1.jpg', - '6': 'images/microscopy/scb_ex3/pm_final/pm34-2.jpg', - - '7': 'images/microscopy/scb_ex3/cyto_final/c-a.jpg', - '8': 'images/microscopy/scb_ex3/cyto_final/c-b.jpg', - '9': 'images/microscopy/scb_ex3/cyto_final/c-c.jpg', - '10': 'images/microscopy/scb_ex3/cyto_final/c-d.jpg', - '11': 'images/microscopy/scb_ex3/cyto_final/c1.jpg', - '12': 'images/microscopy/scb_ex3/cyto_final/c7.jpg', - '13': 'images/microscopy/scb_ex3/cyto_final/c15-1.jpg', - '14': 'images/microscopy/scb_ex3/cyto_final/c15-2.jpg', - '15': 'images/microscopy/scb_ex3/cyto_final/c17.jpg', - '16': 'images/microscopy/scb_ex3/cyto_final/c29.jpg', - - '17': 'images/microscopy/scb_ex3/nucleus_final/n2.jpg', - '18': 'images/microscopy/scb_ex3/nucleus_final/n8.jpg', - '19': 'images/microscopy/scb_ex3/nucleus_final/n9.jpg', - '20': 'images/microscopy/scb_ex3/nucleus_final/n18.jpg', - '21': 'images/microscopy/scb_ex3/nucleus_final/n34.jpg', - '22': 'images/microscopy/scb_ex3/nucleus_final/n43.jpg', - '23': 'images/microscopy/scb_ex3/nucleus_final/n47.jpg', - '25': 'images/microscopy/scb_ex3/nucleus_final/n64.jpg', - '26': 'images/microscopy/scb_ex3/nucleus_final/nuc-a.jpg', - '27': 'images/microscopy/scb_ex3/nucleus_final/nuc-b.jpg', - '28': 'images/microscopy/scb_ex3/nucleus_final/nuc-c.jpg', + ] - '29': 'images/microscopy/scb_ex3/er_final/er1crop.jpg', - '30': 'images/microscopy/scb_ex3/er_final/er2crop.jpg', - '31': 'images/microscopy/scb_ex3/er_final/er3crop1.jpg', - '32': 'images/microscopy/scb_ex3/er_final/er3crop2.jpg', - '33': 'images/microscopy/scb_ex3/er_final/er5crop1.jpg', + } + } + } + } +}; - '34': 'images/microscopy/scb_ex3/nm_final/NM1crop.jpg', - '35': 'images/microscopy/scb_ex3/nm_final/nm2crop.jpg', - '36': 'images/microscopy/scb_ex3/nm_final/nm3crop1.jpg', - '37': 'images/microscopy/scb_ex3/nm_final/nm3crop2.jpg', - '38': 'images/microscopy/scb_ex3/nm_final/nm5crop.jpg', +var __scb_sample_3 = { + id: 'scb_ex3', + name: 'Exercise 3', + course: 'SCB_SampleExercises', + course_name: 'Sample Exercises', + description: 'StarCellBio Exercise 3', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ["Goal & Learning Objectives", scb_ex3_text.goal({})], + ["Introduction", scb_ex3_text.intro({})], + ["Background Information", scb_ex3_text.bg_info({})], + ["Questions", scb_ex3_text.questions({})] + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs', 'micro'], + gel_types: ['.10', '.12', '.15'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: false + }, + { + kind: 'duration', + title: 'Time', + editable: false + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } + ], + actions: [ + { + kind: "add_many", + name: "ADD SAMPLES", + open: 'scb_ex3.setup', + 'collection_id': '%CELL_LINE%' + } - 'bo': 'images/microscopy/scb_ex3/negative_control.jpg', - 'dummy': 'dummy' - }, - model: { - western_blot: { - 'cyto': { - 'parser_fixed': [ - /* WT-EGFR */ - { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'WT-EGFR', - drug: 'growth_media', - duration: '*ANY*', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 2, //high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } - ] - }, + ] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%, %COLLECTION%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + '%COLLECTION%': { + attr: ['treatment_list', 'list', '0', 'duration'], + map: ['durations', '%KEY%', 'name'] + } + } + }, + microscopy: { + disable_blur: false, + disable_brightness: false + }, + add_multiple_dialog: { + order: ['WT-EGFR', 'EGFR Null', 'EGFR-M1', 'EGFR-M2', 'NoUB', + 'ConstActive', 'His-EGFR-FLAG', 'His-EGFR-M1-FLAG', 'His-EGFR-M2-FLAG'], + headings: ['', 'Strain', 'Treatment', 'Treatment Duration'], + 'WT-EGFR': { + rows: [ + { + 'cell_treatments': { + 'gm30': [ + { + 'cell_line': 'WT-EGFR', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'WT-EGFR', - drug: 'growth_mediaEGF', - duration: '30 sec', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 1, //med - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 1, //med - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 1,//med - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 1, //med - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 1, //med - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'], + 'conditions': { + 'IF': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm30', + 'treatment_id': 'growth_media30' + }, + { + 'kind': 'text', + 'text': 'WT-EGFR' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_media30' + }, + { + 'cell_treatments': { + 'gm60': [ + { + 'cell_line': 'WT-EGFR', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'WT-EGFR', - drug: 'growth_mediaEGF', - duration: '1 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 2, //high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 2, //high - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 2, //high - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 2, //high - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'], + 'conditions': { + 'IF': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm60', + 'treatment_id': 'growth_media60' + }, + { + 'kind': 'text', + 'text': 'WT-EGFR' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_media60' + }, + { + 'cell_treatments': { + 'gm6': [ + { + 'cell_line': 'WT-EGFR', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'WT-EGFR', - drug: 'growth_mediaEGF', - duration: '6 h', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0.5, //low - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'], + 'conditions': { + 'IF': ['egfr', 'pm', 'cyto', 'nuc', 'er', 'nm'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm6', + 'treatment_id': 'growth_media6' + }, + { + 'kind': 'text', + 'text': 'WT-EGFR' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_media6' + }, + { + 'cell_treatments': { + 'gmEGF30': [ + { + 'cell_line': 'WT-EGFR', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'WT-EGFR', - drug: 'growth_mediaBuff', - duration: '30 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 2,//high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF30', + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'kind': 'text', + 'text': 'WT-EGFR' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'cell_treatments': { + 'gmEGF60': [ + { + 'cell_line': 'WT-EGFR', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'WT-EGFR', - drug: 'growth_mediaProK', - duration: '30 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, - /* EGFR Null */ + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF60', + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'kind': 'text', + 'text': 'WT-EGFR' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'cell_treatments': { + 'gmEGF6': [ + { + 'cell_line': 'WT-EGFR', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'EGFR Null', - drug: '*ANY*', - duration: '*ANY*', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, - /* EGFR-M1 */ + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF6', + 'treatment_id': 'growth_mediaEGF6' + }, + { + 'kind': 'text', + 'text': 'WT-EGFR' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_mediaEGF6' + }, + { + 'cell_treatments': { + 'gmBuff': [ + { + 'cell_line': 'WT-EGFR', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'EGFR-M1', - drug: '*ANY*', - duration: '*ANY*', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 2, //high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaBuff' + } ] - }, - /*EGFR-M2*/ + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmBuff', + 'treatment_id': 'growth_mediaBuff' + }, + { + 'kind': 'text', + 'text': 'WT-EGFR' + }, + { + 'kind': 'text', + 'text': 'Growth media + buffer' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaBuff' + }, + { + 'cell_treatments': { + 'gmProK': [ + { + 'cell_line': 'WT-EGFR', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'EGFR-M2', - drug: 'growth_media', - duration: '*ANY*', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 2,//high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaProK' + } ] - }, + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmProK', + 'treatment_id': 'growth_mediaProK' + }, + { + 'kind': 'text', + 'text': 'WT-EGFR' + }, + { + 'kind': 'text', + 'text': 'Growth media + ProK' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaProK' + } + ] + }, + 'EGFR Null': { + rows: [ + { + 'cell_treatments': { + 'gm30': [ + { + 'cell_line': 'EGFR Null', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'EGFR-M2', - drug: 'growth_mediaEGF', - duration: '30 sec', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 1, //med - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 1, //med - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 1, //med - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 1, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 1,//med - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm30', + 'treatment_id': 'growth_media30' + }, + { + 'kind': 'text', + 'text': 'EGFR Null' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_media30' + }, + { + 'cell_treatments': { + 'gm60': [ + { + 'cell_line': 'EGFR Null', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'EGFR-M2', - drug: 'growth_mediaEGF', - duration: '1 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 2, // high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 2, // high - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 2, //high - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 2, //high - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm60', + 'treatment_id': 'growth_media60' + }, + { + 'kind': 'text', + 'text': 'EGFR Null' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_media60' + }, + { + 'cell_treatments': { + 'gm6': [ + { + 'cell_line': 'EGFR Null', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'EGFR-M2', - drug: 'growth_mediaEGF', - duration: '6 h', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 2, // high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 2, // high - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 2, // high - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 2, // high - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, - /*NoUB*/ + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm6', + 'treatment_id': 'growth_media6' + }, + { + 'kind': 'text', + 'text': 'EGFR Null' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_media6' + }, + { + 'cell_treatments': { + 'gmEGF30': [ + { + 'cell_line': 'EGFR Null', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'NoUB', - drug: 'growth_media', - duration: '*ANY*', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 2, //high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF30', + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'kind': 'text', + 'text': 'EGFR Null' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'cell_treatments': { + 'gmEGF60': [ + { + 'cell_line': 'EGFR Null', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'NoUB', - drug: 'growth_mediaEGF', - duration: '30 sec', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 1, //med - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 1, //med - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 1, //med - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 1, //med - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 1, //med - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF60', + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'kind': 'text', + 'text': 'EGFR Null' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'cell_treatments': { + 'gmEGF6': [ + { + 'cell_line': 'EGFR Null', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'NoUB', - drug: 'growth_mediaEGF', - duration: '1 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 2, //high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 2, //high - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 2, // high - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 2, //high - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF6', + 'treatment_id': 'growth_mediaEGF6' + }, + { + 'kind': 'text', + 'text': 'EGFR Null' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_mediaEGF6' + }, + { + 'cell_treatments': { + 'gmBuff': [ + { + 'cell_line': 'EGFR Null', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'NoUB', - drug: 'growth_mediaEGF', - duration: '6 h', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 2, // high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 2, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 2, // high - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 2, // high - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaBuff' + } ] - }, - /*ConstActive*/ + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmBuff', + 'treatment_id': 'growth_mediaBuff' + }, + { + 'kind': 'text', + 'text': 'EGFR Null' + }, + { + 'kind': 'text', + 'text': 'Growth media + buffer' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaBuff' + }, + { + 'cell_treatments': { + 'gmProK': [ + { + 'cell_line': 'EGFR Null', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'ConstActive', - drug: '*ANY*', - duration: '*ANY*', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 2, // high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 2, // high - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 2, // high - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 2, // high - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 51, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaProK' + } ] - }, - /* His-EGFR-FLAG*/ + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmProK', + 'treatment_id': 'growth_mediaProK' + }, + { + 'kind': 'text', + 'text': 'EGFR Null' + }, + { + 'kind': 'text', + 'text': 'Growth media + ProK' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaProK' + } + + ] + }, + 'EGFR-M1': { + rows: [ + { + 'cell_treatments': { + 'gm30': [ + { + 'cell_line': 'EGFR-M1', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'His-EGFR-FLAG', - drug: 'growth_mediaBuff', - duration: '30 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 2, // high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 2, // high - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 2, // high - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm30', + 'treatment_id': 'growth_media30' + }, + { + 'kind': 'text', + 'text': 'EGFR-M1' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_media30' + }, + { + 'cell_treatments': { + 'gm60': [ + { + 'cell_line': 'EGFR-M1', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'His-EGFR-FLAG', - drug: 'growth_mediaProK', - duration: '30 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 1, //med - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, - /*His-EGFR-M1-FLAG */ + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm60', + 'treatment_id': 'growth_media60' + }, + { + 'kind': 'text', + 'text': 'EGFR-M1' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_media60' + }, + { + 'cell_treatments': { + 'gm6': [ + { + 'cell_line': 'EGFR-M1', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'His-EGFR-M1-FLAG', - drug: 'growth_mediaBuff', - duration: '30 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 2, // high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 2, // high - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 2, // high - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] - }, + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm6', + 'treatment_id': 'growth_media6' + }, + { + 'kind': 'text', + 'text': 'EGFR-M1' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_media6' + }, + { + 'cell_treatments': { + 'gmEGF30': [ + { + 'cell_line': 'EGFR-M1', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'His-EGFR-M1-FLAG', - drug: 'growth_mediaProK', - duration: '30 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 1, //med - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 1, //med - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, - /* His-EGFR-M2-FLAG*/ + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF30', + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'kind': 'text', + 'text': 'EGFR-M1' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'cell_treatments': { + 'gmEGF60': [ + { + 'cell_line': 'EGFR-M1', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'His-EGFR-M2-FLAG', - drug: 'growth_mediaBuff', - duration: '30 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 2, // high - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 2, // high - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 2, // high - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 0, - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF60', + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'kind': 'text', + 'text': 'EGFR-M1' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'cell_treatments': { + 'gmEGF6': [ + { + 'cell_line': 'EGFR-M1', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: 'His-EGFR-M2-FLAG', - drug: 'growth_mediaProK', - duration: '30 min', - above_marks: [ - //antibody 1 - { - name: 'Mouse anti-EGFR', - weight: 120, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['1'] - }, - { - name: 'Mouse anti-EGFR', - weight: 65, - intensity: 0, - primary_anti_body: ['1'] - }, - //antibody 2 - { - name: 'Mouse anti-pEGFR', - weight: 140, - intensity: 0, - primary_anti_body: ['2'] - }, - //antibody 3 - { - name: 'Mouse anti-pRAF', - weight: 75, - intensity: 0, - primary_anti_body: ['3'] - }, - //antibody 4 - { - name: 'Mouse anti-pMEK', - weight: 45, - intensity: 0, - primary_anti_body: ['4'] - }, - //antibody 5 is included in *ANY* cell_line - //antibody 6 - { - name: 'Mouse anti-6xHis', - weight: 120, - intensity: 0, - primary_anti_body: ['6'] - }, - { - name: 'Mouse anti-6xHis', - weight: 65, - intensity: 0, - primary_anti_body: ['6'] - }, - //antibody 7 - { - name: 'Mouse anti-FLAG', - weight: 120, - intensity: 0, - primary_anti_body: ['7'] - }, - { - name: 'Mouse anti-FLAG', - weight: 51, - intensity: 1, //med - primary_anti_body: ['7'] - } + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, - /*ANY cell_line*/ + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF6', + 'treatment_id': 'growth_mediaEGF6' + }, + { + 'kind': 'text', + 'text': 'EGFR-M1' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_mediaEGF6' + } + ] + }, + 'EGFR-M2': { + rows: [ + { + 'cell_treatments': { + 'gm30': [ + { + 'cell_line': 'EGFR-M2', + 'treatment_list': { + 'list': [ { - transfer_function: 'delta', - cutoff: 1, - cell_line: '*ANY*', - drug: '*ANY*', - duration: '*ANY*', - above_marks: [ - //antibody 5 is the same for all treatments - { - name: 'Mouse anti-PGK1', - weight: 44, - intensity: 1, //med - primary_anti_body: ['5'] - } - - + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } ] + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' } - ] + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm30', + 'treatment_id': 'growth_media30' + }, + { + 'kind': 'text', + 'text': 'EGFR-M2' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '30 sec' } + ], + 'treatment_id': 'growth_media30' }, - facs: { - 'ticks': [50, 100, 150], - 'max': 200, - 'scale': 'pseudo', - 'dna': { - 'parser_simple': [ - { - match: [], - shape: '2-peak-normal-400' - }, - /*The same graph for all treatments for EGFR Null*/ - { - match: ['cell_line'], - cell_line: 'EGFR Null', - shape: 'graph-b' - }, - /*The same graph for all treatments for EGFR-M1*/ - { - match: ['cell_line'], - cell_line: 'EGFR-M1', - shape: 'graph-b' - }, - /*The same graph for all treatments for EGFR-M2*/ - { - match: ['cell_line'], - cell_line: 'EGFR-M2', - shape: 'scaled-peak-3' - }, - /*The same graph for all treatments for NoUB*/ + { + 'cell_treatments': { + 'gm60': [ + { + 'cell_line': 'EGFR-M2', + 'treatment_list': { + 'list': [ { - match: ['cell_line'], - cell_line: 'NoUB', - shape: 'scaled-peak-3' - }, - /*WT-EGFR*/ - { - match: ['cell_line', 'drug_id'], - cell_line: 'WT-EGFR', - drug_id: 'growth_media', - shape: 'scaled-peak-3' - }, - { - match: ['cell_line', 'drug_id', 'duration'], - cell_line: 'WT-EGFR', - drug_id: 'growth_mediaEGF', - duration: '30 sec', - shape: 'scaled-peak-3' - }, - { - match: ['cell_line', 'drug_id', 'duration'], - cell_line: 'WT-EGFR', - drug_id: 'growth_mediaEGF', - duration: '1 min', - shape: 'scaled-peak-3' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } + ] + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm60', + 'treatment_id': 'growth_media60' + }, + { + 'kind': 'text', + 'text': 'EGFR-M2' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_media60' + }, + { + 'cell_treatments': { + 'gm6': [ + { + 'cell_line': 'EGFR-M2', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'duration'], - cell_line: 'WT-EGFR', - drug_id: 'growth_mediaEGF', - duration: '6 h', - shape: 'graph-c' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } + ] + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['egfr'], + 'conditions': { + 'IF': ['egfr'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm6', + 'treatment_id': 'growth_media6' + }, + { + 'kind': 'text', + 'text': 'EGFR-M2' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_media6' + }, + { + 'cell_treatments': { + 'gmEGF30': [ + { + 'cell_line': 'EGFR-M2', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'WT-EGFR', - drug_id: 'growth_mediaBuff', - shape: 'scaled-peak-3' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } + ] + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF30', + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'kind': 'text', + 'text': 'EGFR-M2' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'cell_treatments': { + 'gmEGF60': [ + { + 'cell_line': 'EGFR-M2', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'WT-EGFR', - drug_id: 'growth_mediaProK', - shape: 'graph-b' - }, - - - /*ConstActive*/ + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } + ] + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF60', + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'kind': 'text', + 'text': 'EGFR-M2' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'cell_treatments': { + 'gmEGF6': [ + { + 'cell_line': 'EGFR-M2', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'ConstActive', - drug_id: 'growth_media', - shape: 'scaled-peak-3' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } + ] + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF6', + 'treatment_id': 'growth_mediaEGF6' + }, + { + 'kind': 'text', + 'text': 'EGFR-M2' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_mediaEGF6' + } + ] + }, + 'NoUB': { + rows: [ + { + 'cell_treatments': { + 'gm30': [ + { + 'cell_line': 'NoUB', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'duration'], - cell_line: 'ConstActive', - drug_id: 'growth_mediaEGF', - duration: '30 sec', - shape: 'scaled-peak-3' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } + ] + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm30', + 'treatment_id': 'growth_media30' + }, + { + 'kind': 'text', + 'text': 'NoUB' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_media30' + }, + { + 'cell_treatments': { + 'gm60': [ + { + 'cell_line': 'NoUB', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'duration'], - cell_line: 'ConstActive', - drug_id: 'growth_mediaEGF', - duration: '1 min', - shape: 'scaled-peak-3' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } + ] + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm60', + 'treatment_id': 'growth_media60' + }, + { + 'kind': 'text', + 'text': 'NoUB' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_media60' + }, + { + 'cell_treatments': { + 'gm6': [ + { + 'cell_line': 'NoUB', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'duration'], - cell_line: 'ConstActive', - drug_id: 'growth_mediaEGF', - duration: '6 h', - shape: 'graph-c' - }, - /*His-EGFR-FLAG*/ + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } + ] + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm6', + 'treatment_id': 'growth_media6' + }, + { + 'kind': 'text', + 'text': 'NoUB' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_media6' + }, + { + 'cell_treatments': { + 'gmEGF30': [ + { + 'cell_line': 'NoUB', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'His-EGFR-FLAG', - drug_id: 'growth_mediaBuff', - shape: 'scaled-peak-3' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } + ] + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF30', + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'kind': 'text', + 'text': 'NoUB' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'cell_treatments': { + 'gmEGF60': [ + { + 'cell_line': 'NoUB', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'His-EGFR-FLAG', - drug_id: 'growth_mediaProK', - shape: 'graph-b' - }, - /*His-EGFR-M1-FLAG*/ + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } + ] + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF60', + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'kind': 'text', + 'text': 'NoUB' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'cell_treatments': { + 'gmEGF6': [ + { + 'cell_line': 'NoUB', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'His-EGFR-M1-FLAG', - drug_id: 'growth_mediaBuff', - shape: 'graph-b' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } + ] + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF6', + 'treatment_id': 'growth_mediaEGF6' + }, + { + 'kind': 'text', + 'text': 'NoUB' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_mediaEGF6' + } + + ] + }, + 'ConstActive': { + rows: [ + { + 'cell_treatments': { + 'gm30': [ + { + 'cell_line': 'ConstActive', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'His-EGFR-M1-FLAG', - drug_id: 'growth_mediaProK', - shape: 'graph-b' - }, - /*His-EGFR-M2-FLAG*/ + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } + ] + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm30', + 'treatment_id': 'growth_media30' + }, + { + 'kind': 'text', + 'text': 'ConstActive' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_media30' + }, + { + 'cell_treatments': { + 'gm60': [ + { + 'cell_line': 'ConstActive', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'His-EGFR-M2-FLAG', - drug_id: 'growth_mediaBuff', - shape: 'scaled-peak-3' - }, + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } + ] + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm60', + 'treatment_id': 'growth_media60' + }, + { + 'kind': 'text', + 'text': 'ConstActive' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_media60' + }, + { + 'cell_treatments': { + 'gm6': [ + { + 'cell_line': 'ConstActive', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id'], - cell_line: 'His-EGFR-M2-FLAG', - drug_id: 'growth_mediaProK', - shape: 'graph-b' + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_media' + } + ] + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' } - ] - + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gm6', + 'treatment_id': 'growth_media6' + }, + { + 'kind': 'text', + 'text': 'ConstActive' + }, + { + 'kind': 'text', + 'text': 'Growth media only' + }, + { + 'kind': 'text', + 'text': '6 hrs' } + ], + 'treatment_id': 'growth_media6' }, - microscopy: { - 'slide': { - 'parser_simple': [ + { + 'cell_treatments': { + 'gmEGF30': [ + { + 'cell_line': 'ConstActive', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'EGFR Null', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'egfr', - imgs_hash: [ - [ - {hash: 'bo', if_type: 'green'} - ] + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, + }, + 'duration': '30 sec', + 'duration_value': 30, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF30', + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'kind': 'text', + 'text': 'ConstActive' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '30 sec' + } + ], + 'treatment_id': 'growth_mediaEGF30' + }, + { + 'cell_treatments': { + 'gmEGF60': [ + { + 'cell_line': 'ConstActive', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'WT-EGFR', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'egfr', - imgs_hash: [ - [ - {hash: '1', if_type: 'green'} - ], - [ - {hash: '2', if_type: 'green'} - ], - [ - {hash: '3', if_type: 'green'} - ], - [ - {hash: '4', if_type: 'green'} - ], - [ - {hash: '5', if_type: 'green'} - ], - [ - {hash: '6', if_type: 'green'} - ] + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, + }, + 'duration': '1 min', + 'duration_value': 60, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF60', + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'kind': 'text', + 'text': 'ConstActive' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '1 min' + } + ], + 'treatment_id': 'growth_mediaEGF60' + }, + { + 'cell_treatments': { + 'gmEGF6': [ + { + 'cell_line': 'ConstActive', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'WT-EGFR', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'pm', - imgs_hash: [ - [ - {hash: '1', if_type: 'green'} - ], - [ - {hash: '2', if_type: 'green'} - ], - [ - {hash: '3', if_type: 'green'} - ], - [ - {hash: '4', if_type: 'green'} - ], - [ - {hash: '5', if_type: 'green'} - ], - [ - {hash: '6', if_type: 'green'} - ] + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaEGF' + } ] - }, + }, + 'duration': '6 hrs', + 'duration_value': 21600, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmEGF6', + 'treatment_id': 'growth_mediaEGF6' + }, + { + 'kind': 'text', + 'text': 'ConstActive' + }, + { + 'kind': 'text', + 'text': 'Growth media + EGF' + }, + { + 'kind': 'text', + 'text': '6 hrs' + } + ], + 'treatment_id': 'growth_mediaEGF6' + } + ] + }, + 'His-EGFR-FLAG': { + rows: [ + { + 'cell_treatments': { + 'gmBuff': [ + { + 'cell_line': 'His-EGFR-FLAG', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'WT-EGFR', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'cyto', - imgs_hash: [ - [ - {hash: '7', if_type: 'green'} - ], - [ - {hash: '8', if_type: 'green'} - ], - [ - {hash: '9', if_type: 'green'} - ], - [ - {hash: '10', if_type: 'green'} - ], - [ - {hash: '11', if_type: 'green'} - ], - [ - {hash: '12', if_type: 'green'} - ], - [ - {hash: '13', if_type: 'green'} - ], - [ - {hash: '14', if_type: 'green'} - ], - [ - {hash: '15', if_type: 'green'} - ], - [ - {hash: '16', if_type: 'green'} - ] - + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaBuff' + } ] - }, + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmBuff', + 'treatment_id': 'growth_mediaBuff' + }, + { + 'kind': 'text', + 'text': 'His-EGFR-FLAG' + }, + { + 'kind': 'text', + 'text': 'Growth media + buffer' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaBuff' + }, + { + 'cell_treatments': { + 'gmProK': [ + { + 'cell_line': 'His-EGFR-FLAG', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'WT-EGFR', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'nuc', - imgs_hash: [ - [ - {hash: '18', if_type: 'green'} - ], - [ - {hash: '19', if_type: 'green'} - ], - [ - {hash: '20', if_type: 'green'} - ], - [ - {hash: '21', if_type: 'green'} - ], - [ - {hash: '22', if_type: 'green'} - ], - [ - {hash: '23', if_type: 'green'} - ], - [ - {hash: '25', if_type: 'green'} - ] + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaProK' + } ] - }, + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmProK', + 'treatment_id': 'growth_mediaProK' + }, + { + 'kind': 'text', + 'text': 'His-EGFR-FLAG' + }, + { + 'kind': 'text', + 'text': 'Growth media + ProK' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaProK' + } + + ] + }, + 'His-EGFR-M1-FLAG': { + rows: [ + { + 'cell_treatments': { + 'gmBuff': [ + { + 'cell_line': 'His-EGFR-M1-FLAG', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'WT-EGFR', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'er', - imgs_hash: [ - [ - {hash: '29', if_type: 'green'} - ], - [ - {hash: '30', if_type: 'green'} - ], - [ - {hash: '31', if_type: 'green'} - ], - [ - {hash: '32', if_type: 'green'} - ], - [ - {hash: '33', if_type: 'green'} - ] + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaBuff' + } ] - }, + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmBuff', + 'treatment_id': 'growth_mediaBuff' + }, + { + 'kind': 'text', + 'text': 'His-EGFR-M1-FLAG' + }, + { + 'kind': 'text', + 'text': 'Growth media + buffer' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaBuff' + }, + { + 'cell_treatments': { + 'gmProK': [ + { + 'cell_line': 'His-EGFR-M1-FLAG', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'WT-EGFR', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'nm', - imgs_hash: [ - [ - {hash: '34', if_type: 'green'} - ], - [ - {hash: '35', if_type: 'green'} - ], - [ - {hash: '36', if_type: 'green'} - ], - [ - {hash: '37', if_type: 'green'} - ], - [ - {hash: '38', if_type: 'green'} - ] + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaProK' + } ] - }, + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmProK', + 'treatment_id': 'growth_mediaProK' + }, + { + 'kind': 'text', + 'text': 'His-EGFR-M1-FLAG' + }, + { + 'kind': 'text', + 'text': 'Growth media + ProK' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaProK' + } + + ] + }, + 'His-EGFR-M2-FLAG': { + rows: [ + { + 'cell_treatments': { + 'gmBuff': [ + { + 'cell_line': 'His-EGFR-M2-FLAG', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'EGFR-M1', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'egfr', - imgs_hash: [ - [ - {hash: '1', if_type: 'green'} - ], - [ - {hash: '2', if_type: 'green'} - ], - [ - {hash: '3', if_type: 'green'} - ], - [ - {hash: '4', if_type: 'green'} - ], - [ - {hash: '5', if_type: 'green'} - ], - [ - {hash: '6', if_type: 'green'} - ] + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaBuff' + } ] - }, + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' + } + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmBuff', + 'treatment_id': 'growth_mediaBuff' + }, + { + 'kind': 'text', + 'text': 'His-EGFR-M2-FLAG' + }, + { + 'kind': 'text', + 'text': 'Growth media + buffer' + }, + { + 'kind': 'text', + 'text': '30 min' + } + ], + 'treatment_id': 'growth_mediaBuff' + }, + { + 'cell_treatments': { + 'gmProK': [ + { + 'cell_line': 'His-EGFR-M2-FLAG', + 'treatment_list': { + 'list': [ { - match: ['cell_line', 'drug_id', 'kind', 'conditions'], - cell_line: 'EGFR-M2', - drug_id: 'growth_media', - kind: 'IF', - conditions: 'egfr', - imgs_hash: [ - [ - {hash: '1', if_type: 'green'} - ], - [ - {hash: '2', if_type: 'green'} - ], - [ - {hash: '3', if_type: 'green'} - ], - [ - {hash: '4', if_type: 'green'} - ], - [ - {hash: '5', if_type: 'green'} - ], - [ - {hash: '6', if_type: 'green'} - ] + 'collection_id': 'default', + 'drug_list': { + 'list': [ + { + 'concentration_id': '100', + 'drug_id': 'growth_mediaProK' + } ] + }, + 'duration': '30 min', + 'duration_value': 1800, + 'microscope': ['na'], + 'conditions': { + 'na': ['None'] + }, + 'temperature': '25' } - ] + ] + } + } + ] + }, + 'cells': [ + { + 'kind': 'checkbox', + 'name': 'gmProK', + 'treatment_id': 'growth_mediaProK' + }, + { + 'kind': 'text', + 'text': 'His-EGFR-M2-FLAG' + }, + { + 'kind': 'text', + 'text': 'Growth media + ProK' + }, + { + 'kind': 'text', + 'text': '30 min' } - + ], + 'treatment_id': 'growth_mediaProK' } + ] } + } + }, + add_new_row_instructions: 'add new row instructions', + experiment_setup: scb_ex3_text.experiment_setup({}), + collections: { + '30 s': { + name: '30 sec' + }, + '60 s': { + name: '1 min' + }, + '6 h': { + name: '6 hrs' + }, + '30 m': { + name: '30 min' + } + }, + durations: { + '30 sec': { + name: '30 sec' + }, + '1 min': { + name: '1 min' + }, + '6 h': { + name: '6 hrs' + }, + '30 min': { + name: '30 min' + } + }, + concentrations: { + 100: { + name: '', + value: 100 + } + }, + drugs: { + 'growth_media': { + name: 'Growth media only', + concentrations: [100] + }, + 'growth_mediaEGF': { + name: 'Growth media + EGF', + concentrations: [100] + }, + 'growth_mediaBuff': { + name: 'Growth media + buffer', + concentrations: [100] + }, + 'growth_mediaProK': { + name: 'Growth media + ProK', + concentrations: [100] + } + + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + } + }, + cell_lines: { + 'WT-EGFR': { + name: 'WT-EGFR' + }, + 'EGFR Null': { + name: 'EGFR Null' + }, + 'EGFR-M1': { + name: 'EGFR-M1' + }, + 'EGFR-M2': { + name: 'EGFR-M2' + }, + 'NoUB': { + name: 'NoUB' + }, + 'ConstActive': { + name: 'ConstActive' + }, + 'His-EGFR-FLAG': { + name: 'His-EGFR-FLAG' + }, + 'His-EGFR-M1-FLAG': { + name: 'His-EGFR-M1-FLAG' + }, + 'His-EGFR-M2-FLAG': { + name: 'His-EGFR-M2-FLAG' + } + + + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['1', '2', '3', '4', '5', '6', '7'], + '1': { + name: 'Mouse anti-EGFR', + secondary: ['m'], + marks: [ + { + weight: 54, + intensity: 0 + } + ], + gel_name: 'anti-EGFR' + }, + '2': { + name: 'Mouse anti-pEGFR', + secondary: ['m'], + marks: [ + { + weight: 58, + intensity: 0 + } + ], + gel_name: 'anti-pEGFR' + }, + '3': { + name: 'Mouse anti-pRAF', + secondary: ['m'], + marks: [ + { + weight: 48, + intensity: 0 + } + ], + gel_name: 'anti-pRAF' + }, + '4': { + name: 'Mouse anti-pMEK', + secondary: ['m'], + marks: [ + { + weight: 25, + intensity: 0 + } + ], + gel_name: 'anti-pMEK' + }, + '5': { + name: 'Mouse anti-PGK1', + secondary: ['m'], + marks: [ + { + weight: 45, + intensity: 0 + } + ], + gel_name: 'anti-PGK1' + }, + '6': { + name: 'Rabbit anti-6xHis', + secondary: ['r'], + marks: [ + { + weight: 68, + intensity: 0 + } + ], + gel_name: 'anti-6xHis' + }, + '7': { + name: 'Rabbit anti-FLAG', + secondary: ['r'], + marks: [ + { + weight: 68, + intensity: 0 + } + ], + gel_name: 'anti-FLAG' + } + }, + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'Anti': { + name: 'Antibody-labeling', + conditions: { + 'EGFR': { + name: 'EGFR A488' + } + } + } + }, + micro_kinds: { + 'IF': { + name: 'Antibody-labeling IF', + conditions: { + 'egfr': { + name: 'EGFR A488', + short_name: 'EGFR' + }, + 'pm': { + name: 'PM A488', + short_name: 'PM' + }, + 'cyto': { + name: 'Cyto A488', + short_name: 'Cyto' + }, + 'nuc': { + name: 'Nuc A488', + short_name: 'Nuc' + }, + 'er': { + name: 'ER A488', + short_name: 'ER' + }, + 'nm': { + name: 'NM A488', + short_name: 'NM' + } + } + + + }, + 'na': { + name: 'None' + } + + }, + slides: { + + '1': 'images/microscopy/scb_ex3/pm_final/pm-b.jpg', + '2': 'images/microscopy/scb_ex3/pm_final/pm-c.jpg', + '3': 'images/microscopy/scb_ex3/pm_final/pm2b.jpg', + '4': 'images/microscopy/scb_ex3/pm_final/pm3b.jpg', + '5': 'images/microscopy/scb_ex3/pm_final/pm34-1.jpg', + '6': 'images/microscopy/scb_ex3/pm_final/pm34-2.jpg', + + '7': 'images/microscopy/scb_ex3/cyto_final/c-a.jpg', + '8': 'images/microscopy/scb_ex3/cyto_final/c-b.jpg', + '9': 'images/microscopy/scb_ex3/cyto_final/c-c.jpg', + '10': 'images/microscopy/scb_ex3/cyto_final/c-d.jpg', + '11': 'images/microscopy/scb_ex3/cyto_final/c1.jpg', + '12': 'images/microscopy/scb_ex3/cyto_final/c7.jpg', + '13': 'images/microscopy/scb_ex3/cyto_final/c15-1.jpg', + '14': 'images/microscopy/scb_ex3/cyto_final/c15-2.jpg', + '15': 'images/microscopy/scb_ex3/cyto_final/c17.jpg', + '16': 'images/microscopy/scb_ex3/cyto_final/c29.jpg', + + '17': 'images/microscopy/scb_ex3/nucleus_final/n2.jpg', + '18': 'images/microscopy/scb_ex3/nucleus_final/n8.jpg', + '19': 'images/microscopy/scb_ex3/nucleus_final/n9.jpg', + '20': 'images/microscopy/scb_ex3/nucleus_final/n18.jpg', + '21': 'images/microscopy/scb_ex3/nucleus_final/n34.jpg', + '22': 'images/microscopy/scb_ex3/nucleus_final/n43.jpg', + '23': 'images/microscopy/scb_ex3/nucleus_final/n47.jpg', + '25': 'images/microscopy/scb_ex3/nucleus_final/n64.jpg', + '26': 'images/microscopy/scb_ex3/nucleus_final/nuc-a.jpg', + '27': 'images/microscopy/scb_ex3/nucleus_final/nuc-b.jpg', + '28': 'images/microscopy/scb_ex3/nucleus_final/nuc-c.jpg', + + '29': 'images/microscopy/scb_ex3/er_final/er1crop.jpg', + '30': 'images/microscopy/scb_ex3/er_final/er2crop.jpg', + '31': 'images/microscopy/scb_ex3/er_final/er3crop1.jpg', + '32': 'images/microscopy/scb_ex3/er_final/er3crop2.jpg', + '33': 'images/microscopy/scb_ex3/er_final/er5crop1.jpg', + + + '34': 'images/microscopy/scb_ex3/nm_final/NM1crop.jpg', + '35': 'images/microscopy/scb_ex3/nm_final/nm2crop.jpg', + '36': 'images/microscopy/scb_ex3/nm_final/nm3crop1.jpg', + '37': 'images/microscopy/scb_ex3/nm_final/nm3crop2.jpg', + '38': 'images/microscopy/scb_ex3/nm_final/nm5crop.jpg', + + 'bo': 'images/microscopy/scb_ex3/negative_control.jpg', + 'dummy': 'dummy' + }, + model: { + western_blot: { + 'cyto': { + 'parser_fixed': [ + /* WT-EGFR */ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'WT-EGFR', + drug: 'growth_media', + duration: '*ANY*', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 2, //high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'WT-EGFR', + drug: 'growth_mediaEGF', + duration: '30 sec', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 1, //med + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 1, //med + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 1, //med + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 1, //med + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 1, //med + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'WT-EGFR', + drug: 'growth_mediaEGF', + duration: '1 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 2, //high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 2, //high + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 2, //high + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 2, //high + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'WT-EGFR', + drug: 'growth_mediaEGF', + duration: '6 h', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0.5, //low + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'WT-EGFR', + drug: 'growth_mediaBuff', + duration: '30 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 2, //high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'WT-EGFR', + drug: 'growth_mediaProK', + duration: '30 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + /* EGFR Null */ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'EGFR Null', + drug: '*ANY*', + duration: '*ANY*', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + /* EGFR-M1 */ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'EGFR-M1', + drug: '*ANY*', + duration: '*ANY*', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 2, //high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + /*EGFR-M2*/ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'EGFR-M2', + drug: 'growth_media', + duration: '*ANY*', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 2, //high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'EGFR-M2', + drug: 'growth_mediaEGF', + duration: '30 sec', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 1, //med + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 1, //med + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 1, //med + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 1, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 1, //med + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'EGFR-M2', + drug: 'growth_mediaEGF', + duration: '1 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 2, // high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 2, // high + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 2, //high + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 2, //high + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'EGFR-M2', + drug: 'growth_mediaEGF', + duration: '6 h', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 2, // high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 2, // high + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 2, // high + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 2, // high + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + /*NoUB*/ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'NoUB', + drug: 'growth_media', + duration: '*ANY*', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 2, //high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'NoUB', + drug: 'growth_mediaEGF', + duration: '30 sec', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 1, //med + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 1, //med + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 1, //med + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 1, //med + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 1, //med + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'NoUB', + drug: 'growth_mediaEGF', + duration: '1 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 2, //high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 2, //high + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 2, // high + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 2, //high + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'NoUB', + drug: 'growth_mediaEGF', + duration: '6 h', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 2, // high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 2, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 2, // high + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 2, // high + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + /*ConstActive*/ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'ConstActive', + drug: '*ANY*', + duration: '*ANY*', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 2, // high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 2, // high + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 2, // high + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 2, // high + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 51, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + /* His-EGFR-FLAG*/ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'His-EGFR-FLAG', + drug: 'growth_mediaBuff', + duration: '30 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 2, // high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 2, // high + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 2, // high + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'His-EGFR-FLAG', + drug: 'growth_mediaProK', + duration: '30 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 1, //med + primary_anti_body: ['7'] + } + ] + }, + /*His-EGFR-M1-FLAG */ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'His-EGFR-M1-FLAG', + drug: 'growth_mediaBuff', + duration: '30 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 2, // high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 2, // high + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 2, // high + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'His-EGFR-M1-FLAG', + drug: 'growth_mediaProK', + duration: '30 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 1, //med + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 1, //med + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + /* His-EGFR-M2-FLAG*/ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'His-EGFR-M2-FLAG', + drug: 'growth_mediaBuff', + duration: '30 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 2, // high + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 2, // high + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 2, // high + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 0, + primary_anti_body: ['7'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + cell_line: 'His-EGFR-M2-FLAG', + drug: 'growth_mediaProK', + duration: '30 min', + above_marks: [ + //antibody 1 + { + name: 'Mouse anti-EGFR', + weight: 120, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['1'] + }, + { + name: 'Mouse anti-EGFR', + weight: 65, + intensity: 0, + primary_anti_body: ['1'] + }, + //antibody 2 + { + name: 'Mouse anti-pEGFR', + weight: 140, + intensity: 0, + primary_anti_body: ['2'] + }, + //antibody 3 + { + name: 'Mouse anti-pRAF', + weight: 75, + intensity: 0, + primary_anti_body: ['3'] + }, + //antibody 4 + { + name: 'Mouse anti-pMEK', + weight: 45, + intensity: 0, + primary_anti_body: ['4'] + }, + //antibody 5 is included in *ANY* cell_line + //antibody 6 + { + name: 'Mouse anti-6xHis', + weight: 120, + intensity: 0, + primary_anti_body: ['6'] + }, + { + name: 'Mouse anti-6xHis', + weight: 65, + intensity: 0, + primary_anti_body: ['6'] + }, + //antibody 7 + { + name: 'Mouse anti-FLAG', + weight: 120, + intensity: 0, + primary_anti_body: ['7'] + }, + { + name: 'Mouse anti-FLAG', + weight: 51, + intensity: 1, //med + primary_anti_body: ['7'] + } + ] + }, + /*ANY cell_line*/ + { + transfer_function: 'delta', + cutoff: 1, + cell_line: '*ANY*', + drug: '*ANY*', + duration: '*ANY*', + above_marks: [ + //antibody 5 is the same for all treatments + { + name: 'Mouse anti-PGK1', + weight: 44, + intensity: 1, //med + primary_anti_body: ['5'] + } + + + ] + } + ] + } + }, + facs: { + 'ticks': [50, 100, 150], + 'max': 200, + 'scale': 'pseudo', + 'dna': { + 'parser_simple': [ + { + match: [], + shape: '2-peak-normal-400' + }, + /*The same graph for all treatments for EGFR Null*/ + { + match: ['cell_line'], + cell_line: 'EGFR Null', + shape: 'graph-b' + }, + /*The same graph for all treatments for EGFR-M1*/ + { + match: ['cell_line'], + cell_line: 'EGFR-M1', + shape: 'graph-b' + }, + /*The same graph for all treatments for EGFR-M2*/ + { + match: ['cell_line'], + cell_line: 'EGFR-M2', + shape: 'scaled-peak-3' + }, + /*The same graph for all treatments for NoUB*/ + { + match: ['cell_line'], + cell_line: 'NoUB', + shape: 'scaled-peak-3' + }, + /*WT-EGFR*/ + { + match: ['cell_line', 'drug_id'], + cell_line: 'WT-EGFR', + drug_id: 'growth_media', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id', 'duration'], + cell_line: 'WT-EGFR', + drug_id: 'growth_mediaEGF', + duration: '30 sec', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id', 'duration'], + cell_line: 'WT-EGFR', + drug_id: 'growth_mediaEGF', + duration: '1 min', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id', 'duration'], + cell_line: 'WT-EGFR', + drug_id: 'growth_mediaEGF', + duration: '6 h', + shape: 'graph-c' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'WT-EGFR', + drug_id: 'growth_mediaBuff', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'WT-EGFR', + drug_id: 'growth_mediaProK', + shape: 'graph-b' + }, + + + /*ConstActive*/ + { + match: ['cell_line', 'drug_id'], + cell_line: 'ConstActive', + drug_id: 'growth_media', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id', 'duration'], + cell_line: 'ConstActive', + drug_id: 'growth_mediaEGF', + duration: '30 sec', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id', 'duration'], + cell_line: 'ConstActive', + drug_id: 'growth_mediaEGF', + duration: '1 min', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id', 'duration'], + cell_line: 'ConstActive', + drug_id: 'growth_mediaEGF', + duration: '6 h', + shape: 'graph-c' + }, + /*His-EGFR-FLAG*/ + { + match: ['cell_line', 'drug_id'], + cell_line: 'His-EGFR-FLAG', + drug_id: 'growth_mediaBuff', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'His-EGFR-FLAG', + drug_id: 'growth_mediaProK', + shape: 'graph-b' + }, + /*His-EGFR-M1-FLAG*/ + { + match: ['cell_line', 'drug_id'], + cell_line: 'His-EGFR-M1-FLAG', + drug_id: 'growth_mediaBuff', + shape: 'graph-b' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'His-EGFR-M1-FLAG', + drug_id: 'growth_mediaProK', + shape: 'graph-b' + }, + /*His-EGFR-M2-FLAG*/ + { + match: ['cell_line', 'drug_id'], + cell_line: 'His-EGFR-M2-FLAG', + drug_id: 'growth_mediaBuff', + shape: 'scaled-peak-3' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'His-EGFR-M2-FLAG', + drug_id: 'growth_mediaProK', + shape: 'graph-b' + } + ] + + } + }, + microscopy: { + 'slide': { + 'parser_simple': [ + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'EGFR Null', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'egfr', + imgs_hash: [ + [ + { + hash: 'bo', + if_type: 'green' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'WT-EGFR', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'egfr', + imgs_hash: [ + [ + { + hash: '1', + if_type: 'green' + } + ], + [ + { + hash: '2', + if_type: 'green' + } + ], + [ + { + hash: '3', + if_type: 'green' + } + ], + [ + { + hash: '4', + if_type: 'green' + } + ], + [ + { + hash: '5', + if_type: 'green' + } + ], + [ + { + hash: '6', + if_type: 'green' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'WT-EGFR', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'pm', + imgs_hash: [ + [ + { + hash: '1', + if_type: 'green' + } + ], + [ + { + hash: '2', + if_type: 'green' + } + ], + [ + { + hash: '3', + if_type: 'green' + } + ], + [ + { + hash: '4', + if_type: 'green' + } + ], + [ + { + hash: '5', + if_type: 'green' + } + ], + [ + { + hash: '6', + if_type: 'green' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'WT-EGFR', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'cyto', + imgs_hash: [ + [ + { + hash: '7', + if_type: 'green' + } + ], + [ + { + hash: '8', + if_type: 'green' + } + ], + [ + { + hash: '9', + if_type: 'green' + } + ], + [ + { + hash: '10', + if_type: 'green' + } + ], + [ + { + hash: '11', + if_type: 'green' + } + ], + [ + { + hash: '12', + if_type: 'green' + } + ], + [ + { + hash: '13', + if_type: 'green' + } + ], + [ + { + hash: '14', + if_type: 'green' + } + ], + [ + { + hash: '15', + if_type: 'green' + } + ], + [ + { + hash: '16', + if_type: 'green' + } + ] + + ] + }, + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'WT-EGFR', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'nuc', + imgs_hash: [ + [ + { + hash: '18', + if_type: 'green' + } + ], + [ + { + hash: '19', + if_type: 'green' + } + ], + [ + { + hash: '20', + if_type: 'green' + } + ], + [ + { + hash: '21', + if_type: 'green' + } + ], + [ + { + hash: '22', + if_type: 'green' + } + ], + [ + { + hash: '23', + if_type: 'green' + } + ], + [ + { + hash: '25', + if_type: 'green' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'WT-EGFR', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'er', + imgs_hash: [ + [ + { + hash: '29', + if_type: 'green' + } + ], + [ + { + hash: '30', + if_type: 'green' + } + ], + [ + { + hash: '31', + if_type: 'green' + } + ], + [ + { + hash: '32', + if_type: 'green' + } + ], + [ + { + hash: '33', + if_type: 'green' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'WT-EGFR', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'nm', + imgs_hash: [ + [ + { + hash: '34', + if_type: 'green' + } + ], + [ + { + hash: '35', + if_type: 'green' + } + ], + [ + { + hash: '36', + if_type: 'green' + } + ], + [ + { + hash: '37', + if_type: 'green' + } + ], + [ + { + hash: '38', + if_type: 'green' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'EGFR-M1', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'egfr', + imgs_hash: [ + [ + { + hash: '1', + if_type: 'green' + } + ], + [ + { + hash: '2', + if_type: 'green' + } + ], + [ + { + hash: '3', + if_type: 'green' + } + ], + [ + { + hash: '4', + if_type: 'green' + } + ], + [ + { + hash: '5', + if_type: 'green' + } + ], + [ + { + hash: '6', + if_type: 'green' + } + ] + ] + }, + { + match: ['cell_line', 'drug_id', 'kind', 'conditions'], + cell_line: 'EGFR-M2', + drug_id: 'growth_media', + kind: 'IF', + conditions: 'egfr', + imgs_hash: [ + [ + { + hash: '1', + if_type: 'green' + } + ], + [ + { + hash: '2', + if_type: 'green' + } + ], + [ + { + hash: '3', + if_type: 'green' + } + ], + [ + { + hash: '4', + if_type: 'green' + } + ], + [ + { + hash: '5', + if_type: 'green' + } + ], + [ + { + hash: '6', + if_type: 'green' + } + ] + ] + } + ] + } + + } + } + } }; diff --git a/html_app/assignments/sutd_intro_biology/assignment.js b/html_app/assignments/sutd_intro_biology/assignment.js index 12c4d83b..614a0014 100644 --- a/html_app/assignments/sutd_intro_biology/assignment.js +++ b/html_app/assignments/sutd_intro_biology/assignment.js @@ -1,2320 +1,2948 @@ var __sutd_intro_biology = { - id: 'sutd_intro_biology', - name: 'StarCellBio Assignment 1 (CC13)', - course: 'SUTD_Biology', - course_name: 'Class', - description: 'Microscopy Test of images', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal', scb_assignment_sutd_intro_biology.goal()], - ["Background Information", scb_assignment_sutd_intro_biology.bg_info({})], - ["Questions", scb_assignment_sutd_intro_biology.questions({})] + id: 'sutd_intro_biology', + name: 'StarCellBio Assignment 1 (CC13)', + course: 'SUTD_Biology', + course_name: 'Class', + description: 'Microscopy Test of images', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal', scb_assignment_sutd_intro_biology.goal()], + ["Background Information", scb_assignment_sutd_intro_biology.bg_info({})], + ["Questions", scb_assignment_sutd_intro_biology.questions({})] + ], + ui: { + experimental_design: { + techniques: ['wb', 'micro'], + gel_types: ['.10', '.12', '.15'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: true + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: true + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'micro'], - gel_types: ['.10', '.12', '.15'] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: true}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: true} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - ] - }, - western_blot: { - format: "%CELL_LINE%, %TREATMENT%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']} + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + } + } + }, + microscopy: { + disable_blur: true, + disable_brightness: true + }, + add_multiple_dialog: { + order: ['gfp', 'gfp1', 'gfp2', 'gfp3', 'gfp4', 'gfp5', 'gfpH', 'gfp100', 'gfpTD'], + headings: [ + 'Strain', 'Growth media only', 'Growth media + ligand', 'Growth media + inhibitor', + 'Growth media + ligand + inhibitor' + ], + 'gfp': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' } - }, - microscopy: { - disable_blur: true, - disable_brightness: true - }, - add_multiple_dialog: { - order: ['gfp', 'gfp1', 'gfp2', 'gfp3', 'gfp4', 'gfp5', 'gfpH', 'gfp100', 'gfpTD'], - headings: [ - 'Strain', 'Growth media only', 'Growth media + ligand', 'Growth media + inhibitor', - 'Growth media + ligand + inhibitor' - ], - 'gfp': { - rows: [ - { - cells: [ - {kind: 'text', text: 'GFP'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], + ], - cell_treatments: { - G: [ - {cell_line: 'gfp', - treatment_id: 'media_only', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, - temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp', - treatment_id: 'ligand_media', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, - temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, - temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - }} - ]}} - ] - } - } - ] - }, - 'gfp1': { - rows: [ + cell_treatments: { + G: [ + { + cell_line: 'gfp', + treatment_id: 'media_only', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Protein A'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp1', - treatment_id: 'media_only', - treatment_list: {list: [ - { - collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp1', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp1', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp1', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - }, - 'gfp2': { - rows: [ + ] + } + } + ], + L: [ + { + cell_line: 'gfp', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Protein B'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp2', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp2', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp2', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp2', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - }, - 'gfp3': { - rows: [ + ] + } + } + ], + I: [ + { + cell_line: 'gfp', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Protein C'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp3', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp3', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - }} - ]}} - ], I: [ - {cell_line: 'gfp3', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp3', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - }, - 'gfp4': { - rows: [ + ] + } + } + ], + A: [ + { + cell_line: 'gfp', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Protein D'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp4', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp4', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp4', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp4', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] + ] + } + } + ] + } + } + ] + }, + 'gfp1': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein A' }, - 'gfp5': { - rows: [ - { - cells: [ - {kind: 'text', text: 'GFP-Protein E'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], - cell_treatments: { - G: [ - {cell_line: 'gfp5', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp5', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp5', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp5', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + cell_treatments: { + G: [ + { + cell_line: 'gfp1', + treatment_id: 'media_only', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - }, - 'gfpH': { - rows: [ + ] + } + } + ], + L: [ + { + cell_line: 'gfp1', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-Histone H2B'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfpH', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfpH', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfpH', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfpH', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - - }, - 'gfp100': { - rows: [ + ] + } + } + ], + I: [ + { + cell_line: 'gfp1', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-p100'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfp100', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfp100', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], I: [ - {cell_line: 'gfp100', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfp100', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - ] - - }, - 'gfpTD': { - rows: [ + ] + } + } + ], + A: [ + { + cell_line: 'gfp1', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - cells: [ - {kind: 'text', text: 'GFP-pTD'}, - {kind: 'checkbox', name: "G", treatment_id: 'media_only'}, - {kind: 'checkbox', name: 'L', treatment_id: 'ligand_media' }, - {kind: 'checkbox', name: 'I', treatment_id: 'inhibitor_media'}, - {kind: 'checkbox', name: 'A', treatment_id: 'ligand_media_inhibitor'} - ], - - cell_treatments: { - G: [ - {cell_line: 'gfpTD', - treatment_id: 'media_only', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gm', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], L: [ - {cell_line: 'gfpTD', - treatment_id: 'ligand_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gml', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - }} - ]}} - ], I: [ - {cell_line: 'gfpTD', - treatment_id: 'inhibitor_media', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmi', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ], A: [ - {cell_line: 'gfpTD', - treatment_id: 'ligand_media_inhibitor', - treatment_list: {list: [ - {collection_id: 'default', - drug_list: {list: [ - {drug_id: 'gmil', concentration_id: '100'} - ]}, temperature: '22', - conditions: { - 'IF': ['rgb'] - } - } - ]}} - ] - } + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } - - ] - - } - - } - - }, - - add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs', - collections: { - '': { - name: '' - } - }, - concentrations: { - 100: { - name: '', - value: 100 - } - }, - drugs: { - 'gm': { - name: 'Growth media only', - concentrations: ['100'] - }, - 'gml': { - name: 'Growth media + ligand', - concentrations: ['100'] - }, - 'gmi': { - name: 'Growth media + inhibitor', - concentrations: ['100'] - }, - 'gmil': { - name: 'Growth media + ligand + inhibitor', - concentrations: ['100'] - } - }, - experiment_temperatures: { - '22': { - name: "22" + degreeEntity + "C" + ] + } + } + ] + } } + ] }, - cell_lines: { - 'gfp': { - name: 'GFP' - }, - 'gfp1': { - name: 'GFP-Protein A' - }, - 'gfp2': { - name: 'GFP-Protein B' - }, - 'gfp3': { - name: 'GFP-Protein C' - }, - 'gfp4': { - name: 'GFP-Protein D' - }, - 'gfp5': { - name: 'GFP-Protein E' - }, - 'gfpH': { - name: 'GFP-Histone H2B' - }, - 'gfp100': { - name: 'GFP-p100' - }, - 'gfpTD': { - name: 'GFP-pTD' - } + 'gfp2': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein B' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['mp1', 'mp2', 'mp3', 'mp4', 'mp5', 'mpAG'], - 'mp1': { - name: 'mouse anti-phospho-protein A', - secondary: ['m'], - marks: [ - {weight: 46, intensity: 0} - ], - gel_name: 'P-Protein A' - }, - 'mp2': { - name: 'mouse anti-phospho-protein B', - secondary: ['m'], - marks: [ - {weight: 134, intensity: 0} - ], - gel_name: 'P-Protein B' - }, - 'mp3': { - name: 'mouse anti-phospho-protein C', - secondary: ['m'], - marks: [ - {weight: 44, intensity: 0} - ], - gel_name: 'P-Protein C' - }, - 'mp4': { - name: 'mouse anti-phospho-protein D', - secondary: ['m'], - marks: [ - {weight: 67, intensity: 0} + cell_treatments: { + G: [ + { + cell_line: 'gfp2', + treatment_id: 'media_only', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } ], - gel_name: 'P-Protein D' - }, - 'mp5': { - name: 'mouse anti-phospho-protein E', - secondary: ['m'], - marks: [ - {weight: 74, intensity: 0} + L: [ + { + cell_line: 'gfp2', + treatment_id: 'ligand_media', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } ], - gel_name: 'P-Protein E' - }, - 'mpAG': { - name: 'rabbit anti-GAPDH', - secondary: ['r'], - marks: [ - {weight: 37, intensity: 0} + I: [ + { + cell_line: 'gfp2', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } ], - gel_name: 'GAPDH' - } - },// - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' - }, - 'r': { - name: 'goat anti-rabbit' - } - },// - lysate_kinds: { - 'whole': { - name: 'Whole Cell' + A: [ + { + cell_line: 'gfp2', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } } + ] }, - micro_kinds: { - 'IF': { - name: 'Fluorescence', - conditions: { - 'rgb': {name: 'GFP (green)', - short_name: 'G:GFP'} + 'gfp3': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein C' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' } - }, - 'na': { - name: 'None' - } - }, - slides: { - 'img1': 'images/microscopy/assignment_706_2014/c1.jpg', - 'img2': 'images/microscopy/assignment_706_2014/c4.jpg', - 'img3': 'images/microscopy/assignment_706_2014/c7.jpg', - 'img4': 'images/microscopy/assignment_706_2014/c10.jpg', - 'img40': 'images/microscopy/assignment_706_2014/c15-1.jpg', - 'img41': 'images/microscopy/assignment_706_2014/c15-2.jpg', - 'img6': 'images/microscopy/assignment_706_2014/c17.jpg', - 'img42': 'images/microscopy/assignment_706_2014/c25.jpg', - 'img7': 'images/microscopy/assignment_706_2014/c26.jpg', - 'img8': 'images/microscopy/assignment_706_2014/c29.jpg', - + ], - 'img9': 'images/microscopy/assignment_706_2014/cn2.jpg', - 'img10': 'images/microscopy/assignment_706_2014/cn3.jpg', - 'img11': 'images/microscopy/assignment_706_2014/cn5.jpg', - 'img12': 'images/microscopy/assignment_706_2014/cn6.jpg', - 'img13': 'images/microscopy/assignment_706_2014/cn7.jpg', - 'img14': 'images/microscopy/assignment_706_2014/cn8.jpg', - 'img16': 'images/microscopy/assignment_706_2014/cn11.jpg', - 'img17': 'images/microscopy/assignment_706_2014/cn12.jpg', - 'img18': 'images/microscopy/assignment_706_2014/cn15.jpg', - 'img19': 'images/microscopy/assignment_706_2014/cn17.jpg', - 'img20': 'images/microscopy/assignment_706_2014/cn20.jpg', - - 'img21': 'images/microscopy/assignment_706_2014/n1.jpg', - 'img22': 'images/microscopy/assignment_706_2014/n2.jpg', - 'img23': 'images/microscopy/assignment_706_2014/n8.jpg', - 'img24': 'images/microscopy/assignment_706_2014/n9.jpg', - 'img26': 'images/microscopy/assignment_706_2014/n18.jpg', - 'img29': 'images/microscopy/assignment_706_2014/n34.jpg', - 'img30': 'images/microscopy/assignment_706_2014/n43.jpg', - 'img31': 'images/microscopy/assignment_706_2014/n47.jpg', - 'img32': 'images/microscopy/assignment_706_2014/n60.jpg', - 'img46': 'images/microscopy/assignment_706_2014/n64.jpg', - - - 'img36': 'images/microscopy/assignment_706_2014/pm2.jpg', - 'img37': 'images/microscopy/assignment_706_2014/pm3.jpg', - 'img44': 'images/microscopy/assignment_706_2014/pm34-1.jpg', - 'img45': 'images/microscopy/assignment_706_2014/pm34-2.jpg' - }, - slide_parser: { - 'default': { - 'IF': { - 'rgb': { - 'cytoplasm': [ - [ - { - hash: 'img1', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img2', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img3', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img4', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img40', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img41', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img6', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img42', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img7', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img8', - mag: 'N/A', - if_type: 'green' - } + cell_treatments: { + G: [ + { + cell_line: 'gfp3', + treatment_id: 'media_only', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } ] - ], - 'plasma_membrane': [ - [ - { - hash: 'img36', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img37', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img44', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img45', - mag: 'N/A', - if_type: 'green' - } + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfp3', + treatment_id: 'ligand_media', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } ] - - ], - 'nucleus': [ - [ - { - hash: 'img21', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img22', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img23', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img24', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img26', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img29', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img30', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img31', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img32', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img46', - mag: 'N/A', - if_type: 'green' - } + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfp3', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } ] - - - ], - 'cytoplasm_nucleus': [ - [ - { - hash: 'img9', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img10', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img11', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img12', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img13', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img14', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img16', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img17', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img18', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img19', - mag: 'N/A', - if_type: 'green' - } - ], - [ - { - hash: 'img20', - mag: 'N/A', - if_type: 'green' - } + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfp3', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ + { + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } ] - - ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] } - } + } + ] + } } + ] }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - //CELL GFP - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP H - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfpH', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfpH', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfpH', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfpH', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP p100 - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp100', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + 'gfp4': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein D' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfp4', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp100', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfp4', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp100', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfp4', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp100', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP TD + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfp4', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfpTD', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } + } + ] + }, + 'gfp5': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Protein E' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfp5', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfpTD', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfp5', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfpTD', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfp5', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfpTD', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP A + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfp5', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp1', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } + } + ] + }, + 'gfpH': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-Histone H2B' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfpH', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp1', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfpH', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp1', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfpH', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp1', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL LINE GFPB + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfpH', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp2', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } + } + ] + + }, + 'gfp100': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-p100' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfp100', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp2', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein B', - weight: 161, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfp100', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp2', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfp100', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp2', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein B', - weight: 161, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFPC + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfp100', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp3', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein C', - weight: 71, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp3', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein C', - weight: 71, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp3', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein C', - weight: 71, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp3', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein C', - weight: 71, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP D - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp4', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp4', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein D', - weight: 94, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp4', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp4', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, - //CELL GFP E + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ] + } + } + ] + + }, + 'gfpTD': { + rows: [ + { + cells: [ + { + kind: 'text', + text: 'GFP-pTD' + }, + { + kind: 'checkbox', + name: "G", + treatment_id: 'media_only' + }, + { + kind: 'checkbox', + name: 'L', + treatment_id: 'ligand_media' + }, + { + kind: 'checkbox', + name: 'I', + treatment_id: 'inhibitor_media' + }, + { + kind: 'checkbox', + name: 'A', + treatment_id: 'ligand_media_inhibitor' + } + ], + + cell_treatments: { + G: [ + { + cell_line: 'gfpTD', + treatment_id: 'media_only', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gm', - cell_line: 'gfp5', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gm', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + L: [ + { + cell_line: 'gfpTD', + treatment_id: 'ligand_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gml', - cell_line: 'gfp5', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein D', - weight: 67, // 34&35 - intensity: 2, - primary_anti_body: ['mp4'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'protein E', - weight: 101, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gml', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + I: [ + { + cell_line: 'gfpTD', + treatment_id: 'inhibitor_media', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmi', - cell_line: 'gfp5', - above_marks: [ - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] - }, + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmi', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } + } + ] + } + } + ], + A: [ + { + cell_line: 'gfpTD', + treatment_id: 'ligand_media_inhibitor', + treatment_list: { + list: [ { - transfer_function: 'delta', - cutoff: 1, - drug: 'gmil', - cell_line: 'gfp5', - above_marks: [ - { - name: 'protein B', - weight: 134, // 34&35 - intensity: 2, - primary_anti_body: ['mp2'] - }, - { - name: 'protein C', - weight: 44, // 34&35 - intensity: 2, - primary_anti_body: ['mp3'] - }, - { - name: 'protein E', - weight: 74, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'protein E', - weight: 101, // 34&35 - intensity: 2, - primary_anti_body: ['mp5'] - }, - { - name: 'anti-GAPDH', - weight: 37, // 34&35 - intensity: 2, - primary_anti_body: ['mpAG'] - } - ], - below_marks: [] + collection_id: 'default', + drug_list: { + list: [ + { + drug_id: 'gmil', + concentration_id: '100' + } + ] + }, + temperature: '22', + conditions: { + 'IF': ['rgb'] + } } + ] + } + } + ] + } + } + ] - ] + } + + } + + }, + + add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs', + collections: { + '': { + name: '' + } + }, + concentrations: { + 100: { + name: '', + value: 100 + } + }, + drugs: { + 'gm': { + name: 'Growth media only', + concentrations: ['100'] + }, + 'gml': { + name: 'Growth media + ligand', + concentrations: ['100'] + }, + 'gmi': { + name: 'Growth media + inhibitor', + concentrations: ['100'] + }, + 'gmil': { + name: 'Growth media + ligand + inhibitor', + concentrations: ['100'] + } + }, + experiment_temperatures: { + '22': { + name: "22" + degreeEntity + "C" + } + }, + cell_lines: { + 'gfp': { + name: 'GFP' + }, + 'gfp1': { + name: 'GFP-Protein A' + }, + 'gfp2': { + name: 'GFP-Protein B' + }, + 'gfp3': { + name: 'GFP-Protein C' + }, + 'gfp4': { + name: 'GFP-Protein D' + }, + 'gfp5': { + name: 'GFP-Protein E' + }, + 'gfpH': { + name: 'GFP-Histone H2B' + }, + 'gfp100': { + name: 'GFP-p100' + }, + 'gfpTD': { + name: 'GFP-pTD' + } + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['mp1', 'mp2', 'mp3', 'mp4', 'mp5', 'mpAG'], + 'mp1': { + name: 'mouse anti-phospho-protein A', + secondary: ['m'], + marks: [ + { + weight: 46, + intensity: 0 + } + ], + gel_name: 'P-Protein A' + }, + 'mp2': { + name: 'mouse anti-phospho-protein B', + secondary: ['m'], + marks: [ + { + weight: 134, + intensity: 0 + } + ], + gel_name: 'P-Protein B' + }, + 'mp3': { + name: 'mouse anti-phospho-protein C', + secondary: ['m'], + marks: [ + { + weight: 44, + intensity: 0 + } + ], + gel_name: 'P-Protein C' + }, + 'mp4': { + name: 'mouse anti-phospho-protein D', + secondary: ['m'], + marks: [ + { + weight: 67, + intensity: 0 + } + ], + gel_name: 'P-Protein D' + }, + 'mp5': { + name: 'mouse anti-phospho-protein E', + secondary: ['m'], + marks: [ + { + weight: 74, + intensity: 0 + } + ], + gel_name: 'P-Protein E' + }, + 'mpAG': { + name: 'rabbit anti-GAPDH', + secondary: ['r'], + marks: [ + { + weight: 37, + intensity: 0 + } + ], + gel_name: 'GAPDH' + } + }, // + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, // + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + micro_kinds: { + 'IF': { + name: 'Fluorescence', + conditions: { + 'rgb': { + name: 'GFP (green)', + short_name: 'G:GFP' + } + } + }, + 'na': { + name: 'None' + } + }, + slides: { + 'img1': 'images/microscopy/assignment_706_2014/c1.jpg', + 'img2': 'images/microscopy/assignment_706_2014/c4.jpg', + 'img3': 'images/microscopy/assignment_706_2014/c7.jpg', + 'img4': 'images/microscopy/assignment_706_2014/c10.jpg', + 'img40': 'images/microscopy/assignment_706_2014/c15-1.jpg', + 'img41': 'images/microscopy/assignment_706_2014/c15-2.jpg', + 'img6': 'images/microscopy/assignment_706_2014/c17.jpg', + 'img42': 'images/microscopy/assignment_706_2014/c25.jpg', + 'img7': 'images/microscopy/assignment_706_2014/c26.jpg', + 'img8': 'images/microscopy/assignment_706_2014/c29.jpg', + + + 'img9': 'images/microscopy/assignment_706_2014/cn2.jpg', + 'img10': 'images/microscopy/assignment_706_2014/cn3.jpg', + 'img11': 'images/microscopy/assignment_706_2014/cn5.jpg', + 'img12': 'images/microscopy/assignment_706_2014/cn6.jpg', + 'img13': 'images/microscopy/assignment_706_2014/cn7.jpg', + 'img14': 'images/microscopy/assignment_706_2014/cn8.jpg', + 'img16': 'images/microscopy/assignment_706_2014/cn11.jpg', + 'img17': 'images/microscopy/assignment_706_2014/cn12.jpg', + 'img18': 'images/microscopy/assignment_706_2014/cn15.jpg', + 'img19': 'images/microscopy/assignment_706_2014/cn17.jpg', + 'img20': 'images/microscopy/assignment_706_2014/cn20.jpg', + + 'img21': 'images/microscopy/assignment_706_2014/n1.jpg', + 'img22': 'images/microscopy/assignment_706_2014/n2.jpg', + 'img23': 'images/microscopy/assignment_706_2014/n8.jpg', + 'img24': 'images/microscopy/assignment_706_2014/n9.jpg', + 'img26': 'images/microscopy/assignment_706_2014/n18.jpg', + 'img29': 'images/microscopy/assignment_706_2014/n34.jpg', + 'img30': 'images/microscopy/assignment_706_2014/n43.jpg', + 'img31': 'images/microscopy/assignment_706_2014/n47.jpg', + 'img32': 'images/microscopy/assignment_706_2014/n60.jpg', + 'img46': 'images/microscopy/assignment_706_2014/n64.jpg', + + + 'img36': 'images/microscopy/assignment_706_2014/pm2.jpg', + 'img37': 'images/microscopy/assignment_706_2014/pm3.jpg', + 'img44': 'images/microscopy/assignment_706_2014/pm34-1.jpg', + 'img45': 'images/microscopy/assignment_706_2014/pm34-2.jpg' + }, + slide_parser: { + 'default': { + 'IF': { + 'rgb': { + 'cytoplasm': [ + [ + { + hash: 'img1', + mag: 'N/A', + if_type: 'green' } - }, - microscopy: { - 'valid': ['pfl', 'ac'], - 'slide': { + ], + [ + { + hash: 'img2', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img3', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img4', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img40', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img41', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img6', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img42', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img7', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img8', + mag: 'N/A', + if_type: 'green' + } + ] + ], + 'plasma_membrane': [ + [ + { + hash: 'img36', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img37', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img44', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img45', + mag: 'N/A', + if_type: 'green' + } + ] - 'complex_parser': [ - { - match: [] + ], + 'nucleus': [ + [ + { + hash: 'img21', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img22', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img23', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img24', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img26', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img29', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img30', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img31', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img32', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img46', + mag: 'N/A', + if_type: 'green' + } + ] - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'cytoplasm_nucleus' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfpH', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'nucleus' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp100', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'cytoplasm' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfpTD', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'plasma_membrane' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp1', - drug_id: ['gm', 'gmi'], - phenotype: 'cytoplasm' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp1', - drug_id: ['gml', 'gmil'], - phenotype: 'plasma_membrane' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp2', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'plasma_membrane' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp3', - drug_id: ['gm', 'gmi', 'gmil'], - phenotype: 'cytoplasm' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp3', - drug_id: ['gml'], - phenotype: 'nucleus' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp4', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'cytoplasm' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'gfp5', - drug_id: ['gm', 'gml', 'gmi', 'gmil'], - phenotype: 'cytoplasm' - } - ] + ], + 'cytoplasm_nucleus': [ + [ + { + hash: 'img9', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img10', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img11', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img12', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img13', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img14', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img16', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img17', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img18', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img19', + mag: 'N/A', + if_type: 'green' + } + ], + [ + { + hash: 'img20', + mag: 'N/A', + if_type: 'green' + } + ] + ] + } + } + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + //CELL GFP + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP H + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfpH', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfpH', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfpH', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfpH', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP p100 + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp100', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp100', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp100', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp100', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP TD + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfpTD', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfpTD', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfpTD', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfpTD', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP A + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp1', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp1', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp1', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp1', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL LINE GFPB + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp2', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp2', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein B', + weight: 161, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp2', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp2', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein B', + weight: 161, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFPC + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp3', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein C', + weight: 71, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp3', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein C', + weight: 71, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp3', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein C', + weight: 71, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp3', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein C', + weight: 71, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP D + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp4', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp4', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein D', + weight: 94, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp4', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp4', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + //CELL GFP E + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gm', + cell_line: 'gfp5', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gml', + cell_line: 'gfp5', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein D', + weight: 67, // 34&35 + intensity: 2, + primary_anti_body: ['mp4'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'protein E', + weight: 101, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmi', + cell_line: 'gfp5', + above_marks: [ + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'gmil', + cell_line: 'gfp5', + above_marks: [ + { + name: 'protein B', + weight: 134, // 34&35 + intensity: 2, + primary_anti_body: ['mp2'] + }, + { + name: 'protein C', + weight: 44, // 34&35 + intensity: 2, + primary_anti_body: ['mp3'] + }, + { + name: 'protein E', + weight: 74, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'protein E', + weight: 101, // 34&35 + intensity: 2, + primary_anti_body: ['mp5'] + }, + { + name: 'anti-GAPDH', + weight: 37, // 34&35 + intensity: 2, + primary_anti_body: ['mpAG'] + } + ], + below_marks: [] } + + ] } + }, + microscopy: { + 'valid': ['pfl', 'ac'], + 'slide': { + + 'complex_parser': [ + { + match: [] + + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'cytoplasm_nucleus' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfpH', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'nucleus' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp100', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'cytoplasm' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfpTD', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'plasma_membrane' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp1', + drug_id: ['gm', 'gmi'], + phenotype: 'cytoplasm' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp1', + drug_id: ['gml', 'gmil'], + phenotype: 'plasma_membrane' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp2', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'plasma_membrane' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp3', + drug_id: ['gm', 'gmi', 'gmil'], + phenotype: 'cytoplasm' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp3', + drug_id: ['gml'], + phenotype: 'nucleus' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp4', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'cytoplasm' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'gfp5', + drug_id: ['gm', 'gml', 'gmi', 'gmil'], + phenotype: 'cytoplasm' + } + + ] + + } + } + } + } }; diff --git a/html_app/assignments/sutd_intro_biology_ps2/AddMultipleDialog.js b/html_app/assignments/sutd_intro_biology_ps2/AddMultipleDialog.js index 6a2031c5..a2b5bcfe 100644 --- a/html_app/assignments/sutd_intro_biology_ps2/AddMultipleDialog.js +++ b/html_app/assignments/sutd_intro_biology_ps2/AddMultipleDialog.js @@ -1,98 +1,100 @@ var sutd_ps2 = sutd_ps2 || {}; sutd_ps2.static = sutd_ps2.static || {}; -sutd_ps2.static.sutd_ps2_inner_dialog_add = function (element, dialog, state) { - $('input[type="checkbox"]:checked', dialog).each(function (e) { - var element = $(this); - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var treatment_id = $(element).attr('treatment_id'); - var cell_line = $(element).attr('cell_line'); - var name = $(element).attr('name'); - $(element).attr('aria-checked',true); - var parsed = scb.ui.static.MainFrame.validate_state({ - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'add_many_dialog_box', - skip_hash_update: true - }); +sutd_ps2.static.sutd_ps2_inner_dialog_add = function(element, dialog, state) { + $('input[type="checkbox"]:checked', dialog).each(function(e) { + var element = $(this); + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var treatment_id = $(element).attr('treatment_id'); + var cell_line = $(element).attr('cell_line'); + var name = $(element).attr('name'); + $(element).attr('aria-checked', true); + var parsed = scb.ui.static.MainFrame.validate_state({ + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'add_many_dialog_box', + skip_hash_update: true + }); - var template = parsed.assignment.template; - var rows = template.ui.add_multiple_dialog[cell_line].rows; - var row = _.find(rows, function (eh) { - return eh.treatment_id == treatment_id; - }); - var cell_treatments_array = row.cell_treatments[name]; - _.each(cell_treatments_array, function (eh) { - parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); - }); + var template = parsed.assignment.template; + var rows = template.ui.add_multiple_dialog[cell_line].rows; + var row = _.find(rows, function(eh) { + return eh.treatment_id == treatment_id; + }); + var cell_treatments_array = row.cell_treatments[name]; + _.each(cell_treatments_array, function(eh) { + parsed.experiment.cell_treatment_list.start(scb.utils.clone_and_clear(eh)); }); + }); - $(dialog).detach(); - $('.contact_overlay').remove(); - scb.utils.call_back(state.close); + $(dialog).detach(); + $('.contact_overlay').remove(); + scb.utils.call_back(state.close); } -sutd_ps2.register = function (dialog, state) { - scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_dialog', function (e) { - var container = dialog; - if (container.has(e.target).length === 0) { - $(dialog).detach(); - $('.contact_overlay').remove(); - } - }); - scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_cancel', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - }); - scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_add', function (e) { - sutd_ps2.static.sutd_ps2_inner_dialog_add(this, dialog, state); - $(this).focus(); - }); - scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function (e) { - $(this, dialog).attr('aria-checked',$(this, dialog).attr('aria-checked') =='false' ? true : false); - }); - scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_select_all', function (e) { - $('input[type=checkbox]' , dialog).attr('checked','checked'); - $('input[type=checkbox]' , dialog).attr('aria-checked',true); - }); +sutd_ps2.register = function(dialog, state) { + scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_dialog', function(e) { + var container = dialog; + if (container.has(e.target).length === 0) { + $(dialog).detach(); + $('.contact_overlay').remove(); + } + }); + scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_cancel', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + }); + scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_add', function(e) { + sutd_ps2.static.sutd_ps2_inner_dialog_add(this, dialog, state); + $(this).focus(); + }); + scb.utils.off_on(dialog.parent(), 'change', '.scb_f_experiment_setup_dialog_checkbox', function(e) { + $(this, dialog).attr('aria-checked', $(this, dialog).attr('aria-checked') == 'false' ? true : false); + }); + scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_select_all', function(e) { + $('input[type=checkbox]', dialog).attr('checked', 'checked'); + $('input[type=checkbox]', dialog).attr('aria-checked', true); + }); - scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_title_close', function (e) { - $(dialog).detach(); - $('.contact_overlay').remove(); - }); - scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_select', function (e) { - var cell_line = $(this).attr('cell_line'); - var name = $(this).attr('name'); - $('input[type=checkbox][name="'+name+'"]' , dialog).attr('checked','checked'); - $('input[type=checkbox][name="'+name+'"]' , dialog).attr('aria-checked',true); - }); + scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_title_close', function(e) { + $(dialog).detach(); + $('.contact_overlay').remove(); + }); + scb.utils.off_on(dialog.parent(), 'click', '.sutd_ps2_inner_dialog_select', function(e) { + var cell_line = $(this).attr('cell_line'); + var name = $(this).attr('name'); + $('input[type=checkbox][name="' + name + '"]', dialog).attr('checked', 'checked'); + $('input[type=checkbox][name="' + name + '"]', dialog).attr('aria-checked', true); + }); } -sutd_ps2.setup = function (state) { - var workarea = state.workarea; - var assignment = state.assignment; - var experiment = state.experiment; - var template = state.assignment.template; - var onClose = state.close; +sutd_ps2.setup = function(state) { + var workarea = state.workarea; + var assignment = state.assignment; + var experiment = state.experiment; + var template = state.assignment.template; + var onClose = state.close; - var dialog = $("
"); - dialog.html(sutd_ps2.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); + var dialog = $("
"); + dialog.html(sutd_ps2.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); - dialog.appendTo($(workarea)); - sutd_ps2.register($(dialog), state); + dialog.appendTo($(workarea)); + sutd_ps2.register($(dialog), state); - var css = scb.utils.get(state, ['source_state', 'css']); - _.each( css , function(v,k){ - dialog.css(k,v); - }); + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); - $('.sutd_ps2_dialog').draggable({handle:'.sutd_ps2_inner_dialog_title'}) + $('.sutd_ps2_dialog').draggable({ + handle: '.sutd_ps2_inner_dialog_title' + }) } diff --git a/html_app/assignments/sutd_intro_biology_ps2/assignment.js b/html_app/assignments/sutd_intro_biology_ps2/assignment.js index 98e6328e..4c894144 100644 --- a/html_app/assignments/sutd_intro_biology_ps2/assignment.js +++ b/html_app/assignments/sutd_intro_biology_ps2/assignment.js @@ -1,870 +1,1320 @@ var __sutd_intro_biology_ps2 = { - id: 'sutd_intro_biology_ps2', - name: 'StarCellBio Assignment 2 (CC14)', - course: 'SUTD_Biology', - course_name: 'SUTD Intro Biology', - description: 'FACS and Western Blot for temperature sensitive mutants', - notebook: {}, - experiments: {}, - template: { - random_choose: true, - randomize_all: false, - random_order: [], - finished_random: false, - instructions: [ - ["Goal", scb_assignment_sutd_intro_biology_ps2.goal({})], - ["Background Information", scb_assignment_sutd_intro_biology_ps2.bg_info({})], - ["Questions", scb_assignment_sutd_intro_biology_ps2.questions({})] + id: 'sutd_intro_biology_ps2', + name: 'StarCellBio Assignment 2 (CC14)', + course: 'SUTD_Biology', + course_name: 'SUTD Intro Biology', + description: 'FACS and Western Blot for temperature sensitive mutants', + notebook: {}, + experiments: {}, + template: { + random_choose: true, + randomize_all: false, + random_order: [], + finished_random: false, + instructions: [ + ["Goal", scb_assignment_sutd_intro_biology_ps2.goal({})], + ["Background Information", scb_assignment_sutd_intro_biology_ps2.bg_info({})], + ["Questions", scb_assignment_sutd_intro_biology_ps2.questions({})] + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs', 'micro'], + gel_types: ['.10', '.12', '.15'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: false + }, + { + kind: 'duration', + title: 'Time', + editable: false + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs', 'micro'], - gel_types: ['.10', '.12', '.15'] + actions: [ + { + kind: "add_many", + name: "Add Samples", + open: 'sutd_ps2.setup', + css: { + width: '885px', + height: '600px', + left: 'inherit', + top: '15%' }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: false}, - {kind: 'duration', title: 'Time', editable: false} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - {kind: "add_many", name: "Add Samples", open: 'sutd_ps2.setup', css: { - width: '885px', - height: '600px', - left: 'inherit', - top: '15%' - }, - 'collection_id': '%CELL_LINE%' - } + 'collection_id': '%CELL_LINE%' + } + ] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + } + } + }, + microscopy: { + disable_blur: true, + disable_brightness: true + }, + add_multiple_dialog: { + order: ['S2'], + headings: [ + '', 'Strain', 'Treatment', 'Treatment Duration' + ], + 'S2': { + rows: [ + { + cells: [ + { + kind: 'checkbox', + name: "CR", + treatment_id: 'nc' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'Control siRNA' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'nc', + cell_treatments: { + CR: [ + { + cell_line: 'S2', + treatment_list: { + list: [ + { + collection_id: 'default', + microscope: ['rgb'], + conditions: { + 'IF': ['rgb'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } ] + } }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': { - attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], - map: ['drugs', '%KEY%', 'name']} + { + cells: [ + { + kind: 'checkbox', + name: "R1", + treatment_id: 'rna1' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'siRNA #1' + }, + { + kind: 'text', + text: "3 days" } - }, - microscopy: { - disable_blur: true, - disable_brightness: true - }, - add_multiple_dialog: { - order: ['S2'], - headings: [ - '', 'Strain', 'Treatment', 'Treatment Duration' - ], - 'S2': { - rows: [ - { - cells: [ - {kind: 'checkbox', name: "CR", treatment_id: 'nc'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'Control siRNA'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'nc', - cell_treatments: { - CR: [ - {cell_line: 'S2', - treatment_list: {list: [ - { - collection_id: 'default', - microscope: ['rgb'], - conditions: { - 'IF': ['rgb'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '100'} - ]}, - temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'checkbox', name: "R1", treatment_id: 'rna1'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'siRNA #1'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'rna1', - cell_treatments: { - R1: [ - {cell_line: 'S2', - treatment_list: {list: [ - { - collection_id: 'default', microscope: ['rgb'], - conditions: { - 'IF': ['rgb'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'rna1', concentration_id: '100'} - ]}, - temperature: '25' - } - ]}} - ] - } - }, + ], + treatment_id: 'rna1', + cell_treatments: { + R1: [ + { + cell_line: 'S2', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: "R2", treatment_id: 'rna2'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'siRNA #2'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'rna2', - cell_treatments: { - R2: [ - {cell_line: 'S2', - treatment_list: {list: [ - { - collection_id: 'default', microscope: ['rgb'], - conditions: { - 'IF': ['rgb'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'rna2', concentration_id: '100'} - ]}, - temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'checkbox', name: "R3", treatment_id: 'rna3'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'siRNA #3'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'rna3', - cell_treatments: { - R3: [ - {cell_line: 'S2', - treatment_list: {list: [ - { - collection_id: 'default', microscope: ['rgb'], - conditions: { - 'IF': ['rgb'] - }, - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'rna3', concentration_id: '100'} - ]}, - temperature: '25' - } - ]}} - ] - } + collection_id: 'default', + microscope: ['rgb'], + conditions: { + 'IF': ['rgb'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'rna1', + concentration_id: '100' + } + ] + }, + temperature: '25' } - ] - } - } - }, - add_new_row_instructions: 'add new row instructions', - experiment_setup: scb_assignment_sutd_intro_biology_ps2.experiment_setup({}), - collections: { - '': { - name: '' - } - }, - concentrations: { - 100: { - name: '', - value: 100 - } - }, - drugs: { - 'nc': { - name: 'Control siRNA', - concentrations: [100] - }, - 'rna1': { - name: 'siRNA #1', - concentrations: [100] - }, - 'rna2': { - name: 'siRNA #2', - concentrations: [100] - }, - 'rna3': { - name: 'siRNA #3', - concentrations: [100] - } - - }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" - } - }, - cell_lines: { - 'S2': { - name: 'S2' - } - - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['cyclinB', 'cyclinE', 'scc1', 'pgk1'], - - 'cyclinB': { - name: 'mouse anti-cyclin B', - secondary: ['m'], - marks: [ - {weight: 58, intensity: 0} - ], - gel_name: 'cyclin B' - }, - 'cyclinE': { - name: 'mouse anti-cyclin E', - secondary: ['m'], - marks: [ - {weight: 54, intensity: 0}, - {weight: 55, intensity: 0}, - {weight: 58, intensity: 0} - ], - gel_name: 'cyclin E' - }, - 'scc1': { - name: 'rabbit anti-Scc1', - secondary: ['r'], - marks: [ - {weight: 48, intensity: 0} - ], - gel_name: 'Scc1' - }, - 'pgk1': { - name: 'rabbit anti-pgk1', - secondary: ['r'], - marks: [ - {weight: 25, intensity: 0} - ], - gel_name: 'pgk1' - } - - }, - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' + ] + } + } + ] + } }, - 'r': { - name: 'goat anti-rabbit' - } - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - } - }, - facs_kinds: { - 'whole': { - name: 'Dye/Stain', - conditions: { - 'whole': {name: 'PI'} - } - } - }, - micro_kinds: { - 'IF': { - name: 'Antibody-labeling IF', - conditions: { - 'rgb': {name: 'γ-tubulin (red), α-tubulin (green), DAPI (blue)', - short_name: 'R:γ-tub, G:α-tub, B:DAPI'} + { + cells: [ + { + kind: 'checkbox', + name: "R2", + treatment_id: 'rna2' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'siRNA #2' + }, + { + kind: 'text', + text: "3 days" } + ], + treatment_id: 'rna2', + cell_treatments: { + R2: [ + { + cell_line: 'S2', + treatment_list: { + list: [ + { + collection_id: 'default', + microscope: ['rgb'], + conditions: { + 'IF': ['rgb'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'rna2', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } }, - 'na': { - name: 'None' + { + cells: [ + { + kind: 'checkbox', + name: "R3", + treatment_id: 'rna3' + }, + { + kind: 'text', + text: 'S2' + }, + { + kind: 'text', + text: 'siRNA #3' + }, + { + kind: 'text', + text: "3 days" + } + ], + treatment_id: 'rna3', + cell_treatments: { + R3: [ + { + cell_line: 'S2', + treatment_list: { + list: [ + { + collection_id: 'default', + microscope: ['rgb'], + conditions: { + 'IF': ['rgb'] + }, + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'rna3', + concentration_id: '100' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } } - }, - slides: { - 'img0001': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_1_composite.jpg', - 'img0002': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_2_composite.jpg', - 'img0003': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_3_composite.jpg', - 'img0004': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_4_composite.jpg', - 'img0005': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_5_composite.jpg', - 'img0006': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_6_composite.jpg', - 'img0007': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_1_composite.jpg', - 'img0008': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_2_composite.jpg', - 'img0009': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_3_composite.jpg', - 'img0010': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_4_composite.jpg', - 'img0011': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_5_composite.jpg', - 'img0012': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_6_composite.jpg', - 'img0013': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_1_composite.jpg', - 'img0014': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_2_composite.jpg', - 'img0015': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_3_composite.jpg', - 'img0016': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_4_composite.jpg', - 'img0017': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_5_composite.jpg', - 'img0018': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_6_composite.jpg', - 'img0019': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_1_composite.jpg', - 'img0020': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_2_composite.jpg', - 'img0021': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_3_composite.jpg', - 'img0022': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_4_composite.jpg', - 'img0024': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_5_composite.jpg', - 'img0025': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_6_composite.jpg', - 'img0027': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_1_composite.jpg', - 'img0028': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_2_composite.jpg', - 'img0029': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_3_composite.jpg', - 'img0034': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_4_composite.jpg', - 'img0035': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_5_composite.jpg', - 'img0036': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_6_composite.jpg', - 'img0037': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_1_composite.jpg', - 'img0038': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_2_composite.jpg', - 'img0039': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_3_composite.jpg', - 'img0040': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_4_composite.jpg', - 'img0041': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_5_composite.jpg', - 'img0042': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_6_composite.jpg', - 'img0043': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_1_composite.jpg', - 'img0044': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_2_composite.jpg', - 'img0045': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_3_composite.jpg', - 'img0046': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_4_composite.jpg', - 'img0047': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_5_composite.jpg', - 'img0048': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_6_composite.jpg', + ] + } + } + }, + add_new_row_instructions: 'add new row instructions', + experiment_setup: scb_assignment_sutd_intro_biology_ps2.experiment_setup({}), + collections: { + '': { + name: '' + } + }, + concentrations: { + 100: { + name: '', + value: 100 + } + }, + drugs: { + 'nc': { + name: 'Control siRNA', + concentrations: [100] + }, + 'rna1': { + name: 'siRNA #1', + concentrations: [100] + }, + 'rna2': { + name: 'siRNA #2', + concentrations: [100] + }, + 'rna3': { + name: 'siRNA #3', + concentrations: [100] + } - 'img0049': 'images/microscopy/sutd_2/rna1/Metaphase_arrest1.jpg', - 'img0050': 'images/microscopy/sutd_2/rna1/Metaphase_arrest2.jpg', - 'img0051': 'images/microscopy/sutd_2/rna1/Metaphase_arrest3.jpg', - 'img0052': 'images/microscopy/sutd_2/rna1/Metaphase_arrest4.jpg', + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + } + }, + cell_lines: { + 'S2': { + name: 'S2' + } - 'img0053': 'images/microscopy/sutd_2/rna2/MT_instability1.jpg', - 'img0054': 'images/microscopy/sutd_2/rna2/MT_instability2.jpg', - 'img0055': 'images/microscopy/sutd_2/rna2/MT_instability3.jpg', - 'img0056': 'images/microscopy/sutd_2/rna2/MT_instability4.jpg', - 'img0057': 'images/microscopy/sutd_2/rna2/MT_instability5.jpg', - 'img0058': 'images/microscopy/sutd_2/rna2/MT_instability6.jpg', + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['cyclinB', 'cyclinE', 'scc1', 'pgk1'], - 'img0059': 'images/microscopy/sutd_2/rna3/Interphase_10Normal_UnequalChromsomeDistribution1_composite.jpg', - 'img0060': 'images/microscopy/sutd_2/rna3/Interphase_10Normal_UnequalChromsomeDistribution2_composite.jpg', - 'img0067': 'images/microscopy/sutd_2/rna3/Interphase_10Normal_UnequalChromsomeDistribution3_composite.jpg', - 'img0068': 'images/microscopy/sutd_2/rna3/Interphase_10Normal_UnequalChromsomeDistribution4_composite.jpg', - 'img0069': 'images/microscopy/sutd_2/rna3/Interphase_12Normal_UnequalChromsomeDistribution1_composite.jpg', - 'img0070': 'images/microscopy/sutd_2/rna3/Interphase_12Normal_UnequalChromsomeDistribution2_composite.jpg', - 'img0071': 'images/microscopy/sutd_2/rna3/Interphase_12Normal_UnequalChromsomeDistribution3_composite.jpg', - 'img0072': 'images/microscopy/sutd_2/rna3/Interphase_12Normal_UnequalChromsomeDistribution4_composite.jpg', - 'img0073': 'images/microscopy/sutd_2/rna3/Interphase_13Normal_UnequalChromsomeDistribution1_composite.jpg', - 'img0074': 'images/microscopy/sutd_2/rna3/Interphase_13Normal_UnequalChromsomeDistribution2_composite.jpg', - 'img0075': 'images/microscopy/sutd_2/rna3/Interphase_13Normal_UnequalChromsomeDistribution3_composite.jpg', - 'img0076': 'images/microscopy/sutd_2/rna3/Interphase_13Normal_UnequalChromsomeDistribution4_composite.jpg', + 'cyclinB': { + name: 'mouse anti-cyclin B', + secondary: ['m'], + marks: [ + { + weight: 58, + intensity: 0 + } + ], + gel_name: 'cyclin B' + }, + 'cyclinE': { + name: 'mouse anti-cyclin E', + secondary: ['m'], + marks: [ + { + weight: 54, + intensity: 0 + }, + { + weight: 55, + intensity: 0 + }, + { + weight: 58, + intensity: 0 + } + ], + gel_name: 'cyclin E' + }, + 'scc1': { + name: 'rabbit anti-Scc1', + secondary: ['r'], + marks: [ + { + weight: 48, + intensity: 0 + } + ], + gel_name: 'Scc1' + }, + 'pgk1': { + name: 'rabbit anti-pgk1', + secondary: ['r'], + marks: [ + { + weight: 25, + intensity: 0 + } + ], + gel_name: 'pgk1' + } - 'img0077': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_5_composite.jpg', - 'img0078': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_6_composite.jpg', - 'img0079': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_1_composite.jpg', - 'img0080': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_2_composite.jpg', - 'img0081': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_3_composite.jpg', - 'img0082': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_4_composite.jpg', - 'img0083': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_5_composite.jpg', - 'img0084': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_6_composite.jpg', - 'img0085': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Unequal_Chromosome_Distribution/Unequal_Chromosome_Distribution_2.jpg', - 'img0087': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Unequal_Chromosome_Distribution/Unequal_Chromosome_Distribution_6.jpg' - }, - slide_parser: { - 'default': { - 'IF': { - 'rgb': { + }, + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'whole': { + name: 'Dye/Stain', + conditions: { + 'whole': { + name: 'PI' + } + } + } + }, + micro_kinds: { + 'IF': { + name: 'Antibody-labeling IF', + conditions: { + 'rgb': { + name: 'γ-tubulin (red), α-tubulin (green), DAPI (blue)', + short_name: 'R:γ-tub, G:α-tub, B:DAPI' + } + } + }, + 'na': { + name: 'None' + } + }, + slides: { + 'img0001': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_1_composite.jpg', + 'img0002': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_2_composite.jpg', + 'img0003': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_3_composite.jpg', + 'img0004': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_4_composite.jpg', + 'img0005': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_5_composite.jpg', + 'img0006': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_4Normal_Anaphase_6_composite.jpg', + 'img0007': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_1_composite.jpg', + 'img0008': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_2_composite.jpg', + 'img0009': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_3_composite.jpg', + 'img0010': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_4_composite.jpg', + 'img0011': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_5_composite.jpg', + 'img0012': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_5Normal_Anaphase_6_composite.jpg', + 'img0013': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_1_composite.jpg', + 'img0014': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_2_composite.jpg', + 'img0015': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_3_composite.jpg', + 'img0016': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_4_composite.jpg', + 'img0017': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_5_composite.jpg', + 'img0018': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_6Normal_Anaphase_6_composite.jpg', + 'img0019': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_1_composite.jpg', + 'img0020': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_2_composite.jpg', + 'img0021': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_3_composite.jpg', + 'img0022': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_4_composite.jpg', + 'img0024': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_5_composite.jpg', + 'img0025': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_7Normal_Anaphase_6_composite.jpg', + 'img0027': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_1_composite.jpg', + 'img0028': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_2_composite.jpg', + 'img0029': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_3_composite.jpg', + 'img0034': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_4_composite.jpg', + 'img0035': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_5_composite.jpg', + 'img0036': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_8Normal_Anaphase_6_composite.jpg', + 'img0037': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_1_composite.jpg', + 'img0038': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_2_composite.jpg', + 'img0039': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_3_composite.jpg', + 'img0040': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_4_composite.jpg', + 'img0041': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_5_composite.jpg', + 'img0042': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_9Normal_Anaphase_6_composite.jpg', + 'img0043': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_1_composite.jpg', + 'img0044': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_2_composite.jpg', + 'img0045': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_3_composite.jpg', + 'img0046': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_4_composite.jpg', + 'img0047': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_5_composite.jpg', + 'img0048': 'images/microscopy/sutd_2/cn/Interphase_10Normal_Metaphase_10Normal_Anaphase_6_composite.jpg', - 'nc': [ - [ - {'hash': 'img0001', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0002', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0003', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0004', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0005', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0006', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0007', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0008', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0009', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0010', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0011', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0012', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0013', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0014', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0015', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0016', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0017', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0018', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0019', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0020', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0021', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0022', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0023', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0024', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0025', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0026', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0027', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0028', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0029', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0030', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0031', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0032', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0033', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0034', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0035', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0036', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0037', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0038', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0039', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0040', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0041', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0042', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0043', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0044', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0045', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0046', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0047', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0048', 'if_type': 'merge', 'mag': 'N/A'} - ] + 'img0049': 'images/microscopy/sutd_2/rna1/Metaphase_arrest1.jpg', + 'img0050': 'images/microscopy/sutd_2/rna1/Metaphase_arrest2.jpg', + 'img0051': 'images/microscopy/sutd_2/rna1/Metaphase_arrest3.jpg', + 'img0052': 'images/microscopy/sutd_2/rna1/Metaphase_arrest4.jpg', + 'img0053': 'images/microscopy/sutd_2/rna2/MT_instability1.jpg', + 'img0054': 'images/microscopy/sutd_2/rna2/MT_instability2.jpg', + 'img0055': 'images/microscopy/sutd_2/rna2/MT_instability3.jpg', + 'img0056': 'images/microscopy/sutd_2/rna2/MT_instability4.jpg', + 'img0057': 'images/microscopy/sutd_2/rna2/MT_instability5.jpg', + 'img0058': 'images/microscopy/sutd_2/rna2/MT_instability6.jpg', - ], - 'rna1': [ - [ - {'hash': 'img0049', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0050', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0051', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0052', 'if_type': 'merge', 'mag': 'N/A'} - ] + 'img0059': 'images/microscopy/sutd_2/rna3/Interphase_10Normal_UnequalChromsomeDistribution1_composite.jpg', + 'img0060': 'images/microscopy/sutd_2/rna3/Interphase_10Normal_UnequalChromsomeDistribution2_composite.jpg', + 'img0067': 'images/microscopy/sutd_2/rna3/Interphase_10Normal_UnequalChromsomeDistribution3_composite.jpg', + 'img0068': 'images/microscopy/sutd_2/rna3/Interphase_10Normal_UnequalChromsomeDistribution4_composite.jpg', + 'img0069': 'images/microscopy/sutd_2/rna3/Interphase_12Normal_UnequalChromsomeDistribution1_composite.jpg', + 'img0070': 'images/microscopy/sutd_2/rna3/Interphase_12Normal_UnequalChromsomeDistribution2_composite.jpg', + 'img0071': 'images/microscopy/sutd_2/rna3/Interphase_12Normal_UnequalChromsomeDistribution3_composite.jpg', + 'img0072': 'images/microscopy/sutd_2/rna3/Interphase_12Normal_UnequalChromsomeDistribution4_composite.jpg', + 'img0073': 'images/microscopy/sutd_2/rna3/Interphase_13Normal_UnequalChromsomeDistribution1_composite.jpg', + 'img0074': 'images/microscopy/sutd_2/rna3/Interphase_13Normal_UnequalChromsomeDistribution2_composite.jpg', + 'img0075': 'images/microscopy/sutd_2/rna3/Interphase_13Normal_UnequalChromsomeDistribution3_composite.jpg', + 'img0076': 'images/microscopy/sutd_2/rna3/Interphase_13Normal_UnequalChromsomeDistribution4_composite.jpg', - ], - 'rna2': [ - [ - {'hash': 'img0053', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0054', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0055', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0056', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0057', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0058', 'if_type': 'merge', 'mag': 'N/A'} - ] - ], - 'rna3': [ - [ - {'hash': 'img0059', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0060', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0061', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0062', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0063', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0064', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0065', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0066', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0067', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0068', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0069', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0070', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0071', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0072', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0073', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0074', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0075', 'if_type': 'merge', 'mag': 'N/A'} - ], - [ - {'hash': 'img0076', 'if_type': 'merge', 'mag': 'N/A'} - ] - - ] - } + 'img0077': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_5_composite.jpg', + 'img0078': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_8Normal_Anaphase_6_composite.jpg', + 'img0079': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_1_composite.jpg', + 'img0080': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_2_composite.jpg', + 'img0081': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_3_composite.jpg', + 'img0082': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_4_composite.jpg', + 'img0083': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_5_composite.jpg', + 'img0084': 'images/microscopy/assignment_706_2014_ps2/composites/Metaphase_Anaphase-control/Normal_Metaphase_9Normal_Anaphase_6_composite.jpg', + 'img0085': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Unequal_Chromosome_Distribution/Unequal_Chromosome_Distribution_2.jpg', + 'img0087': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_IF_DNA-blue_MT-green_spindle_poles-red/Unequal_Chromosome_Distribution/Unequal_Chromosome_Distribution_6.jpg' + }, + slide_parser: { + 'default': { + 'IF': { + 'rgb': { + 'nc': [ + [ + { + 'hash': 'img0001', + 'if_type': 'merge', + 'mag': 'N/A' } - } - }, + ], + [ + { + 'hash': 'img0002', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0003', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0004', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0005', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0006', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0007', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0008', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0009', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0010', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0011', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0012', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0013', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0014', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0015', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0016', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0017', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0018', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0019', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0020', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0021', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0022', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0023', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0024', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0025', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0026', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0027', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0028', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0029', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0030', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0031', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0032', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0033', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0034', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0035', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0036', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0037', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0038', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0039', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0040', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0041', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0042', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0043', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0044', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0045', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0046', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0047', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0048', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - { - transfer_function: 'delta', - cutoff: 1, - drug: 'nc', - cell_line: 'S2', - above_marks: [ - { - name: 'Cyclin E', - weight: 48, - intensity: 4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 1, - primary_anti_body: ['cyclinB'] - }, - { - name: 'Scc1', - weight: 68, - intensity: 2, - primary_anti_body: ['scc1'] - }, - { - name: 'Scc1', - weight: 20, - intensity: 1, - primary_anti_body: ['scc1'] - }, - { - name: 'Scc1', - weight: 30, - intensity: 1, - primary_anti_body: ['scc1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 3, - primary_anti_body: ['pgk1'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'rna1', - cell_line: 'S2', - above_marks: [ - { - name: 'Cyclin E', - weight: 48, - intensity: 0, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 9, - primary_anti_body: ['cyclinB'] - }, - { - name: 'Scc1', - weight: 68, - intensity: 5, - primary_anti_body: ['scc1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 3, - primary_anti_body: ['pgk1'] - } + ], + 'rna1': [ + [ + { + 'hash': 'img0049', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0050', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0051', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0052', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'rna2', - cell_line: 'S2', - above_marks: [ - { - name: 'Cyclin E', - weight: 48, - intensity: 0, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 9, - primary_anti_body: ['cyclinB'] - }, - { - name: 'Scc1', - weight: 68, - intensity: 5, - primary_anti_body: ['scc1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 3, - primary_anti_body: ['pgk1'] - } + ], + 'rna2': [ + [ + { + 'hash': 'img0053', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0054', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0055', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0056', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0057', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0058', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] + ], + 'rna3': [ + [ + { + 'hash': 'img0059', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0060', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0061', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0062', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0063', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0064', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0065', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0066', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0067', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0068', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0069', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0070', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0071', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0072', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0073', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0074', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0075', + 'if_type': 'merge', + 'mag': 'N/A' + } + ], + [ + { + 'hash': 'img0076', + 'if_type': 'merge', + 'mag': 'N/A' + } + ] - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'rna3', - cell_line: 'S2', - above_marks: [ - { - name: 'Cyclin E', - weight: 48, - intensity: 4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: 4, - primary_anti_body: ['cyclinB'] - }, - { - name: 'Scc1', - weight: 68, - intensity: 2, - primary_anti_body: ['scc1'] - }, - { - name: 'Scc1', - weight: 20, - intensity: 3, - primary_anti_body: ['scc1'] - }, - { - name: 'Scc1', - weight: 30, - intensity: 3, - primary_anti_body: ['scc1'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 3, - primary_anti_body: ['pgk1'] - } + ] + } - ] - } + } + } + }, - ] + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + { + transfer_function: 'delta', + cutoff: 1, + drug: 'nc', + cell_line: 'S2', + above_marks: [ + { + name: 'Cyclin E', + weight: 48, + intensity: 4, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 1, + primary_anti_body: ['cyclinB'] + }, + { + name: 'Scc1', + weight: 68, + intensity: 2, + primary_anti_body: ['scc1'] + }, + { + name: 'Scc1', + weight: 20, + intensity: 1, + primary_anti_body: ['scc1'] + }, + { + name: 'Scc1', + weight: 30, + intensity: 1, + primary_anti_body: ['scc1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 3, + primary_anti_body: ['pgk1'] } + + ] }, - facs: { - 'ticks': [50, 100, 150, 250], - 'max': 250, - 'scale': 'linear', - 'dna': { - 'parser_simple': [ - { - match: [], - shape: '2-peak-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'nc', - shape: '1-peak-normal-1-flatbump-400' - }, - { - match: ['drug_id'], - drug_id: 'rna1', - shape: 'scaled-peak-2' - }, - { - match: ['drug_id'], - drug_id: 'rna2', - shape: 'scaled-peak-2' - }, - { - match: ['drug_id'], - drug_id: 'rna3', - shape: 'unequal-segregation' - } - ] + { + transfer_function: 'delta', + cutoff: 1, + drug: 'rna1', + cell_line: 'S2', + above_marks: [ + { + name: 'Cyclin E', + weight: 48, + intensity: 0, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 9, + primary_anti_body: ['cyclinB'] + }, + { + name: 'Scc1', + weight: 68, + intensity: 5, + primary_anti_body: ['scc1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 3, + primary_anti_body: ['pgk1'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'rna2', + cell_line: 'S2', + above_marks: [ + { + name: 'Cyclin E', + weight: 48, + intensity: 0, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 9, + primary_anti_body: ['cyclinB'] + }, + { + name: 'Scc1', + weight: 68, + intensity: 5, + primary_anti_body: ['scc1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 3, + primary_anti_body: ['pgk1'] } + + ] }, - microscopy: { - 'valid': ['S2', 'nc'], - 'slide': { + { + transfer_function: 'delta', + cutoff: 1, + drug: 'rna3', + cell_line: 'S2', + above_marks: [ + { + name: 'Cyclin E', + weight: 48, + intensity: 4, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: 4, + primary_anti_body: ['cyclinB'] + }, + { + name: 'Scc1', + weight: 68, + intensity: 2, + primary_anti_body: ['scc1'] + }, + { + name: 'Scc1', + weight: 20, + intensity: 3, + primary_anti_body: ['scc1'] + }, + { + name: 'Scc1', + weight: 30, + intensity: 3, + primary_anti_body: ['scc1'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 3, + primary_anti_body: ['pgk1'] + } - 'conditions_parser': [ - { - match: [] + ] + } - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['nc'], - conditions: 'rgb', - phenotype: 'nc' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna1'], - conditions: 'rgb', - phenotype: 'rna1' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna2'], - conditions: 'rgb', - phenotype: 'rna2' - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['rna3'], - conditions: 'rgb', - phenotype: 'rna3' - } - ] + ] + } + }, + facs: { + 'ticks': [50, 100, 150, 250], + 'max': 250, + 'scale': 'linear', + 'dna': { + 'parser_simple': [ + { + match: [], + shape: '2-peak-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'nc', + shape: '1-peak-normal-1-flatbump-400' + }, + { + match: ['drug_id'], + drug_id: 'rna1', + shape: 'scaled-peak-2' + }, + { + match: ['drug_id'], + drug_id: 'rna2', + shape: 'scaled-peak-2' + }, + { + match: ['drug_id'], + drug_id: 'rna3', + shape: 'unequal-segregation' + } + ] - } + } + }, + microscopy: { + 'valid': ['S2', 'nc'], + 'slide': { + + 'conditions_parser': [ + { + match: [] + + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['nc'], + conditions: 'rgb', + phenotype: 'nc' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna1'], + conditions: 'rgb', + phenotype: 'rna1' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna2'], + conditions: 'rgb', + phenotype: 'rna2' + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['rna3'], + conditions: 'rgb', + phenotype: 'rna3' } + ] + } + } } + } }; diff --git a/html_app/components/FACSModelFactory.js b/html_app/components/FACSModelFactory.js index bbbec98a..67aa803d 100644 --- a/html_app/components/FACSModelFactory.js +++ b/html_app/components/FACSModelFactory.js @@ -1,659 +1,721 @@ scb.components = scb.components || {}; scb.components.FACSModelFactory = function scb_components_FACSModelFactory(model, template) { - var self = this; - - if (scb.utils.isDefined(model.dna)) { - self.dna = function (state) { - var t = template; - var m = model.dna; - if (m.parser_simple) { - var facs_lane = state.facs_lane; - var cell_treatment = facs_lane.cell_treatment; - var drug_treatments = cell_treatment.treatment_list.list; - var duration= drug_treatments[0].duration; - var shape = ''; - var facs_state = { - cell_line: function (str) { - return str == cell_treatment.cell_line - }, - temperature: function (str) { - return str == drug_treatments[0].temperature - }, - condition: function (str){ - return str == facs_lane.conditions; - }, - duration: function(str){ - return str == duration; - }, - drug_id: function (str) { - var any = false; - _.each(drug_treatments, function (dt) { - _.each(dt.drug_list.list, function (drug) { - any |= (drug.drug_id == str); - }); - }); - return any; - } - } - - _.each(m.parser_simple, function (rule) { - if (rule.match.length == 0) { - shape = rule.shape; - } - else { - var matches = true; - _.each(rule.match, function (property) { - if (facs_state[property]) { - matches &= facs_state[property](rule[property]); - } - else { - console.info("UNDEFINED PROPERTY: " + property); - } - }); - if (matches) { - shape = rule.shape; - } - } - }); - state.shape = shape; - self.shape_to_data(state); + var self = this; + + if (scb.utils.isDefined(model.dna)) { + self.dna = function(state) { + var t = template; + var m = model.dna; + if (m.parser_simple) { + var facs_lane = state.facs_lane; + var cell_treatment = facs_lane.cell_treatment; + var drug_treatments = cell_treatment.treatment_list.list; + var duration = drug_treatments[0].duration; + var shape = ''; + var facs_state = { + cell_line: function(str) { + return str == cell_treatment.cell_line + }, + temperature: function(str) { + return str == drug_treatments[0].temperature + }, + condition: function(str) { + return str == facs_lane.conditions; + }, + duration: function(str) { + return str == duration; + }, + drug_id: function(str) { + var any = false; + _.each(drug_treatments, function(dt) { + _.each(dt.drug_list.list, function(drug) { + any |= (drug.drug_id == str); + }); + }); + return any; + } + } + _.each(m.parser_simple, function(rule) { + if (rule.match.length == 0) { + shape = rule.shape; + } else { + var matches = true; + _.each(rule.match, function(property) { + if (facs_state[property]) { + matches &= facs_state[property](rule[property]); + } else { + console.info("UNDEFINED PROPERTY: " + property); + } + }); + if (matches) { + shape = rule.shape; } - // here we need to compute how this actually works - /* I think: - - Model will initiate random stuff when it starts - - Here we will move model depending on drugs - - And finish with collection time - - Visualizer will count from here and draw DNA curve - */ + } + }); + state.shape = shape; + self.shape_to_data(state); + + } + // here we need to compute how this actually works + /* I think: + - Model will initiate random stuff when it starts + - Here we will move model depending on drugs + - And finish with collection time + - Visualizer will count from here and draw DNA curve + */ + } + self.shape_to_data = function(state) { + var shape = ('' + state.shape).toLowerCase(); + + function g0g1(x) { + return 4 * Math.exp(-((x - 1) * (x - 1)) * 30); + } + + function near_zero(x) { + return 1 / 2 * (x > 0 && x < 1 ? (.08 - x / 50) : 0); + } + + function s(x) { + return .05 * (5 * (x > .8 && x < 1 ? x - .8 : 0) + (x > 1 & x < 2 ? (.8 + (2 - x) / 5) : 0) / .6 + 1.3 * (x > 2 & x < 2.3 ? (2.3 - x) / .3 : 0)); + } + + function g2m(x) { + return 1 / 2 * Math.exp(-((x - 2) * (x - 2) * 15)); + } + + function s_block(x) { + return Math.exp(-((2 - x) * Math.exp(2 - x) - .9) * ((2 - x) * Math.exp(2 - x) - .9) / .4); + } + + function peak2g1(x) { + return normal_dist(x, 0.78, 0.08, 4, false) * 2; + } + + function peak2g2(x) { + return normal_dist(x, 0.39, 0.08, 1, false) * 3; + } + + function peak2Ug1(x) { + return normal_dist(x, 0.83, 0.165, 3, true) * 4.1; + } + + function peak2Ug2(x) { + return normal_dist(x, 0.31, 0.14, -2, true) * 6; + } + + /* + *The following 3 functions describe the asynchronous image + * with a tall peak at 50 and a small bump at 100, and flat + * middle ground. + */ + function bump100(x) { + return normal_dist(x, 1.1, 0.2, -2, true) * 0.2; + } + function bigpeak50(x) { + return normal_dist(x, 0.5, 0.1, -3, true); + } + function middlenoise(x) { + var y = -Math.pow(x - 0.9, 2) + 0.25; + return (y > 0) ? y : 0; + + } + /* These two functions are added for graph B */ + /* The peak is between 0 an 1, trailing background noise from the right */ + function peak021(x) { + return normal_dist(x, 0.15, 0.25, -3, true); + } + function tail(x) { + return normal_dist(x, 0.45, 0.3, -2, true) * 0.2; + } + + /* graph C */ + function graph_C(x, mean) { + return normal_dist(x, mean, 0.2, 0.5, false); + } + /*Single narrow peak */ + function scaled_peak(x, mean) { + return normal_dist(x, mean, 0.13, 0.5, false); + } + + + + function g1(x) { + // return normal_dist(x, 0.2, 0.27, -25, true)* 0.7; + return normal_dist(x, 0.15, 0.22, -26, true) * 0.3; + } + + function g2(x) { + return normal_dist(x, 0.38, 0.09, 1, false) * 0.85; + } + + function g3(x) { + return normal_dist(x, 0.85, 0.14, 3, true) * 0.5; + } + + function g4(x) { + return normal_dist(x, 1, 0.32, 1, false) * 0.77; + } + /* Four peaks for Unequal segregation image */ + function h1(x) { + return normal_dist(x, 0.3, 0.22, -26, true) * 0.3; + } + + function h2(x) { + return normal_dist(x, 0.6, 0.11, 1, false); + } + + function h3(x) { + return normal_dist(x, 1.2, 0.17, 3, true) * 0.6; + } + + function h4(x) { + return normal_dist(x, 1.4, 0.45, 1, false) * 0.8; + } + + function sblockg1(x) { + return normal_dist(x, 0.24, 0.2, -6, true) - 0.17; + } + + function peak100(x) { + return normal_dist(x, 0.8, 0.05, 0.5, false); + } + + function peak50(x) { + return normal_dist(x, 0.4, 0.05, 0.5, false); + } + + //////////////////// + //////////////////// + //////////////////// + var number_of_curves = 1; + + function erfc(x) { + // save the sign of x + var sign = (x >= 0) ? 1 : -1; + x = Math.abs(x); + + // constants + var a1 = 0.254829592; + var a2 = -0.284496736; + var a3 = 1.421413741; + var a4 = -1.453152027; + var a5 = 1.061405429; + var p = 0.3275911; + + // A&S formula 7.1.26 + var t = 1.0 / (1.0 + p * x); + var y = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.exp(-x * x); + return sign * y + 1; // erf(-x) = -erf(x); + } + + + function roundData(input) { + var round_number = 10000; + for (var index = 0; index < input.length; index++) { + input[index][0] = Math.round(input[index][0] * round_number) / round_number; + input[index][1] = Math.round(input[index][1] * round_number) / round_number; } - self.shape_to_data = function (state) { - var shape = ('' + state.shape).toLowerCase(); - - function g0g1(x) { - return 4 * Math.exp(-((x - 1) * (x - 1)) * 30); + return input; + } + function normal_dist(x_val, location, scale, shape, haserror) { + var term1 = Math.exp(-((x_val - location) * (x_val - location)) / (2 * scale * scale)); + var term2 = haserror ? erfc(-(shape * (x_val - location)) / (Math.sqrt(2) * scale)) : 1; + var term3 = Math.sqrt(Math.PI * 2) * scale; + return (term1 * term2) / term3; + } + + function normalize(data, big_const, factor, y_scale) { + var factor = factor || .05; + var big_const = big_const || 2750; + var sum = 0; + _.each(data, function(s) { + sum += s[1]; + }); + _.each(data, function(s) { + // y= y/ sum(y_i) + s[1] = s[1] / sum * (1 - factor + 2 * factor * Math.random()) + }); + + sum = 0; + _.each(data, function(s) { + sum += s[1]; + }); + console.log("Sum of normalized data: " + sum); + if (sum != 0) { /*normalizing the y values*/ + _.each(data, function(s, index) { + if (template.model.facs.scale) { + data[index][1] = data[index][1] / sum * big_const; + } else { + data[index][1] = data[index][1] / sum * (template.model.facs.max ? ((big_const * 100) / template.model.facs.max) * number_of_curves : 2750); } + }); + } - function near_zero(x) { - return 1 / 2 * ( x > 0 && x < 1 ? (.08 - x / 50) : 0 ); + _.each(data, function(s, index) { /*normalizing x values*/ + /* new exercises will now have attribute 'scale' */ + /* Using scale to distinguish old exercises and preserve the old normalization way*/ + if (template.model.facs.scale) { + /*this is assuming that the start point is 0 */ + data[index][0] = template.model.facs.max * data[index][0] / data[data.length - 1][0]; + } else { /*to preserve the old exercise scaling, keeping old code*/ + data[index][0] = data[index][0] * (template.model.facs.max ? ((template.model.facs.max * 50) / 100) : 50); + } + + }); + + } + + + var options = { + series: { + lines: { + show: true, + fill: true, + steps: true, + lineWidth: 1 + }, + points: { + show: false, + radius: .5, + fill: false + }, + color: '#808080' + }, + xaxis: { + show: true, + color: '#000000', + min: 0, + max: template.model.facs.max ? template.model.facs.max : 150, + ticks: template.model.facs.ticks ? template.model.facs.ticks : [50, 100], + tickLength: 0, + transform: function(v) { + if (template.model.facs.scale && template.model.facs.scale.indexOf('log') > -1) { + return Math.log(v + 0.0001) / Math.LN10; /*move away from zero*/ + } else { + return v; + } + }, + + tickFormatter: function(v, axis) { + if (template.model.facs.scale && template.model.facs.scale.indexOf('pseudo') > -1) { + return "10^" + Math.round(v / template.model.facs.ticks[0]); + } else if (template.model.facs.scale && template.model.facs.scale.indexOf('log') > -1) { + return "10^" + (Math.round(Math.log(v) / Math.LN10)).toString(); //(Math.round( Math.log(v)/Math.LN10)).toString().sup();}, + } else { + return v; } - function s(x) { - return .05 * (5 * (x > .8 && x < 1 ? x - .8 : 0) + (x > 1 & x < 2 ? (.8 + (2 - x) / 5) : 0) / .6 + 1.3 * (x > 2 & x < 2.3 ? (2.3 - x) / .3 : 0)); + }, + + font: { + family: 'sourcesanspro-regular', + size: 11, + } + }, + yaxis: { + show: true, + color: '#000000', + min: template.model.facs.max ? 0 : -1, + max: 100, + tickLength: 0, + font: { + family: 'sourcesanspro-regular', + size: 11 + } + + + }, + // '': { ticks: [0.001,0.01,0.1,1,10,100], + // transform: function(v) {return Math.log(v+0.0001); /*move away from zero*/} , tickDecimals: 3 , + // tickFormatter: function (v, axis) {return "10" + (Math.round( Math.log(v)/Math.LN10)).toString().sup();} + // }, + legend: { + show: false + }, + grid: { + clickable: true, + hoverable: true, + borderWidth: 0, + aboveData: true, + autoHighlight: false, + markings: [{ + xaxis: { + from: 0, + to: template.model.facs.max ? template.model.facs.max : 150 + }, + yaxis: { + from: 0, + to: 0 + }, + color: "#000" + }, + { + xaxis: { + from: 0, + to: 0 + }, + yaxis: { + from: 0, + to: 100 + }, + color: "#000" + }] + }, + }; + /* Old assignments do not have ticks */ + var step = template.model.facs.ticks ? (template.model.facs.ticks[1] - template.model.facs.ticks[0]) : 50; + + if (('' + shape).toLowerCase() == 'normal') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = g0g1(x + bias) + 3 * g2m(x + bias) + near_zero(x + bias) + s(x + bias); + data.push([x, y]); + + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data + }, + // {label: 'phase 1', data:[[0,0.01],[0.8,0.01]],lines:{fill:false}}, + // {label: 'phase 2', data:[[0.8,0.011],[1.2,0.011]],lines:{fill:false}}, + // {label: 'phase 3', data:[[1.2,0.01],[1.8,0.01]],lines:{fill:false}}, + // {label: 'phase 4', data:[[1.8,0.011],[2.3,0.011]],lines:{fill:false}} + + ], + options: options + }; + } + if (shape == 'graph-c') { + var data = []; + /* 2 is location of the peak in terms of steps*/ + var mean = 3 / (template.model.facs.max / step) * 2; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = graph_C(x + bias, mean); + data.push([x, y]); + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data } + ], + options: options + }; + } + if (shape == 'graph-b') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = peak021(x + bias) + tail(x + bias); + data.push([x, y]); - function g2m(x) { - return 1 / 2 * Math.exp(-((x - 2) * (x - 2) * 15)); + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data } + ], + options: options + }; + } + + if (('' + shape).toLowerCase() == 's-block') { + var data = []; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = s_block(x); + data.push([x, y]); - function s_block(x) { - return Math.exp(-((2 - x) * Math.exp(2 - x) - .9) * ((2 - x) * Math.exp(2 - x) - .9) / .4); + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data } + ], + options: options + }; + } - function peak2g1(x){ - return normal_dist(x, 0.78, 0.08, 4, false)*2; - } - - function peak2g2(x){ - return normal_dist(x, 0.39, 0.08, 1, false)*3 ; - } - - function peak2Ug1(x){ - return normal_dist(x, 0.83, 0.165, 3, true)*4.1; - } - - function peak2Ug2(x){ - return normal_dist(x, 0.31, 0.14, -2, true)*6; - } - - /* - *The following 3 functions describe the asynchronous image - * with a tall peak at 50 and a small bump at 100, and flat - * middle ground. - */ - function bump100(x){ - return normal_dist(x, 1.1, 0.2, -2, true)*0.2; - } - function bigpeak50(x){ - return normal_dist(x, 0.5, 0.1, -3, true); - } - function middlenoise(x){ - var y= -Math.pow(x-0.9,2)+0.25; - return (y>0)?y:0; + if (('' + shape).toLowerCase() == 'g1-block') { + } + if (('' + shape).toLowerCase() == 'g2-block') { + var data = []; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = g2m(x); + data.push([x, y]); + + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data } - /* These two functions are added for graph B */ - /* The peak is between 0 an 1, trailing background noise from the right */ - function peak021(x){ - return normal_dist(x, 0.15, 0.25, -3, true); - } - function tail(x){ - return normal_dist(x, 0.45, 0.3, -2, true)*0.2; - } - - /* graph C */ - function graph_C(x, mean){ - return normal_dist(x, mean, 0.2, 0.5, false); - } - /*Single narrow peak */ - function scaled_peak(x, mean){ - return normal_dist(x, mean, 0.13, 0.5, false); + ], + options: options + }; + } + if (('' + shape).toLowerCase() == 'alpha-block') { + var data = []; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = g0g1(x); + data.push([x, y]); + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data } + ], + options: options + }; + } - - function g1(x){ - // return normal_dist(x, 0.2, 0.27, -25, true)* 0.7; - return normal_dist(x, 0.15, 0.22, -26, true)* 0.3; - } - - function g2(x){ - return normal_dist(x, 0.38, 0.09, 1, false)*0.85; - } - - function g3(x){ - return normal_dist(x, 0.85, 0.14, 3, true)*0.5; - } - - function g4(x){ - return normal_dist(x, 1, 0.32, 1, false)*0.77; - } - /* Four peaks for Unequal segregation image */ - function h1(x){ - return normal_dist(x, 0.3, 0.22, -26, true)* 0.3; - } - - function h2(x){ - return normal_dist(x, 0.6, 0.11, 1, false); - } - - function h3(x){ - return normal_dist(x, 1.2, 0.17, 3, true)*0.6; - } - - function h4(x){ - return normal_dist(x, 1.4, 0.45, 1, false)*0.8; - } - - function sblockg1(x){ - return normal_dist(x, 0.24, 0.2, -6, true)-0.17; - } - - function peak100(x){ - return normal_dist(x, 0.8, 0.05, 0.5, false); - } + if (('' + shape).toLowerCase() == '2-peak-normal-400') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 2; + var y = peak2g1(x + bias) + peak2g2(x + bias); + data.push([x, y]); - function peak50(x){ - return normal_dist(x, 0.4, 0.05, 0.5, false); - } + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + + if (('' + shape).toLowerCase() == 'peak-100-normal-400') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = peak100(x + bias); + data.push([x, y]); -//////////////////// -//////////////////// -//////////////////// - var number_of_curves = 1; - - function erfc(x) { - // save the sign of x - var sign = (x >= 0) ? 1 : -1; - x = Math.abs(x); - - // constants - var a1 = 0.254829592; - var a2 = -0.284496736; - var a3 = 1.421413741; - var a4 = -1.453152027; - var a5 = 1.061405429; - var p = 0.3275911; - - // A&S formula 7.1.26 - var t = 1.0/(1.0 + p*x); - var y = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.exp(-x * x); - return sign * y+1; // erf(-x) = -erf(x); - } - - - function roundData(input){ - var round_number = 10000; - for(var index = 0 ; index < input.length; index++){ - input[index][0] = Math.round(input[index][0] * round_number)/round_number; - input[index][1] = Math.round(input[index][1] * round_number)/round_number; - } - return input; - } - function normal_dist(x_val,location, scale, shape, haserror){ - var term1 = Math.exp(-((x_val - location) * (x_val - location))/(2*scale*scale)); - var term2 = haserror ? erfc(-(shape*(x_val-location))/(Math.sqrt(2)*scale)): 1; - var term3 = Math.sqrt(Math.PI*2)*scale; - return (term1*term2)/term3 ; - } - - function normalize(data, big_const, factor, y_scale) { - var factor = factor || .05; - var big_const=big_const || 2750; - var sum = 0; - _.each(data, function (s) { - sum += s[1]; - }); - _.each(data, function (s) { - // y= y/ sum(y_i) - s[1] = s[1] / sum * (1 - factor + 2 * factor * Math.random()) - }); - - sum = 0; - _.each(data, function (s) { - sum += s[1]; - }); - console.log("Sum of normalized data: "+sum); - if(sum!=0) { /*normalizing the y values*/ - _.each(data, function (s, index) { - if (template.model.facs.scale) { - data[index][1] = data[index][1] / sum * big_const; - } else { - data[index][1] = data[index][1] / sum * (template.model.facs.max ? ((big_const * 100) / template.model.facs.max) * number_of_curves : 2750 ); - } - }); - } - - _.each(data, function (s, index) {/*normalizing x values*/ - /* new exercises will now have attribute 'scale' */ - /* Using scale to distinguish old exercises and preserve the old normalization way*/ - if(template.model.facs.scale){ - /*this is assuming that the start point is 0 */ - data[index][0]= template.model.facs.max * data[index][0] / data[data.length-1][0]; - }else { /*to preserve the old exercise scaling, keeping old code*/ - data[index][0] = data[index][0] * (template.model.facs.max ? ((template.model.facs.max*50)/100): 50 ) ; - } - - }); + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + /* Single thin peak function scaled according to max value*/ + /* can locate peaks at any multiple of 'step' (so far has been always 50)*/ + if (shape.indexOf('scaled-peak') > -1) { + var data = []; + var mean = 0; + + /*assuming that 150 is the third point on the scale*/ + if (shape.indexOf('3') > -1) { + mean = 3 / (template.model.facs.max / step) * 3; + } else if (shape.indexOf('2') > -1) { + mean = 3 / (template.model.facs.max / step) * 2; + } else if (shape.indexOf('1') > -1) { + mean = 3 / (template.model.facs.max / step); + } + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = scaled_peak(x + bias, mean); + data.push([x, y]); - } + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + if (('' + shape).toLowerCase() == '2-peak-uneven-normal-400') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 2; + var y = peak2Ug1(x + bias) + peak2Ug2(x + bias); + data.push([x, y]); + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + if (('' + shape).toLowerCase() == '1-peak-normal-1-flatbump-400') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 2; + var y = bigpeak50(x + bias) + bump100(x + bias) + middlenoise(x + bias); + data.push([x, y]); - var options = { - series: { - lines: {show: true, fill: true, steps: true, lineWidth: 1}, - points: {show: false, radius: .5, fill: false}, - color: '#808080' - }, - xaxis: { - show: true, - color: '#000000', - min: 0, - max: template.model.facs.max ? template.model.facs.max: 150, - ticks: template.model.facs.ticks ? template.model.facs.ticks: [50, 100], - tickLength: 0, - transform: function(v) { - if(template.model.facs.scale && template.model.facs.scale.indexOf('log')>-1) { - return Math.log(v + 0.0001) / Math.LN10; /*move away from zero*/ - }else{ - return v; - } - }, - - tickFormatter: function (v, axis) { - if (template.model.facs.scale && template.model.facs.scale.indexOf('pseudo') > -1) { - return "10^"+Math.round(v/template.model.facs.ticks[0]); - } else if (template.model.facs.scale && template.model.facs.scale.indexOf('log') > -1) { - return "10^" + (Math.round(Math.log(v) / Math.LN10)).toString(); //(Math.round( Math.log(v)/Math.LN10)).toString().sup();}, - } - else{ - return v; - } - - }, - - font: { - family: 'sourcesanspro-regular', - size: 11, - } - }, - yaxis: { - show: true, - color: '#000000', - min: template.model.facs.max ? 0: -1 , - max: 100, - tickLength:0, - font: { - family: 'sourcesanspro-regular', - size: 11 - } - - - }, -// '': { ticks: [0.001,0.01,0.1,1,10,100], -// transform: function(v) {return Math.log(v+0.0001); /*move away from zero*/} , tickDecimals: 3 , -// tickFormatter: function (v, axis) {return "10" + (Math.round( Math.log(v)/Math.LN10)).toString().sup();} -// }, - legend: { - show: false - }, - grid: {clickable: true, hoverable: true, borderWidth: 0, aboveData: true, autoHighlight: false, markings: [ { xaxis: { from: 0, to: template.model.facs.max ? template.model.facs.max: 150 }, - yaxis: { from: 0, to: 0 }, color: "#000" }, - { xaxis: { from: 0, to: 0 }, yaxis: { from: 0, to: 100 }, color: "#000" }]}, - }; - /* Old assignments do not have ticks */ - var step= template.model.facs.ticks?(template.model.facs.ticks[1]-template.model.facs.ticks[0]) : 50; - - if (('' + shape).toLowerCase() == 'normal') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = g0g1(x + bias) + 3 * g2m(x + bias) + near_zero(x + bias) + s(x + bias); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data}, -// {label: 'phase 1', data:[[0,0.01],[0.8,0.01]],lines:{fill:false}}, -// {label: 'phase 2', data:[[0.8,0.011],[1.2,0.011]],lines:{fill:false}}, -// {label: 'phase 3', data:[[1.2,0.01],[1.8,0.01]],lines:{fill:false}}, -// {label: 'phase 4', data:[[1.8,0.011],[2.3,0.011]],lines:{fill:false}} - - ], - options: options - }; - } - if (shape == 'graph-c') { - var data = []; - /* 2 is location of the peak in terms of steps*/ - var mean=3/(template.model.facs.max/step)*2; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = graph_C(x + bias, mean); - data.push([x, y]); - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data} - ], - options: options - }; - } - if ( shape == 'graph-b') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y= peak021(x + bias)+tail(x + bias); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data} - ], - options: options - }; - } + } + normalize(data, 1700); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + if (('' + shape).toLowerCase() == 'peak-50-normal-400') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = peak50(x + bias); + data.push([x, y]); - if (('' + shape).toLowerCase() == 's-block') { - var data = []; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = s_block(x); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data} - ], - options: options - }; - } + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + + if (('' + shape).toLowerCase() == '4-peak-normal-400') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 4; + var y = g1(x + bias) + g2(x + bias) + g3(x + bias) + g4(x + bias); + data.push([x, y]); - if (('' + shape).toLowerCase() == 'g1-block') { + } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + if (('' + shape).toLowerCase() == 'unequal-segregation') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 4; + var y = h1(x + bias) + h2(x + bias) + h3(x + bias) + h4(x + bias); + data.push([x, y]); - } - if (('' + shape).toLowerCase() == 'g2-block') { - var data = []; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = g2m(x); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data} - ], - options: options - }; - } - if (('' + shape).toLowerCase() == 'alpha-block') { - var data = []; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = g0g1(x); - data.push([x, y]); - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data} - ], - options: options - }; - } - - - if (('' + shape).toLowerCase() == '2-peak-normal-400') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 2; - var y = peak2g1(x + bias) + peak2g2(x + bias); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - - if (('' + shape).toLowerCase() == 'peak-100-normal-400') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = peak100(x+bias); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - /* Single thin peak function scaled according to max value*/ - /* can locate peaks at any multiple of 'step' (so far has been always 50)*/ - if (shape.indexOf('scaled-peak')>-1) { - var data = []; - var mean=0; - - /*assuming that 150 is the third point on the scale*/ - if(shape.indexOf('3')>-1){ - mean=3/(template.model.facs.max/step) *3; - }else if(shape.indexOf('2')>-1){ - mean=3/(template.model.facs.max/step)*2; - }else if(shape.indexOf('1')>-1){ - mean=3/(template.model.facs.max/step); - } - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = scaled_peak(x+bias, mean); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - if (('' + shape).toLowerCase() == '2-peak-uneven-normal-400') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 2; - var y = peak2Ug1(x + bias) + peak2Ug2(x + bias); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - if (('' + shape).toLowerCase() == '1-peak-normal-1-flatbump-400') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 2; - var y = bigpeak50(x+bias)+bump100(x+bias)+middlenoise(x+bias); - data.push([x, y]); - - } - normalize(data,1700); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - if (('' + shape).toLowerCase() == 'peak-50-normal-400') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = peak50(x+bias); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - - if (('' + shape).toLowerCase() == '4-peak-normal-400') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 4; - var y = g1(x + bias) + g2(x + bias) + g3(x + bias) + g4(x + bias); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - if (('' + shape).toLowerCase() == 'unequal-segregation') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 4; - var y = h1(x + bias)+ h2(x + bias) + h3(x + bias) + h4(x + bias); - data.push([x, y]); - - } - normalize(data,4000); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - - if (('' + shape).toLowerCase() == 's-block-normal-400') { - var data = []; - var bias = (Math.random() - .5) * .10; - for (var x = 0; x < 3; x += .01) { - number_of_curves = 1; - var y = sblockg1(x + bias); - data.push([x, y]); - - } - normalize(data); - roundData(data); - state.data = { - data: [ - { data: data}, - - ], - options: options - }; - - } - - + } + normalize(data, 4000); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + + if (('' + shape).toLowerCase() == 's-block-normal-400') { + var data = []; + var bias = (Math.random() - .5) * .10; + for (var x = 0; x < 3; x += .01) { + number_of_curves = 1; + var y = sblockg1(x + bias); + data.push([x, y]); } - } + normalize(data); + roundData(data); + state.data = { + data: [ + { + data: data + }, + + ], + options: options + }; + + } + + - self.compute = function (state) { - return self.dna(state); } + } + + self.compute = function(state) { + return self.dna(state); + } } \ No newline at end of file diff --git a/html_app/components/MicroscopyModelFactory.js b/html_app/components/MicroscopyModelFactory.js index 7c80c56a..6a0c4a57 100644 --- a/html_app/components/MicroscopyModelFactory.js +++ b/html_app/components/MicroscopyModelFactory.js @@ -1,219 +1,228 @@ scb.components = scb.components || {}; scb.components.MicroscopyModelFactory = function scb_components_MicroscopyModelFactory(model, template) { - var self = this; + var self = this; - if(scb.utils.isDefined(model.slide)){//model here is template.model.microscopy - self.slide = function(state){ - var hash_list = []; - _.each(state.microscopy.lanes_list.list, function(x){ - if(x.current_slides.length > 0){ - _.each(x.current_slides, function(slide){ - hash_list.push(slide.hash); - }); - } - }); + if (scb.utils.isDefined(model.slide)) { //model here is template.model.microscopy + self.slide = function(state) { + var hash_list = []; + _.each(state.microscopy.lanes_list.list, function(x) { + if (x.current_slides.length > 0) { + _.each(x.current_slides, function(slide) { + hash_list.push(slide.hash); + }); + } + }); - var microscopy_lane = state.microscopy_lane; - var cell_line = microscopy_lane.cell_treatment.cell_line; - var collection_id= microscopy_lane.cell_treatment.treatment_list.first.collection_id; - var drug_id = microscopy_lane.cell_treatment.treatment_list.first.drug_list.list[0].drug_id; - var slide_type = microscopy_lane.kind; - var conditions = microscopy_lane.slide_conditions; - var imgs = []; - var isFound = false; - var max; - var index, alreadySelected, number_of_comparisons; - var slide_array=[]; - var parser = model.slide; + var microscopy_lane = state.microscopy_lane; + var cell_line = microscopy_lane.cell_treatment.cell_line; + var collection_id = microscopy_lane.cell_treatment.treatment_list.first.collection_id; + var drug_id = microscopy_lane.cell_treatment.treatment_list.first.drug_list.list[0].drug_id; + var slide_type = microscopy_lane.kind; + var conditions = microscopy_lane.slide_conditions; + var imgs = []; + var isFound = false; + var max; + var index; + var alreadySelected; + var number_of_comparisons; + var slide_array = []; + var parser = model.slide; - if (parser.parser_simple) { + if (parser.parser_simple) { - var micro_state = { - kind: function (str) { - return str == slide_type; - }, - collection_id: function (str) { - return str == collection_id; - }, - drug_id: function (str) { - return str == drug_id; - }, - cell_line: function (str) { - return str == cell_line; - }, - conditions: function (str) { - return str == conditions; + var micro_state = { + kind: function(str) { + return str == slide_type; + }, + collection_id: function(str) { + return str == collection_id; + }, + drug_id: function(str) { + return str == drug_id; + }, + cell_line: function(str) { + return str == cell_line; + }, + conditions: function(str) { + return str == conditions; + } + }; + _.each(parser.parser_simple, function(rule) { + var matches = true; + _.each(rule.match, function(property) { + if (micro_state[property]) { + matches &= micro_state[property](rule[property]); + } else { + console.info("UNDEFINED PROPERTY: " + property); + } + }); + if (!isFound) { + if (matches) { + if (template.slide_parser) { + max = template.slide_parser[collection_id][slide_type][conditions].length; + } else { + max = rule.imgs_hash.length; + } + number_of_comparisons = 0; + do { + /*Math.random returns num in [0,1) so no need to worry about subtracting 1 from index*/ + index = Math.floor(Math.random() * (max)); + if (template.slide_parser) { + slide_array = template.slide_parser[collection_id][slide_type][conditions][index]; + } else { + slide_array = rule.imgs_hash[index]; + for (var x = 0; x < slide_array.length; x++) { + if (!slide_array[x].hasOwnProperty('mag')) { + slide_array[x].mag = "N/A" } - }; - _.each(parser.parser_simple, function (rule) { - var matches = true; - _.each(rule.match, function (property) { - if (micro_state[property]) { - matches &= micro_state[property](rule[property]); - } else { - console.info("UNDEFINED PROPERTY: " + property); - } - }); - if (!isFound) { - if (matches) { - if (template.slide_parser) { - max = template.slide_parser[collection_id][slide_type][conditions].length; - } else { - max = rule.imgs_hash.length; - } - number_of_comparisons = 0; - do { - /*Math.random returns num in [0,1) so no need to worry about subtracting 1 from index*/ - index = Math.floor(Math.random() * (max)); - if (template.slide_parser) { - slide_array = template.slide_parser[collection_id][slide_type][conditions][index]; - } else { - slide_array = rule.imgs_hash[index]; - for( var x= 0; x < slide_array.length; x++){ - if(!slide_array[x].hasOwnProperty('mag')){ - slide_array[x].mag = "N/A" - } - } - } + } + } - alreadySelected = false; - _.each(slide_array, function (x) { - if (_.contains(hash_list, x.hash)) { - alreadySelected = true; - } - }); - number_of_comparisons += 1; - } while (alreadySelected && number_of_comparisons < max); - imgs = slide_array; - isFound = true; - } - } + alreadySelected = false; + _.each(slide_array, function(x) { + if (_.contains(hash_list, x.hash)) { + alreadySelected = true; + } }); - state.slides = imgs; - state.slide_type = slide_type; - }else if (parser.complex_parser){ - var micro_state = { - drug_id: function (drug_list) { - return drug_list.indexOf(drug_id) > -1; - }, - cell_line: function (str) { - //make it a list and you compare to each one in list not just str - return str == cell_line; - } - }; - - _.each(parser.complex_parser, function (rule) { - if (rule.match.length == 0) { - img_str = '../images/microscopy/black.jpg' - } - else { - var matches = true; - _.each(rule.match, function (property) { - if (micro_state[property]) { - matches &= micro_state[property](rule[property]); - }else { - console.info("UNDEFINED PROPERTY: " + property); - } - }); - if(!isFound){ - if(matches){ - var phenotype = rule.phenotype; - max = template.slide_parser[collection_id][slide_type][conditions][phenotype].length; - number_of_comparisons = 0; - do{ - index = Math.floor(Math.random() * (max - 1 + 1)); - slide_array = template.slide_parser[collection_id][slide_type][conditions][phenotype][index]; - alreadySelected = false; - _.each(slide_array, function(x){if(_.contains(hash_list, x.hash)) alreadySelected=true; - }); - number_of_comparisons=number_of_comparisons+1; - }while(alreadySelected && number_of_comparisons < max); - imgs=slide_array; - isFound = true; - } - } - } - }); - state.slides = imgs; - state.slide_type = slide_type; - } - else if(parser.conditions_parser){ - var micro_state = { - drug_id: function (arr) { - var hasVal = false; - for(var x = 0; x < arr.length; x++){ - if(arr[x] == drug_id) - hasVal = true; - } - return hasVal; - }, - cell_line: function (str) { - //make it a list and you compare to each one in list not just str - return str == cell_line; - }, - conditions: function (str) { - return str == conditions; - } - }; - _.each(parser.conditions_parser, function (rule) { - if (rule.match.length == 0) { - img_str = '../images/microscopy/black.jpg' - } - else { - var matches = true; - _.each(rule.match, function (property) { - if (micro_state[property]) { - matches &= micro_state[property](rule[property]); - }else { - console.info("UNDEFINED PROPERTY: " + property); - } - }); - if(!isFound){ - if(matches){ - var phenotype = rule.phenotype; - var max = template.slide_parser[collection_id][slide_type][conditions][phenotype].length; - var index = Math.floor(Math.random() * (max - 1 + 1)); - var slide_array = template.slide_parser[collection_id][slide_type][conditions][phenotype][index]; - var alreadySelected = false; - _.each(slide_array, function(x){if(_.contains(hash_list, x.hash)) alreadySelected=true; - }); - var number_of_comparisons = 0; - while(alreadySelected && number_of_comparisons < max){ - console.info(number_of_comparisons); - index = Math.floor(Math.random() * (max - 1 + 1)); - slide_array = template.slide_parser[collection_id][slide_type][conditions][phenotype][index]; - alreadySelected = false; - _.each(slide_array, function(x){if(_.contains(hash_list, x.hash)) alreadySelected=true; - }); - number_of_comparisons=number_of_comparisons+1; - } - imgs=slide_array; - isFound = true; - } - } - } - }); - state.slides = imgs; - state.slide_type = slide_type; - - } - } - } + number_of_comparisons += 1; + } while (alreadySelected && number_of_comparisons < max); + imgs = slide_array; + isFound = true; + } + } + }); + state.slides = imgs; + state.slide_type = slide_type; + } else if (parser.complex_parser) { + var micro_state = { + drug_id: function(drug_list) { + return drug_list.indexOf(drug_id) > -1; + }, + cell_line: function(str) { + //make it a list and you compare to each one in list not just str + return str == cell_line; + } + }; - if(scb.utils.isDefined(model.is_ab)){ - self.slide = function(state) { - var kind = state.microscopy_lane.kind; - var conditions = state.microscopy_lane.slide_conditions; - var identifier = state.microscopy_lane.cell_treatment.identifier; - var key = kind+"%%"+conditions+"%%" + identifier; - var image_state = model[key]; - state.slides = image_state['slides']; - state.slide_type = image_state['slide_type']; + _.each(parser.complex_parser, function(rule) { + if (rule.match.length == 0) { + img_str = '../images/microscopy/black.jpg' + } else { + var matches = true; + _.each(rule.match, function(property) { + if (micro_state[property]) { + matches &= micro_state[property](rule[property]); + } else { + console.info("UNDEFINED PROPERTY: " + property); + } + }); + if (!isFound) { + if (matches) { + var phenotype = rule.phenotype; + max = template.slide_parser[collection_id][slide_type][conditions][phenotype].length; + number_of_comparisons = 0; + do { + index = Math.floor(Math.random() * (max - 1 + 1)); + slide_array = template.slide_parser[collection_id][slide_type][conditions][phenotype][index]; + alreadySelected = false; + _.each(slide_array, function(x) { + if (_.contains(hash_list, x.hash)) { + alreadySelected = true; + } + }); + number_of_comparisons = number_of_comparisons + 1; + } while (alreadySelected && number_of_comparisons < max); + imgs = slide_array; + isFound = true; + } } - } + } + }); + state.slides = imgs; + state.slide_type = slide_type; + } else if (parser.conditions_parser) { + var micro_state = { + drug_id: function(arr) { + var hasVal = false; + for (var x = 0; x < arr.length; x++) { + if (arr[x] == drug_id) { + hasVal = true; + } + } + return hasVal; + }, + cell_line: function(str) { + //make it a list and you compare to each one in list not just str + return str == cell_line; + }, + conditions: function(str) { + return str == conditions; + } + }; + _.each(parser.conditions_parser, function(rule) { + if (rule.match.length == 0) { + img_str = '../images/microscopy/black.jpg' + } else { + var matches = true; + _.each(rule.match, function(property) { + if (micro_state[property]) { + matches &= micro_state[property](rule[property]); + } else { + console.info("UNDEFINED PROPERTY: " + property); + } + }); + if (!isFound) { + if (matches) { + var phenotype = rule.phenotype; + var max = template.slide_parser[collection_id][slide_type][conditions][phenotype].length; + var index = Math.floor(Math.random() * (max - 1 + 1)); + var slide_array = template.slide_parser[collection_id][slide_type][conditions][phenotype][index]; + var alreadySelected = false; + _.each(slide_array, function(x) { + if (_.contains(hash_list, x.hash)) { + alreadySelected = true; + } + }); + var number_of_comparisons = 0; + while (alreadySelected && number_of_comparisons < max) { + console.info(number_of_comparisons); + index = Math.floor(Math.random() * (max - 1 + 1)); + slide_array = template.slide_parser[collection_id][slide_type][conditions][phenotype][index]; + alreadySelected = false; + _.each(slide_array, function(x) { + if (_.contains(hash_list, x.hash)) { + alreadySelected = true; + } + }); + number_of_comparisons = number_of_comparisons + 1; + } + imgs = slide_array; + isFound = true; + } + } + } + }); + state.slides = imgs; + state.slide_type = slide_type; - self.compute = function (state) { - return self.slide(state); + } } + } + + if (scb.utils.isDefined(model.is_ab)) { + self.slide = function(state) { + var kind = state.microscopy_lane.kind; + var conditions = state.microscopy_lane.slide_conditions; + var identifier = state.microscopy_lane.cell_treatment.identifier; + var key = kind + "%%" + conditions + "%%" + identifier; + var image_state = model[key]; + state.slides = image_state['slides']; + state.slide_type = image_state['slide_type']; + } + } + + self.compute = function(state) { + return self.slide(state); + } } \ No newline at end of file diff --git a/html_app/components/ModelFactory.js b/html_app/components/ModelFactory.js index 955b49cf..50282872 100644 --- a/html_app/components/ModelFactory.js +++ b/html_app/components/ModelFactory.js @@ -1,15 +1,15 @@ scb.components = scb.components || {}; scb.components.ModelFactory = function scb_components_ModelFactory(template) { - var self = this; + var self = this; - if(scb.utils.isDefined(template.model.western_blot)) { - self.western_blot = new scb.components.WesternBlotModelFactory(template.model.western_blot, template); - } - if(scb.utils.isDefined(template.model.facs)) { - self.facs = new scb.components.FACSModelFactory(template.model.facs, template); - } - if(scb.utils.isDefined(template.model.microscopy)) { - self.microscopy = new scb.components.MicroscopyModelFactory(template.model.microscopy, template); - } + if (scb.utils.isDefined(template.model.western_blot)) { + self.western_blot = new scb.components.WesternBlotModelFactory(template.model.western_blot, template); + } + if (scb.utils.isDefined(template.model.facs)) { + self.facs = new scb.components.FACSModelFactory(template.model.facs, template); + } + if (scb.utils.isDefined(template.model.microscopy)) { + self.microscopy = new scb.components.MicroscopyModelFactory(template.model.microscopy, template); + } }; \ No newline at end of file diff --git a/html_app/components/WesternBlotCanvas.js b/html_app/components/WesternBlotCanvas.js index ddf5864c..6283c371 100644 --- a/html_app/components/WesternBlotCanvas.js +++ b/html_app/components/WesternBlotCanvas.js @@ -1,345 +1,340 @@ -if (typeof (scb.components ) == 'undefined') { - scb.components = {}; +if (typeof (scb.components) == 'undefined') { + scb.components = {}; } scb.components.WesternBlot = function scb_components_WesternBlot(state, context) { - var self = this; + var self = this; - self.initialize_bias = function () { - var background = []; - var height = 2000; - var up = 0; - var down = 0; - var dump_factor_slope = -.2; - var dump_factor_intercept = 0.6; - var rnd_multiplier = 32; - var rnd_trim = .007; + self.initialize_bias = function() { + var background = []; + var height = 2000; + var up = 0; + var down = 0; + var dump_factor_slope = -.2; + var dump_factor_intercept = 0.6; + var rnd_multiplier = 32; + var rnd_trim = .007; - // clear background array - for (var h = 0; h < height; h++) { - background[h] = 0; - } - - if (_.find(context.template.primary_anti_body[state.gel.primary_anti_body].secondary, function (e) { - return e == state.gel.secondary_anti_body; - })) { + // clear background array + for (var h = 0; h < height; h++) { + background[h] = 0; + } - // move background up or down - var trigger = 0; - for (var h = 50; h < height; h++) { - var rnd2 = Math.random(); - var rnd3 = Math.random(); - if (rnd2 < rnd_trim || rnd3 < rnd_trim) { - trigger++; - if (trigger > 2) { - rnd_trim = rnd_trim * .5; - } - } - up = up * (dump_factor_intercept + Math.random() * dump_factor_slope) + (rnd2 < rnd_trim ? rnd_multiplier : 0 ) + Math.random() * 2 / 3; - down = down * (dump_factor_intercept + Math.random() * dump_factor_slope) + (rnd3 < rnd_trim ? rnd_multiplier : 0 ) + Math.random() * 2 / 3; - background[h] += up; - background[height - h] += down; - } + if (_.find(context.template.primary_anti_body[state.gel.primary_anti_body].secondary, function(e) { + return e == state.gel.secondary_anti_body; + })) { + // move background up or down + var trigger = 0; + for (var h = 50; h < height; h++) { + var rnd2 = Math.random(); + var rnd3 = Math.random(); + if (rnd2 < rnd_trim || rnd3 < rnd_trim) { + trigger++; + if (trigger > 2) { + rnd_trim = rnd_trim * .5; + } } - var lane_yslope = []; - var lanes = state.lanes_length; - var yyslope = (Math.random() - .5) * 2; - var yslope = yyslope; - var middle = 5 + Math.round(Math.random() * 3); - if (Math.random() < .5) { - for (var lane = 0; lane < lanes; lane++) { - yslope = (lane - middle) * (lane - middle) * yyslope / 400; - yslope = yslope > .04 ? yslope * .75 : yslope; - yslope = yslope < -.04 ? yslope * .75 : yslope; - lane_yslope[lane] = yslope; - } - } else { - for (var lane = 0; lane < lanes; lane++) { - yslope = (lane - middle) * (lane - middle) * yyslope / 400 * ((lane - middle) < 0 ? -1 : 1 ); - yslope = yslope > .04 ? yslope * .75 : yslope; - yslope = yslope < -.04 ? yslope * .75 : yslope; - lane_yslope[lane] = yslope; - } - } - - self.background = background; - self.lane_yslope = lane_yslope; + up = up * (dump_factor_intercept + Math.random() * dump_factor_slope) + (rnd2 < rnd_trim ? rnd_multiplier : 0) + Math.random() * 2 / 3; + down = down * (dump_factor_intercept + Math.random() * dump_factor_slope) + (rnd3 < rnd_trim ? rnd_multiplier : 0) + Math.random() * 2 / 3; + background[h] += up; + background[height - h] += down; + } } + var lane_yslope = []; + var lanes = state.lanes_length; + var yyslope = (Math.random() - .5) * 2; + var yslope = yyslope; + var middle = 5 + Math.round(Math.random() * 3); + if (Math.random() < .5) { + for (var lane = 0; lane < lanes; lane++) { + yslope = (lane - middle) * (lane - middle) * yyslope / 400; + yslope = yslope > .04 ? yslope * .75 : yslope; + yslope = yslope < -.04 ? yslope * .75 : yslope; + lane_yslope[lane] = yslope; + } + } else { + for (var lane = 0; lane < lanes; lane++) { + yslope = (lane - middle) * (lane - middle) * yyslope / 400 * ((lane - middle) < 0 ? -1 : 1); + yslope = yslope > .04 ? yslope * .75 : yslope; + yslope = yslope < -.04 ? yslope * .75 : yslope; + lane_yslope[lane] = yslope; + } + } - self.build_one_tab = function (state) { - var tab = {}; - tab.exposure = state.time; - tab.name = scb.Utils.print_time(state.time); - tab.gel = state.gel.id; + self.background = background; + self.lane_yslope = lane_yslope; - tab.lanes = []; - var lanes_list = state.gel.marks; - for (var lane_index in lanes_list) { - var lane = {}; - var lane_item = lanes_list[lane_index]; - lane.marks = []; - for (var mark_index in lane_item.marks) { - var mark = {}; - //TODO: need marks - var sample_mark = lane_item.marks[mark_index]; - mark.position = sample_mark.weight; - mark.intensity = 0.04 * sample_mark.intensity * tab.exposure * parseFloat(lane_item.amount_of_protein_loaded); - lane.marks.push(mark); - console.info("Mark intensity: " + mark.intensity + " " + tab.exposure + " " + sample_mark.intensity); - } - if (_.find(context.template.primary_anti_body[state.gel.primary_anti_body].secondary, function (e) { - return e == state.gel.secondary_anti_body; - })) { + } - var bg_marks = context.template.primary_anti_body[state.gel.primary_anti_body].marks; - for (var mark_index in bg_marks) { - var mark = {}; - //TODO: need marks - var sample_mark = bg_marks[mark_index]; - mark.position = sample_mark.weight; - mark.intensity = 0.04 * sample_mark.intensity * tab.exposure * parseFloat(lane_item.amount_of_protein_loaded); - lane.marks.push(mark); - console.info("BG Mark intensity: " + mark.intensity + " " + tab.exposure + " " + sample_mark.intensity); - } - } - var consolidated_lane = {} ; - _.each( lane.marks , function(elem) { - if( consolidated_lane[elem.position] ) - { - consolidated_lane[elem.position] += elem.intensity; - } - else - { - consolidated_lane[elem.position] = elem.intensity; - } - }); - lane.marks = []; - _.each( consolidated_lane , function( value, key ) { - lane.marks.push( { - position: parseFloat(key), - intensity: value - }); - }); - tab.lanes.push(lane); - } - var round_number = 100000; - for(var index = 0 ; index < self.background.length; index++){ - self.background[index] = Math.round(self.background[index] * round_number)/round_number; - } - tab.background = self.background; - for(var index = 0 ; index < self.lane_yslope.length; index++){ - self.lane_yslope[index] = Math.round(self.lane_yslope[index] * round_number)/round_number; - } - tab.lane_yslope = self.lane_yslope; + self.build_one_tab = function(state) { + var tab = {}; + tab.exposure = state.time; + tab.name = scb.Utils.print_time(state.time); + tab.gel = state.gel.id; - self.tab = tab; - return tab; + tab.lanes = []; + var lanes_list = state.gel.marks; + for (var lane_index in lanes_list) { + var lane = {}; + var lane_item = lanes_list[lane_index]; + lane.marks = []; + for (var mark_index in lane_item.marks) { + var mark = {}; + //TODO: need marks + var sample_mark = lane_item.marks[mark_index]; + mark.position = sample_mark.weight; + mark.intensity = 0.04 * sample_mark.intensity * tab.exposure * parseFloat(lane_item.amount_of_protein_loaded); + lane.marks.push(mark); + console.info("Mark intensity: " + mark.intensity + " " + tab.exposure + " " + sample_mark.intensity); + } + if (_.find(context.template.primary_anti_body[state.gel.primary_anti_body].secondary, function(e) { + return e == state.gel.secondary_anti_body; + })) { + + var bg_marks = context.template.primary_anti_body[state.gel.primary_anti_body].marks; + for (var mark_index in bg_marks) { + var mark = {}; + //TODO: need marks + var sample_mark = bg_marks[mark_index]; + mark.position = sample_mark.weight; + mark.intensity = 0.04 * sample_mark.intensity * tab.exposure * parseFloat(lane_item.amount_of_protein_loaded); + lane.marks.push(mark); + console.info("BG Mark intensity: " + mark.intensity + " " + tab.exposure + " " + sample_mark.intensity); + } + } + var consolidated_lane = {}; + _.each(lane.marks, function(elem) { + if (consolidated_lane[elem.position]) { + consolidated_lane[elem.position] += elem.intensity; + } else { + consolidated_lane[elem.position] = elem.intensity; + } + }); + lane.marks = []; + _.each(consolidated_lane, function(value, key) { + lane.marks.push({ + position: parseFloat(key), + intensity: value + }); + }); + tab.lanes.push(lane); + } + var round_number = 100000; + for (var index = 0; index < self.background.length; index++) { + self.background[index] = Math.round(self.background[index] * round_number) / round_number; } + tab.background = self.background; + for (var index = 0; index < self.lane_yslope.length; index++) { + self.lane_yslope[index] = Math.round(self.lane_yslope[index] * round_number) / round_number; + } + tab.lane_yslope = self.lane_yslope; - self.paint_blot = function (canvas_id, tab) { + self.tab = tab; + return tab; + } - var LANE_OFFSET_0 = 15.25; //14.50; - var LANE_OFFSET_0A = 15.0; - var LANE_OFFSET_1 = .12 + .75; - var LANE_OFFSET_1A = .15 + .75; - var LANE_OFFSET_2 = .88 + .75; - var LANE_OFFSET_2A = .85 + .75; + self.paint_blot = function(canvas_id, tab) { - var canvas = document.getElementById(canvas_id); - var width = canvas.width; - var height = canvas.height; - if (width != canvas.clientWidth) { - canvas.width = canvas.clientWidth; - width = canvas.width; - } - if (height != canvas.clientHeight) { - canvas.height = canvas.clientHeight; - height = canvas.height; - } + var LANE_OFFSET_0 = 15.25; //14.50; + var LANE_OFFSET_0A = 15.0; + var LANE_OFFSET_1 = .12 + .75; + var LANE_OFFSET_1A = .15 + .75; + var LANE_OFFSET_2 = .88 + .75; + var LANE_OFFSET_2A = .85 + .75; - var g = canvas.getContext('2d'); - self.clear_canvas(canvas, width, height, g); - g.strokeStyle = '#ffffff'; - g.shadowColor = '#ffffff'; + var canvas = document.getElementById(canvas_id); + var width = canvas.width; + var height = canvas.height; + if (width != canvas.clientWidth) { + canvas.width = canvas.clientWidth; + width = canvas.width; + } + if (height != canvas.clientHeight) { + canvas.height = canvas.clientHeight; + height = canvas.height; + } - var lanes = 15; - var lane_width = width / (lanes + 1); - lanes = tab.lanes.length > 15 ? lanes : tab.lanes.length; + var g = canvas.getContext('2d'); + self.clear_canvas(canvas, width, height, g); + g.strokeStyle = '#ffffff'; + g.shadowColor = '#ffffff'; - var background = tab.background; - var lane_yslope = tab.lane_yslope; + var lanes = 15; + var lane_width = width / (lanes + 1); + lanes = tab.lanes.length > 15 ? lanes : tab.lanes.length; - // paint background lane - yslope_offset = {}; - var exposure = parseInt(tab.exposure); - if (exposure < 1) { - exposure = 1; - } - for (var lane = 0; lane < lanes; lane++) { - var yslope = lane_yslope[lane]; - yslope_offset[lane] = yslope; - // for(var h = 0; h < height; h++) { - // var v = 255 - 4 - Math.round(background[h + xoffset] * Math.log(exposure / 50)); - // var v2 = 255 - Math.round(background[h + xoffset] * 8); - // var color = 'rgb(' + v + ',' + v + ',' + v + ')'; - // var scolor = 'rgb(' + v2 + ',' + v2 + ',' + v2 + ')'; - // - // g.strokeStyle = color; - // g.shadowColor = scolor; - // g.shadowBlur = Math.round(Math.log(exposure / 20)); - // g.lineWidth = 2; - // - // g.beginPath(); - // g.moveTo(lane_width * (lane + LANE_OFFSET_1), h); - // g.lineTo(lane_width * (lane + LANE_OFFSET_2), h + yslope); - // g.closePath(); - // g.stroke(); - // // g.fillRect(lane_width * (lane + .15), h, lane_width * .7, 1); - // } - } + var background = tab.background; + var lane_yslope = tab.lane_yslope; + + // paint background lane + yslope_offset = {}; + var exposure = parseInt(tab.exposure); + if (exposure < 1) { + exposure = 1; + } + for (var lane = 0; lane < lanes; lane++) { + var yslope = lane_yslope[lane]; + yslope_offset[lane] = yslope; + // for(var h = 0; h < height; h++) { + // var v = 255 - 4 - Math.round(background[h + xoffset] * Math.log(exposure / 50)); + // var v2 = 255 - Math.round(background[h + xoffset] * 8); + // var color = 'rgb(' + v + ',' + v + ',' + v + ')'; + // var scolor = 'rgb(' + v2 + ',' + v2 + ',' + v2 + ')'; + // + // g.strokeStyle = color; + // g.shadowColor = scolor; + // g.shadowBlur = Math.round(Math.log(exposure / 20)); + // g.lineWidth = 2; + // + // g.beginPath(); + // g.moveTo(lane_width * (lane + LANE_OFFSET_1), h); + // g.lineTo(lane_width * (lane + LANE_OFFSET_2), h + yslope); + // g.closePath(); + // g.stroke(); + // // g.fillRect(lane_width * (lane + .15), h, lane_width * .7, 1); + // } + } + var h = 10; + if (tab.exposure != 0) { + g.save(); + var yoffset = 0; + var yoffset_next = 0; + for (var lane = 0; lane < lanes; lane++) { var h = 10; - if (tab.exposure != 0) { - g.save(); - var yoffset = 0; - var yoffset_next = 0; - for (var lane = 0; lane < lanes; lane++) { - var h = 10; - g.lineCap = 'round'; - g.lineJoin = 'miter'; - g.shadowColor = '#b0b0b0'; - g.shadowBlur = 5; + g.lineCap = 'round'; + g.lineJoin = 'miter'; + g.shadowColor = '#b0b0b0'; + g.shadowBlur = 5; - var cnt = 0; - var blurs = tab.lanes[lane].marks; - var yslope = yslope_offset[lane]; - yoffset = yoffset_next; - yoffset_next = yoffset + yslope * lane_width; - for (var i = 0; i < blurs.length; i++) { - var blur = blurs[i].position; - var intensity = blurs[i].intensity; - cnt++; - if (intensity <= 0) { - continue; - } - // if(intensity < 10) { - // intensity = 12; - // } - if(state.gel.parent.parent.gel_type == '.10') - var blur_position = h + 26 / (blur + 10) * (height - h); - else if( state.gel.parent.parent.gel_type == '.12') - var blur_position = 930 *Math.pow(blur,-0.582); - else if (state.gel.parent.parent.gel_type == '.15') - var blur_position = 1385.1*Math.pow(blur,-0.765); - - - //var blur_position = h + 26 / (blur + 10) * (height - h); - var lineWidth = Math.log(intensity / 10); - g.strokeStyle = '#c0c0c0'; - g.shadowBlur = 2; - g.globalAlpha = 1; - if (lineWidth < .5) { - var alpha = 1; - alpha = intensity / 12; - g.globalAlpha = alpha; - console.info("ALPHA " + alpha + " " + g.strokeStyle); - g.shadowBlur = 0; - } - g.lineWidth = lineWidth > .25 ? lineWidth : .25; - console.info("DISPL " + blurs[i].intensity + " " + Math.log(intensity / 10) + " " + g.lineWidth); - g.beginPath(); - g.moveTo((lane_width * (lane + LANE_OFFSET_1A) - g.lineWidth / 2)-10, blur_position + yoffset); - g.lineTo((lane_width * (lane + LANE_OFFSET_2A) + g.lineWidth / 2)-10, blur_position + yoffset_next); - g.closePath(); - g.stroke(); - g.stroke(); - g.stroke(); - g.stroke(); - } - g.globalAlpha = 1; + var cnt = 0; + var blurs = tab.lanes[lane].marks; + var yslope = yslope_offset[lane]; + yoffset = yoffset_next; + yoffset_next = yoffset + yslope * lane_width; + for (var i = 0; i < blurs.length; i++) { + var blur = blurs[i].position; + var intensity = blurs[i].intensity; + cnt++; + if (intensity <= 0) { + continue; + } + // if(intensity < 10) { + // intensity = 12; + // } + if (state.gel.parent.parent.gel_type == '.10') { + var blur_position = h + 26 / (blur + 10) * (height - h); + } else if (state.gel.parent.parent.gel_type == '.12') { + var blur_position = 930 * Math.pow(blur, -0.582); + } else if (state.gel.parent.parent.gel_type == '.15') { + var blur_position = 1385.1 * Math.pow(blur, -0.765); + } - } - g.restore(); - } - g.save(); - g.strokeStyle = '#000000'; - g.lineWidth = .5; - g.shadowBlur = 0; - g.fillStyle = '#000000'; - self.h = h ; - self.height = height; - if (state.gel.parent.parent.marker_loaded) { - var weights = [10, 15, 20, 25, 37, 50, 75, 100, 150, 250]; - for (var weigth_index in weights) { - if(state.gel.parent.parent.gel_type == '.10' && weights[weigth_index]<=20){} - else - { - var weight = weights[weigth_index]; - var position = self.weight_to_position(weight); - // h + 26 / (weight + 10) * (height - h); - g.font="9px Arial"; - g.fillText("" + weight, lane_width * (LANE_OFFSET_0) +1, position + 3); - g.beginPath(); - g.moveTo((lane_width * (LANE_OFFSET_0) - g.lineWidth / 2)+1, position); - g.lineTo((lane_width * (LANE_OFFSET_0A) + g.lineWidth / 2)+1, position); - g.closePath(); - g.stroke(); - } - } - g.fillText("kDa", lane_width * (LANE_OFFSET_0), 10); -// for(var lane = 0; lane < lanes; lane++) { -// g.fillText("Lane " + (lane + 1), lane_width * (lane + LANE_OFFSET_1A ) - g.lineWidth / 2, 15); -// } + + //var blur_position = h + 26 / (blur + 10) * (height - h); + var lineWidth = Math.log(intensity / 10); + g.strokeStyle = '#c0c0c0'; + g.shadowBlur = 2; + g.globalAlpha = 1; + if (lineWidth < .5) { + var alpha = 1; + alpha = intensity / 12; + g.globalAlpha = alpha; + console.info("ALPHA " + alpha + " " + g.strokeStyle); + g.shadowBlur = 0; + } + g.lineWidth = lineWidth > .25 ? lineWidth : .25; + console.info("DISPL " + blurs[i].intensity + " " + Math.log(intensity / 10) + " " + g.lineWidth); + g.beginPath(); + g.moveTo((lane_width * (lane + LANE_OFFSET_1A) - g.lineWidth / 2) - 10, blur_position + yoffset); + g.lineTo((lane_width * (lane + LANE_OFFSET_2A) + g.lineWidth / 2) - 10, blur_position + yoffset_next); + g.closePath(); + g.stroke(); + g.stroke(); + g.stroke(); + g.stroke(); } - else { - // g.fillText("marker was not loaded", 5, 15); + g.globalAlpha = 1; + + } + g.restore(); + } + g.save(); + g.strokeStyle = '#000000'; + g.lineWidth = .5; + g.shadowBlur = 0; + g.fillStyle = '#000000'; + self.h = h ; + self.height = height; + if (state.gel.parent.parent.marker_loaded) { + var weights = [10, 15, 20, 25, 37, 50, 75, 100, 150, 250]; + for (var weigth_index in weights) { + if (state.gel.parent.parent.gel_type == '.10' && weights[weigth_index] <= 20) { + } else { + var weight = weights[weigth_index]; + var position = self.weight_to_position(weight); + // h + 26 / (weight + 10) * (height - h); + g.font = "9px Arial"; + g.fillText("" + weight, lane_width * (LANE_OFFSET_0) + 1, position + 3); + g.beginPath(); + g.moveTo((lane_width * (LANE_OFFSET_0) - g.lineWidth / 2) + 1, position); + g.lineTo((lane_width * (LANE_OFFSET_0A) + g.lineWidth / 2) + 1, position); + g.closePath(); + g.stroke(); } - g.restore(); + } + g.fillText("kDa", lane_width * (LANE_OFFSET_0), 10); + // for(var lane = 0; lane < lanes; lane++) { + // g.fillText("Lane " + (lane + 1), lane_width * (lane + LANE_OFFSET_1A ) - g.lineWidth / 2, 15); + // } + } else { + // g.fillText("marker was not loaded", 5, 15); } + g.restore(); + } - self.weight_to_position = function(weight) { - var h = self.h; - var height = self.height; - if(state.gel.parent.parent.gel_type == '.10') - var position = h + 26 / (weight + 10) * (height - h); - else if( state.gel.parent.parent.gel_type == '.12') - var position = 930 *Math.pow(weight,-0.582); - else if (state.gel.parent.parent.gel_type == '.15') - var position = 1385.1*Math.pow(weight,-0.765); - return position; + self.weight_to_position = function(weight) { + var h = self.h; + var height = self.height; + if (state.gel.parent.parent.gel_type == '.10') { + var position = h + 26 / (weight + 10) * (height - h); + } else if (state.gel.parent.parent.gel_type == '.12') { + var position = 930 * Math.pow(weight, -0.582); + } else if (state.gel.parent.parent.gel_type == '.15') { + var position = 1385.1 * Math.pow(weight, -0.765); } + return position; + } - self.position_to_weight = function(position) { - var h = self.h; - var height = self.height; - if( position != h ) - { - if(state.gel.parent.parent.gel_type == '.10') - var weight = 26 * (height-h)/(position-h) - 10; - else if( state.gel.parent.parent.gel_type == '.12') - var weight = Math.pow(930 /position,1/0.582); - else if (state.gel.parent.parent.gel_type == '.15') - var weight = Math.pow(1385.1/position,1/0.765); - return weight; - } - else - { - return "N/A"; - } + self.position_to_weight = function(position) { + var h = self.h; + var height = self.height; + if (position != h) { + if (state.gel.parent.parent.gel_type == '.10') { + var weight = 26 * (height - h) / (position - h) - 10; + } else if (state.gel.parent.parent.gel_type == '.12') { + var weight = Math.pow(930 / position, 1 / 0.582); + } else if (state.gel.parent.parent.gel_type == '.15') { + var weight = Math.pow(1385.1 / position, 1 / 0.765); + } + return weight; + } else { + return "N/A"; } + } - self.clear_canvas = function (canvas, width, height, g) { - g.clearRect(0, 0, width, height); - g.fillStyle = 'white'; - g.fillRect(0, 0, width, height); - g.fillStyle = '#ecedf3'; - g.fillRect(0, 0, width, height); - g.fillStyle = 'white'; - //g.fillRect(0, 0, width, 20); - g.fillRect(width - 22, 0, width, height); + self.clear_canvas = function(canvas, width, height, g) { + g.clearRect(0, 0, width, height); + g.fillStyle = 'white'; + g.fillRect(0, 0, width, height); + g.fillStyle = '#ecedf3'; + g.fillRect(0, 0, width, height); + g.fillStyle = 'white'; + //g.fillRect(0, 0, width, 20); + g.fillRect(width - 22, 0, width, height); - } + } } \ No newline at end of file diff --git a/html_app/components/WesternBlotModelFactory.js b/html_app/components/WesternBlotModelFactory.js index 75c90f4f..6121d9f8 100644 --- a/html_app/components/WesternBlotModelFactory.js +++ b/html_app/components/WesternBlotModelFactory.js @@ -1,371 +1,376 @@ scb.components = scb.components || {}; scb.components.WesternBlotModelFactory = function scb_components_WesternBlotModelFactory(model, template) { - var self = this; + var self = this; - function anti_body_match(primary_anti_body_array, gel, template) { - if (scb.utils.isDefined(primary_anti_body_array)) { - for (var i in primary_anti_body_array) { - var anti_body_id = primary_anti_body_array[i]; - if (anti_body_id == gel.primary_anti_body) { - var secondary_anti_bodies_array = template.primary_anti_body[gel.primary_anti_body].secondary; - if (_.find(secondary_anti_bodies_array, function (e) { - return e == gel.secondary_anti_body; - })) { - return true; - } - } - } - return false; - } else { + function anti_body_match(primary_anti_body_array, gel, template) { + if (scb.utils.isDefined(primary_anti_body_array)) { + for (var i in primary_anti_body_array) { + var anti_body_id = primary_anti_body_array[i]; + if (anti_body_id == gel.primary_anti_body) { + var secondary_anti_bodies_array = template.primary_anti_body[gel.primary_anti_body].secondary; + if (_.find(secondary_anti_bodies_array, function(e) { + return e == gel.secondary_anti_body; + })) { return true; + } } + } + return false; + } else { + return true; } + } - var keep; + var keep; - self.parser_ab = function (lane, gel, rules, lane_marks) { + self.parser_ab = function(lane, gel, rules, lane_marks) { - for (var rule_index in rules) { - var rule = rules[rule_index]; + for (var rule_index in rules) { + var rule = rules[rule_index]; + + if (rule.identifier == lane.cell_treatment.identifier) { + var rule_marks = rule.marks; + for (var rule_mark_index in rule_marks) { + var rule_mark = rule_marks[rule_mark_index]; + if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { + var intensity = rule_mark.intensity; + var update_mark = _.find(lane_marks, function(e) { + return e.weight == rule_mark.weight + }); + if (scb.utils.isDefined(update_mark)) { + update_mark.intensity += intensity; + } else { + lane_marks.push({ + weight: rule_mark.weight, + intensity: intensity + }); + } + } + } + } + } + } - if (rule.identifier == lane.cell_treatment.identifier) { - var rule_marks = rule.marks; - for (var rule_mark_index in rule_marks) { + if (scb.utils.isDefined(model.cyto)) { + self.cyto = function(lane, gel, lane_marks) { + if (lane.kind == 'whole' || lane.kind == 'cyto' || lane.kind == 'whole_cell') { + if (lane.id == 'marker') { + lane_marks.push({ + weight: 0, + intensity: 0 + }); + } + /* parser_1 is used only by __assigment_facs */ + else if (scb.utils.isDefined(model.cyto.parser_1)) { + var rules = model.cyto.parser_1; + for (var rule_index in rules) { + var rule = rules[rule_index]; + console.info("lane.cell_treatment.cell_line:" + lane.cell_treatment.cell_line); + console.info("rule.cell_line:" + rule.cell_line); + if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { + var treatments = lane.cell_treatment.treatment_list.list; + for (var treatment_index in treatments) { + var treatment = treatments[treatment_index]; + var drugs = treatment.drug_list.list; + var drug = _.find(drugs, function(d) { + return d.drug_id == rule.drug; + }); + var drug_concentration = drug ? parseFloat(template.concentrations[drug.concentration_id].value) : 0; + var drug_schedule = parseFloat(treatment.schedule_value); + var collection_schedule = parseFloat(lane.collection_schedule.schedule_value); + if (rule.transfer_function == 'linear_concentration_duration_with_max' && drug_concentration != 0) { + var exposure_time = collection_schedule - drug_schedule; + var rule_marks = rule.marks; + for (var rule_mark_index in rule_marks) { + var rule_mark = rule_marks[rule_mark_index]; + var intensity = rule_mark.intensity_slope * exposure_time + rule_mark.intensity_intercept; + if (scb.utils.isDefined(rule_mark.intensity_min) && (intensity < rule_mark.intensity_min)) { + intensity = rule_mark.intensity_min; + } + if (scb.utils.isDefined(rule_mark.intensity_max) && (intensity > rule_mark.intensity_max)) { + intensity = rule_mark.intensity_max; + } + var update_mark = _.find(lane_marks, function(e) { + return e.weight == rule_mark.weight + }); + if (scb.utils.isDefined(update_mark)) { + update_mark.intensity += intensity; + } else { + lane_marks.push({ + weight: rule_mark.weight, + intensity: intensity + }); + } + } + } + } + } + } + } // end parser_1 + else if (scb.utils.isDefined(model.cyto.parser_fixed)) { + var rules = model.cyto.parser_fixed; + for (var rule_index in rules) { + var rule = rules[rule_index]; + if (rule.transfer_function == 'static') { + if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { + treatments = lane.cell_treatment.treatment_list; + keep = true; + if (rule.drug && rule.drug != '*ANY*') { + /* Check if this lane has rule.drug_id */ + keep = treatments.first.drug_list.list[0].drug_id == rule.drug; + } + if (rule.temperature) { + var value = scb.utils.get(lane, ["cell_treatment", "treatment_list", "list", 0, "temperature"], null); + keep = keep && (rule.temperature == value); + } + if (rule.duration) { + var value = scb.utils.get(lane, ["cell_treatment", "treatment_list", "list", 0, "duration"], null); + keep = keep && (rule.duration == value || rule.duration == '*ANY*'); + } + if (keep) { + var rule_marks = rule.marks; + for (var rule_mark_index in rule_marks) { var rule_mark = rule_marks[rule_mark_index]; if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { - var intensity = rule_mark.intensity; - var update_mark = _.find(lane_marks, function (e) { - return e.weight == rule_mark.weight + var intensity = rule_mark.intensity; + var update_mark = _.find(lane_marks, function(e) { + return e.weight == rule_mark.weight + }); + if (scb.utils.isDefined(update_mark)) { + update_mark.intensity += intensity; + } else { + lane_marks.push({ + weight: rule_mark.weight, + intensity: intensity }); - if (scb.utils.isDefined(update_mark)) { + } + } + } + } + } + } else if (rule.transfer_function == 'delta') { + if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { + treatments = lane.cell_treatment.treatment_list.list; + /* Compares only one drug, I guess assuming that out of a list of + drugs at least one drug is unique per treatment */ + for (var treatment_index in treatments) { + var treatment = treatments[treatment_index]; + var drugs = treatment.drug_list.list; + var drug = _.find(drugs, function(d) { + return d.drug_id == rule.drug; + }); + var drug_concentration = drug ? parseFloat(template.concentrations[drug.concentration_id].value) : 0; + /* if rule.drug is ANY, set drug_concentration to any value >= cutoff*/ + drug_concentration = (rule.drug == '*ANY*') ? 1 : drug_concentration; + var marks_list = (drug_concentration >= rule.cutoff) ? rule.above_marks : rule.below_marks; + keep = true; + + if (rule.duration) { + var value = scb.utils.get(lane, ["cell_treatment", "treatment_list", "list", 0, "duration"], null); + keep = keep && (rule.duration == value || rule.duration == '*ANY*'); + } + if (scb.utils.isDefined(marks_list) && keep) { + + for (var mark_index in marks_list) { + var rule_mark = marks_list[mark_index]; + if (rule_mark) { + if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { + var intensity = rule_mark.intensity; + var update_mark = _.find(lane_marks, function(e) { + return e.weight == rule_mark.weight + }); + if (scb.utils.isDefined(update_mark)) { update_mark.intensity += intensity; - } else { + } else { lane_marks.push({ - weight: rule_mark.weight, - intensity: intensity + weight: rule_mark.weight, + intensity: intensity }); + } } + } } + } } + } } + } + } + //END parser Fixed + else if (scb.utils.isDefined(model.cyto.parser_ab)) { + var rules = model.cyto.parser_ab; + self.parser_ab(lane, rules, lane_marks); } + lane.marks = lane_marks; + } } - if (scb.utils.isDefined(model.cyto)) { - self.cyto = function (lane, gel, lane_marks) { - if (lane.kind == 'whole' || lane.kind == 'cyto' || lane.kind == 'whole_cell') { - if(lane.id == 'marker') - lane_marks.push({ weight: 0, intensity: 0}); - /* parser_1 is used only by __assigment_facs */ - else if (scb.utils.isDefined(model.cyto.parser_1)) { - var rules = model.cyto.parser_1; - for (var rule_index in rules) { - var rule = rules[rule_index]; - console.info("lane.cell_treatment.cell_line:" + lane.cell_treatment.cell_line); - console.info("rule.cell_line:" + rule.cell_line); - if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { - var treatments = lane.cell_treatment.treatment_list.list; - for (var treatment_index in treatments) { - var treatment = treatments[treatment_index]; - var drugs = treatment.drug_list.list; - var drug = _.find(drugs, function (d) { - return d.drug_id == rule.drug; - }); - var drug_concentration = drug ? parseFloat(template.concentrations[drug.concentration_id].value) : 0; - var drug_schedule = parseFloat(treatment.schedule_value); - var collection_schedule = parseFloat(lane.collection_schedule.schedule_value); - if (rule.transfer_function == 'linear_concentration_duration_with_max' && drug_concentration != 0) { - var exposure_time = collection_schedule - drug_schedule; - var rule_marks = rule.marks; - for (var rule_mark_index in rule_marks) { - var rule_mark = rule_marks[rule_mark_index]; - var intensity = rule_mark.intensity_slope * exposure_time + rule_mark.intensity_intercept; - if (scb.utils.isDefined(rule_mark.intensity_min) && (intensity < rule_mark.intensity_min)) { - intensity = rule_mark.intensity_min; - } - if (scb.utils.isDefined(rule_mark.intensity_max) && (intensity > rule_mark.intensity_max)) { - intensity = rule_mark.intensity_max; - } - var update_mark = _.find(lane_marks, function (e) { - return e.weight == rule_mark.weight - }); - if (scb.utils.isDefined(update_mark)) { - update_mark.intensity += intensity; - } else { - lane_marks.push({ - weight: rule_mark.weight, - intensity: intensity - }); - } - } - } - } - } + self.nuclear = function(lane, gel, lane_marks) { + if (lane.kind == 'whole' || lane.kind == 'nuclear' || lane.kind == 'whole_cell') { + if (lane.id == 'marker') { + lane_marks.push({ + weight: 0, + intensity: 0 + }); + } else if (scb.utils.isDefined(model.nuclear.parser_1)) { + var rules = model.nuclear.parser_1; + for (var rule_index in rules) { + var rule = rules[rule_index]; + console.info("lane.cell_treatment.cell_line:" + lane.cell_treatment.cell_line); + console.info("rule.cell_line:" + rule.cell_line); + if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { + var treatments = lane.cell_treatment.treatment_list.list; + for (var treatment_index in treatments) { + var treatment = treatments[treatment_index]; + var drugs = treatment.drug_list.list; + var drug = _.find(drugs, function(d) { + return d.drug_id == rule.drug; + }); + var drug_concentration = drug ? parseFloat(template.concentrations[drug.concentration_id].value) : 0; + var drug_schedule = parseFloat(treatment.schedule_value); + var collection_schedule = parseFloat(lane.collection_schedule.schedule_value); + if (rule.transfer_function == 'linear_concentration_duration_with_max' && drug_concentration != 0) { + var exposure_time = collection_schedule - drug_schedule; + var rule_marks = rule.marks; + for (var rule_mark_index in rule_marks) { + var rule_mark = rule_marks[rule_mark_index]; + var intensity = rule_mark.intensity_slope * exposure_time + rule_mark.intensity_intercept; + if (scb.utils.isDefined(rule_mark.intensity_min) && (intensity < rule_mark.intensity_min)) { + intensity = rule_mark.intensity_min; } - } // end parser_1 - else if (scb.utils.isDefined(model.cyto.parser_fixed)) { - var rules = model.cyto.parser_fixed; - for (var rule_index in rules) { - var rule = rules[rule_index]; - if (rule.transfer_function == 'static') { - if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { - treatments = lane.cell_treatment.treatment_list; - keep = true; - if(rule.drug && rule.drug != '*ANY*') { - /* Check if this lane has rule.drug_id */ - keep = treatments.first.drug_list.list[0].drug_id == rule.drug; - } - if (rule.temperature) { - var value = scb.utils.get(lane, ["cell_treatment", "treatment_list", "list", 0, "temperature"], null); - keep = keep && ( rule.temperature == value ); - } - if(rule.duration){ - var value = scb.utils.get(lane, ["cell_treatment", "treatment_list", "list", 0, "duration"], null); - keep = keep && ( rule.duration == value || rule.duration == '*ANY*'); - } - if (keep) { - var rule_marks = rule.marks; - for (var rule_mark_index in rule_marks) { - var rule_mark = rule_marks[rule_mark_index]; - if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { - var intensity = rule_mark.intensity; - var update_mark = _.find(lane_marks, function (e) { - return e.weight == rule_mark.weight - }); - if (scb.utils.isDefined(update_mark)) { - update_mark.intensity += intensity; - } else { - lane_marks.push({ - weight: rule_mark.weight, - intensity: intensity - }); - } - } - } - } - } - } else if (rule.transfer_function == 'delta') { - if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { - treatments = lane.cell_treatment.treatment_list.list; - /* Compares only one drug, I guess assuming that out of a list of - drugs at least one drug is unique per treatment */ - for (var treatment_index in treatments) { - var treatment = treatments[treatment_index]; - var drugs = treatment.drug_list.list; - var drug = _.find(drugs, function (d) { - return d.drug_id == rule.drug; - }); - var drug_concentration = drug ? parseFloat(template.concentrations[drug.concentration_id].value) : 0; - /* if rule.drug is ANY, set drug_concentration to any value >= cutoff*/ - drug_concentration=(rule.drug == '*ANY*')? 1 :drug_concentration; - var marks_list = (drug_concentration >= rule.cutoff) ? rule.above_marks : rule.below_marks; - keep = true; - - if(rule.duration){ - var value = scb.utils.get(lane, ["cell_treatment", "treatment_list", "list", 0, "duration"], null); - keep = keep && ( rule.duration == value || rule.duration == '*ANY*'); - } - if (scb.utils.isDefined(marks_list) && keep) { - - for (var mark_index in marks_list) { - var rule_mark = marks_list[mark_index]; - if (rule_mark) { - if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { - var intensity = rule_mark.intensity; - var update_mark = _.find(lane_marks, function (e) { - return e.weight == rule_mark.weight - }); - if (scb.utils.isDefined(update_mark)) { - update_mark.intensity += intensity; - } else { - lane_marks.push({ - weight: rule_mark.weight, - intensity: intensity - }); - } - } - } - } - } - } - } - } + if (scb.utils.isDefined(rule_mark.intensity_max) && (intensity > rule_mark.intensity_max)) { + intensity = rule_mark.intensity_max; } + var update_mark = _.find(lane_marks, function(e) { + return e.weight == rule_mark.weight + }); + if (scb.utils.isDefined(update_mark)) { + update_mark.intensity += intensity; + } else { + lane_marks.push({ + weight: rule_mark.weight, + intensity: intensity + }); + } + } } - //END parser Fixed - else if (scb.utils.isDefined(model.cyto.parser_ab)) { - var rules = model.cyto.parser_ab; - self.parser_ab(lane, rules, lane_marks); - } - lane.marks = lane_marks; + } } - } - - self.nuclear = function (lane, gel, lane_marks) { - if (lane.kind == 'whole' || lane.kind == 'nuclear' || lane.kind == 'whole_cell') { - if (lane.id == 'marker') - lane_marks.push({ weight: 0, intensity: 0}); - else if (scb.utils.isDefined(model.nuclear.parser_1)) { - var rules = model.nuclear.parser_1; - for (var rule_index in rules) { - var rule = rules[rule_index]; - console.info("lane.cell_treatment.cell_line:" + lane.cell_treatment.cell_line); - console.info("rule.cell_line:" + rule.cell_line); - if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { - var treatments = lane.cell_treatment.treatment_list.list; - for (var treatment_index in treatments) { - var treatment = treatments[treatment_index]; - var drugs = treatment.drug_list.list; - var drug = _.find(drugs, function (d) { - return d.drug_id == rule.drug; - }); - var drug_concentration = drug ? parseFloat(template.concentrations[drug.concentration_id].value) : 0; - var drug_schedule = parseFloat(treatment.schedule_value); - var collection_schedule = parseFloat(lane.collection_schedule.schedule_value); - if (rule.transfer_function == 'linear_concentration_duration_with_max' && drug_concentration != 0) { - var exposure_time = collection_schedule - drug_schedule; - var rule_marks = rule.marks; - for (var rule_mark_index in rule_marks) { - var rule_mark = rule_marks[rule_mark_index]; - var intensity = rule_mark.intensity_slope * exposure_time + rule_mark.intensity_intercept; - if (scb.utils.isDefined(rule_mark.intensity_min) && (intensity < rule_mark.intensity_min)) { - intensity = rule_mark.intensity_min; - } - if (scb.utils.isDefined(rule_mark.intensity_max) && (intensity > rule_mark.intensity_max)) { - intensity = rule_mark.intensity_max; - } - var update_mark = _.find(lane_marks, function (e) { - return e.weight == rule_mark.weight - }); - if (scb.utils.isDefined(update_mark)) { - update_mark.intensity += intensity; - } else { - lane_marks.push({ - weight: rule_mark.weight, - intensity: intensity - }); - } - } - } - } - } + } + } // end parser_1 + else if (scb.utils.isDefined(model.nuclear.parser_fixed)) { + var rules = model.nuclear.parser_fixed; + for (var rule_index in rules) { + var rule = rules[rule_index]; + if (rule.transfer_function == 'static') { + if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { + var keep = true; + if (rule.temperature) { + var value = scb.utils.get(lane, ["cell_treatment", "treatment_list", "list", 0, "temperature"], null); + keep = (rule.temperature == value); + } + if (keep) { + var rule_marks = rule.marks; + for (var rule_mark_index in rule_marks) { + var rule_mark = rule_marks[rule_mark_index]; + if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { + var intensity = rule_mark.intensity; + var update_mark = _.find(lane_marks, function(e) { + return e.weight == rule_mark.weight + }); + if (scb.utils.isDefined(update_mark)) { + update_mark.intensity += intensity; + } else { + lane_marks.push({ + weight: rule_mark.weight, + intensity: intensity + }); + } } - } // end parser_1 - else if (scb.utils.isDefined(model.nuclear.parser_fixed)) { - var rules = model.nuclear.parser_fixed; - for (var rule_index in rules) { - var rule = rules[rule_index]; - if (rule.transfer_function == 'static') { - if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { - var keep = true; - if (rule.temperature) { - var value = scb.utils.get(lane, ["cell_treatment", "treatment_list", "list", 0, "temperature"], null); - keep = ( rule.temperature == value ); - } - if (keep) { - var rule_marks = rule.marks; - for (var rule_mark_index in rule_marks) { - var rule_mark = rule_marks[rule_mark_index]; - if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { - var intensity = rule_mark.intensity; - var update_mark = _.find(lane_marks, function (e) { - return e.weight == rule_mark.weight - }); - if (scb.utils.isDefined(update_mark)) { - update_mark.intensity += intensity; - } else { - lane_marks.push({ - weight: rule_mark.weight, - intensity: intensity - }); - } - } - } - } - } - } else if (rule.transfer_function == 'delta') { - if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { - var treatments = lane.cell_treatment.treatment_list.list; - for (var treatment_index in treatments) { - var treatment = treatments[treatment_index]; - var drugs = treatment.drug_list.list; - var drug = _.find(drugs, function (d) { - return d.drug_id == rule.drug; - }); - var drug_concentration = drug ? parseFloat(template.concentrations[drug.concentration_id].value) : 0; - var marks_list = (drug_concentration >= rule.cutoff) ? rule.above_marks : rule.below_marks; - if (scb.utils.isDefined(marks_list)) { + } + } + } + } else if (rule.transfer_function == 'delta') { + if (lane.cell_treatment.cell_line == rule.cell_line || rule.cell_line == '*ANY*') { + var treatments = lane.cell_treatment.treatment_list.list; + for (var treatment_index in treatments) { + var treatment = treatments[treatment_index]; + var drugs = treatment.drug_list.list; + var drug = _.find(drugs, function(d) { + return d.drug_id == rule.drug; + }); + var drug_concentration = drug ? parseFloat(template.concentrations[drug.concentration_id].value) : 0; + var marks_list = (drug_concentration >= rule.cutoff) ? rule.above_marks : rule.below_marks; + if (scb.utils.isDefined(marks_list)) { - for (var mark_index in marks_list) { - var rule_mark = marks_list[mark_index]; - if (rule_mark) { - if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { - var intensity = rule_mark.intensity; - var update_mark = _.find(lane_marks, function (e) { - return e.weight == rule_mark.weight - }); - if (scb.utils.isDefined(update_mark)) { - update_mark.intensity += intensity; - } else { - lane_marks.push({ - weight: rule_mark.weight, - intensity: intensity - }); - } - } - } - } - } - } - } + for (var mark_index in marks_list) { + var rule_mark = marks_list[mark_index]; + if (rule_mark) { + if (anti_body_match(rule_mark.primary_anti_body, gel, template)) { + var intensity = rule_mark.intensity; + var update_mark = _.find(lane_marks, function(e) { + return e.weight == rule_mark.weight + }); + if (scb.utils.isDefined(update_mark)) { + update_mark.intensity += intensity; + } else { + lane_marks.push({ + weight: rule_mark.weight, + intensity: intensity + }); + } } + } } + } } - //END parser Fixed - else if (scb.utils.isDefined(model.nuclear.parser_ab)) { - var rules = model.nuclear.parser_ab; - self.parser_ab(lane, rules, lane_marks); - } - lane.marks = lane_marks; + } } + } } - + //END parser Fixed + else if (scb.utils.isDefined(model.nuclear.parser_ab)) { + var rules = model.nuclear.parser_ab; + self.parser_ab(lane, rules, lane_marks); + } + lane.marks = lane_marks; + } } - self.compute = function (lane, gel, lane_marks) { - var parser_ab = false; + } - if ( - (scb.utils.isDefined(model.cyto) && scb.utils.isDefined(model.cyto.parser_ab)) || - (scb.utils.isDefined(model.whole) && scb.utils.isDefined(model.whole.parser_ab)) || - (scb.utils.isDefined(model.nuclear) && scb.utils.isDefined(model.nuclear.parser_ab)) - ) - { - parser_ab = true; - } + self.compute = function(lane, gel, lane_marks) { + var parser_ab = false; - if (parser_ab){ - ret = undefined; - if (lane.id != 'marker') { - if (lane.kind == 'whole' || lane.kind == 'whole_cell') { - var rules = model.whole.parser_ab; - self.parser_ab(lane, gel, rules, lane_marks); - } - if (lane.kind == 'nuclear') { - var rules = model.nuclear.parser_ab; - self.parser_ab(lane, rules, lane_marks); - } - if (lane.kind == 'cyto') { - var rules = model.cyto.parser_ab; - self.parser_ab(lane, rules, lane_marks); - } - } + if ( + (scb.utils.isDefined(model.cyto) && scb.utils.isDefined(model.cyto.parser_ab)) || + (scb.utils.isDefined(model.whole) && scb.utils.isDefined(model.whole.parser_ab)) || + (scb.utils.isDefined(model.nuclear) && scb.utils.isDefined(model.nuclear.parser_ab)) + ) { + parser_ab = true; + } + + if (parser_ab) { + ret = undefined; + if (lane.id != 'marker') { + if (lane.kind == 'whole' || lane.kind == 'whole_cell') { + var rules = model.whole.parser_ab; + self.parser_ab(lane, gel, rules, lane_marks); + } + if (lane.kind == 'nuclear') { + var rules = model.nuclear.parser_ab; + self.parser_ab(lane, rules, lane_marks); } - else { - var ret = self.cyto(lane, gel, lane_marks); - console.info(lane_marks); - return ret; + if (lane.kind == 'cyto') { + var rules = model.cyto.parser_ab; + self.parser_ab(lane, rules, lane_marks); } + } + } else { + var ret = self.cyto(lane, gel, lane_marks); + console.info(lane_marks); + return ret; } + } } diff --git a/html_app/google-analytics.js b/html_app/google-analytics.js index 6f1bc693..5c29aa72 100644 --- a/html_app/google-analytics.js +++ b/html_app/google-analytics.js @@ -1,7 +1,11 @@ - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +(function(i, s, o, g, r, a, m) { + i['GoogleAnalyticsObject'] = r;i[r] = i[r] || function() { + (i[r].q = i[r].q || []).push(arguments) + }, i[r].l = 1 * new Date();a = s.createElement(o), + m = s.getElementsByTagName(o)[0]; + a.async = 1; + a.src = g;m.parentNode.insertBefore(a, m) +})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); - ga('create', 'UA-64448603-1', 'auto'); - ga('send', 'pageview'); +ga('create', 'UA-64448603-1', 'auto'); +ga('send', 'pageview'); diff --git a/html_app/instructor/InstructorAssignmentSetupView.js b/html_app/instructor/InstructorAssignmentSetupView.js index 6e77c600..c6313ba9 100644 --- a/html_app/instructor/InstructorAssignmentSetupView.js +++ b/html_app/instructor/InstructorAssignmentSetupView.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -9,224 +9,227 @@ scb.ui.static = scb.ui.static || {}; scb.ui.static.InstructorAssignmentSetupView = scb.ui.static.InstructorAssignmentSetupView || {}; -scb.ui.static.InstructorAssignmentSetupView.ARROW_OFFSET = 15; -scb.ui.static.InstructorAssignmentSetupView.ARROW_DIVISION = 2; +scb.ui.static.InstructorAssignmentSetupView.ARROW_OFFSET = 15; +scb.ui.static.InstructorAssignmentSetupView.ARROW_DIVISION = 2; scb.ui.static.InstructorAssignmentSetupView.HEADER_WIDTH = 579; scb.ui.static.InstructorAssignmentSetupView.HEADER_OFFSET = 34; -scb.ui.static.InstructorAssignmentSetupView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorAssignmentSetupView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_assignment_name_value = function(element, workarea){ - var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); -// parsed.assignment.course_name = $(element).val(); - - var state = { - assignment_id: parsed.assignment.id, - view:'assignment_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); - if( parsed.redisplay ) - { - alert( "INVALID ELEMENT!"); - } - if( parsed.assignment ) - { - parsed.assignment.name = $(element).val(); - } - -// scb.ui.static.InstructorFrame.refresh(); - +scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_assignment_name_value = function(element, workarea) { + var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); + // parsed.assignment.course_name = $(element).val(); + + var state = { + assignment_id: parsed.assignment.id, + view: 'assignment_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.assignment) { + parsed.assignment.name = $(element).val(); + } + + // scb.ui.static.InstructorFrame.refresh(); + } -scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_save_assignment_button = function(element, workarea){ - var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); - scb.ui.static.InstructorFrame.pending_save(parsed); - if(parsed.assignment.name != ''){ - parsed.assignment.assignment_prepared = true; - } - else parsed.assignment.assignment_prepared = false; - if(parsed.assignment.assignment_prepared){ - parsed.assignment.template = MASTER_TEMPLATE; - $.ajax({ - type: "POST", - url: '../scb/create_new_assignment.js', - data: JSON.stringify({assignment: parsed.assignment.__data__}) - }).done(function(e) { - if(e == 'created'){ - var state = { - assignment_id: parsed.assignment.id, - view: 'experiment_setup_page1', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); - } - else{ - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert('This assignment has already been created. Create a new assignment.', - function() { $('html').css('overflow', 'visible'); - $('.error_overlay').remove()/* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - } - }); - } +scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_save_assignment_button = function(element, workarea) { + var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); + scb.ui.static.InstructorFrame.pending_save(parsed); + if (parsed.assignment.name != '') { + parsed.assignment.assignment_prepared = true; + } else { + parsed.assignment.assignment_prepared = false; + } + if (parsed.assignment.assignment_prepared) { + parsed.assignment.template = MASTER_TEMPLATE; + $.ajax({ + type: "POST", + url: '../scb/create_new_assignment.js', + data: JSON.stringify({ + assignment: parsed.assignment.__data__ + }) + }).done(function(e) { + if (e == 'created') { + var state = { + assignment_id: parsed.assignment.id, + view: 'experiment_setup_page1', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); + } else { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert('This assignment has already been created. Create a new assignment.', function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove() /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + } + }); + } } -scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_create_new_assignment = function(element, workarea){ - var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); - parsed.assignment.is_new_assignment = true; - //GOODNESSGRACIOUS ME - //INCLUDE ARCHIVED ASSIGNMENTS -- fix the request to one list - //ROWS FOR PUBLIC PRIVATE FUNCTIONALITY - //MANAGEABLE - - //ASSIGNMENT ROWS - //TABLE FOR LAYOUT - //FIX COURSE SETUP - - - parsed.assignment.description = assignment_template.description; - parsed.assignment.last_instruction = assignment_template.last_instruction; - parsed.assignment.name = assignment_template.name; - parsed.assignment.template = assignment_template.template; - parsed.assignment.template_id = assignment_template.id; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_create_new_assignment = function(element, workarea) { + var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); + parsed.assignment.is_new_assignment = true; + //GOODNESSGRACIOUS ME + //INCLUDE ARCHIVED ASSIGNMENTS -- fix the request to one list + //ROWS FOR PUBLIC PRIVATE FUNCTIONALITY + //MANAGEABLE + + //ASSIGNMENT ROWS + //TABLE FOR LAYOUT + //FIX COURSE SETUP + + + parsed.assignment.description = assignment_template.description; + parsed.assignment.last_instruction = assignment_template.last_instruction; + parsed.assignment.name = assignment_template.name; + parsed.assignment.template = assignment_template.template; + parsed.assignment.template_id = assignment_template.id; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_choose_existing_template = function(element, workarea){ - var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); - parsed.assignment.is_new_assignment = false; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_choose_existing_template = function(element, workarea) { + var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); + parsed.assignment.is_new_assignment = false; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_back_button = function(element, workarea){ - var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); - parsed.assignment.course_prepared = false; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_back_button = function(element, workarea) { + var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); + parsed.assignment.course_prepared = false; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_template_select = function(element, workarea){ - var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); - parsed.assignment.is_new_assignment = false; - - var template_id = $(element).val(); - var assignment_template = parsed.assignment.parent.get(template_id); - - parsed.assignment.description = assignment_template.description; - parsed.assignment.last_instruction = assignment_template.last_instruction; - parsed.assignment.name = assignment_template.name; - parsed.assignment.template = assignment_template.template; - parsed.assignment.template_id = assignment_template.id; - - - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_template_select = function(element, workarea) { + var parsed = scb.ui.static.InstructorAssignmentSetupView.parse(element); + parsed.assignment.is_new_assignment = false; + + var template_id = $(element).val(); + var assignment_template = parsed.assignment.parent.get(template_id); + + parsed.assignment.description = assignment_template.description; + parsed.assignment.last_instruction = assignment_template.last_instruction; + parsed.assignment.name = assignment_template.name; + parsed.assignment.template = assignment_template.template; + parsed.assignment.template_id = assignment_template.id; + + + scb.ui.static.InstructorFrame.refresh(); } scb.ui.static.InstructorAssignmentSetupView.register = function(workarea) { - scb.utils.off_on(workarea, 'change', '.scb_f_assignment_setup_assignment_name_value', function (e) { - scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_assignment_name_value(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_assignment_setup_save_assignment_button', function (e) { - scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_save_assignment_button(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_assignment_setup_create_new_assignment', function (e) { - scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_create_new_assignment(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_assignment_setup_choose_existing_template', function (e) { - scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_choose_existing_template(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_assignment_setup_back_button', function (e) { - scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_back_button(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_s_assignment_setup_assignment_list select', function (e) { - scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_template_select(this, e); - }); + scb.utils.off_on(workarea, 'change', '.scb_f_assignment_setup_assignment_name_value', function(e) { + scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_assignment_name_value(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_assignment_setup_save_assignment_button', function(e) { + scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_save_assignment_button(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_assignment_setup_create_new_assignment', function(e) { + scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_create_new_assignment(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_assignment_setup_choose_existing_template', function(e) { + scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_choose_existing_template(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_assignment_setup_back_button', function(e) { + scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_back_button(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_s_assignment_setup_assignment_list select', function(e) { + scb.ui.static.InstructorAssignmentSetupView.scb_f_assignment_setup_template_select(this, e); + }); }; scb.ui.InstructorAssignmentSetupView = function scb_ui_InstructorAssignmentSetupView(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + // var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + // kind = 'create_assignment'; + } + + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; + } + + + workarea.html(scb_instructor_assignment_setup.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - -// var kind = 'select_course'; - - if(assignments.selected.course_prepared){ -// kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_assignment_setup.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); - }); + }); - } + } } \ No newline at end of file diff --git a/html_app/instructor/InstructorCourseSetupView.js b/html_app/instructor/InstructorCourseSetupView.js index 3b8d4cb7..451ab099 100644 --- a/html_app/instructor/InstructorCourseSetupView.js +++ b/html_app/instructor/InstructorCourseSetupView.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -9,233 +9,234 @@ scb.ui.static = scb.ui.static || {}; scb.ui.static.InstructorCourseSetupView = scb.ui.static.InstructorCourseSetupView || {}; -scb.ui.static.InstructorCourseSetupView.ARROW_OFFSET = 15; -scb.ui.static.InstructorCourseSetupView.ARROW_DIVISION = 2; +scb.ui.static.InstructorCourseSetupView.ARROW_OFFSET = 15; +scb.ui.static.InstructorCourseSetupView.ARROW_DIVISION = 2; scb.ui.static.InstructorCourseSetupView.HEADER_WIDTH = 579; scb.ui.static.InstructorCourseSetupView.HEADER_OFFSET = 34; -scb.ui.static.InstructorCourseSetupView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorCourseSetupView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_name_value = function(element, workarea){ - var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); -// parsed.assignment.course_name = $(element).val(); - - var state = { - assignment_id: parsed.assignment.id, - view:'course_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); - if( parsed.redisplay ) - { - alert( "INVALID ELEMENT!"); - } - if( parsed.assignment ) - { - parsed.assignment.course_name = $(element).val(); - } - -// scb.ui.static.InstructorFrame.refresh(); - +scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_name_value = function(element, workarea) { + var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); + // parsed.assignment.course_name = $(element).val(); + + var state = { + assignment_id: parsed.assignment.id, + view: 'course_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.assignment) { + parsed.assignment.course_name = $(element).val(); + } + + // scb.ui.static.InstructorFrame.refresh(); + } -scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_code_value = function(element, workarea){ - var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); - parsed.assignment.course = $(element).val(); - var state = { - assignment_id: parsed.assignment.id, - view:'course_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); - if( parsed.redisplay ) - { - alert( "INVALID ELEMENT!"); - } - if( parsed.assignment ) - { - parsed.assignment.course = $(element).val(); - } - -// scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_code_value = function(element, workarea) { + var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); + parsed.assignment.course = $(element).val(); + var state = { + assignment_id: parsed.assignment.id, + view: 'course_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.assignment) { + parsed.assignment.course = $(element).val(); + } + + // scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_save_course_button = function(element, workarea){ - var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); - scb.ui.static.InstructorFrame.pending_save(parsed); - if(parsed.assignment.course && parsed.assignment.course_name != ''){ - parsed.assignment.course_prepared = true; - } - else parsed.assignment.course_prepared = false; - if(parsed.assignment.course_prepared){ - $.ajax({ - type: "POST", - url: '../scb/create_course.js', - data: JSON.stringify({course_code: parsed.assignment.course, course_name: parsed.assignment.course_name}) - }).done(function(e) { - if(e == 'created'){ - var state = { - assignment_id: parsed.assignment.id, - view: 'assignment_setup', - skip_hash_update: true - }; - scb.ui.static.InstructorFrame.refresh(state); - } - else{ - if(parsed.assignment.is_new_course){ - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert('This course has already been created. Select an already created course.', - function() { $('html').css('overflow', 'visible'); - $('.error_overlay').remove()/* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - } - else{ - var state = { - assignment_id: parsed.assignment.id, - view: 'assignment_setup', - skip_hash_update: true - }; - scb.ui.static.InstructorFrame.refresh(state); - } - } - }); - } - - +scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_save_course_button = function(element, workarea) { + var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); + scb.ui.static.InstructorFrame.pending_save(parsed); + if (parsed.assignment.course && parsed.assignment.course_name != '') { + parsed.assignment.course_prepared = true; + } else { + parsed.assignment.course_prepared = false; + } + if (parsed.assignment.course_prepared) { + $.ajax({ + type: "POST", + url: '../scb/create_course.js', + data: JSON.stringify({ + course_code: parsed.assignment.course, + course_name: parsed.assignment.course_name + }) + }).done(function(e) { + if (e == 'created') { + var state = { + assignment_id: parsed.assignment.id, + view: 'assignment_setup', + skip_hash_update: true + }; + scb.ui.static.InstructorFrame.refresh(state); + } else { + if (parsed.assignment.is_new_course) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert('This course has already been created. Select an already created course.', function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove() /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + } else { + var state = { + assignment_id: parsed.assignment.id, + view: 'assignment_setup', + skip_hash_update: true + }; + scb.ui.static.InstructorFrame.refresh(state); + } + } + }); + } + + } - -scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_choose_existing_course = function(element, workarea){ - var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); - parsed.assignment.is_new_course = false; - scb.ui.static.InstructorFrame.refresh(); + +scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_choose_existing_course = function(element, workarea) { + var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); + parsed.assignment.is_new_course = false; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_create_new_course = function(element, workarea){ - var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); - parsed.assignment.is_new_course = true; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_create_new_course = function(element, workarea) { + var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); + parsed.assignment.is_new_course = true; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_select = function(element, workarea){ - var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); - parsed.assignment.is_new_course = false; - - var template_id = $(element).val(); - var assignment_template = parsed.assignment.parent.get(template_id); - - parsed.assignment.course_name = assignment_template.course_name; +scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_select = function(element, workarea) { + var parsed = scb.ui.static.InstructorCourseSetupView.parse(element); + parsed.assignment.is_new_course = false; - parsed.assignment.course = assignment_template.course; - - - scb.ui.static.InstructorFrame.refresh(); + var template_id = $(element).val(); + var assignment_template = parsed.assignment.parent.get(template_id); + + parsed.assignment.course_name = assignment_template.course_name; + + parsed.assignment.course = assignment_template.course; + + + scb.ui.static.InstructorFrame.refresh(); } scb.ui.static.InstructorCourseSetupView.register = function(workarea) { - scb.utils.off_on(workarea, 'change', '.scb_f_course_setup_course_name_value', function (e) { - scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_name_value(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_course_setup_course_code_value', function (e) { - scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_code_value(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_course_setup_save_course_button', function (e) { - scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_save_course_button(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_course_setup_create_new_course', function (e) { - scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_create_new_course(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_course_setup_choose_existing_course', function (e) { - scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_choose_existing_course(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_s_course_setup_course_list select', function (e) { - scb.ui.static.InstructorAssignmentSetupView.scb_f_course_setup_course_select(this, e); - }); - + scb.utils.off_on(workarea, 'change', '.scb_f_course_setup_course_name_value', function(e) { + scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_name_value(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_course_setup_course_code_value', function(e) { + scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_course_code_value(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_course_setup_save_course_button', function(e) { + scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_save_course_button(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_course_setup_create_new_course', function(e) { + scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_create_new_course(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_course_setup_choose_existing_course', function(e) { + scb.ui.static.InstructorCourseSetupView.scb_f_course_setup_choose_existing_course(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_s_course_setup_course_list select', function(e) { + scb.ui.static.InstructorAssignmentSetupView.scb_f_course_setup_course_select(this, e); + }); + }; scb.ui.InstructorCourseSetupView = function scb_ui_InstructorCourseSetupView(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - -// var kind = 'select_course'; - - if(assignments.selected.course_prepared){ -// kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_course_setup.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + // var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + // kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_course_setup.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorDashboardView.js b/html_app/instructor/InstructorDashboardView.js index fe72ad0c..7eabd71b 100644 --- a/html_app/instructor/InstructorDashboardView.js +++ b/html_app/instructor/InstructorDashboardView.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -9,137 +9,138 @@ scb.ui.static = scb.ui.static || {}; scb.ui.static.InstructorDashboardView = scb.ui.static.InstructorDashboardView || {}; -scb.ui.static.InstructorDashboardView.ARROW_OFFSET = 15; -scb.ui.static.InstructorDashboardView.ARROW_DIVISION = 2; +scb.ui.static.InstructorDashboardView.ARROW_OFFSET = 15; +scb.ui.static.InstructorDashboardView.ARROW_DIVISION = 2; scb.ui.static.InstructorDashboardView.HEADER_WIDTH = 579; scb.ui.static.InstructorDashboardView.HEADER_OFFSET = 34; -scb.ui.static.InstructorDashboardView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorDashboardView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorDashboardView.scb_f_dashboard_new_assignment_button = function (element, workarea) { - var parsed = scb.ui.static.InstructorDashboardView.parse(element); - var context = parsed.context; - var parent = parsed.assignment.parent; - - var new_assignment_data = { - id: Math.random().toString(36).substring(7), - name: '', - course: '', - course_name: '', - description: '', - experiments: {}, - template: {}, - permission: 'Private', - operation: 'edit' - }; - - - var new_assignment = parent.start(new_assignment_data); - var state = { - assignment_id: new_assignment.id, - view: 'course_setup', - skip_hash_update: true - }; - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorDashboardView.scb_f_dashboard_new_assignment_button = function(element, workarea) { + var parsed = scb.ui.static.InstructorDashboardView.parse(element); + var context = parsed.context; + var parent = parsed.assignment.parent; + + var new_assignment_data = { + id: Math.random().toString(36).substring(7), + name: '', + course: '', + course_name: '', + description: '', + experiments: {}, + template: {}, + permission: 'Private', + operation: 'edit' + }; + + + var new_assignment = parent.start(new_assignment_data); + var state = { + assignment_id: new_assignment.id, + view: 'course_setup', + skip_hash_update: true + }; + scb.ui.static.InstructorFrame.refresh(state); } -scb.ui.static.InstructorDashboardView.scb_f_dashboard_course_management_button = function(element, workarea ) -{ - var $target = $('.scb_s_dashboard_table_wrapper',workarea); - var url = $(element).attr('href'); - $target.load(url); - return false; +scb.ui.static.InstructorDashboardView.scb_f_dashboard_course_management_button = function(element, workarea) { + var $target = $('.scb_s_dashboard_table_wrapper', workarea); + var url = $(element).attr('href'); + $target.load(url); + return false; } -scb.ui.static.InstructorDashboardView.scb_s_assignment_header_img_left = function (element, workarea) { - var parsed = scb.ui.static.InstructorDashboardView.parse(element); +scb.ui.static.InstructorDashboardView.scb_s_assignment_header_img_left = function(element, workarea) { + var parsed = scb.ui.static.InstructorDashboardView.parse(element); } -scb.ui.static.InstructorDashboardView.scb_s_assignment_header_img_right = function (element, workarea) { - var parsed = scb.ui.static.InstructorDashboardView.parse(element); +scb.ui.static.InstructorDashboardView.scb_s_assignment_header_img_right = function(element, workarea) { + var parsed = scb.ui.static.InstructorDashboardView.parse(element); } scb.ui.static.InstructorDashboardView.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_dashboard_new_assignment_button', function (e) { - scb.ui.static.InstructorDashboardView.scb_f_dashboard_new_assignment_button(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_s_assignment_header_img_left', function (e) { - scb.ui.static.InstructorDashboardView.scb_s_assignment_header_img_left(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_s_assignment_header_img_right', function (e) { - scb.ui.static.InstructorDashboardView.scb_s_assignment_header_img_right(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_assignments_new_experiment', function (e) { - $('.scb_f_experiments_step_link').get(0).click(); - }); + scb.utils.off_on(workarea, 'click', '.scb_f_dashboard_new_assignment_button', function(e) { + scb.ui.static.InstructorDashboardView.scb_f_dashboard_new_assignment_button(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_assignment_header_img_left', function(e) { + scb.ui.static.InstructorDashboardView.scb_s_assignment_header_img_left(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_assignment_header_img_right', function(e) { + scb.ui.static.InstructorDashboardView.scb_s_assignment_header_img_right(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_assignments_new_experiment', function(e) { + $('.scb_f_experiments_step_link').get(0).click(); + }); }; scb.ui.InstructorDashboardView = function scb_ui_InstructorDashboardView(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; + } + workarea.html(scb_instructor_dashboard.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + + $('.scb_s_dashboard_table_row').hover(function() { + $('.scb_s_dashboard_link', this).toggle(); }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - workarea.html(scb_instructor_dashboard.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - - $('.scb_s_dashboard_table_row').hover(function(){ - $('.scb_s_dashboard_link', this).toggle(); - }); - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); - } + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } } \ No newline at end of file diff --git a/html_app/instructor/InstructorExperimentSetupPage1View.js b/html_app/instructor/InstructorExperimentSetupPage1View.js index f9197721..28d6b857 100644 --- a/html_app/instructor/InstructorExperimentSetupPage1View.js +++ b/html_app/instructor/InstructorExperimentSetupPage1View.js @@ -1,182 +1,188 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } scb.ui.static = scb.ui.static || {}; scb.ui.static.InstructorExperimentSetupPage1View = scb.ui.static.InstructorExperimentSetupPage1View || {}; -scb.ui.static.InstructorExperimentSetupPage1View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorExperimentSetupPage1View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_page1_save_assignment_button = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - var state = { - assignment_id: parsed.assignment.id, - view: 'experiment_setup_page2', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_page1_save_assignment_button = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + var state = { + assignment_id: parsed.assignment.id, + view: 'experiment_setup_page2', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } -scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_add_strain = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); - var strain_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - parsed.assignment.template.cell_lines[strain_id] = {name: $(element).val()}; +scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_add_strain = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); + var strain_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + parsed.assignment.template.cell_lines[strain_id] = { + name: $(element).val() + }; - scb.ui.static.InstructorFrame.refresh(); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_list_item = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); - var strain_id = $(element).attr('strain_id') ? $(element).attr('strain_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - parsed.assignment.template.cell_lines[strain_id] = {name: $(element).val()}; +scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_list_item = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); + var strain_id = $(element).attr('strain_id') ? $(element).attr('strain_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + parsed.assignment.template.cell_lines[strain_id] = { + name: $(element).val() + }; - scb.ui.static.InstructorFrame.refresh(); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_temperature = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); - parsed.assignment.has_temperature = !parsed.assignment.has_temperature; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_temperature = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); + parsed.assignment.has_temperature = !parsed.assignment.has_temperature; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_start_time = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); - parsed.assignment.has_start_time = !parsed.assignment.has_start_time; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_start_time = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); + parsed.assignment.has_start_time = !parsed.assignment.has_start_time; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_duration = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); - parsed.assignment.has_duration = !parsed.assignment.has_duration; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_duration = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); + parsed.assignment.has_duration = !parsed.assignment.has_duration; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_collection_time = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); - parsed.assignment.has_collection_time = !parsed.assignment.has_collection_time; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_collection_time = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage1View.parse(element); + parsed.assignment.has_collection_time = !parsed.assignment.has_collection_time; + scb.ui.static.InstructorFrame.refresh(); } scb.ui.static.InstructorExperimentSetupPage1View.register = function(workarea) { - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_list_item', function (e) { - scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_list_item(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_add_strain', function (e) { - scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_add_strain(this, e); - }); - - - - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_select_temperature', function (e) { - scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_temperature(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_select_start_time', function (e) { - scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_start_time(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_select_duration', function (e) { - scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_duration(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_select_collection_time', function (e) { - scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_collection_time(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page1_save_assignment_button', function (e) { - scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_page1_save_assignment_button(this, e); - }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_list_item', function(e) { + scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_list_item(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_add_strain', function(e) { + scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_add_strain(this, e); + }); + + + + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_select_temperature', function(e) { + scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_temperature(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_select_start_time', function(e) { + scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_start_time(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_select_duration', function(e) { + scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_duration(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_select_collection_time', function(e) { + scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_select_collection_time(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page1_save_assignment_button', function(e) { + scb.ui.static.InstructorExperimentSetupPage1View.scb_f_experiment_setup_page1_save_assignment_button(this, e); + }); + + + - - - }; scb.ui.InstructorExperimentSetupPage1View = function scb_ui_InstructorExperimentSetupPage1View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_experiment_setup_page1.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_experiment_setup_page1.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorExperimentSetupPage2View.js b/html_app/instructor/InstructorExperimentSetupPage2View.js index 154afa79..dd835d6a 100644 --- a/html_app/instructor/InstructorExperimentSetupPage2View.js +++ b/html_app/instructor/InstructorExperimentSetupPage2View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,397 +10,579 @@ scb.ui.static.InstructorExperimentSetupPage2View = scb.ui.static.InstructorExper -scb.ui.static.InstructorExperimentSetupPage2View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorExperimentSetupPage2View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_page2_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - - if(parsed.assignment.has_start_time){ - parsed.assignment.template.ui.experiment_setup.table[2].children.splice(2, 0, {kind: "start", title: "Treatment Start Time", editable: false}); - parsed.assignment.template.ui.add_multiple_dialog.headings.push('Start Time'); - } - if(parsed.assignment.has_duration){ - parsed.assignment.template.ui.experiment_setup.table[2].children.splice(3, 0, {kind: "duration", title: "Duration", editable: false}); - parsed.assignment.template.ui.add_multiple_dialog.headings.push('Duration'); - } - if(parsed.assignment.has_collection_time){ - parsed.assignment.template.ui.experiment_setup.table[2].children.splice(4, 0, {kind: "collection", title: "Collection Timepoints", editable: false}); - parsed.assignment.template.ui.add_multiple_dialog.headings.push('Collection'); - - } - if(parsed.assignment.has_temperature){ - parsed.assignment.template.ui.experiment_setup.table.splice(3, 0, {kind: 'temperature', title: 'Temperature', editable: false}); - parsed.assignment.template.ui.add_multiple_dialog.headings.push('Temperature'); - } - //collection_id: 'default' - - - _.each(parsed.assignment.template.cell_lines, function(strain, strain_id, list){ - parsed.assignment.template.ui.add_multiple_dialog[strain_id] = {rows:[]} - parsed.assignment.template.ui.add_multiple_dialog.order.push(strain_id); - _.each(parsed.assignment.template.drugs, function(drug, drug_id, list){ - - if(parsed.assignment.has_collection_time && parsed.assignment.has_temperature){ - _.each(parsed.assignment.template.collections, function(collection, collection_id, list){ - _.each(parsed.assignment.template.experiment_temperatures, function(temperature, temperature_id, list){ - var row_treatment_id = Math.random().toString(36).substring(10); - var row_element = { - cells: [ - {kind: 'checkbox', name: "X", treatment_id: row_treatment_id}, - {kind: 'text', text: strain.name}, - {kind: 'text', text: drug.name}, - {kind: 'text', text: parsed.assignment.template.concentrations[drug.concentrations[0]].name}, - {kind: 'text', text: collection.name}, - {kind: 'text', text: temperature.name} - ], - treatment_id: row_treatment_id, - cell_treatments: { - "X": [ - {cell_line: strain_id, - treatment_list: {list: [ - { - drug_list: { - list: [ - {drug_id: drug_id, concentration_id: drug.concentrations[0]}, - ] - }, - collection_id: collection_id, - temperature: temperature_id - } - ]}} - ] - } - }; - if(parsed.assignment.has_start_time){ - row_element.cell_treatments.X[0].treatment_list.list[0]['schedule'] = drug.schedule[0]; - row_element.cells.splice(4, 0, {kind: 'text', text: parsed.assignment.template.start_times[drug.schedule[0]].name}); - - } - if(parsed.assignment.has_duration){ - row_element.cell_treatments.X[0].treatment_list.list[0]['duration'] = drug.duration[0]; - row_element.cells.splice(5, 0, {kind: 'text', text: parsed.assignment.template.durations[drug.duration[0]].name}); - } - parsed.assignment.template.ui.add_multiple_dialog[strain_id].rows.push(row_element); - }); - }); - - } - else if(parsed.assignment.has_collection_time){ - _.each(parsed.assignment.template.collections, function(collection, collection_id, list){ - var row_treatment_id = Math.random().toString(36).substring(10); - var row_element = { - cells: [ - {kind: 'checkbox', name: "X", treatment_id: row_treatment_id}, - {kind: 'text', text: strain.name}, - {kind: 'text', text: drug.name}, - {kind: 'text', text: parsed.assignment.template.concentrations[drug.concentrations[0]].name}, - {kind: 'text', text: collection.name} - ], - treatment_id: row_treatment_id, - cell_treatments: { - "X": [ - {cell_line: strain_id, - treatment_list: {list: [ - { - drug_list: { - list: [ - {drug_id: drug_id, concentration_id: drug.concentrations[0]}, - ] - }, - collection_id: collection_id - } - ]}} - ] - } - }; - if(parsed.assignment.has_start_time){ - row_element.cell_treatments.X[0].treatment_list.list[0]['schedule'] = drug.schedule[0]; - row_element.cells.splice(4, 0, {kind: 'text', text: parsed.assignment.template.start_times[drug.schedule[0]].name}); - } - if(parsed.assignment.has_duration){ - row_element.cell_treatments.X[0].treatment_list.list[0]['duration'] = drug.duration[0]; - row_element.cells.splice(5, 0, {kind: 'text', text: parsed.assignment.template.durations[drug.duration[0]].name}); - - } - parsed.assignment.template.ui.add_multiple_dialog[strain_id].rows.push(row_element); - }); - - } - else if(parsed.assignment.has_temperature){ - _.each(parsed.assignment.template.experiment_temperatures, function(temperature, temperature_id, list){ - var row_treatment_id = Math.random().toString(36).substring(10); - var row_element = { - cells: [ - {kind: 'checkbox', name: "X", treatment_id: row_treatment_id}, - {kind: 'text', text: strain.name}, - {kind: 'text', text: drug.name}, - {kind: 'text', text: parsed.assignment.template.concentrations[drug.concentrations[0]].name}, - {kind: 'text', text: temperature.name} - ], - treatment_id: row_treatment_id, - cell_treatments: { - "X": [ - {cell_line: strain_id, - treatment_list: {list: [ - { - drug_list: { - list: [ - {drug_id: drug_id, concentration_id: drug.concentrations[0]}, - ] - }, - temperature: temperature_id - } - ]}} - ] - } - }; - if(parsed.assignment.has_start_time){ - row_element.cell_treatments.X[0].treatment_list.list[0]['schedule'] = drug.schedule[0]; - row_element.cells.splice(4, 0, {kind: 'text', text: parsed.assignment.template.start_times[drug.schedule[0]].name}); - } - if(parsed.assignment.has_duration){ - row_element.cell_treatments.X[0].treatment_list.list[0]['duration'] = drug.duration[0]; - row_element.cells.splice(5, 0, {kind: 'text', text: parsed.assignment.template.durations[drug.duration[0]].name}); - } - parsed.assignment.template.ui.add_multiple_dialog[strain_id].rows.push(row_element); - }); - - } - else{ - var row_treatment_id = Math.random().toString(36).substring(10); - var row_element = { - cells: [ - {kind: 'checkbox', name: "X", treatment_id: row_treatment_id}, - {kind: 'text', text: strain.name}, - {kind: 'text', text: drug.name}, - {kind: 'text', text: parsed.assignment.template.concentrations[drug.concentrations[0]].name}, - ], - treatment_id: row_treatment_id, - cell_treatments: { - "X": [ - {cell_line: strain_id, - treatment_list: {list: [ - { - drug_list: { - list: [ - {drug_id: drug_id, concentration_id: drug.concentrations[0]}, - ] - } - } - ]}} - ] - } - }; - if(parsed.assignment.has_start_time){ - row_element.cell_treatments.X[0].treatment_list.list[0]['schedule'] = drug.schedule[0]; - row_element.cells.splice(4, 0, {kind: 'text', text: parsed.assignment.template.start_times[drug.schedule[0]].name}); - } - if(parsed.assignment.has_duration){ - row_element.cell_treatments.X[0].treatment_list.list[0]['duration'] = drug.duration[0]; - row_element.cells.splice(5, 0, {kind: 'text', text: parsed.assignment.template.durations[drug.duration[0]].name}); - } - parsed.assignment.template.ui.add_multiple_dialog[strain_id].rows.push(row_element); - - } - - }); - }); - - - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'experiment_setup_page3', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_page2_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + + if (parsed.assignment.has_start_time) { + parsed.assignment.template.ui.experiment_setup.table[2].children.splice(2, 0, { + kind: "start", + title: "Treatment Start Time", + editable: false + }); + parsed.assignment.template.ui.add_multiple_dialog.headings.push('Start Time'); + } + if (parsed.assignment.has_duration) { + parsed.assignment.template.ui.experiment_setup.table[2].children.splice(3, 0, { + kind: "duration", + title: "Duration", + editable: false + }); + parsed.assignment.template.ui.add_multiple_dialog.headings.push('Duration'); + } + if (parsed.assignment.has_collection_time) { + parsed.assignment.template.ui.experiment_setup.table[2].children.splice(4, 0, { + kind: "collection", + title: "Collection Timepoints", + editable: false + }); + parsed.assignment.template.ui.add_multiple_dialog.headings.push('Collection'); + + } + if (parsed.assignment.has_temperature) { + parsed.assignment.template.ui.experiment_setup.table.splice(3, 0, { + kind: 'temperature', + title: 'Temperature', + editable: false + }); + parsed.assignment.template.ui.add_multiple_dialog.headings.push('Temperature'); + } + //collection_id: 'default' + + + _.each(parsed.assignment.template.cell_lines, function(strain, strain_id, list) { + parsed.assignment.template.ui.add_multiple_dialog[strain_id] = { + rows: [] + } + parsed.assignment.template.ui.add_multiple_dialog.order.push(strain_id); + _.each(parsed.assignment.template.drugs, function(drug, drug_id, list) { + + if (parsed.assignment.has_collection_time && parsed.assignment.has_temperature) { + _.each(parsed.assignment.template.collections, function(collection, collection_id, list) { + _.each(parsed.assignment.template.experiment_temperatures, function(temperature, temperature_id, list) { + var row_treatment_id = Math.random().toString(36).substring(10); + var row_element = { + cells: [ + { + kind: 'checkbox', + name: "X", + treatment_id: row_treatment_id + }, + { + kind: 'text', + text: strain.name + }, + { + kind: 'text', + text: drug.name + }, + { + kind: 'text', + text: parsed.assignment.template.concentrations[drug.concentrations[0]].name + }, + { + kind: 'text', + text: collection.name + }, + { + kind: 'text', + text: temperature.name + } + ], + treatment_id: row_treatment_id, + cell_treatments: { + "X": [ + { + cell_line: strain_id, + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: drug_id, + concentration_id: drug.concentrations[0] + }, + ] + }, + collection_id: collection_id, + temperature: temperature_id + } + ] + } + } + ] + } + }; + if (parsed.assignment.has_start_time) { + row_element.cell_treatments.X[0].treatment_list.list[0]['schedule'] = drug.schedule[0]; + row_element.cells.splice(4, 0, { + kind: 'text', + text: parsed.assignment.template.start_times[drug.schedule[0]].name + }); + + } + if (parsed.assignment.has_duration) { + row_element.cell_treatments.X[0].treatment_list.list[0]['duration'] = drug.duration[0]; + row_element.cells.splice(5, 0, { + kind: 'text', + text: parsed.assignment.template.durations[drug.duration[0]].name + }); + } + parsed.assignment.template.ui.add_multiple_dialog[strain_id].rows.push(row_element); + }); + }); + + } else if (parsed.assignment.has_collection_time) { + _.each(parsed.assignment.template.collections, function(collection, collection_id, list) { + var row_treatment_id = Math.random().toString(36).substring(10); + var row_element = { + cells: [ + { + kind: 'checkbox', + name: "X", + treatment_id: row_treatment_id + }, + { + kind: 'text', + text: strain.name + }, + { + kind: 'text', + text: drug.name + }, + { + kind: 'text', + text: parsed.assignment.template.concentrations[drug.concentrations[0]].name + }, + { + kind: 'text', + text: collection.name + } + ], + treatment_id: row_treatment_id, + cell_treatments: { + "X": [ + { + cell_line: strain_id, + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: drug_id, + concentration_id: drug.concentrations[0] + }, + ] + }, + collection_id: collection_id + } + ] + } + } + ] + } + }; + if (parsed.assignment.has_start_time) { + row_element.cell_treatments.X[0].treatment_list.list[0]['schedule'] = drug.schedule[0]; + row_element.cells.splice(4, 0, { + kind: 'text', + text: parsed.assignment.template.start_times[drug.schedule[0]].name + }); + } + if (parsed.assignment.has_duration) { + row_element.cell_treatments.X[0].treatment_list.list[0]['duration'] = drug.duration[0]; + row_element.cells.splice(5, 0, { + kind: 'text', + text: parsed.assignment.template.durations[drug.duration[0]].name + }); + + } + parsed.assignment.template.ui.add_multiple_dialog[strain_id].rows.push(row_element); + }); + + } else if (parsed.assignment.has_temperature) { + _.each(parsed.assignment.template.experiment_temperatures, function(temperature, temperature_id, list) { + var row_treatment_id = Math.random().toString(36).substring(10); + var row_element = { + cells: [ + { + kind: 'checkbox', + name: "X", + treatment_id: row_treatment_id + }, + { + kind: 'text', + text: strain.name + }, + { + kind: 'text', + text: drug.name + }, + { + kind: 'text', + text: parsed.assignment.template.concentrations[drug.concentrations[0]].name + }, + { + kind: 'text', + text: temperature.name + } + ], + treatment_id: row_treatment_id, + cell_treatments: { + "X": [ + { + cell_line: strain_id, + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: drug_id, + concentration_id: drug.concentrations[0] + }, + ] + }, + temperature: temperature_id + } + ] + } + } + ] + } + }; + if (parsed.assignment.has_start_time) { + row_element.cell_treatments.X[0].treatment_list.list[0]['schedule'] = drug.schedule[0]; + row_element.cells.splice(4, 0, { + kind: 'text', + text: parsed.assignment.template.start_times[drug.schedule[0]].name + }); + } + if (parsed.assignment.has_duration) { + row_element.cell_treatments.X[0].treatment_list.list[0]['duration'] = drug.duration[0]; + row_element.cells.splice(5, 0, { + kind: 'text', + text: parsed.assignment.template.durations[drug.duration[0]].name + }); + } + parsed.assignment.template.ui.add_multiple_dialog[strain_id].rows.push(row_element); + }); + + } else { + var row_treatment_id = Math.random().toString(36).substring(10); + var row_element = { + cells: [ + { + kind: 'checkbox', + name: "X", + treatment_id: row_treatment_id + }, + { + kind: 'text', + text: strain.name + }, + { + kind: 'text', + text: drug.name + }, + { + kind: 'text', + text: parsed.assignment.template.concentrations[drug.concentrations[0]].name + }, + ], + treatment_id: row_treatment_id, + cell_treatments: { + "X": [ + { + cell_line: strain_id, + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: drug_id, + concentration_id: drug.concentrations[0] + }, + ] + } + } + ] + } + } + ] + } + }; + if (parsed.assignment.has_start_time) { + row_element.cell_treatments.X[0].treatment_list.list[0]['schedule'] = drug.schedule[0]; + row_element.cells.splice(4, 0, { + kind: 'text', + text: parsed.assignment.template.start_times[drug.schedule[0]].name + }); + } + if (parsed.assignment.has_duration) { + row_element.cell_treatments.X[0].treatment_list.list[0]['duration'] = drug.duration[0]; + row_element.cells.splice(5, 0, { + kind: 'text', + text: parsed.assignment.template.durations[drug.duration[0]].name + }); + } + parsed.assignment.template.ui.add_multiple_dialog[strain_id].rows.push(row_element); + + } + + }); + }); + + + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'experiment_setup_page3', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var treatment_id = $(element).attr('treatment_id') ? $(element).attr('treatment_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - if(parsed.assignment.template.drugs[treatment_id]){ - parsed.assignment.template.drugs[treatment_id] = {concentrations: parsed.assignment.template.drugs[treatment_id].concentrations, name: $(element).val(), schedule: parsed.assignment.template.drugs[treatment_id].schedule, duration: parsed.assignment.template.drugs[treatment_id].duration}; - } - else - parsed.assignment.template.drugs[treatment_id] = {concentrations: [], name: $(element).val(), schedule: [], duration: []}; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var treatment_id = $(element).attr('treatment_id') ? $(element).attr('treatment_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + if (parsed.assignment.template.drugs[treatment_id]) { + parsed.assignment.template.drugs[treatment_id] = { + concentrations: parsed.assignment.template.drugs[treatment_id].concentrations, + name: $(element).val(), + schedule: parsed.assignment.template.drugs[treatment_id].schedule, + duration: parsed.assignment.template.drugs[treatment_id].duration + }; + } else { + parsed.assignment.template.drugs[treatment_id] = { + concentrations: [], + name: $(element).val(), + schedule: [], + duration: [] + }; + } + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_concentration_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var concentration_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - var units= $('.scb_f_experiment_setup_treatment_concentration_units_edit select[treatment_id="'+$(element).attr('treatment_id')+'"]').val(); - parsed.assignment.template.concentrations[concentration_id] = {value: concentration_id, name: $(element).val() + ' ' + units, conc: $(element).val() , units: units}; - var treatment_id = $(element).attr('treatment_id'); - if(parsed.assignment.template.drugs[treatment_id].concentrations.length > 0){ - delete parsed.assignment.template.concentrations[parsed.assignment.template.drugs[treatment_id].concentrations[0]]; - } - parsed.assignment.template.drugs[treatment_id].concentrations = []; - parsed.assignment.template.drugs[treatment_id].concentrations.push(concentration_id); - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_concentration_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var concentration_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + var units = $('.scb_f_experiment_setup_treatment_concentration_units_edit select[treatment_id="' + $(element).attr('treatment_id') + '"]').val(); + parsed.assignment.template.concentrations[concentration_id] = { + value: concentration_id, + name: $(element).val() + ' ' + units, + conc: $(element).val(), + units: units + }; + var treatment_id = $(element).attr('treatment_id'); + if (parsed.assignment.template.drugs[treatment_id].concentrations.length > 0) { + delete parsed.assignment.template.concentrations[parsed.assignment.template.drugs[treatment_id].concentrations[0]]; + } + parsed.assignment.template.drugs[treatment_id].concentrations = []; + parsed.assignment.template.drugs[treatment_id].concentrations.push(concentration_id); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_concentration_units_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var concentration_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - var treatment_val= $('.scb_f_experiment_setup_treatment_concentration_edit[treatment_id="'+$(element).attr('treatment_id')+'"]').val(); - parsed.assignment.template.concentrations[concentration_id] = {value: concentration_id, name: treatment_val + ' ' + $(element).val(), conc: treatment_val, units: $(element).val()}; - var treatment_id = $(element).attr('treatment_id'); - if(parsed.assignment.template.drugs[treatment_id].concentrations.length > 0){ - delete parsed.assignment.template.concentrations[parsed.assignment.template.drugs[treatment_id].concentrations[0]]; - } - parsed.assignment.template.drugs[treatment_id].concentrations = []; - parsed.assignment.template.drugs[treatment_id].concentrations.push(concentration_id); - scb.ui.static.InstructorFrame.refresh(); - +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_concentration_units_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var concentration_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + var treatment_val = $('.scb_f_experiment_setup_treatment_concentration_edit[treatment_id="' + $(element).attr('treatment_id') + '"]').val(); + parsed.assignment.template.concentrations[concentration_id] = { + value: concentration_id, + name: treatment_val + ' ' + $(element).val(), + conc: treatment_val, + units: $(element).val() + }; + var treatment_id = $(element).attr('treatment_id'); + if (parsed.assignment.template.drugs[treatment_id].concentrations.length > 0) { + delete parsed.assignment.template.concentrations[parsed.assignment.template.drugs[treatment_id].concentrations[0]]; + } + parsed.assignment.template.drugs[treatment_id].concentrations = []; + parsed.assignment.template.drugs[treatment_id].concentrations.push(concentration_id); + scb.ui.static.InstructorFrame.refresh(); + } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_start_time_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var start_time_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - var units = $('.scb_f_experiment_setup_start_time_units_edit select[treatment_id="'+$(element).attr('treatment_id')+'"]').val(); - parsed.assignment.template.start_times[start_time_id] = {name: $(element).val() + ' ' + units, time: $(element).val(), units: units}; - var treatment_id = $(element).attr('treatment_id'); - if(parsed.assignment.template.drugs[treatment_id].schedule.length > 0){ - delete parsed.assignment.template.start_times[parsed.assignment.template.drugs[treatment_id].schedule[0]]; - } - parsed.assignment.template.drugs[treatment_id].schedule = []; - parsed.assignment.template.drugs[treatment_id].schedule.push(start_time_id); - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_start_time_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var start_time_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + var units = $('.scb_f_experiment_setup_start_time_units_edit select[treatment_id="' + $(element).attr('treatment_id') + '"]').val(); + parsed.assignment.template.start_times[start_time_id] = { + name: $(element).val() + ' ' + units, + time: $(element).val(), + units: units + }; + var treatment_id = $(element).attr('treatment_id'); + if (parsed.assignment.template.drugs[treatment_id].schedule.length > 0) { + delete parsed.assignment.template.start_times[parsed.assignment.template.drugs[treatment_id].schedule[0]]; + } + parsed.assignment.template.drugs[treatment_id].schedule = []; + parsed.assignment.template.drugs[treatment_id].schedule.push(start_time_id); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_start_time_units_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var start_time_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - var start_time_val = $('.scb_f_experiment_setup_start_time_edit[treatment_id="'+$(element).attr('treatment_id')+'"]').val(); - parsed.assignment.template.start_times[start_time_id] = {name: start_time_val + ' ' + $(element).val() , time: start_time_val, units: $(element).val() }; - var treatment_id = $(element).attr('treatment_id'); - if(parsed.assignment.template.drugs[treatment_id].schedule.length > 0){ - delete parsed.assignment.template.start_times[parsed.assignment.template.drugs[treatment_id].schedule[0]]; - } - parsed.assignment.template.drugs[treatment_id].schedule = []; - parsed.assignment.template.drugs[treatment_id].schedule.push(start_time_id); - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_start_time_units_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var start_time_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + var start_time_val = $('.scb_f_experiment_setup_start_time_edit[treatment_id="' + $(element).attr('treatment_id') + '"]').val(); + parsed.assignment.template.start_times[start_time_id] = { + name: start_time_val + ' ' + $(element).val(), + time: start_time_val, + units: $(element).val() + }; + var treatment_id = $(element).attr('treatment_id'); + if (parsed.assignment.template.drugs[treatment_id].schedule.length > 0) { + delete parsed.assignment.template.start_times[parsed.assignment.template.drugs[treatment_id].schedule[0]]; + } + parsed.assignment.template.drugs[treatment_id].schedule = []; + parsed.assignment.template.drugs[treatment_id].schedule.push(start_time_id); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_duration_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var duration_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - var units = $('.scb_f_experiment_setup_duration_units_edit select[treatment_id="'+$(element).attr('treatment_id')+'"]').val(); - parsed.assignment.template.durations[duration_id] = {name: $(element).val() + ' ' + units, duration: $(element).val(), units: units}; - var treatment_id = $(element).attr('treatment_id'); - if(parsed.assignment.template.drugs[treatment_id].duration.length > 0){ - delete parsed.assignment.template.durations[parsed.assignment.template.drugs[treatment_id].duration[0]]; - } - parsed.assignment.template.drugs[treatment_id].duration = []; - parsed.assignment.template.drugs[treatment_id].duration.push(duration_id); - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_duration_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var duration_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + var units = $('.scb_f_experiment_setup_duration_units_edit select[treatment_id="' + $(element).attr('treatment_id') + '"]').val(); + parsed.assignment.template.durations[duration_id] = { + name: $(element).val() + ' ' + units, + duration: $(element).val(), + units: units + }; + var treatment_id = $(element).attr('treatment_id'); + if (parsed.assignment.template.drugs[treatment_id].duration.length > 0) { + delete parsed.assignment.template.durations[parsed.assignment.template.drugs[treatment_id].duration[0]]; + } + parsed.assignment.template.drugs[treatment_id].duration = []; + parsed.assignment.template.drugs[treatment_id].duration.push(duration_id); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_duration_units_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var duration_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - var duration_val = $('.scb_f_experiment_setup_duration_edit[treatment_id="'+$(element).attr('treatment_id')+'"]').val(); - parsed.assignment.template.durations[duration_id] = {name: duration_val + ' ' + $(element).val(), duration: duration_val, units: $(element).val()}; - var treatment_id = $(element).attr('treatment_id'); - if(parsed.assignment.template.drugs[treatment_id].duration.length > 0){ - delete parsed.assignment.template.durations[parsed.assignment.template.drugs[treatment_id].duration[0]]; - } - parsed.assignment.template.drugs[treatment_id].duration = []; - parsed.assignment.template.drugs[treatment_id].duration.push(duration_id); - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_duration_units_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var duration_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + var duration_val = $('.scb_f_experiment_setup_duration_edit[treatment_id="' + $(element).attr('treatment_id') + '"]').val(); + parsed.assignment.template.durations[duration_id] = { + name: duration_val + ' ' + $(element).val(), + duration: duration_val, + units: $(element).val() + }; + var treatment_id = $(element).attr('treatment_id'); + if (parsed.assignment.template.drugs[treatment_id].duration.length > 0) { + delete parsed.assignment.template.durations[parsed.assignment.template.drugs[treatment_id].duration[0]]; + } + parsed.assignment.template.drugs[treatment_id].duration = []; + parsed.assignment.template.drugs[treatment_id].duration.push(duration_id); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_treatment = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var drug_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - parsed.assignment.template.drugs[drug_id] = {concentrations: [], name: $(element).val(), schedule: [], duration: []};; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_treatment = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var drug_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + parsed.assignment.template.drugs[drug_id] = { + concentrations: [], + name: $(element).val(), + schedule: [], + duration: [] + };; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_temperature_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var temperature_id =$(element).attr('temperature_id') ? $(element).attr('temperature_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - parsed.assignment.template.experiment_temperatures[temperature_id] = { name: $(element).val() + degreeEntity + "C", temp: $(element).val()}; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_temperature_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var temperature_id = $(element).attr('temperature_id') ? $(element).attr('temperature_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + parsed.assignment.template.experiment_temperatures[temperature_id] = { + name: $(element).val() + degreeEntity + "C", + temp: $(element).val() + }; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_temperature = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var temperature_id = $(element).attr('temperature_id') ? $(element).attr('temperature_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - parsed.assignment.template.experiment_temperatures[temperature_id] = {name: $(element).val() + degreeEntity + "C", temp: $(element).val() }; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_temperature = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var temperature_id = $(element).attr('temperature_id') ? $(element).attr('temperature_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + parsed.assignment.template.experiment_temperatures[temperature_id] = { + name: $(element).val() + degreeEntity + "C", + temp: $(element).val() + }; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_collection_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var collection_id = $(element).attr('collection_id') ? $(element).attr('collection_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - parsed.assignment.template.collections[collection_id] = {name: $(element).val()}; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_collection_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var collection_id = $(element).attr('collection_id') ? $(element).attr('collection_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + parsed.assignment.template.collections[collection_id] = { + name: $(element).val() + }; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_collection = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var collection_id = $(element).attr('collection_id') ? $(element).attr('collection_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - parsed.assignment.template.collections[collection_id] = {name: $(element).val()}; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_collection = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var collection_id = $(element).attr('collection_id') ? $(element).attr('collection_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + parsed.assignment.template.collections[collection_id] = { + name: $(element).val() + }; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_treatment = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var treatment_id = $(element).attr('treatment_id'); - delete parsed.assignment.template.drugs[treatment_id]; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_treatment = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var treatment_id = $(element).attr('treatment_id'); + delete parsed.assignment.template.drugs[treatment_id]; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_temperature = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var temperature_id = $(element).attr('temperature_id') ; - delete parsed.assignment.template.experiment_temperatures[temperature_id]; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_temperature = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var temperature_id = $(element).attr('temperature_id'); + delete parsed.assignment.template.experiment_temperatures[temperature_id]; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_collection = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); - var collection_id = $(element).attr('collection_id') ; - delete parsed.assignment.template.collections[collection_id]; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_collection = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage2View.parse(element); + var collection_id = $(element).attr('collection_id'); + delete parsed.assignment.template.collections[collection_id]; + scb.ui.static.InstructorFrame.refresh(); } @@ -408,123 +590,125 @@ scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_c scb.ui.static.InstructorExperimentSetupPage2View.register = function(workarea) { - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page2_save_assignment_button', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_page2_save_assignment_button(this, e); - }); - - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_treatment_edit', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_edit(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_treatment_concentration_edit', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_concentration_edit(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_treatment_concentration_units_edit select', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_concentration_units_edit(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_start_time_edit', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_start_time_edit(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_start_time_units_edit select', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_start_time_units_edit(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_duration_edit', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_duration_edit(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_duration_units_edit select', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_duration_units_edit(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_temperature_edit', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_temperature_edit(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_collection_edit', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_collection_edit(this, e); - }); - - - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_add_temperature', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_temperature(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_add_treatment', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_treatment(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_add_collection', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_collection(this, e); - }); - - - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_remove_treatment', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_treatment(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_remove_temperature', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_temperature(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_remove_collection', function (e) { - scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_collection(this, e); - }); - + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page2_save_assignment_button', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_page2_save_assignment_button(this, e); + }); + + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_treatment_edit', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_edit(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_treatment_concentration_edit', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_concentration_edit(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_treatment_concentration_units_edit select', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_treatment_concentration_units_edit(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_start_time_edit', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_start_time_edit(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_start_time_units_edit select', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_start_time_units_edit(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_duration_edit', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_duration_edit(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_duration_units_edit select', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_duration_units_edit(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_temperature_edit', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_temperature_edit(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_experiment_setup_collection_edit', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_collection_edit(this, e); + }); + + + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_add_temperature', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_temperature(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_add_treatment', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_treatment(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_add_collection', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_add_collection(this, e); + }); + + + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_remove_treatment', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_treatment(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_remove_temperature', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_temperature(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_remove_collection', function(e) { + scb.ui.static.InstructorExperimentSetupPage2View.scb_f_experiment_setup_remove_collection(this, e); + }); + }; scb.ui.InstructorExperimentSetupPage2View = function scb_ui_InstructorExperimentSetupPage2View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; + } + + + workarea.html(scb_instructor_experiment_setup_page2.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_experiment_setup_page2.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); - }); + }); - } + } } \ No newline at end of file diff --git a/html_app/instructor/InstructorExperimentSetupPage3View.js b/html_app/instructor/InstructorExperimentSetupPage3View.js index 3e067468..b80d47ee 100644 --- a/html_app/instructor/InstructorExperimentSetupPage3View.js +++ b/html_app/instructor/InstructorExperimentSetupPage3View.js @@ -1,254 +1,284 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } scb.ui.static = scb.ui.static || {}; scb.ui.static.InstructorExperimentSetupPage3View = scb.ui.static.InstructorExperimentSetupPage3View || {}; -scb.ui.static.InstructorExperimentSetupPage3View.SORT_TOTAL = 4; +scb.ui.static.InstructorExperimentSetupPage3View.SORT_TOTAL = 4; -scb.ui.static.InstructorExperimentSetupPage3View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorExperimentSetupPage3View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_remove_row = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); - var treatment_id = $(element).attr('treatment_id'); - var delete_row = null; - _.each(parsed.assignment.template.ui.add_multiple_dialog, function(strain){ - if(strain.rows){ - var delete_row = _.filter(strain.rows, function(row){ - return row.treatment_id == treatment_id; - }); - if(delete_row.length > 0) - strain.rows = _.without(strain.rows, delete_row[0]); - - } - - }); - - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_remove_row = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); + var treatment_id = $(element).attr('treatment_id'); + var delete_row = null; + _.each(parsed.assignment.template.ui.add_multiple_dialog, function(strain) { + if (strain.rows) { + var delete_row = _.filter(strain.rows, function(row) { + return row.treatment_id == treatment_id; + }); + if (delete_row.length > 0) { + strain.rows = _.without(strain.rows, delete_row[0]); + } + + } + + }); + + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'experiment_setup_page4', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'experiment_setup_page4', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } -scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_sort_button = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); - $.jqDialog.content(scb_instructor_experiment_setup_page3.sort_window({assignment: parsed.assignment})); - $('.scb_f_sort_close_button').click(function(){ - if($('.scb_s_sort_dialog').length >0){ - $('.scb_s_sort_dialog').remove(); - $('.overlay').remove(); - $('#jqDialog_box').hide(); - } - }); - - $('.scb_f_experiment_setup_page3_sort').click(function(){ - parsed.assignment.sort = []; - _.each($('.scb_f_experiment_setup_page3_sort_row'), function(key,value,list){ - var index = value+1; - if($('.scb_f_experiment_setup_page3_checkbox_sort'+index, key).attr('checked')){ - var sort_object = {} - sort_object['sort'] = $('.scb_f_experiment_setup_page3_field_sort'+index, key).val(); - sort_object['sort_type'] = $('.scb_f_experiment_setup_page3_type_sort'+index, key).val(); - parsed.assignment.sort.push(sort_object); - } - }); - if($('.scb_s_sort_dialog').length >0){ - $('.scb_s_sort_dialog').remove(); - $('.overlay').remove(); - $('#jqDialog_box').hide(); - } - - scb.ui.static.InstructorFrame.refresh(); - }); - - +scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_sort_button = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); + $.jqDialog.content(scb_instructor_experiment_setup_page3.sort_window({ + assignment: parsed.assignment + })); + $('.scb_f_sort_close_button').click(function() { + if ($('.scb_s_sort_dialog').length > 0) { + $('.scb_s_sort_dialog').remove(); + $('.overlay').remove(); + $('#jqDialog_box').hide(); + } + }); + + $('.scb_f_experiment_setup_page3_sort').click(function() { + parsed.assignment.sort = []; + _.each($('.scb_f_experiment_setup_page3_sort_row'), function(key, value, list) { + var index = value + 1; + if ($('.scb_f_experiment_setup_page3_checkbox_sort' + index, key).attr('checked')) { + var sort_object = {} + sort_object['sort'] = $('.scb_f_experiment_setup_page3_field_sort' + index, key).val(); + sort_object['sort_type'] = $('.scb_f_experiment_setup_page3_type_sort' + index, key).val(); + parsed.assignment.sort.push(sort_object); + } + }); + if ($('.scb_s_sort_dialog').length > 0) { + $('.scb_s_sort_dialog').remove(); + $('.overlay').remove(); + $('#jqDialog_box').hide(); + } + + scb.ui.static.InstructorFrame.refresh(); + }); + + } -scb.ui.static.InstructorExperimentSetupPage3View.scb_f_sort_close_button = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); +scb.ui.static.InstructorExperimentSetupPage3View.scb_f_sort_close_button = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); + - } -scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_sort = function(element, workarea){ - var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); +scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_sort = function(element, workarea) { + var parsed = scb.ui.static.InstructorExperimentSetupPage3View.parse(element); } scb.ui.static.InstructorExperimentSetupPage3View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page3_save_assignment_button', function (e) { - scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_save_assignment_button(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page3_remove_row', function (e) { - scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_remove_row(this, e); - }); - - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_sort_button', function (e) { - scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_sort_button(this, e); - }); - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page3_save_assignment_button', function(e) { + scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_save_assignment_button(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page3_remove_row', function(e) { + scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_page3_remove_row(this, e); + }); + + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_sort_button', function(e) { + scb.ui.static.InstructorExperimentSetupPage3View.scb_f_experiment_setup_sort_button(this, e); + }); + + + + + }; -scb.ui.static.InstructorExperimentSetupPage3View.rows = function(dialog, sort_order){ - var rows =[]; - var headings = dialog.headings; - var sorting_conditions = []; - for(var x = 0 ; x < sort_order.length ; x++){ - for(var y = 0; y < headings.length; y++){ - if(sort_order[x]['sort'] == headings[y]){ - sorting_conditions.push([y-1, sort_order[x]['sort_type']]); - } - } - } - - _.each(dialog.order, function(strain){ - _.each(dialog[strain].rows, function(row){ - var insert_row = {treatment_id:row.treatment_id, row: []}; - _.each(row.cells, function(cell){ - if(cell.kind=='text') - insert_row.row.push(cell.text); - - }); - rows.push(insert_row); - }); - }); - rows = rows.sort( - function(a, b){ - if(a.treatment_id == 'zh1zia4i'|| b.treatment_id =='zh1zia4i'){ - console.log('foundit'); - } - if(sort_order.length <=0){ - if( a.row[0] > b.row[0]) return 1; - if( a.row[0] < b.row[0]) return -1; - if(a.row[0] == b.row[0]) return 0; - } - if(sort_order.length >=1){ - if( a.row[sorting_conditions[0][0]] > b.row[sorting_conditions[0][0]]) return sorting_conditions[0][1] == 'Ascending'? 1: -1; - if( a.row[sorting_conditions[0][0]] < b.row[sorting_conditions[0][0]]) return sorting_conditions[0][1] == 'Ascending' ? -1: 1; -// if(a.row[sorting_conditions[0][0]] == b.row[sorting_conditions[0][0]]) return 0; - } - if(sort_order.length >=2){ - if( a.row[sorting_conditions[1][0]] > b.row[sorting_conditions[1][0]]) return sorting_conditions[1][1] == 'Ascending'? 1: -1; - if( a.row[sorting_conditions[1][0]] < b.row[sorting_conditions[1][0]]) return sorting_conditions[1][1] == 'Ascending' ? -1: 1; -// if(a.row[sorting_conditions[1][0]] == b.row[sorting_conditions[1][0]]) return 0; - } - if(sort_order.length >=3){ - if( a.row[sorting_conditions[2][0]] > b.row[sorting_conditions[2][0]]) return sorting_conditions[2][1] == 'Ascending'? 1: -1; - if( a.row[sorting_conditions[2][0]] < b.row[sorting_conditions[2][0]]) return sorting_conditions[2][1] == 'Ascending' ? -1: 1; -// if(a.row[sorting_conditions[2][0]] == b.row[sorting_conditions[2][0]]) return 0; - } - if(sort_order.length >=4){ - if( a.row[sorting_conditions[3][0]] > b.row[sorting_conditions[3][0]]) return sorting_conditions[3][1] == 'Ascending'? 1: -1; - if( a.row[sorting_conditions[3][0]] < b.row[sorting_conditions[3][0]]) return sorting_conditions[3][1] == 'Ascending' ? -1: 1; -// if(a.row[sorting_conditions[3][0]] == b.row[sorting_conditions[3][0]]) return 0; - } - } - ); - return rows; +scb.ui.static.InstructorExperimentSetupPage3View.rows = function(dialog, sort_order) { + var rows = []; + var headings = dialog.headings; + var sorting_conditions = []; + for (var x = 0; x < sort_order.length; x++) { + for (var y = 0; y < headings.length; y++) { + if (sort_order[x]['sort'] == headings[y]) { + sorting_conditions.push([y - 1, sort_order[x]['sort_type']]); + } + } + } + + _.each(dialog.order, function(strain) { + _.each(dialog[strain].rows, function(row) { + var insert_row = { + treatment_id: row.treatment_id, + row: [] + }; + _.each(row.cells, function(cell) { + if (cell.kind == 'text') { + insert_row.row.push(cell.text); + } + + }); + rows.push(insert_row); + }); + }); + rows = rows.sort(function(a, b) { + if (a.treatment_id == 'zh1zia4i' || b.treatment_id == 'zh1zia4i') { + console.log('foundit'); + } + if (sort_order.length <= 0) { + if (a.row[0] > b.row[0]) { + return 1; + } + if (a.row[0] < b.row[0]) { + return -1; + } + if (a.row[0] == b.row[0]) { + return 0; + } + } + if (sort_order.length >= 1) { + if (a.row[sorting_conditions[0][0]] > b.row[sorting_conditions[0][0]]) { + return sorting_conditions[0][1] == 'Ascending' ? 1 : -1; + } + if (a.row[sorting_conditions[0][0]] < b.row[sorting_conditions[0][0]]) { + return sorting_conditions[0][1] == 'Ascending' ? -1 : 1; + } + // if(a.row[sorting_conditions[0][0]] == b.row[sorting_conditions[0][0]]) return 0; + } + if (sort_order.length >= 2) { + if (a.row[sorting_conditions[1][0]] > b.row[sorting_conditions[1][0]]) { + return sorting_conditions[1][1] == 'Ascending' ? 1 : -1; + } + if (a.row[sorting_conditions[1][0]] < b.row[sorting_conditions[1][0]]) { + return sorting_conditions[1][1] == 'Ascending' ? -1 : 1; + } + // if(a.row[sorting_conditions[1][0]] == b.row[sorting_conditions[1][0]]) return 0; + } + if (sort_order.length >= 3) { + if (a.row[sorting_conditions[2][0]] > b.row[sorting_conditions[2][0]]) { + return sorting_conditions[2][1] == 'Ascending' ? 1 : -1; + } + if (a.row[sorting_conditions[2][0]] < b.row[sorting_conditions[2][0]]) { + return sorting_conditions[2][1] == 'Ascending' ? -1 : 1; + } + // if(a.row[sorting_conditions[2][0]] == b.row[sorting_conditions[2][0]]) return 0; + } + if (sort_order.length >= 4) { + if (a.row[sorting_conditions[3][0]] > b.row[sorting_conditions[3][0]]) { + return sorting_conditions[3][1] == 'Ascending' ? 1 : -1; + } + if (a.row[sorting_conditions[3][0]] < b.row[sorting_conditions[3][0]]) { + return sorting_conditions[3][1] == 'Ascending' ? -1 : 1; + } + // if(a.row[sorting_conditions[3][0]] == b.row[sorting_conditions[3][0]]) return 0; + } + } + ); + return rows; } scb.ui.InstructorExperimentSetupPage3View = function scb_ui_InstructorExperimentSetupPage3View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - var rows = scb.ui.static.InstructorExperimentSetupPage3View.rows(assignments.selected.template.ui.add_multiple_dialog, assignments.selected.sort); - - - - workarea.html(scb_instructor_experiment_setup_page3.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - rows: rows, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + var rows = scb.ui.static.InstructorExperimentSetupPage3View.rows(assignments.selected.template.ui.add_multiple_dialog, assignments.selected.sort); + + + + workarea.html(scb_instructor_experiment_setup_page3.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + rows: rows, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorExperimentSetupPage4View.js b/html_app/instructor/InstructorExperimentSetupPage4View.js index b43a05aa..bf1927ff 100644 --- a/html_app/instructor/InstructorExperimentSetupPage4View.js +++ b/html_app/instructor/InstructorExperimentSetupPage4View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,123 +10,129 @@ scb.ui.static.InstructorExperimentSetupPage4View = scb.ui.static.InstructorExper -scb.ui.static.InstructorExperimentSetupPage4View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorExperimentSetupPage4View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorExperimentSetupPage4View.scb_f_experiment_setup_page4_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorExperimentSetupPage4View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'select_technique', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorExperimentSetupPage4View.scb_f_experiment_setup_page4_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorExperimentSetupPage4View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'select_technique', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorExperimentSetupPage4View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page4_save_assignment_button', function (e) { - scb.ui.static.InstructorExperimentSetupPage4View.scb_f_experiment_setup_page4_save_assignment_button(this, e); - }); - + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_page4_save_assignment_button', function(e) { + scb.ui.static.InstructorExperimentSetupPage4View.scb_f_experiment_setup_page4_save_assignment_button(this, e); + }); + }; -scb.ui.static.InstructorExperimentSetupPage4View.rows = function(dialog){ - var rows =[]; - var headings = dialog.headings; - _.each(dialog.order, function(strain){ - _.each(dialog[strain].rows, function(row){ - var insert_row = {treatment_id:row.treatment_id, row: []}; - _.each(row.cells, function(cell){ - if(cell.kind=='text') - insert_row.row.push(cell.text); - else - insert_row.row.push('cell_plate'); - - }); - rows.push(insert_row); - }); - }); - - return rows; +scb.ui.static.InstructorExperimentSetupPage4View.rows = function(dialog) { + var rows = []; + var headings = dialog.headings; + _.each(dialog.order, function(strain) { + _.each(dialog[strain].rows, function(row) { + var insert_row = { + treatment_id: row.treatment_id, + row: [] + }; + _.each(row.cells, function(cell) { + if (cell.kind == 'text') { + insert_row.row.push(cell.text); + } else { + insert_row.row.push('cell_plate'); + } + + }); + rows.push(insert_row); + }); + }); + + return rows; } scb.ui.InstructorExperimentSetupPage4View = function scb_ui_InstructorExperimentSetupPage4View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - var rows = scb.ui.static.InstructorExperimentSetupPage4View.rows(assignments.selected.template.ui.add_multiple_dialog); - - workarea.html(scb_instructor_experiment_setup_page4.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - rows: rows, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + var rows = scb.ui.static.InstructorExperimentSetupPage4View.rows(assignments.selected.template.ui.add_multiple_dialog); + + workarea.html(scb_instructor_experiment_setup_page4.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + rows: rows, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorFacsPage1View.js b/html_app/instructor/InstructorFacsPage1View.js index c48ca248..cfdedf64 100644 --- a/html_app/instructor/InstructorFacsPage1View.js +++ b/html_app/instructor/InstructorFacsPage1View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,111 +10,113 @@ scb.ui.static.InstructorFacsPage1View = scb.ui.static.InstructorFacsPage1View || -scb.ui.static.InstructorFacsPage1View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorFacsPage1View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorFacsPage1View.scb_f_facs_page1_save_assignment_button = function(element, workarea){ +scb.ui.static.InstructorFacsPage1View.scb_f_facs_page1_save_assignment_button = function(element, workarea) { - var parsed = scb.ui.static.InstructorFacsPage1View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'facs_page2', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); + var parsed = scb.ui.static.InstructorFacsPage1View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'facs_page2', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorFacsPage1View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_facs_page1_save_assignment_button', function (e) { - scb.ui.static.InstructorFacsPage1View.scb_f_facs_page1_save_assignment_button(this, e); - }); - - - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_facs_page1_save_assignment_button', function(e) { + scb.ui.static.InstructorFacsPage1View.scb_f_facs_page1_save_assignment_button(this, e); + }); + + + + + + + }; scb.ui.InstructorFacsPage1View = function scb_ui_InstructorFacsPage1View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_facs_page1.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_facs_page1.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorFacsPage2View.js b/html_app/instructor/InstructorFacsPage2View.js index cb065270..cd6f7700 100644 --- a/html_app/instructor/InstructorFacsPage2View.js +++ b/html_app/instructor/InstructorFacsPage2View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,123 +10,127 @@ scb.ui.static.InstructorFacsPage2View = scb.ui.static.InstructorFacsPage2View || -scb.ui.static.InstructorFacsPage2View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorFacsPage2View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorFacsPage2View.scb_f_facs_page2_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorFacsPage2View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - - - var view = ''; - if(_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'micro')) - view = 'microscopy_page1'; - else view = 'dashboard'; - - - var state = { - assignment_id: parsed.assignment.id, - view: view, - skip_hash_update: true - }; - - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorFacsPage2View.scb_f_facs_page2_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorFacsPage2View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + + + var view = ''; + if (_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'micro')) { + view = 'microscopy_page1'; + } else { + view = 'dashboard'; + } + + + var state = { + assignment_id: parsed.assignment.id, + view: view, + skip_hash_update: true + }; + + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorFacsPage2View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_facs_page2_save_assignment_button', function (e) { - scb.ui.static.InstructorFacsPage2View.scb_f_facs_page2_save_assignment_button(this, e); - }); - - - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_facs_page2_save_assignment_button', function(e) { + scb.ui.static.InstructorFacsPage2View.scb_f_facs_page2_save_assignment_button(this, e); + }); + + + + + + + }; scb.ui.InstructorFacsPage2View = function scb_ui_InstructorFacsPage2View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_facs_page2.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_facs_page2.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorFrame.js b/html_app/instructor/InstructorFrame.js index 429cd255..cc5ca9b6 100644 --- a/html_app/instructor/InstructorFrame.js +++ b/html_app/instructor/InstructorFrame.js @@ -5,1125 +5,1141 @@ scb.ui.static = scb.ui.static || {}; scb.ui.static.InstructorFrame = scb.ui.static.InstructorFrame || {}; -scb.ui.static.InstructorFrame.update_hash = function (state) { - console.info("update_hash " + state.onhashchange); - console.info($.bbq.getState()); - console.info(state); - - if (!state.onhashchange) { - delete state.onhashchange; - var History = window.History; - if (!History.enabled) { - return; - } - History.discardedState(); - History.discardedState(); - History.pushState(state, 2, "/#" + $.param(state)); +scb.ui.static.InstructorFrame.update_hash = function(state) { + console.info("update_hash " + state.onhashchange); + console.info($.bbq.getState()); + console.info(state); + + if (!state.onhashchange) { + delete state.onhashchange; + var History = window.History; + if (!History.enabled) { + return; } + History.discardedState(); + History.discardedState(); + History.pushState(state, 2, "/#" + $.param(state)); + } } scb.ui.InstructorFrame = function scb_ui_InstructorFrame(master_model, context) { - var self = this; - var pending_save = false; - context.main_frame = self; - self.sections = {}; - - var assignments = new scb.AssignmentList(master_model.assignments, context); - - user_is_auth = typeof get_student_courses_result != "undefined" ? get_student_courses_result.is_auth : get_instructor_assignments_result.is_auth; + var self = this; + var pending_save = false; + context.main_frame = self; + self.sections = {}; - user_token = typeof get_student_courses_result != "undefined" ? get_student_courses_result.token : get_instructor_assignments_result.token; + var assignments = new scb.AssignmentList(master_model.assignments, context); + user_is_auth = typeof get_student_courses_result != "undefined" ? get_student_courses_result.is_auth : get_instructor_assignments_result.is_auth; - scb.ui.static.InstructorFrame.ensure_auth_context = function () { - context = context || {}; - context.auth = context.auth || {}; - } - scb.ui.static.InstructorFrame.validate_state = function (state) { - var ret = { - redisplay: false - }; - - if (state.assignment_id) { - var assignment = assignments.get(state.assignment_id); - if (assignment) { - assignments.selected_id = assignment.id; - ret.assignment = assignment; - - if (state.experiment_id) { - var experiment = assignment.experiments.get(state.experiment_id); - if (experiment) { - assignment.experiments.selected_id = experiment.id; - ret.experiment = experiment; - if (state.western_blot_id) { - var western_blot = experiment.western_blot_list.get(state.western_blot_id); - if (western_blot) { - ret.western_blot = western_blot; - if (state.western_blot_gel_id && western_blot) { - var western_blot_gel = western_blot.gel_list.get(state.western_blot_gel_id); - ret.western_blot_gel = western_blot_gel; - } - } - } - if (state.cell_treatment_id) { - var cell_treatment = experiment.cell_treatment_list.get(state.cell_treatment_id); - if (cell_treatment) { - ret.cell_treatment = cell_treatment; - if (state.treatment_id && cell_treatment) { - var treatment = cell_treatment.treatment_list.get(state.treatment_id); - ret.treatment = treatment; - } - } - } - if (state.facs_id) { - var facs = experiment.facs_list.get(state.facs_id); - if (facs) { - ret.facs = facs; - if (state.facs_lane_id && facs) { - var facs_lane = facs.lanes_list.get(state.facs_lane_id) - ret.facs_lane = facs_lane; - } - } - } - if (state.microscopy_id) { - var microscopy = experiment.microscopy_list.get(state.microscopy_id); - if(microscopy) { - ret.microscopy = microscopy; - } - if (state.microscopy_lane_id && microscopy) { - var microscopy_lane = microscopy.lanes_list.get(state.microscopy_lane_id) - ret.microscopy_lane = microscopy_lane; - } - } - - } - else { - - state.onhashchange = false; - state.view = 'course_setup'; - delete state.experiment_id; - scb.ui.static.InstructorFrame.update_hash(state); - ret.redisplay = true; - ret.redisplay_state = state; - } - } - } - else { - - state.onhashchange = false; - state.view = 'course_setup'; - delete state.assignment_id; - scb.ui.static.InstructorFrame.update_hash(state); - ret.redisplay = true; - ret.redisplay_state = state; - } - } - if (ret.redisplay == false && state.skip_hash_update != true) { - scb.ui.static.InstructorFrame.update_hash(state); - } - ret.context = context; - return ret; - } + user_token = typeof get_student_courses_result != "undefined" ? get_student_courses_result.token : get_instructor_assignments_result.token; - //TODO: DEBUG REMOVE - window._assigments = assignments; - self.current_tab = { - hide: scb.Utils.noop, - show: scb.Utils.noop + scb.ui.static.InstructorFrame.ensure_auth_context = function() { + context = context || {}; + context.auth = context.auth || {}; + } + scb.ui.static.InstructorFrame.validate_state = function(state) { + var ret = { + redisplay: false }; - var workarea = context.ui; - workarea.css({ - 'height': '100%' - }); - - scb.ui.static.InstructorDashboardView.register(workarea); - scb.ui.static.InstructorCourseSetupView.register(workarea); - scb.ui.static.InstructorAssignmentSetupView.register(workarea); - scb.ui.static.ExperimentDesignView.register(workarea); - scb.ui.static.InstructorExperimentSetupPage1View.register(workarea); - scb.ui.static.InstructorExperimentSetupPage2View.register(workarea); - scb.ui.static.InstructorExperimentSetupPage3View.register(workarea); - scb.ui.static.InstructorExperimentSetupPage4View.register(workarea); - - scb.ui.static.InstructorWesternBlotPage1View.register(workarea); - scb.ui.static.InstructorWesternBlotPage2View.register(workarea); - scb.ui.static.InstructorWesternBlotPage3View.register(workarea); - scb.ui.static.InstructorWesternBlotPage4View.register(workarea); - scb.ui.static.InstructorWesternBlotPage5View.register(workarea); - - - scb.ui.static.InstructorMicroscopyPage1View.register(workarea); - scb.ui.static.InstructorMicroscopyPage2View.register(workarea); - scb.ui.static.InstructorMicroscopyPage3View.register(workarea); - - scb.ui.static.InstructorSelectTechniqueView.register(workarea); - - scb.ui.static.InstructorFacsPage1View.register(workarea); - scb.ui.static.InstructorFacsPage2View.register(workarea); - - - scb.ui.static.InstructorFrame.in_ajax = false; - scb.ui.static.InstructorFrame.show_in_ajax = false; - scb.ui.static.InstructorFrame.show_in_ajax_message = ''; - - scb.ui.static.InstructorFrame.in_ajax_display = function () { - var saving = $('#saving'); - if (scb.ui.static.InstructorFrame.show_in_ajax) { - saving.show(); - $('#saving_message', saving).html(scb.ui.static.InstructorFrame.show_in_ajax_message); - } - else { - saving.hide(); - } - } - scb.ui.static.InstructorFrame.save = function () { - var tmp; - try { - tmp = assignments.selected.experiments.selected_id; - } catch (ex) { - } - try { - assignment.selected.experiments.selected_id = null; - } catch (ex) { - } - var model_string = JSON.stringify(master_model); - if (localStorage.getItem("scb_master_model") != model_string) { - master_model.timestamp = (new Date()).getTime(); - model_string = JSON.stringify(master_model); - try { - localStorage.setItem("scb_master_model", model_string); - if (!scb.ui.static.InstructorFrame.in_ajax) { - scb.ui.static.InstructorFrame.in_ajax = true; - scb.ui.static.InstructorFrame.show_in_ajax = true; - scb.ui.static.InstructorFrame.show_in_ajax_message = ''; - scb.ui.static.InstructorFrame.in_ajax_display(); - scb.utils.server.call(model_string, function (state) { - scb.ui.static.InstructorFrame.in_ajax = false; - scb.ui.static.InstructorFrame.show_in_ajax = !state.success; - scb.ui.static.InstructorFrame.show_in_ajax_message = !state.success ? 'Failed, will retry in 30 seconds.' : ''; - scb.ui.static.InstructorFrame.in_ajax_display(); - }); + if (state.assignment_id) { + var assignment = assignments.get(state.assignment_id); + if (assignment) { + assignments.selected_id = assignment.id; + ret.assignment = assignment; + + if (state.experiment_id) { + var experiment = assignment.experiments.get(state.experiment_id); + if (experiment) { + assignment.experiments.selected_id = experiment.id; + ret.experiment = experiment; + if (state.western_blot_id) { + var western_blot = experiment.western_blot_list.get(state.western_blot_id); + if (western_blot) { + ret.western_blot = western_blot; + if (state.western_blot_gel_id && western_blot) { + var western_blot_gel = western_blot.gel_list.get(state.western_blot_gel_id); + ret.western_blot_gel = western_blot_gel; } + } } - catch (e) { + if (state.cell_treatment_id) { + var cell_treatment = experiment.cell_treatment_list.get(state.cell_treatment_id); + if (cell_treatment) { + ret.cell_treatment = cell_treatment; + if (state.treatment_id && cell_treatment) { + var treatment = cell_treatment.treatment_list.get(state.treatment_id); + ret.treatment = treatment; + } + } } + if (state.facs_id) { + var facs = experiment.facs_list.get(state.facs_id); + if (facs) { + ret.facs = facs; + if (state.facs_lane_id && facs) { + var facs_lane = facs.lanes_list.get(state.facs_lane_id) + ret.facs_lane = facs_lane; + } + } + } + if (state.microscopy_id) { + var microscopy = experiment.microscopy_list.get(state.microscopy_id); + if (microscopy) { + ret.microscopy = microscopy; + } + if (state.microscopy_lane_id && microscopy) { + var microscopy_lane = microscopy.lanes_list.get(state.microscopy_lane_id) + ret.microscopy_lane = microscopy_lane; + } + } + + } else { + + state.onhashchange = false; + state.view = 'course_setup'; + delete state.experiment_id; + scb.ui.static.InstructorFrame.update_hash(state); + ret.redisplay = true; + ret.redisplay_state = state; + } } - try { - assignment.experiments.selected_id = tmp; - } catch (ex) { - } - }; + } else { - scb.ui.static.InstructorFrame.load = function () { - var master_model = JSON.parse(localStorage.getItem("scb_master_model")); - starcellbio(context.ui, master_model); + state.onhashchange = false; + state.view = 'course_setup'; + delete state.assignment_id; + scb.ui.static.InstructorFrame.update_hash(state); + ret.redisplay = true; + ret.redisplay_state = state; + } } - - scb.ui.static.InstructorFrame.clear_NO_PROMPT = function () { - $.ajax({url: '/accounts/logout/', async: false, timeout: 5 }); - self.show({view: 'dashboard'}); - master_model = master_model_data; - scb.ui.static.InstructorFrame.save(); - starcellbio(context.ui, master_model); + if (ret.redisplay == false && state.skip_hash_update != true) { + scb.ui.static.InstructorFrame.update_hash(state); } - - scb.ui.static.InstructorFrame.clear = function () { - var r = prompt("This will restart whole assignment. Your saved data will be lost. Type: 'YES' to proceed."); - if (r == 'YES') { - self.show({view: 'dashboard'}); - master_model = master_model_data; - scb.ui.static.InstructorFrame.save(); - starcellbio(context.ui, master_model); + ret.context = context; + return ret; + } + + //TODO: DEBUG REMOVE + window._assigments = assignments; + + self.current_tab = { + hide: scb.Utils.noop, + show: scb.Utils.noop + }; + + var workarea = context.ui; + workarea.css({ + 'height': '100%' + }); + + scb.ui.static.InstructorDashboardView.register(workarea); + scb.ui.static.InstructorCourseSetupView.register(workarea); + scb.ui.static.InstructorAssignmentSetupView.register(workarea); + scb.ui.static.ExperimentDesignView.register(workarea); + scb.ui.static.InstructorExperimentSetupPage1View.register(workarea); + scb.ui.static.InstructorExperimentSetupPage2View.register(workarea); + scb.ui.static.InstructorExperimentSetupPage3View.register(workarea); + scb.ui.static.InstructorExperimentSetupPage4View.register(workarea); + + scb.ui.static.InstructorWesternBlotPage1View.register(workarea); + scb.ui.static.InstructorWesternBlotPage2View.register(workarea); + scb.ui.static.InstructorWesternBlotPage3View.register(workarea); + scb.ui.static.InstructorWesternBlotPage4View.register(workarea); + scb.ui.static.InstructorWesternBlotPage5View.register(workarea); + + + scb.ui.static.InstructorMicroscopyPage1View.register(workarea); + scb.ui.static.InstructorMicroscopyPage2View.register(workarea); + scb.ui.static.InstructorMicroscopyPage3View.register(workarea); + + scb.ui.static.InstructorSelectTechniqueView.register(workarea); + + scb.ui.static.InstructorFacsPage1View.register(workarea); + scb.ui.static.InstructorFacsPage2View.register(workarea); + + + scb.ui.static.InstructorFrame.in_ajax = false; + scb.ui.static.InstructorFrame.show_in_ajax = false; + scb.ui.static.InstructorFrame.show_in_ajax_message = ''; + + scb.ui.static.InstructorFrame.in_ajax_display = function() { + var saving = $('#saving'); + if (scb.ui.static.InstructorFrame.show_in_ajax) { + saving.show(); + $('#saving_message', saving).html(scb.ui.static.InstructorFrame.show_in_ajax_message); + } else { + saving.hide(); + } + } + scb.ui.static.InstructorFrame.save = function() { + var tmp; + try { + tmp = assignments.selected.experiments.selected_id; + } catch ( ex ) {} + try { + assignment.selected.experiments.selected_id = null; + } catch ( ex ) {} + var model_string = JSON.stringify(master_model); + if (localStorage.getItem("scb_master_model") != model_string) { + master_model.timestamp = (new Date()).getTime(); + model_string = JSON.stringify(master_model); + try { + localStorage.setItem("scb_master_model", model_string); + if (!scb.ui.static.InstructorFrame.in_ajax) { + scb.ui.static.InstructorFrame.in_ajax = true; + scb.ui.static.InstructorFrame.show_in_ajax = true; + scb.ui.static.InstructorFrame.show_in_ajax_message = ''; + scb.ui.static.InstructorFrame.in_ajax_display(); + scb.utils.server.call(model_string, function(state) { + scb.ui.static.InstructorFrame.in_ajax = false; + scb.ui.static.InstructorFrame.show_in_ajax = !state.success; + scb.ui.static.InstructorFrame.show_in_ajax_message = !state.success ? 'Failed, will retry in 30 seconds.' : ''; + scb.ui.static.InstructorFrame.in_ajax_display(); + }); } - else { - $('html').css('overflow', 'hidden'); - - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("Operation canceled!\n If you wanted to clear everything type YES in previous dialog.", - function() {$('html').css('overflow', 'visible'); - $('.error_overlay').remove();/* callback function for 'OK' button*/ });; - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Error:

"); - $('#jqDialog_box').attr('role', 'alertdialog'); + } catch ( e ) {} + } + try { + assignment.experiments.selected_id = tmp; + } catch ( ex ) {} + }; + + scb.ui.static.InstructorFrame.load = function() { + var master_model = JSON.parse(localStorage.getItem("scb_master_model")); + starcellbio(context.ui, master_model); + } + + scb.ui.static.InstructorFrame.clear_NO_PROMPT = function() { + $.ajax({ + url: '/accounts/logout/', + async: false, + timeout: 5 + }); + self.show({ + view: 'dashboard' + }); + master_model = master_model_data; + scb.ui.static.InstructorFrame.save(); + starcellbio(context.ui, master_model); + } + + scb.ui.static.InstructorFrame.clear = function() { + var r = prompt("This will restart whole assignment. Your saved data will be lost. Type: 'YES' to proceed."); + if (r == 'YES') { + self.show({ + view: 'dashboard' + }); + master_model = master_model_data; + scb.ui.static.InstructorFrame.save(); + starcellbio(context.ui, master_model); + } else { + $('html').css('overflow', 'hidden'); + + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("Operation canceled!\n If you wanted to clear everything type YES in previous dialog.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); /* callback function for 'OK' button*/ + });; + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Error:

"); + $('#jqDialog_box').attr('role', 'alertdialog'); - } } + } - scb.utils.off_on(workarea, 'click', '.save_master_model', function () { - scb.ui.static.InstructorFrame.save(); - alert("Save"); - }); + scb.utils.off_on(workarea, 'click', '.save_master_model', function() { + scb.ui.static.InstructorFrame.save(); + alert("Save"); + }); - scb.utils.off_on(workarea, 'click', '.load_master_model', function () { - scb.ui.static.InstructorFrame.load(); - }); + scb.utils.off_on(workarea, 'click', '.load_master_model', function() { + scb.ui.static.InstructorFrame.load(); + }); - scb.utils.off_on(workarea, 'click', '.clear_master_model', function () { - scb.ui.static.InstructorFrame.clear(); - }); + scb.utils.off_on(workarea, 'click', '.clear_master_model', function() { + scb.ui.static.InstructorFrame.clear(); + }); - scb.utils.off_on(workarea.parent(), 'click', '.remove_experiment', function () { - $('html').css('overflow', 'hidden'); - - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.confirm("Delete experiment?", - function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - var model_id = scb.Utils.get_attribute($(this), 'experiment_id'); - assignments.selected.experiments.remove(model_id); - assignments.selected.experiments.selected_id = null; - self.show({}); - },// callback function for 'YES' button - function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - return; - } // callback function for 'NO' button - ); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Delete experiment?

"); - $('#jqDialog_box').attr('role', 'alertdialog'); + scb.utils.off_on(workarea.parent(), 'click', '.remove_experiment', function() { + $('html').css('overflow', 'hidden'); - }); - - - - - //HANDLER FOR CONTACT BUTTON AND IFRAME - scb.utils.off_on(workarea.parent(), 'click', '.scb_f_contact', function (evt) { - $(workarea).append(scb_contact.contact({})); - - $(workarea).prepend(scb_common.contact_overlay()); - - scb.utils.off_on(workarea, 'click', '.scb_f_contact_close_button', function () { - $('.scb_s_contact_dialog').detach(); - - $('.contact_overlay').remove(); - }); - $('.scb_s_contact_iframe', workarea).load(function(){ - $('.scb_s_contact_dialog').draggable({ handle:'.scb_s_feedback_form'}); - var iframe = $('.scb_s_contact_iframe').get(0); - var content = (iframe.contentDocument || iframe.contentWindow); - content.body.style.fontSize = '90%'; - content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; - var inputs = content.getElementsByTagName('button'); - $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); - var fieldset = content.querySelectorAll('fieldset'); - var texts = content.querySelectorAll('input'); - $(texts).attr('placeholder', ''); - $(texts).css('font-family', 'Trebuchet MS, sans-serif'); - - var iframe = $('.scb_s_contact_iframe').contents(); - iframe.find('input[type="checkbox"]').css('height', '12px'); - - var fieldset = content.querySelectorAll('fieldset'); - $(fieldset).css('border', '0'); - $('.scb_s_contact_iframe', workarea).contents().find(".scb_f_contact_submit_button").click(function(e){ - $('.scb_s_contact_iframe', workarea).load(function(){ - var profile = $('.scb_s_contact_iframe', workarea).contents().get(0); - if(profile.body.textContent.indexOf('you for your feedback.') >0){ - parent.document.location.reload(); - } - }); - }); - }); - }); - - - - - //HANDLER FOR USER_GUIDE BUTTON AND IFRAME - scb.utils.off_on(workarea.parent(), 'click', '.scb_f_user_guide', function (evt) { - var iframe_history=['#']; - var currentPush = false; - $('body').append(scb_userguide.userguide({})); - $("#closesearch").hide(); - $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); - $('.scb_s_ug_home').attr('disabled', 'disabled'); - scb.utils.off_on('body', 'click', '.scb_f_ug_close_button', function () { - $('.scb_f_ug_help_search_bar').detach(); - }); - $(function() { - $(".scb_f_ug_help_search_bar").mousemove(function(e) { - var myPos = $(this).offset(); - myPos.bottom = $(this).offset().top + $(this).outerHeight(); - myPos.right = $(this).offset().left + $(this).outerWidth(); - - if (myPos.bottom > e.pageY && e.pageY > myPos.bottom -20 && myPos.right > e.pageX && e.pageX > myPos.right - 20) { - $(this).css({ cursor: "nwse-resize" }); - } - else { - $(this).css({ cursor: "" }); - } - }); - }); - - $('iframe.scb_s_ug_dialog').load(function(){ - $('.scb_f_ug_help_search_bar').width($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help_display').width()+20); - $('iframe.scb_s_ug_dialog').width($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help').width()+20); - $('iframe.scb_s_ug_dialog').height($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help').height()+20); - $('.scb_f_ug_help_search_bar').draggable({ handle:'.user_guide_title'}); - $('iframe.scb_s_ug_dialog').contents().find('body').css('font-family', "Trebuchet MS, Helvetica, Arial, Verdana, sans-serif"); - $('iframe.scb_s_ug_dialog').contents().find("#popout").hide(); - $('iframe.scb_s_ug_dialog').contents().click(function(event) { - if(event.target.className !='scb_s_ug_home' && event.target.id !='search'){ - if(iframe_history.length ==0){ - iframe_history=['#']; - } - $(".scb_s_ug_home").removeClass('scb_s_ug_home_disabled'); - $('.scb_s_ug_home').removeAttr('disabled'); - if($('iframe.scb_s_ug_dialog').contents().find("#popout").length >0){ - $('iframe.scb_s_ug_dialog').contents().find("#popout").hide(); - } - var anchor_element = $(event.target).closest('.anchors') - if(event.target.className == 'intextlink') - anchor_element = $(event.target).get(0); - var anchor_hash = $(anchor_element).attr('href'); - var window_location=window.location.toString()+'/static/ug2/help.html'+anchor_hash; - hashchange_function(anchor_hash, anchor_element); - iframe_history.push(anchor_hash); - currentPush=true; - //console.log(iframe_history); - $(".scb_s_ug_back").removeClass('scb_s_ug_back_disabled'); - $('.scb_s_ug_back').removeAttr('disabled'); - event.preventDefault(); - } - }); - - $('#search').click(function(){ - $('iframe.scb_s_ug_dialog').ready(function(){ - $("#closesearch").show(); - $('iframe.scb_s_ug_dialog').contents().find(".help_search_input").val($(".help_search_input").val()); - $('iframe.scb_s_ug_dialog').contents().find("#search").click(); - }); - }); - - $('.help_search_input').keypress( function(e) { - var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; - if(key == 13) { - e.preventDefault(); - console.log($(".help_search_input").val()); - $('#search').click(); - } - }); - - - $(".scb_s_ug_home").click(function(){ - iframe_history.push('#'); - currentPush = true; - $('iframe.scb_s_ug_dialog').contents().find(".scb_s_ug_home").click(); - $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); - $('.scb_s_ug_home').attr('disabled', 'disabled'); - $(".scb_s_ug_back").removeClass('scb_s_ug_back_disabled'); - $('.scb_s_ug_back').removeAttr('disabled'); - $("#closesearch").hide(); - $(".help_search_input").val(""); - }); - - - $(".scb_s_ug_back").click(function(){ - var back_url = iframe_history.pop(); - if(currentPush){ - back_url = iframe_history.pop(); - } - currentPush=false; - - if(back_url){ - if(back_url =="#") - $('iframe.scb_s_ug_dialog').contents().find(".scb_s_ug_home").click(); - else - $('iframe.scb_s_ug_dialog').contents().find('a[href="'+back_url+'"]').click(); - } - else{ - $(".scb_s_ug_back").addClass('scb_s_ug_back_disabled'); - $('.scb_s_ug_back').attr('disabled', 'disabled'); - - $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); - $('.scb_s_ug_home').attr('disabled', 'disabled'); - } - }); - - console.info('clicked main popout', $('.main_popout')); - - $(".main_popout").click(function(){ - var popout_string = ""; - var visible= $('iframe.scb_s_ug_dialog').contents().find('.scb_s_section_inactive:visible'); - if(visible.length ==1) - { - if($(visible).attr('class') == 'scb_s_section_inactive') - popout_string = $('iframe.scb_s_ug_dialog').contents().find('*:visible ').closest('.scb_s_help_sublink').attr('class').split(' ')[1]; - else - popout_string = $(visible).attr('class'); - } - else{ - popout_string = $($('iframe.scb_s_ug_dialog').contents().find('span:visible').get(0)).attr('class'); - } - - popout_string = popout_string.replace(/_/g, '-'); - if($('iframe.scb_s_ug_dialog').contents().find('.scb_s_section_inactive').length ==0) - popout_string =""; - try - { - var popoutWindow =window.open("static/ug2/full_guide.html#"+popout_string); - } - catch(err) - { - var popoutWindow =window.open("ug2/full_guide.html#"+popout_string); - } - - }); - - $("#closesearch").click(function(){ - $('.help_search_input').val(''); - $("#closesearch").hide(); - $(".scb_s_ug_home").click(); - }); - - }); - - }); + $('body').prepend(scb_experiment_setup.general_error_overlay()); - //HANDLER FOR LOGIN BUTTON AND IFRAME - scb.utils.off_on(workarea.parent(), 'click', '.scb_f_login', function (evt) { - scb.ui.static.InstructorFrame.ensure_auth_context(); - if(assignments.selected && !user_is_auth){ - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - - $.jqDialog.confirm("If you sign in to your account, you will lose your current work as a guest. Would you like to continue?", - function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - if (user_is_auth) { - - window.location = '/accounts/logout/'; - } - else { - add_login_script(workarea); - } - evt.preventDefault(); - },// callback function for 'YES' button - function() { - $('.error_overlay').remove(); - $('html').css('overflow', 'visible'); - return; - } // callback function for 'NO' button - ); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - evt.preventDefault(); - } - else{ - if (user_is_auth) { - - window.location = '/accounts/logout/'; - } - else { - add_login_script(workarea); - } - evt.preventDefault(); - } - }); + $.jqDialog.confirm("Delete experiment?", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + var model_id = scb.Utils.get_attribute($(this), 'experiment_id'); + assignments.selected.experiments.remove(model_id); + assignments.selected.experiments.selected_id = null; + self.show({}); + }, // callback function for 'YES' button + function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + return; + } // callback function for 'NO' button + ); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Delete experiment?

"); + $('#jqDialog_box').attr('role', 'alertdialog'); + }); - self.sections.dashboard = new scb.ui.InstructorDashboardView({ - workarea: workarea, - context: context - }); - self.sections.course_setup = new scb.ui.InstructorCourseSetupView({ - workarea: workarea, - context: context - }); - - self.sections.assignment_setup = new scb.ui.InstructorAssignmentSetupView({ - workarea: workarea, - context: context - }); - self.sections.experiment_setup_page1 = new scb.ui.InstructorExperimentSetupPage1View({ - workarea: workarea, - context: context - }); - self.sections.experiment_setup_page2 = new scb.ui.InstructorExperimentSetupPage2View({ - workarea: workarea, - context: context - }); - - self.sections.experiment_setup_page3 = new scb.ui.InstructorExperimentSetupPage3View({ - workarea: workarea, - context: context - }); - self.sections.experiment_setup_page4 = new scb.ui.InstructorExperimentSetupPage4View({ - workarea: workarea, - context: context - }); + //HANDLER FOR CONTACT BUTTON AND IFRAME + scb.utils.off_on(workarea.parent(), 'click', '.scb_f_contact', function(evt) { + $(workarea).append(scb_contact.contact({})); + $(workarea).prepend(scb_common.contact_overlay()); - self.sections.select_technique = new scb.ui.InstructorSelectTechniqueView({ - workarea: workarea, - context: context - }); + scb.utils.off_on(workarea, 'click', '.scb_f_contact_close_button', function() { + $('.scb_s_contact_dialog').detach(); - self.sections.western_blot_page1 = new scb.ui.InstructorWesternBlotPage1View({ - workarea: workarea, - context: context - }); - - self.sections.western_blot_page2 = new scb.ui.InstructorWesternBlotPage2View({ - workarea: workarea, - context: context + $('.contact_overlay').remove(); }); - self.sections.western_blot_page3 = new scb.ui.InstructorWesternBlotPage3View({ - workarea: workarea, - context: context - }); - self.sections.western_blot_page4 = new scb.ui.InstructorWesternBlotPage4View({ - workarea: workarea, - context: context - }); - self.sections.western_blot_page5 = new scb.ui.InstructorWesternBlotPage5View({ - workarea: workarea, - context: context - }); - - self.sections.microscopy_page1 = new scb.ui.InstructorMicroscopyPage1View({ - workarea: workarea, - context: context - }); - - self.sections.microscopy_page2 = new scb.ui.InstructorMicroscopyPage2View({ - workarea: workarea, - context: context + $('.scb_s_contact_iframe', workarea).load(function() { + $('.scb_s_contact_dialog').draggable({ + handle: '.scb_s_feedback_form' + }); + var iframe = $('.scb_s_contact_iframe').get(0); + var content = (iframe.contentDocument || iframe.contentWindow); + content.body.style.fontSize = '90%'; + content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; + var inputs = content.getElementsByTagName('button'); + $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); + var fieldset = content.querySelectorAll('fieldset'); + var texts = content.querySelectorAll('input'); + $(texts).attr('placeholder', ''); + $(texts).css('font-family', 'Trebuchet MS, sans-serif'); + + var iframe = $('.scb_s_contact_iframe').contents(); + iframe.find('input[type="checkbox"]').css('height', '12px'); + + var fieldset = content.querySelectorAll('fieldset'); + $(fieldset).css('border', '0'); + $('.scb_s_contact_iframe', workarea).contents().find(".scb_f_contact_submit_button").click(function(e) { + $('.scb_s_contact_iframe', workarea).load(function() { + var profile = $('.scb_s_contact_iframe', workarea).contents().get(0); + if (profile.body.textContent.indexOf('you for your feedback.') > 0) { + parent.document.location.reload(); + } + }); + }); }); + }); - self.sections.microscopy_page3 = new scb.ui.InstructorMicroscopyPage3View({ - workarea: workarea, - context: context - }); - self.sections.facs_page1 = new scb.ui.InstructorFacsPage1View({ - workarea: workarea, - context: context + + + //HANDLER FOR USER_GUIDE BUTTON AND IFRAME + scb.utils.off_on(workarea.parent(), 'click', '.scb_f_user_guide', function(evt) { + var iframe_history = ['#']; + var currentPush = false; + $('body').append(scb_userguide.userguide({})); + $("#closesearch").hide(); + $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); + $('.scb_s_ug_home').attr('disabled', 'disabled'); + scb.utils.off_on('body', 'click', '.scb_f_ug_close_button', function() { + $('.scb_f_ug_help_search_bar').detach(); }); - self.sections.facs_page2 = new scb.ui.InstructorFacsPage2View({ - workarea: workarea, - context: context + $(function() { + $(".scb_f_ug_help_search_bar").mousemove(function(e) { + var myPos = $(this).offset(); + myPos.bottom = $(this).offset().top + $(this).outerHeight(); + myPos.right = $(this).offset().left + $(this).outerWidth(); + + if (myPos.bottom > e.pageY && e.pageY > myPos.bottom - 20 && myPos.right > e.pageX && e.pageX > myPos.right - 20) { + $(this).css({ + cursor: "nwse-resize" + }); + } else { + $(this).css({ + cursor: "" + }); + } + }); }); + $('iframe.scb_s_ug_dialog').load(function() { + $('.scb_f_ug_help_search_bar').width($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help_display').width() + 20); + $('iframe.scb_s_ug_dialog').width($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help').width() + 20); + $('iframe.scb_s_ug_dialog').height($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help').height() + 20); + $('.scb_f_ug_help_search_bar').draggable({ + handle: '.user_guide_title' + }); + $('iframe.scb_s_ug_dialog').contents().find('body').css('font-family', "Trebuchet MS, Helvetica, Arial, Verdana, sans-serif"); + $('iframe.scb_s_ug_dialog').contents().find("#popout").hide(); + $('iframe.scb_s_ug_dialog').contents().click(function(event) { + if (event.target.className != 'scb_s_ug_home' && event.target.id != 'search') { + if (iframe_history.length == 0) { + iframe_history = ['#']; + } + $(".scb_s_ug_home").removeClass('scb_s_ug_home_disabled'); + $('.scb_s_ug_home').removeAttr('disabled'); + if ($('iframe.scb_s_ug_dialog').contents().find("#popout").length > 0) { + $('iframe.scb_s_ug_dialog').contents().find("#popout").hide(); + } + var anchor_element = $(event.target).closest('.anchors') + if (event.target.className == 'intextlink') { + anchor_element = $(event.target).get(0); + } + var anchor_hash = $(anchor_element).attr('href'); + var window_location = window.location.toString() + '/static/ug2/help.html' + anchor_hash; + hashchange_function(anchor_hash, anchor_element); + iframe_history.push(anchor_hash); + currentPush = true; + //console.log(iframe_history); + $(".scb_s_ug_back").removeClass('scb_s_ug_back_disabled'); + $('.scb_s_ug_back').removeAttr('disabled'); + event.preventDefault(); + } + }); - self.show = function (state) { - scb.ui.static.InstructorFrame.ensure_auth_context(); - context.auth.logged_in = user_is_auth; - state = state || { - view: 'dashboard' + $('#search').click(function() { + $('iframe.scb_s_ug_dialog').ready(function() { + $("#closesearch").show(); + $('iframe.scb_s_ug_dialog').contents().find(".help_search_input").val($(".help_search_input").val()); + $('iframe.scb_s_ug_dialog').contents().find("#search").click(); + }); + }); + + $('.help_search_input').keypress(function(e) { + var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; + if (key == 13) { + e.preventDefault(); + console.log($(".help_search_input").val()); + $('#search').click(); } - if (state.onhashchange) { - window.scrollTo(0, 0); + }); + + + $(".scb_s_ug_home").click(function() { + iframe_history.push('#'); + currentPush = true; + $('iframe.scb_s_ug_dialog').contents().find(".scb_s_ug_home").click(); + $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); + $('.scb_s_ug_home').attr('disabled', 'disabled'); + $(".scb_s_ug_back").removeClass('scb_s_ug_back_disabled'); + $('.scb_s_ug_back').removeAttr('disabled'); + $("#closesearch").hide(); + $(".help_search_input").val(""); + }); + + + $(".scb_s_ug_back").click(function() { + var back_url = iframe_history.pop(); + if (currentPush) { + back_url = iframe_history.pop(); } - scb.ui.static.InstructorFrame.save(); - console.info(JSON.stringify(state)); - var parsed = scb.ui.static.InstructorFrame.validate_state(state); - if (parsed.redisplay) { - self.show(parsed.redisplay_state); - return; + currentPush = false; + + if (back_url) { + if (back_url == "#") { + $('iframe.scb_s_ug_dialog').contents().find(".scb_s_ug_home").click(); + } else { + $('iframe.scb_s_ug_dialog').contents().find('a[href="' + back_url + '"]').click(); + } + } else { + $(".scb_s_ug_back").addClass('scb_s_ug_back_disabled'); + $('.scb_s_ug_back').attr('disabled', 'disabled'); + + $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); + $('.scb_s_ug_home').attr('disabled', 'disabled'); } - - if (state.view == 'dashboard') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } - - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.dashboard.show({ - workarea: workarea, - assignments: assignments - }); + }); + + console.info('clicked main popout', $('.main_popout')); + + $(".main_popout").click(function() { + var popout_string = ""; + var visible = $('iframe.scb_s_ug_dialog').contents().find('.scb_s_section_inactive:visible'); + if (visible.length == 1) { + if ($(visible).attr('class') == 'scb_s_section_inactive') { + popout_string = $('iframe.scb_s_ug_dialog').contents().find('*:visible ').closest('.scb_s_help_sublink').attr('class').split(' ')[1]; + } else { + popout_string = $(visible).attr('class'); + } + } else { + popout_string = $($('iframe.scb_s_ug_dialog').contents().find('span:visible').get(0)).attr('class'); } - if (state.view == 'course_setup') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.course_setup.show({ - workarea: workarea, - assignments: assignments - }); + popout_string = popout_string.replace(/_/g, '-'); + if ($('iframe.scb_s_ug_dialog').contents().find('.scb_s_section_inactive').length == 0) { + popout_string = ""; } - - if (state.view == 'assignment_setup') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } - - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.assignment_setup.show({ - workarea: workarea, - assignments: assignments - }); + try { + var popoutWindow = window.open("static/ug2/full_guide.html#" + popout_string); + } catch ( err ) { + var popoutWindow = window.open("ug2/full_guide.html#" + popout_string); } - if (state.view == 'experiment_setup_page1') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.experiment_setup_page1.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'experiment_setup_page2') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + }); - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.experiment_setup_page2.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'experiment_setup_page3') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + $("#closesearch").click(function() { + $('.help_search_input').val(''); + $("#closesearch").hide(); + $(".scb_s_ug_home").click(); + }); - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.experiment_setup_page3.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'experiment_setup_page4') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + }); - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.experiment_setup_page4.show({ - workarea: workarea, - assignments: assignments - }); - } + }); - - if (state.view == 'select_technique') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + //HANDLER FOR LOGIN BUTTON AND IFRAME + scb.utils.off_on(workarea.parent(), 'click', '.scb_f_login', function(evt) { + scb.ui.static.InstructorFrame.ensure_auth_context(); + if (assignments.selected && !user_is_auth) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.select_technique.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'western_blot_page1') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.western_blot_page1.show({ - workarea: workarea, - assignments: assignments - }); - } - - if (state.view == 'western_blot_page2') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + $.jqDialog.confirm("If you sign in to your account, you will lose your current work as a guest. Would you like to continue?", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + if (user_is_auth) { - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.western_blot_page2.show({ - workarea: workarea, - assignments: assignments - }); + window.location = '/accounts/logout/'; + } else { + add_login_script(workarea); } - - if (state.view == 'western_blot_page3') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + evt.preventDefault(); + }, // callback function for 'YES' button + function() { + $('.error_overlay').remove(); + $('html').css('overflow', 'visible'); + return; + } // callback function for 'NO' button + ); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + evt.preventDefault(); + } else { + if (user_is_auth) { + + window.location = '/accounts/logout/'; + } else { + add_login_script(workarea); + } + evt.preventDefault(); + } + }); + + + + self.sections.dashboard = new scb.ui.InstructorDashboardView({ + workarea: workarea, + context: context + }); + self.sections.course_setup = new scb.ui.InstructorCourseSetupView({ + workarea: workarea, + context: context + }); + + self.sections.assignment_setup = new scb.ui.InstructorAssignmentSetupView({ + workarea: workarea, + context: context + }); + + self.sections.experiment_setup_page1 = new scb.ui.InstructorExperimentSetupPage1View({ + workarea: workarea, + context: context + }); + + self.sections.experiment_setup_page2 = new scb.ui.InstructorExperimentSetupPage2View({ + workarea: workarea, + context: context + }); + + self.sections.experiment_setup_page3 = new scb.ui.InstructorExperimentSetupPage3View({ + workarea: workarea, + context: context + }); + self.sections.experiment_setup_page4 = new scb.ui.InstructorExperimentSetupPage4View({ + workarea: workarea, + context: context + }); + + + self.sections.select_technique = new scb.ui.InstructorSelectTechniqueView({ + workarea: workarea, + context: context + }); + + self.sections.western_blot_page1 = new scb.ui.InstructorWesternBlotPage1View({ + workarea: workarea, + context: context + }); + + self.sections.western_blot_page2 = new scb.ui.InstructorWesternBlotPage2View({ + workarea: workarea, + context: context + }); + self.sections.western_blot_page3 = new scb.ui.InstructorWesternBlotPage3View({ + workarea: workarea, + context: context + }); + self.sections.western_blot_page4 = new scb.ui.InstructorWesternBlotPage4View({ + workarea: workarea, + context: context + }); + self.sections.western_blot_page5 = new scb.ui.InstructorWesternBlotPage5View({ + workarea: workarea, + context: context + }); + + self.sections.microscopy_page1 = new scb.ui.InstructorMicroscopyPage1View({ + workarea: workarea, + context: context + }); + + self.sections.microscopy_page2 = new scb.ui.InstructorMicroscopyPage2View({ + workarea: workarea, + context: context + }); + + self.sections.microscopy_page3 = new scb.ui.InstructorMicroscopyPage3View({ + workarea: workarea, + context: context + }); + + self.sections.facs_page1 = new scb.ui.InstructorFacsPage1View({ + workarea: workarea, + context: context + }); + self.sections.facs_page2 = new scb.ui.InstructorFacsPage2View({ + workarea: workarea, + context: context + }); + + + self.show = function(state) { + scb.ui.static.InstructorFrame.ensure_auth_context(); + context.auth.logged_in = user_is_auth; + state = state || { + view: 'dashboard' + } + if (state.onhashchange) { + window.scrollTo(0, 0); + } + scb.ui.static.InstructorFrame.save(); + console.info(JSON.stringify(state)); + var parsed = scb.ui.static.InstructorFrame.validate_state(state); + if (parsed.redisplay) { + self.show(parsed.redisplay_state); + return; + } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.western_blot_page3.show({ - workarea: workarea, - assignments: assignments - }); - } - - if (state.view == 'western_blot_page4') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + if (state.view == 'dashboard') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.western_blot_page4.show({ - workarea: workarea, - assignments: assignments - }); - } - - if (state.view == 'western_blot_page5') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.dashboard.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'course_setup') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.western_blot_page5.show({ - workarea: workarea, - assignments: assignments - }); - } - - if (state.view == 'facs_page1') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.course_setup.show({ + workarea: workarea, + assignments: assignments + }); + } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.facs_page1.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'facs_page2') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + if (state.view == 'assignment_setup') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.facs_page2.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'microscopy_page1') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.assignment_setup.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'experiment_setup_page1') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.microscopy_page1.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'microscopy_page2') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.experiment_setup_page1.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'experiment_setup_page2') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.microscopy_page2.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'microscopy_page3') { - if (!parsed.assignment) { - state.assignment_id = assignments.list[0].id; - state.onhashchange = false; - self.show(state); - return; - } + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.experiment_setup_page2.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'experiment_setup_page3') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.InstructorFrame.update_hash(state); - self.sections.microscopy_page3.show({ - workarea: workarea, - assignments: assignments - }); - } - - if (state.view == 'assignment_last') { + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.experiment_setup_page3.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'experiment_setup_page4') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.experiment_setup_page4.show({ + workarea: workarea, + assignments: assignments + }); + } - if (parsed.experiment) { - state.view = parsed.experiment.last_view ? parsed.experiment.last_view : 'experiment_design'; - self.show(state); - } - else { - $('html').css('overflow', 'hidden'); - - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("Experiment does not exist", function() { $('html').css('overflow', 'visible'); - $('.error_overlay').remove();/* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Error

"); - $('#jqDialog_box').attr('role', 'alertdialog'); - if (parsed.assignment) { - self.show({ - view: 'dashboard', - assignment: parsed.assignment - }); - } - else { - self.show({ - view: 'dashboard' - }); - } - } - } - if (user_is_auth) { - $('.scb_s_login_status').text('SIGN OUT'); - } - scb.ui.static.InstructorFrame.in_ajax_display(); + if (state.view == 'select_technique') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.select_technique.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'western_blot_page1') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.western_blot_page1.show({ + workarea: workarea, + assignments: assignments + }); } - - scb.ui.static.InstructorFrame.pending_save_queue = []; - scb.ui.static.InstructorFrame.pending_save_inajax = false; - scb.ui.static.InstructorFrame.pending_save = function(parsed){ - scb.ui.static.InstructorFrame.pending_save_queue.push( (new Date()).getTime() ); - setTimeout( function() { - scb.ui.static.InstructorFrame.pending_save_process(parsed); - }, 5000 ) ; + + if (state.view == 'western_blot_page2') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.western_blot_page2.show({ + workarea: workarea, + assignments: assignments + }); } - scb.ui.static.InstructorFrame.pending_save_process = function(parsed) { - if( scb.ui.static.InstructorFrame.pending_save_inajax ) { - console.info( "In ajax - skipping save" ) ; - return ; } - if( scb.ui.static.InstructorFrame.pending_save_queue.length > 0 ) { - console.info( "Ajax save - clear Queue" ) ; - scb.ui.static.InstructorFrame.pending_save_queue = []; - if(typeof post_state_result === 'undefined') - token = user_token; - else - token = post_state_result.token; - post_obj = {'token': token, 'model': parsed.context.master_model} - console.log(post_obj); - scb.ui.static.InstructorFrame.pending_save_inajax = true; - console.info( "Ajax save - start request " ) ; - $.ajax({ - type: "POST", - url: 'scb/edit_assignment.js', - data: JSON.stringify(post_obj), - success: function (data){ - console.info( "Ajax save - request success " ) ; - scb.ui.static.InstructorFrame.pending_save_inajax = false; - console.log(data) ; - setTimeout( function() { - scb.ui.static.InstructorFrame.pending_save_process(parsed); - },5000); - }, - error: function(data) { - console.info( "Ajax save - request failed, retry... " ) ; - scb.ui.static.InstructorFrame.pending_save_inajax = false; - scb.ui.static.InstructorFrame.pending_save(parsed); - } - }); - } + if (state.view == 'western_blot_page3') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.western_blot_page3.show({ + workarea: workarea, + assignments: assignments + }); } - - scb.ui.static.InstructorFrame.pending_save_orig = function(parsed){ - if(!pending_save){ - setTimeout(function() { - pending_save = false; - console.log('believe'); - var token = 0; - if(typeof post_state_result === 'undefined') - token = user_token; - else - token = post_state_result.token; - post_obj = {'token': token, 'model': parsed.context.master_model} - console.log(post_obj); - $.ajax({ - type: "POST", - url: 'scb/post_state.js', - data: JSON.stringify(post_obj), - success: function (data){ - console.log(data); - } - }); - }, 5000); - pending_save = true; - } + if (state.view == 'western_blot_page4') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.western_blot_page4.show({ + workarea: workarea, + assignments: assignments + }); } - scb.ui.static.InstructorFrame.refresh = function (navigation_state) { - var state = navigation_state || $.deparam(location.hash.replace(/^#/, ''), true); + + if (state.view == 'western_blot_page5') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; state.onhashchange = false; - state.view = state.view || 'dashboard'; self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.western_blot_page5.show({ + workarea: workarea, + assignments: assignments + }); } - $(window).bind('hashchange', function (e) { - var state = $.deparam(location.hash.replace(/^#/, ''), true); - state.onhashchange = true; - state.view = state.view || 'dashboard'; + if (state.view == 'facs_page1') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; self.show(state); - }); + return; + } - (function () { - var state = $.deparam(location.hash.replace(/^#/, ''), true); -// if(state.assignment_id) -// delete state.assignment_id; + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.facs_page1.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'facs_page2') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; state.onhashchange = false; - state.view = state.view || 'dashboard'; self.show(state); - })(); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.facs_page2.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'microscopy_page1') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.microscopy_page1.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'microscopy_page2') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.microscopy_page2.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'microscopy_page3') { + if (!parsed.assignment) { + state.assignment_id = assignments.list[0].id; + state.onhashchange = false; + self.show(state); + return; + } + + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.InstructorFrame.update_hash(state); + self.sections.microscopy_page3.show({ + workarea: workarea, + assignments: assignments + }); + } + + if (state.view == 'assignment_last') { + + if (parsed.experiment) { + state.view = parsed.experiment.last_view ? parsed.experiment.last_view : 'experiment_design'; + self.show(state); + } else { + $('html').css('overflow', 'hidden'); + + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("Experiment does not exist", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Error

"); + $('#jqDialog_box').attr('role', 'alertdialog'); + if (parsed.assignment) { + self.show({ + view: 'dashboard', + assignment: parsed.assignment + }); + } else { + self.show({ + view: 'dashboard' + }); + } + } + } + if (user_is_auth) { + $('.scb_s_login_status').text('SIGN OUT'); + } + scb.ui.static.InstructorFrame.in_ajax_display(); + + } + + scb.ui.static.InstructorFrame.pending_save_queue = []; + scb.ui.static.InstructorFrame.pending_save_inajax = false; + scb.ui.static.InstructorFrame.pending_save = function(parsed) { + scb.ui.static.InstructorFrame.pending_save_queue.push((new Date()).getTime()); + setTimeout(function() { + scb.ui.static.InstructorFrame.pending_save_process(parsed); + }, 5000); + } + + scb.ui.static.InstructorFrame.pending_save_process = function(parsed) { + if (scb.ui.static.InstructorFrame.pending_save_inajax) { + console.info("In ajax - skipping save"); + return; + } + if (scb.ui.static.InstructorFrame.pending_save_queue.length > 0) { + console.info("Ajax save - clear Queue"); + scb.ui.static.InstructorFrame.pending_save_queue = []; + if (typeof post_state_result === 'undefined') { + token = user_token; + } else { + token = post_state_result.token; + } + post_obj = { + 'token': token, + 'model': parsed.context.master_model + } + console.log(post_obj); + scb.ui.static.InstructorFrame.pending_save_inajax = true; + console.info("Ajax save - start request "); + $.ajax({ + type: "POST", + url: 'scb/edit_assignment.js', + data: JSON.stringify(post_obj), + success: function(data) { + console.info("Ajax save - request success "); + scb.ui.static.InstructorFrame.pending_save_inajax = false; + console.log(data); + setTimeout(function() { + scb.ui.static.InstructorFrame.pending_save_process(parsed); + }, 5000); + }, + error: function(data) { + console.info("Ajax save - request failed, retry... "); + scb.ui.static.InstructorFrame.pending_save_inajax = false; + scb.ui.static.InstructorFrame.pending_save(parsed); + } + }); + } + } + + + scb.ui.static.InstructorFrame.pending_save_orig = function(parsed) { + if (!pending_save) { + setTimeout(function() { + pending_save = false; + console.log('believe'); + var token = 0; + if (typeof post_state_result === 'undefined') { + token = user_token; + } else { + token = post_state_result.token; + } + post_obj = { + 'token': token, + 'model': parsed.context.master_model + } + console.log(post_obj); + $.ajax({ + type: "POST", + url: 'scb/post_state.js', + data: JSON.stringify(post_obj), + success: function(data) { + console.log(data); + } + }); + }, 5000); + pending_save = true; + } + } + scb.ui.static.InstructorFrame.refresh = function(navigation_state) { + var state = navigation_state || $.deparam(location.hash.replace(/^#/, ''), true); + state.onhashchange = false; + state.view = state.view || 'dashboard'; + self.show(state); + } + + $(window).bind('hashchange', function(e) { + var state = $.deparam(location.hash.replace(/^#/, ''), true); + state.onhashchange = true; + state.view = state.view || 'dashboard'; + self.show(state); + }); + + (function() { + var state = $.deparam(location.hash.replace(/^#/, ''), true); + // if(state.assignment_id) + // delete state.assignment_id; + state.onhashchange = false; + state.view = state.view || 'dashboard'; + self.show(state); + })(); - -}; -function add_login_script(workarea){ - - $(workarea).append(scb_auth.login({})); - scb.utils.off_on(workarea, 'click', '.scb_f_login_close_button', function () { - $('.scb_s_login_dialog').detach(); - }); - $('.scb_f_login_iframe').load(function(){ - var iframe = $('.scb_f_login_iframe').get(0); - var content = (iframe.contentDocument || iframe.contentWindow); - content.body.style.fontSize = '90%'; - content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; - var inputs = content.getElementsByTagName('button'); - $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); - var fieldset = content.querySelectorAll('fieldset'); - $(fieldset).children().wrap('

'); - var texts = content.querySelectorAll('input'); - $(texts).attr('placeholder', ''); - $(texts).css('font-family', 'Trebuchet MS, sans-serif'); - - var iframe = $('.scb_f_login_iframe').contents(); - iframe.find('input[type="checkbox"]').css('height', '12px'); - iframe.find('input[type="radio"][value="student"]').attr('checked', 'checked'); - - iframe.find('a:contains("Member")').click(function(){ - $('.scb_f_login_iframe').load(function(){ - var iframe = $('.scb_f_login_iframe').contents(); - $('.scb_s_login_form > div').text('Sign Up'); - $('.scb_s_login_dialog').addClass('scb_s_signup_dialog'); - $('.scb_f_login_iframe').css('height', '560px'); - }); - }); - iframe.find('a:contains("Password")').click(function(){ - $('.scb_f_login_iframe').load(function(){ - - $('.scb_s_login_form > div').text('Reset Password'); - }); - }); - - iframe.find('a:contains("Back")').click(function(){ - $('.scb_f_login_iframe').load(function(){ - - $('.scb_s_login_form > div').text('Sign In'); - }); - }); - - iframe.find(".auth_submit_button").click(function(){ - var mask = document.createElement('div'); - mask.className='overlay'; - $(mask).css({'width': '100%','height': '100%','position': 'fixed', 'z-index': '993', 'background': 'rgba(125,125,125,0.7)', 'visibility': 'visible'}); - $('body').prepend(mask); - var progress_icon = document.createElement('img'); - progress_icon.src = '../../../images/homepage/ajax_loader.gif'; - progress_icon.style.marginLeft = '50%'; - progress_icon.style.marginTop= '50%'; - - $('.overlay').append(progress_icon); - - $('.scb_f_login_iframe').hide(); - $('.scb_f_login_iframe').load(function(){ - var profile = $('.scb_f_login_iframe').contents().get(0); - if(profile.body.textContent.indexOf('confirmed') >0){ - parent.document.location.reload(); - - } - - else{ - $(mask).remove(); - $('.scb_f_login_iframe').show(); - if($('.scb_f_login_iframe').contents().find('.login_submit').length >0) - $('.scb_f_login_iframe').contents().find('#errorMsg').html('Incorrect username or password. Try again'); - - } - }); - }); - }); }; + +function add_login_script(workarea) { + + $(workarea).append(scb_auth.login({})); + scb.utils.off_on(workarea, 'click', '.scb_f_login_close_button', function() { + $('.scb_s_login_dialog').detach(); + }); + $('.scb_f_login_iframe').load(function() { + var iframe = $('.scb_f_login_iframe').get(0); + var content = (iframe.contentDocument || iframe.contentWindow); + content.body.style.fontSize = '90%'; + content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; + var inputs = content.getElementsByTagName('button'); + $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); + var fieldset = content.querySelectorAll('fieldset'); + $(fieldset).children().wrap('

'); + var texts = content.querySelectorAll('input'); + $(texts).attr('placeholder', ''); + $(texts).css('font-family', 'Trebuchet MS, sans-serif'); + + var iframe = $('.scb_f_login_iframe').contents(); + iframe.find('input[type="checkbox"]').css('height', '12px'); + iframe.find('input[type="radio"][value="student"]').attr('checked', 'checked'); + + iframe.find('a:contains("Member")').click(function() { + $('.scb_f_login_iframe').load(function() { + var iframe = $('.scb_f_login_iframe').contents(); + $('.scb_s_login_form > div').text('Sign Up'); + $('.scb_s_login_dialog').addClass('scb_s_signup_dialog'); + $('.scb_f_login_iframe').css('height', '560px'); + }); + }); + iframe.find('a:contains("Password")').click(function() { + $('.scb_f_login_iframe').load(function() { + + $('.scb_s_login_form > div').text('Reset Password'); + }); + }); + + iframe.find('a:contains("Back")').click(function() { + $('.scb_f_login_iframe').load(function() { + + $('.scb_s_login_form > div').text('Sign In'); + }); + }); + + iframe.find(".auth_submit_button").click(function() { + var mask = document.createElement('div'); + mask.className = 'overlay'; + $(mask).css({ + 'width': '100%', + 'height': '100%', + 'position': 'fixed', + 'z-index': '993', + 'background': 'rgba(125,125,125,0.7)', + 'visibility': 'visible' + }); + $('body').prepend(mask); + var progress_icon = document.createElement('img'); + progress_icon.src = '../../../images/homepage/ajax_loader.gif'; + progress_icon.style.marginLeft = '50%'; + progress_icon.style.marginTop = '50%'; + + $('.overlay').append(progress_icon); + + $('.scb_f_login_iframe').hide(); + $('.scb_f_login_iframe').load(function() { + var profile = $('.scb_f_login_iframe').contents().get(0); + if (profile.body.textContent.indexOf('confirmed') > 0) { + parent.document.location.reload(); + + } else { + $(mask).remove(); + $('.scb_f_login_iframe').show(); + if ($('.scb_f_login_iframe').contents().find('.login_submit').length > 0) { + $('.scb_f_login_iframe').contents().find('#errorMsg').html('Incorrect username or password. Try again'); + } + + } + }); + }); + }); +} +; diff --git a/html_app/instructor/InstructorMicroscopyPage1View.js b/html_app/instructor/InstructorMicroscopyPage1View.js index 398ddab2..fa72c685 100644 --- a/html_app/instructor/InstructorMicroscopyPage1View.js +++ b/html_app/instructor/InstructorMicroscopyPage1View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,114 +10,116 @@ scb.ui.static.InstructorMicroscopyPage1View = scb.ui.static.InstructorMicroscopy -scb.ui.static.InstructorMicroscopyPage1View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorMicroscopyPage1View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorMicroscopyPage1View.scb_f_microscopy_page1_save_assignment_button = function(element, workarea){ +scb.ui.static.InstructorMicroscopyPage1View.scb_f_microscopy_page1_save_assignment_button = function(element, workarea) { - var parsed = scb.ui.static.InstructorMicroscopyPage1View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'microscopy_page2', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); + var parsed = scb.ui.static.InstructorMicroscopyPage1View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'microscopy_page2', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorMicroscopyPage1View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_page1_save_assignment_button', function (e) { - scb.ui.static.InstructorMicroscopyPage1View.scb_f_microscopy_page1_save_assignment_button(this, e); - }); - - - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_page1_save_assignment_button', function(e) { + scb.ui.static.InstructorMicroscopyPage1View.scb_f_microscopy_page1_save_assignment_button(this, e); + }); + + + + + + + }; scb.ui.InstructorMicroscopyPage1View = function scb_ui_InstructorMicroscopyPage1View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_microscopy_page1.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_microscopy_page1.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorMicroscopyPage2View.js b/html_app/instructor/InstructorMicroscopyPage2View.js index 90cf8f64..081a2e56 100644 --- a/html_app/instructor/InstructorMicroscopyPage2View.js +++ b/html_app/instructor/InstructorMicroscopyPage2View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,52 +10,52 @@ scb.ui.static.InstructorMicroscopyPage2View = scb.ui.static.InstructorMicroscopy -scb.ui.static.InstructorMicroscopyPage2View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorMicroscopyPage2View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorMicroscopyPage2View.scb_f_microscopy_page2_save_assignment_button = function(element, workarea){ +scb.ui.static.InstructorMicroscopyPage2View.scb_f_microscopy_page2_save_assignment_button = function(element, workarea) { - var parsed = scb.ui.static.InstructorMicroscopyPage2View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'microscopy_page3', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); + var parsed = scb.ui.static.InstructorMicroscopyPage2View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'microscopy_page3', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorMicroscopyPage2View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_page2_save_assignment_button', function (e) { - scb.ui.static.InstructorMicroscopyPage2View.scb_f_microscopy_page2_save_assignment_button(this, e); - }); - - - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_page2_save_assignment_button', function(e) { + scb.ui.static.InstructorMicroscopyPage2View.scb_f_microscopy_page2_save_assignment_button(this, e); + }); + + + + + + + }; @@ -63,62 +63,64 @@ scb.ui.static.InstructorMicroscopyPage2View.register = function(workarea) { scb.ui.InstructorMicroscopyPage2View = function scb_ui_InstructorMicroscopyPage2View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_microscopy_page2.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_microscopy_page2.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorMicroscopyPage3View.js b/html_app/instructor/InstructorMicroscopyPage3View.js index 231365d9..d8a5d738 100644 --- a/html_app/instructor/InstructorMicroscopyPage3View.js +++ b/html_app/instructor/InstructorMicroscopyPage3View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,52 +10,52 @@ scb.ui.static.InstructorMicroscopyPage3View = scb.ui.static.InstructorMicroscopy -scb.ui.static.InstructorMicroscopyPage3View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorMicroscopyPage3View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorMicroscopyPage3View.scb_f_microscopy_page3_save_assignment_button = function(element, workarea){ +scb.ui.static.InstructorMicroscopyPage3View.scb_f_microscopy_page3_save_assignment_button = function(element, workarea) { - var parsed = scb.ui.static.InstructorMicroscopyPage3View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'dashboard', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); + var parsed = scb.ui.static.InstructorMicroscopyPage3View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'dashboard', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorMicroscopyPage3View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_page3_save_assignment_button', function (e) { - scb.ui.static.InstructorMicroscopyPage3View.scb_f_microscopy_page3_save_assignment_button(this, e); - }); - - - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_page3_save_assignment_button', function(e) { + scb.ui.static.InstructorMicroscopyPage3View.scb_f_microscopy_page3_save_assignment_button(this, e); + }); + + + + + + + }; @@ -63,62 +63,64 @@ scb.ui.static.InstructorMicroscopyPage3View.register = function(workarea) { scb.ui.InstructorMicroscopyPage3View = function scb_ui_InstructorMicroscopyPage3View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_microscopy_page3.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_microscopy_page3.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorSelectTechniqueView.js b/html_app/instructor/InstructorSelectTechniqueView.js index 55f37f88..166ecfaf 100644 --- a/html_app/instructor/InstructorSelectTechniqueView.js +++ b/html_app/instructor/InstructorSelectTechniqueView.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,145 +10,151 @@ scb.ui.static.InstructorSelectTechniqueView = scb.ui.static.InstructorSelectTech -scb.ui.static.InstructorSelectTechniqueView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorSelectTechniqueView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorSelectTechniqueView.scb_f_select_technique_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorSelectTechniqueView.parse(element); - parsed.assignment.template.ui.experimental_design['techniques'] = []; - -// techniques: [ 'wb' , 'facs', 'micro' ] - if($('.scb_f_select_technique_select_western_blot').attr('checked')){ - parsed.assignment.template.ui.experimental_design.techniques.push('wb'); - parsed.assignment.template.model['western_blot'] = {}; - } - - if($('.scb_f_select_technique_select_facs').attr('checked')){ - parsed.assignment.template.ui.experimental_design.techniques.push('facs'); - parsed.assignment.template.model['facs'] = {}; - } - - if($('.scb_f_select_technique_select_microscopy').attr('checked')){ - parsed.assignment.template.ui.experimental_design.techniques.push('micro'); - parsed.assignment.template.model['microscopy'] = {}; - } - - - - - scb.ui.static.InstructorFrame.pending_save(parsed); - - var view = ''; - if(_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'wb')) - view = 'western_blot_page1'; - else if(_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'facs')) - view = 'facs_page1'; - else if(_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'micro')) - view = 'microscopy_page1'; - - - var state = { - assignment_id: parsed.assignment.id, - view: view, - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorSelectTechniqueView.scb_f_select_technique_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorSelectTechniqueView.parse(element); + parsed.assignment.template.ui.experimental_design['techniques'] = []; + + // techniques: [ 'wb' , 'facs', 'micro' ] + if ($('.scb_f_select_technique_select_western_blot').attr('checked')) { + parsed.assignment.template.ui.experimental_design.techniques.push('wb'); + parsed.assignment.template.model['western_blot'] = {}; + } + + if ($('.scb_f_select_technique_select_facs').attr('checked')) { + parsed.assignment.template.ui.experimental_design.techniques.push('facs'); + parsed.assignment.template.model['facs'] = {}; + } + + if ($('.scb_f_select_technique_select_microscopy').attr('checked')) { + parsed.assignment.template.ui.experimental_design.techniques.push('micro'); + parsed.assignment.template.model['microscopy'] = {}; + } + + + + + scb.ui.static.InstructorFrame.pending_save(parsed); + + var view = ''; + if (_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'wb')) { + view = 'western_blot_page1'; + } else if (_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'facs')) { + view = 'facs_page1'; + } else if (_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'micro')) { + view = 'microscopy_page1'; + } + + + var state = { + assignment_id: parsed.assignment.id, + view: view, + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorSelectTechniqueView.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_select_technique_save_assignment_button', function (e) { - scb.ui.static.InstructorSelectTechniqueView.scb_f_select_technique_save_assignment_button(this, e); - }); + scb.utils.off_on(workarea, 'click', '.scb_f_select_technique_save_assignment_button', function(e) { + scb.ui.static.InstructorSelectTechniqueView.scb_f_select_technique_save_assignment_button(this, e); + }); }; -scb.ui.static.InstructorSelectTechniqueView.enable_techniques = function(techniques){ - if(_.contains(techniques, 'wb')) - $('.scb_f_select_technique_select_western_blot').attr('checked', true); - if(_.contains(techniques, 'facs')) - $('.scb_f_select_technique_select_facs').attr('checked', true); - if(_.contains(techniques, 'micro')) - $('.scb_f_select_technique_select_microscopy').attr('checked', true); +scb.ui.static.InstructorSelectTechniqueView.enable_techniques = function(techniques) { + if (_.contains(techniques, 'wb')) { + $('.scb_f_select_technique_select_western_blot').attr('checked', true); + } + if (_.contains(techniques, 'facs')) { + $('.scb_f_select_technique_select_facs').attr('checked', true); + } + if (_.contains(techniques, 'micro')) { + $('.scb_f_select_technique_select_microscopy').attr('checked', true); + } } scb.ui.InstructorSelectTechniqueView = function scb_ui_InstructorSelectTechniqueView(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_select_technique.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - var techniques = scb.ui.static.InstructorSelectTechniqueView.enable_techniques(assignments.selected.template.ui.experimental_design.techniques); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_select_technique.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + var techniques = scb.ui.static.InstructorSelectTechniqueView.enable_techniques(assignments.selected.template.ui.experimental_design.techniques); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorWesternBlotPage1View.js b/html_app/instructor/InstructorWesternBlotPage1View.js index 7fc9f749..a11cd68e 100644 --- a/html_app/instructor/InstructorWesternBlotPage1View.js +++ b/html_app/instructor/InstructorWesternBlotPage1View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,174 +10,194 @@ scb.ui.static.InstructorWesternBlotPage1View = scb.ui.static.InstructorWesternBl -scb.ui.static.InstructorWesternBlotPage1View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorWesternBlotPage1View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorWesternBlotPage1View.scb_f_western_blot_page1_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorWesternBlotPage1View.parse(element); - - parsed.assignment.template.lysate_kinds = {}; - - if($('.scb_f_western_blot_select_whole_cell_lysate').attr('checked')){ - parsed.assignment.template.lysate_kinds['whole'] = ({name: 'Whole Cell' }); - - } - if($('.scb_f_western_blot_select_cytoplasmic').attr('checked')){ - parsed.assignment.template.lysate_kinds['cyto'] = ({name: 'Cytoplasm' }); - - } - if($('.scb_f_western_blot_select_nuclear').attr('checked')){ - parsed.assignment.template.lysate_kinds['nuclear'] = ({name: 'Nuclear' }); - - } - - - if(_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'nuclear')){ - parsed.assignment.template.model.western_blot['nuclear'] = {parser_fixed: []}; - } - if(_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'cyto')){ - parsed.assignment.template.model.western_blot['cyto'] = {parser_fixed: []}; - } - if(_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'whole') && - !_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'nuclear') && - !_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'cyto')){ - parsed.assignment.template.model.western_blot['cyto'] = {parser_fixed: []}; - - } - - - - parsed.assignment.template.ui.experimental_design.gel_types = []; - - if($('.scb_f_western_blot_select_ten').attr('checked')){ - parsed.assignment.template.ui.experimental_design.gel_types.push('.10'); - } - if($('.scb_f_western_blot_select_twelve').attr('checked')){ - parsed.assignment.template.ui.experimental_design.gel_types.push('.12'); - } - if($('.scb_f_western_blot_select_fifteen').attr('checked')){ - parsed.assignment.template.ui.experimental_design.gel_types.push('.15'); - } - - scb.ui.static.InstructorFrame.pending_save(parsed); - - var state = { - assignment_id: parsed.assignment.id, - view: 'western_blot_page2', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorWesternBlotPage1View.scb_f_western_blot_page1_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorWesternBlotPage1View.parse(element); + + parsed.assignment.template.lysate_kinds = {}; + + if ($('.scb_f_western_blot_select_whole_cell_lysate').attr('checked')) { + parsed.assignment.template.lysate_kinds['whole'] = ({ + name: 'Whole Cell' + }); + + } + if ($('.scb_f_western_blot_select_cytoplasmic').attr('checked')) { + parsed.assignment.template.lysate_kinds['cyto'] = ({ + name: 'Cytoplasm' + }); + + } + if ($('.scb_f_western_blot_select_nuclear').attr('checked')) { + parsed.assignment.template.lysate_kinds['nuclear'] = ({ + name: 'Nuclear' + }); + + } + + + if (_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'nuclear')) { + parsed.assignment.template.model.western_blot['nuclear'] = { + parser_fixed: [] + }; + } + if (_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'cyto')) { + parsed.assignment.template.model.western_blot['cyto'] = { + parser_fixed: [] + }; + } + if (_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'whole') && + !_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'nuclear') && + !_.contains(_.keys(parsed.assignment.template.lysate_kinds), 'cyto')) { + parsed.assignment.template.model.western_blot['cyto'] = { + parser_fixed: [] + }; + + } + + + + parsed.assignment.template.ui.experimental_design.gel_types = []; + + if ($('.scb_f_western_blot_select_ten').attr('checked')) { + parsed.assignment.template.ui.experimental_design.gel_types.push('.10'); + } + if ($('.scb_f_western_blot_select_twelve').attr('checked')) { + parsed.assignment.template.ui.experimental_design.gel_types.push('.12'); + } + if ($('.scb_f_western_blot_select_fifteen').attr('checked')) { + parsed.assignment.template.ui.experimental_design.gel_types.push('.15'); + } + + scb.ui.static.InstructorFrame.pending_save(parsed); + + var state = { + assignment_id: parsed.assignment.id, + view: 'western_blot_page2', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorWesternBlotPage1View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page1_save_assignment_button', function (e) { - scb.ui.static.InstructorWesternBlotPage1View.scb_f_western_blot_page1_save_assignment_button(this, e); - }); - - - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page1_save_assignment_button', function(e) { + scb.ui.static.InstructorWesternBlotPage1View.scb_f_western_blot_page1_save_assignment_button(this, e); + }); + + + + + + + }; -scb.ui.static.InstructorWesternBlotPage1View.enable_checkboxes = function(lysate_kinds, gel_types){ - if(_.contains(_.keys(assignments.selected.template.lysate_kinds), 'whole')) - $('.scb_f_western_blot_select_whole_cell_lysate').attr('checked', true); - if(_.contains(_.keys(assignments.selected.template.lysate_kinds), 'nuclear')) - $('.scb_f_western_blot_select_nuclear').attr('checked', true); - if(_.contains(_.keys(assignments.selected.template.lysate_kinds), 'cyto')) - $('.scb_f_western_blot_select_cytoplasmic').attr('checked', true); - - if(_.contains(gel_types, '.10')) - $('.scb_f_western_blot_select_ten').attr('checked', true); - if(_.contains(gel_types, '.12')) - $('.scb_f_western_blot_select_twelve').attr('checked', true); - if(_.contains(gel_types, '.15')) - $('.scb_f_western_blot_select_fifteen').attr('checked', true); +scb.ui.static.InstructorWesternBlotPage1View.enable_checkboxes = function(lysate_kinds, gel_types) { + if (_.contains(_.keys(assignments.selected.template.lysate_kinds), 'whole')) { + $('.scb_f_western_blot_select_whole_cell_lysate').attr('checked', true); + } + if (_.contains(_.keys(assignments.selected.template.lysate_kinds), 'nuclear')) { + $('.scb_f_western_blot_select_nuclear').attr('checked', true); + } + if (_.contains(_.keys(assignments.selected.template.lysate_kinds), 'cyto')) { + $('.scb_f_western_blot_select_cytoplasmic').attr('checked', true); + } + + if (_.contains(gel_types, '.10')) { + $('.scb_f_western_blot_select_ten').attr('checked', true); + } + if (_.contains(gel_types, '.12')) { + $('.scb_f_western_blot_select_twelve').attr('checked', true); + } + if (_.contains(gel_types, '.15')) { + $('.scb_f_western_blot_select_fifteen').attr('checked', true); + } } scb.ui.InstructorWesternBlotPage1View = function scb_ui_InstructorWesternBlotPage1View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - - workarea.html(scb_instructor_western_blot_page1.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - var techniques = scb.ui.static.InstructorWesternBlotPage1View.enable_checkboxes( assignments.selected.template.lysate_kinds, assignments.selected.template.ui.experimental_design.gel_types); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + + workarea.html(scb_instructor_western_blot_page1.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + var techniques = scb.ui.static.InstructorWesternBlotPage1View.enable_checkboxes(assignments.selected.template.lysate_kinds, assignments.selected.template.ui.experimental_design.gel_types); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorWesternBlotPage2View.js b/html_app/instructor/InstructorWesternBlotPage2View.js index 84fe7204..61a9fdf3 100644 --- a/html_app/instructor/InstructorWesternBlotPage2View.js +++ b/html_app/instructor/InstructorWesternBlotPage2View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,259 +10,265 @@ scb.ui.static.InstructorWesternBlotPage2View = scb.ui.static.InstructorWesternBl -scb.ui.static.InstructorWesternBlotPage2View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorWesternBlotPage2View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_page2_save_assignment_button = function(element, workarea){ +scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_page2_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + - var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'western_blot_page3', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); + var state = { + assignment_id: parsed.assignment.id, + view: 'western_blot_page3', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } -scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_primary_anti_body_list_item = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); - var anti_body_id = $(element).attr('anti_body_id') ? $(element).attr('anti_body_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - if(!parsed.assignment.template.primary_anti_body[anti_body_id]){ - - parsed.assignment.template.primary_anti_body[anti_body_id] = { - name: $(element).val(), - secondary: [], - marks: [], - total_marks: [], - whole_marks:[], - nuclear_marks: [], - cyto_marks: [], - gel_name: $(element).val() - }; - } - else{ - parsed.assignment.template.primary_anti_body[anti_body_id] = { - name: $(element).val(), - secondary: parsed.assignment.template.primary_anti_body[anti_body_id].secondary, - marks: parsed.assignment.template.primary_anti_body[anti_body_id].marks, - whole_marks:parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks, - total_marks: parsed.assignment.template.primary_anti_body[anti_body_id].total_marks, - nuclear_marks: parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks, - cyto_marks: parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks, - gel_name: $(element).val() - }; - } +scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_primary_anti_body_list_item = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); + var anti_body_id = $(element).attr('anti_body_id') ? $(element).attr('anti_body_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + if (!parsed.assignment.template.primary_anti_body[anti_body_id]) { + + parsed.assignment.template.primary_anti_body[anti_body_id] = { + name: $(element).val(), + secondary: [], + marks: [], + total_marks: [], + whole_marks: [], + nuclear_marks: [], + cyto_marks: [], + gel_name: $(element).val() + }; + } else { + parsed.assignment.template.primary_anti_body[anti_body_id] = { + name: $(element).val(), + secondary: parsed.assignment.template.primary_anti_body[anti_body_id].secondary, + marks: parsed.assignment.template.primary_anti_body[anti_body_id].marks, + whole_marks: parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks, + total_marks: parsed.assignment.template.primary_anti_body[anti_body_id].total_marks, + nuclear_marks: parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks, + cyto_marks: parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks, + gel_name: $(element).val() + }; + } - scb.ui.static.InstructorFrame.refresh(); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_secondary_anti_body_list_item = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); - var idExists=false; - var existing_id = ''; - _.each(parsed.assignment.template.secondary_anti_body, function(key, value, list){ - if(key.name==$.trim($(element).val())){ - existing_id = value; - idExists=true; - } - }); - var secondary_id = idExists ? existing_id: Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - var anti_body_id = $(element).attr('anti_body_id') ? $(element).attr('anti_body_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - - parsed.assignment.template.secondary_anti_body[secondary_id] = {name: $(element).val()};; - - - - - if(!parsed.assignment.template.primary_anti_body[anti_body_id]){ - - parsed.assignment.template.primary_anti_body[anti_body_id] = { - name: '', - secondary: [secondary_id], - marks: [], - whole_marks:[], - total_marks: [], - nuclear_marks: [], - cyto_marks: [], - gel_name: '' - }; - } - else{ - parsed.assignment.template.primary_anti_body[anti_body_id] = { - name: parsed.assignment.template.primary_anti_body[anti_body_id].name, - secondary:[secondary_id], - marks: parsed.assignment.template.primary_anti_body[anti_body_id].marks, - whole_marks:parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks, - total_marks: parsed.assignment.template.primary_anti_body[anti_body_id].total_marks, - nuclear_marks: parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks, - cyto_marks: parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks, - gel_name: parsed.assignment.template.primary_anti_body[anti_body_id].gel_name - }; - } - - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_secondary_anti_body_list_item = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); + var idExists = false; + var existing_id = ''; + _.each(parsed.assignment.template.secondary_anti_body, function(key, value, list) { + if (key.name == $.trim($(element).val())) { + existing_id = value; + idExists = true; + } + }); + var secondary_id = idExists ? existing_id : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + var anti_body_id = $(element).attr('anti_body_id') ? $(element).attr('anti_body_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + + parsed.assignment.template.secondary_anti_body[secondary_id] = { + name: $(element).val() + };; + + + + + if (!parsed.assignment.template.primary_anti_body[anti_body_id]) { + + parsed.assignment.template.primary_anti_body[anti_body_id] = { + name: '', + secondary: [secondary_id], + marks: [], + whole_marks: [], + total_marks: [], + nuclear_marks: [], + cyto_marks: [], + gel_name: '' + }; + } else { + parsed.assignment.template.primary_anti_body[anti_body_id] = { + name: parsed.assignment.template.primary_anti_body[anti_body_id].name, + secondary: [secondary_id], + marks: parsed.assignment.template.primary_anti_body[anti_body_id].marks, + whole_marks: parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks, + total_marks: parsed.assignment.template.primary_anti_body[anti_body_id].total_marks, + nuclear_marks: parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks, + cyto_marks: parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks, + gel_name: parsed.assignment.template.primary_anti_body[anti_body_id].gel_name + }; + } + + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_add_primary_anti_body = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); - var anti_body_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - - parsed.assignment.template.primary_anti_body[anti_body_id] = { - name: '', - secondary: [], - marks: [], - whole_marks:[], - total_marks: [], - nuclear_marks: [], - cyto_marks: [], - gel_name: '' - }; - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_add_primary_anti_body = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); + var anti_body_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + + parsed.assignment.template.primary_anti_body[anti_body_id] = { + name: '', + secondary: [], + marks: [], + whole_marks: [], + total_marks: [], + nuclear_marks: [], + cyto_marks: [], + gel_name: '' + }; + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_page2_remove_row = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); - var anti_body_id = $(element).attr('anti_body_id'); - delete parsed.assignment.template.primary_anti_body[anti_body_id]; +scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_page2_remove_row = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage2View.parse(element); + var anti_body_id = $(element).attr('anti_body_id'); + delete parsed.assignment.template.primary_anti_body[anti_body_id]; - - scb.ui.static.InstructorFrame.refresh(); + + scb.ui.static.InstructorFrame.refresh(); } scb.ui.static.InstructorWesternBlotPage2View.register = function(workarea) { - - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page2_save_assignment_button', function (e) { - scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_page2_save_assignment_button(this, e); - }); - - scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_primary_anti_body_list_item', function (e) { - scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_primary_anti_body_list_item(this, e); - }); - - scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_secondary_anti_body_list_item', function (e) { - scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_secondary_anti_body_list_item(this, e); - }); - - - - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_add_primary_anti_body', function (e) { - scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_add_primary_anti_body(this, e); - }); - - - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page2_remove_row', function (e) { - scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_page2_remove_row(this, e); - }); - - - - + + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page2_save_assignment_button', function(e) { + scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_page2_save_assignment_button(this, e); + }); + + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_primary_anti_body_list_item', function(e) { + scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_primary_anti_body_list_item(this, e); + }); + + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_secondary_anti_body_list_item', function(e) { + scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_secondary_anti_body_list_item(this, e); + }); + + + + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_add_primary_anti_body', function(e) { + scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_add_primary_anti_body(this, e); + }); + + + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page2_remove_row', function(e) { + scb.ui.static.InstructorWesternBlotPage2View.scb_f_western_blot_page2_remove_row(this, e); + }); + + + + }; -scb.ui.static.InstructorWesternBlotPage2View.rows = function(dialog){ - var rows =[]; - var headings = dialog.headings; - _.each(dialog.order, function(strain){ - _.each(dialog[strain].rows, function(row){ - var insert_row = {treatment_id:row.treatment_id, row: []}; - _.each(row.cells, function(cell){ - if(cell.kind=='text') - insert_row.row.push(cell.text); - else - insert_row.row.push('cell_plate'); - - }); - rows.push(insert_row); - }); - }); - - return rows; +scb.ui.static.InstructorWesternBlotPage2View.rows = function(dialog) { + var rows = []; + var headings = dialog.headings; + _.each(dialog.order, function(strain) { + _.each(dialog[strain].rows, function(row) { + var insert_row = { + treatment_id: row.treatment_id, + row: [] + }; + _.each(row.cells, function(cell) { + if (cell.kind == 'text') { + insert_row.row.push(cell.text); + } else { + insert_row.row.push('cell_plate'); + } + + }); + rows.push(insert_row); + }); + }); + + return rows; } scb.ui.InstructorWesternBlotPage2View = function scb_ui_InstructorWesternBlotPage2View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - var rows = scb.ui.static.InstructorWesternBlotPage2View.rows(assignments.selected.template.ui.add_multiple_dialog); - - workarea.html(scb_instructor_western_blot_page2.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - rows: rows, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + var rows = scb.ui.static.InstructorWesternBlotPage2View.rows(assignments.selected.template.ui.add_multiple_dialog); + + workarea.html(scb_instructor_western_blot_page2.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + rows: rows, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorWesternBlotPage3View.js b/html_app/instructor/InstructorWesternBlotPage3View.js index ba914471..9fb4a4f0 100644 --- a/html_app/instructor/InstructorWesternBlotPage3View.js +++ b/html_app/instructor/InstructorWesternBlotPage3View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,210 +10,225 @@ scb.ui.static.InstructorWesternBlotPage3View = scb.ui.static.InstructorWesternBl -scb.ui.static.InstructorWesternBlotPage3View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorWesternBlotPage3View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_page3_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorWesternBlotPage3View.parse(element); - - - - _.each(parsed.assignment.template.primary_anti_body, function(antibody){ - _.each(antibody.whole_marks, function(whole){ - antibody.total_marks.push(whole.weight); - }); - _.each(antibody.nuclear_marks, function(nuclear){ - antibody.total_marks.push(nuclear.weight); - }); - _.each(antibody.cyto_marks, function(cyto){ - antibody.total_marks.push(cyto.weight); - }); - antibody.total_marks = _.uniq(antibody.total_marks); - - }); - - - - - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'western_blot_page4', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_page3_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorWesternBlotPage3View.parse(element); + + + + _.each(parsed.assignment.template.primary_anti_body, function(antibody) { + _.each(antibody.whole_marks, function(whole) { + antibody.total_marks.push(whole.weight); + }); + _.each(antibody.nuclear_marks, function(nuclear) { + antibody.total_marks.push(nuclear.weight); + }); + _.each(antibody.cyto_marks, function(cyto) { + antibody.total_marks.push(cyto.weight); + }); + antibody.total_marks = _.uniq(antibody.total_marks); + + }); + + + + + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'western_blot_page4', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } -scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_whole_antibody_size_list_item = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage3View.parse(element); - var anti_body_id = $(element).attr('anti_body_id'); - parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks_string = $(element).val(); - var marks = $(element).val().split(','); - parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks = []; - _.each(marks, function(mark){ - var value = $.trim(mark); - parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks.push({weight: value, intensity: 0}); +scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_whole_antibody_size_list_item = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage3View.parse(element); + var anti_body_id = $(element).attr('anti_body_id'); + parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks_string = $(element).val(); + var marks = $(element).val().split(','); + parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks = []; + _.each(marks, function(mark) { + var value = $.trim(mark); + parsed.assignment.template.primary_anti_body[anti_body_id].whole_marks.push({ + weight: value, + intensity: 0 + }); - }); - - scb.ui.static.InstructorFrame.refresh(); + }); + + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_nuclear_antibody_size_list_item = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage3View.parse(element); - var anti_body_id = $(element).attr('anti_body_id'); - parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks_string = $(element).val(); - var marks = $(element).val().split(','); - parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks = []; - _.each(marks, function(mark){ - var value = $.trim(mark); - parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks.push({weight: value, intensity: 0}); - }); - - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_nuclear_antibody_size_list_item = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage3View.parse(element); + var anti_body_id = $(element).attr('anti_body_id'); + parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks_string = $(element).val(); + var marks = $(element).val().split(','); + parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks = []; + _.each(marks, function(mark) { + var value = $.trim(mark); + parsed.assignment.template.primary_anti_body[anti_body_id].nuclear_marks.push({ + weight: value, + intensity: 0 + }); + }); + + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_cyto_antibody_size_list_item = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage3View.parse(element); - var anti_body_id = $(element).attr('anti_body_id'); - parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks_string = $(element).val(); - var marks = $(element).val().split(','); - parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks = [] - _.each(marks, function(mark){ - var value = $.trim(mark); - parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks.push({weight: value, intensity: 0}); - }); - - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_cyto_antibody_size_list_item = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage3View.parse(element); + var anti_body_id = $(element).attr('anti_body_id'); + parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks_string = $(element).val(); + var marks = $(element).val().split(','); + parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks = [] + _.each(marks, function(mark) { + var value = $.trim(mark); + parsed.assignment.template.primary_anti_body[anti_body_id].cyto_marks.push({ + weight: value, + intensity: 0 + }); + }); + + scb.ui.static.InstructorFrame.refresh(); } scb.ui.static.InstructorWesternBlotPage3View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page3_save_assignment_button', function (e) { - scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_page3_save_assignment_button(this, e); - }); - - scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_whole_antibody_size_list_item', function (e) { - scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_whole_antibody_size_list_item(this, e); - }); - - - scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_nuclear_antibody_size_list_item', function (e) { - scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_nuclear_antibody_size_list_item(this, e); - }); - - scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_cyto_antibody_size_list_item', function (e) { - scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_cyto_antibody_size_list_item(this, e); - }); - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page3_save_assignment_button', function(e) { + scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_page3_save_assignment_button(this, e); + }); + + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_whole_antibody_size_list_item', function(e) { + scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_whole_antibody_size_list_item(this, e); + }); + + + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_nuclear_antibody_size_list_item', function(e) { + scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_nuclear_antibody_size_list_item(this, e); + }); + + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_cyto_antibody_size_list_item', function(e) { + scb.ui.static.InstructorWesternBlotPage3View.scb_f_western_blot_cyto_antibody_size_list_item(this, e); + }); + + + + + }; -scb.ui.static.InstructorWesternBlotPage3View.rows = function(dialog){ - var rows =[]; - var headings = dialog.headings; - _.each(dialog.order, function(strain){ - _.each(dialog[strain].rows, function(row){ - var insert_row = {treatment_id:row.treatment_id, row: []}; - _.each(row.cells, function(cell){ - if(cell.kind=='text') - insert_row.row.push(cell.text); - else - insert_row.row.push('cell_plate'); - - }); - rows.push(insert_row); - }); - }); - - return rows; +scb.ui.static.InstructorWesternBlotPage3View.rows = function(dialog) { + var rows = []; + var headings = dialog.headings; + _.each(dialog.order, function(strain) { + _.each(dialog[strain].rows, function(row) { + var insert_row = { + treatment_id: row.treatment_id, + row: [] + }; + _.each(row.cells, function(cell) { + if (cell.kind == 'text') { + insert_row.row.push(cell.text); + } else { + insert_row.row.push('cell_plate'); + } + + }); + rows.push(insert_row); + }); + }); + + return rows; } scb.ui.InstructorWesternBlotPage3View = function scb_ui_InstructorWesternBlotPage3View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - var rows = scb.ui.static.InstructorWesternBlotPage3View.rows(assignments.selected.template.ui.add_multiple_dialog); - - workarea.html(scb_instructor_western_blot_page3.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - rows: rows, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + var rows = scb.ui.static.InstructorWesternBlotPage3View.rows(assignments.selected.template.ui.add_multiple_dialog); + + workarea.html(scb_instructor_western_blot_page3.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + rows: rows, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorWesternBlotPage4View.js b/html_app/instructor/InstructorWesternBlotPage4View.js index 340305be..96c78ae2 100644 --- a/html_app/instructor/InstructorWesternBlotPage4View.js +++ b/html_app/instructor/InstructorWesternBlotPage4View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,269 +10,282 @@ scb.ui.static.InstructorWesternBlotPage4View = scb.ui.static.InstructorWesternBl -scb.ui.static.InstructorWesternBlotPage4View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorWesternBlotPage4View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorWesternBlotPage4View.rows = function(dialog){ - var rows =[]; - var headings = dialog.headings; - _.each(dialog.order, function(strain){ - _.each(dialog[strain].rows, function(row){ - var insert_row = {treatment_id:row.treatment_id, row: []}; - _.each(row.cells, function(cell){ - if(cell.kind=='text') - insert_row.row.push(cell.text); - else - insert_row.row.push('cell_plate'); - - }); - rows.push(insert_row); - }); - }); - - return rows; +scb.ui.static.InstructorWesternBlotPage4View.rows = function(dialog) { + var rows = []; + var headings = dialog.headings; + _.each(dialog.order, function(strain) { + _.each(dialog[strain].rows, function(row) { + var insert_row = { + treatment_id: row.treatment_id, + row: [] + }; + _.each(row.cells, function(cell) { + if (cell.kind == 'text') { + insert_row.row.push(cell.text); + } else { + insert_row.row.push('cell_plate'); + } + + }); + rows.push(insert_row); + }); + }); + + return rows; } -scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorWesternBlotPage4View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - - var state = { - assignment_id: parsed.assignment.id, - view: 'western_blot_page5', - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorWesternBlotPage4View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + + var state = { + assignment_id: parsed.assignment.id, + view: 'western_blot_page5', + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } scb.ui.static.InstructorWesternBlotPage4View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page4_save_assignment_button', function (e) { - scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_save_assignment_button(this, e); - }); - - - - - - - + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page4_save_assignment_button', function(e) { + scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_save_assignment_button(this, e); + }); + + + + + + + }; -scb.ui.static.InstructorWesternBlotPage4View.rows = function(dialog){ - var rows =[]; - var headings = dialog.headings; - _.each(dialog.order, function(strain){ - _.each(dialog[strain].rows, function(row){ - var insert_row = {treatment_id:row.treatment_id, row: ''}; +scb.ui.static.InstructorWesternBlotPage4View.rows = function(dialog) { + var rows = []; + var headings = dialog.headings; + _.each(dialog.order, function(strain) { + _.each(dialog[strain].rows, function(row) { + var insert_row = { + treatment_id: row.treatment_id, + row: '' + }; - var cells = _.filter(row.cells, function(cell){ return cell.kind=='text'; }); - cells = _.map(cells, function(cell){ return cell.text.replace(/\s+/g, ''); }); - insert_row.row = cells.join(); + var cells = _.filter(row.cells, function(cell) { + return cell.kind == 'text'; + }); + cells = _.map(cells, function(cell) { + return cell.text.replace(/\s+/g, ''); + }); + insert_row.row = cells.join(); - rows.push(insert_row); - }); - }); + rows.push(insert_row); + }); + }); - return rows; + return rows; } -scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_exposure_slider = function (e, ui) { - var element = this; - if($(this).hasClass('scb_f_western_blot_page4_exposure_slider')){ - var parsed = scb.ui.static.InstructorWesternBlotPage4View.parse(element); - var antibody_id = $(element).attr('antibody_id'); - var treatment_id = $(element).attr('treatment_id'); - var drug_id = ''; - var cell_line_id = ''; - _.each(parsed.assignment.template.ui.add_multiple_dialog, function(cell_line, value, list){ - if(value != 'order'){ - _.each(cell_line.rows, function(row){ - if(row.treatment_id == treatment_id){ - cell_line_id = row.cell_treatments.X[0].cell_line - drug_id = row.cell_treatments.X[0].treatment_list.list[0].drug_list.list[0].drug_id; - } - }); - } - }); - - - - _.each(parsed.assignment.template.model.western_blot, function(parser){ - var parser_exists = false; - _.each(parser.parser_fixed, function(cell_parser){ - if(cell_parser.cell_line == cell_line_id && cell_parser.drug == drug_id){ - parser_exists = true; - var marker_exists = false; - _.each(cell_parser.above_marks, function(mark){ - if(mark.primary_anti_body[0] == antibody_id){ - marker_exists = true; - mark.intensity = ui.value; - } - }); - if(!marker_exists){ - cell_parser.above_marks.push({ - name: parsed.assignment.template.primary_anti_body[antibody_id].name, - weight: $(element).attr('weight'), - intensity: ui.value, - primary_anti_body: [antibody_id] - }); - } - - } - - }); - if(!parser_exists){ - parser.parser_fixed.push({ - transfer_function: 'delta', - cutoff: 1, - drug: drug_id, - cell_line: cell_line_id, - above_marks: [{ - name: parsed.assignment.template.primary_anti_body[antibody_id].name, - weight:$(this).attr('weight'), - intensity: ui.value, - primary_anti_body: [antibody_id] - }] - }); - } - }); - - } - - +scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_exposure_slider = function(e, ui) { + var element = this; + if ($(this).hasClass('scb_f_western_blot_page4_exposure_slider')) { + var parsed = scb.ui.static.InstructorWesternBlotPage4View.parse(element); + var antibody_id = $(element).attr('antibody_id'); + var treatment_id = $(element).attr('treatment_id'); + var drug_id = ''; + var cell_line_id = ''; + _.each(parsed.assignment.template.ui.add_multiple_dialog, function(cell_line, value, list) { + if (value != 'order') { + _.each(cell_line.rows, function(row) { + if (row.treatment_id == treatment_id) { + cell_line_id = row.cell_treatments.X[0].cell_line + drug_id = row.cell_treatments.X[0].treatment_list.list[0].drug_list.list[0].drug_id; + } + }); + } + }); + + + + _.each(parsed.assignment.template.model.western_blot, function(parser) { + var parser_exists = false; + _.each(parser.parser_fixed, function(cell_parser) { + if (cell_parser.cell_line == cell_line_id && cell_parser.drug == drug_id) { + parser_exists = true; + var marker_exists = false; + _.each(cell_parser.above_marks, function(mark) { + if (mark.primary_anti_body[0] == antibody_id) { + marker_exists = true; + mark.intensity = ui.value; + } + }); + if (!marker_exists) { + cell_parser.above_marks.push({ + name: parsed.assignment.template.primary_anti_body[antibody_id].name, + weight: $(element).attr('weight'), + intensity: ui.value, + primary_anti_body: [antibody_id] + }); + } + + } + + }); + if (!parser_exists) { + parser.parser_fixed.push({ + transfer_function: 'delta', + cutoff: 1, + drug: drug_id, + cell_line: cell_line_id, + above_marks: [{ + name: parsed.assignment.template.primary_anti_body[antibody_id].name, + weight: $(this).attr('weight'), + intensity: ui.value, + primary_anti_body: [antibody_id] + }] + }); + } + }); + + } + + } scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_adjust_sliders = function(assignment) { - console.log(assignment); - var strain_combos = []; - - _.each(assignment.template.ui.add_multiple_dialog, function(cell_line, value, list){ - if(value != 'order'){ - _.each(cell_line.rows, function(row){ - strain_combos.push({ - treatment_id: row.treatment_id, - cell_line: row.cell_treatments.X[0].cell_line, - drug: row.cell_treatments.X[0].treatment_list.list[0].drug_list.list[0].drug_id - }); - console.log(row.treatment_id); - }); - } - }); - _.each($('.scb_f_western_blot_page4_exposure_slider'), function(slider){ - var treatment_id = $(slider).attr('treatment_id'); - var antibody_id = $(slider).attr('antibody_id'); - _.each(strain_combos, function(combo){ - if(treatment_id == combo.treatment_id){ - _.each(assignment.template.model.western_blot, function(parser){ - _.each(parser.parser_fixed, function(cell_parser){ - if(cell_parser.cell_line == combo.cell_line && cell_parser.drug == combo.drug){ - _.each(cell_parser.above_marks, function(mark){ - if(mark.primary_anti_body[0] == antibody_id){ - $(slider).slider('value', mark.intensity); - } - }); - } - - }); - }); - ///// - } - }); - }); + console.log(assignment); + var strain_combos = []; + + _.each(assignment.template.ui.add_multiple_dialog, function(cell_line, value, list) { + if (value != 'order') { + _.each(cell_line.rows, function(row) { + strain_combos.push({ + treatment_id: row.treatment_id, + cell_line: row.cell_treatments.X[0].cell_line, + drug: row.cell_treatments.X[0].treatment_list.list[0].drug_list.list[0].drug_id + }); + console.log(row.treatment_id); + }); + } + }); + _.each($('.scb_f_western_blot_page4_exposure_slider'), function(slider) { + var treatment_id = $(slider).attr('treatment_id'); + var antibody_id = $(slider).attr('antibody_id'); + _.each(strain_combos, function(combo) { + if (treatment_id == combo.treatment_id) { + _.each(assignment.template.model.western_blot, function(parser) { + _.each(parser.parser_fixed, function(cell_parser) { + if (cell_parser.cell_line == combo.cell_line && cell_parser.drug == combo.drug) { + _.each(cell_parser.above_marks, function(mark) { + if (mark.primary_anti_body[0] == antibody_id) { + $(slider).slider('value', mark.intensity); + } + }); + } + + }); + }); + ///// + } + }); + }); } scb.ui.InstructorWesternBlotPage4View = function scb_ui_InstructorWesternBlotPage4View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - var rows = scb.ui.static.InstructorWesternBlotPage4View.rows(assignments.selected.template.ui.add_multiple_dialog); - - workarea.html(scb_instructor_western_blot_page4.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - rows: rows, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - $('.scb_f_western_blot_page4_exposure_slider').slider({ - range: "min", - value:15, - min: 0, - max: 30, - step: 3, - stop: scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_exposure_slider - }); - - scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_adjust_sliders(assignments.selected); - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + var rows = scb.ui.static.InstructorWesternBlotPage4View.rows(assignments.selected.template.ui.add_multiple_dialog); + + workarea.html(scb_instructor_western_blot_page4.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + rows: rows, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + $('.scb_f_western_blot_page4_exposure_slider').slider({ + range: "min", + value: 15, + min: 0, + max: 30, + step: 3, + stop: scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_exposure_slider + }); + + scb.ui.static.InstructorWesternBlotPage4View.scb_f_western_blot_page4_adjust_sliders(assignments.selected); + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/instructor/InstructorWesternBlotPage5View.js b/html_app/instructor/InstructorWesternBlotPage5View.js index 739d78b5..044295e7 100644 --- a/html_app/instructor/InstructorWesternBlotPage5View.js +++ b/html_app/instructor/InstructorWesternBlotPage5View.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -10,136 +10,149 @@ scb.ui.static.InstructorWesternBlotPage5View = scb.ui.static.InstructorWesternBl -scb.ui.static.InstructorWesternBlotPage5View.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.InstructorWesternBlotPage5View.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.InstructorFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.InstructorFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_save_assignment_button = function(element, workarea){ - - var parsed = scb.ui.static.InstructorWesternBlotPage4View.parse(element); - - scb.ui.static.InstructorFrame.pending_save(parsed); - - var view = ''; - if(_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'facs')) - view = 'facs_page1'; - else if(_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'micro')) - view = 'microscopy_page1'; - else view = 'dashboard'; - - - var state = { - assignment_id: parsed.assignment.id, - view: view, - skip_hash_update: true - }; - - scb.ui.static.InstructorFrame.refresh(state); +scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_save_assignment_button = function(element, workarea) { + + var parsed = scb.ui.static.InstructorWesternBlotPage4View.parse(element); + + scb.ui.static.InstructorFrame.pending_save(parsed); + + var view = ''; + if (_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'facs')) { + view = 'facs_page1'; + } else if (_.contains(parsed.assignment.template.ui.experimental_design.techniques, 'micro')) { + view = 'microscopy_page1'; + } else { + view = 'dashboard'; + } + + + var state = { + assignment_id: parsed.assignment.id, + view: view, + skip_hash_update: true + }; + + scb.ui.static.InstructorFrame.refresh(state); } -scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_radio_no = function(element, workarea){ +scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_radio_no = function(element, workarea) { + + var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); + + parsed.assignment.has_background_bands = false; - var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); - - parsed.assignment.has_background_bands = false; - - scb.ui.static.InstructorFrame.refresh(); + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_radio_yes = function(element, workarea){ +scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_radio_yes = function(element, workarea) { - var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); - - parsed.assignment.has_background_bands = true; - - scb.ui.static.InstructorFrame.refresh(); + var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); + + parsed.assignment.has_background_bands = true; + + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_checkbox = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); - var antibody_id = $(element).attr('anti_body_id'); - - if($(element).attr('checked')){ - parsed.assignment.background_band_list[antibody_id] = 1; - -// parsed.assignment.background_band_list = _.uniq(parsed.assignment.background_band_list); - } - else{ - delete parsed.assignment.background_band_list[antibody_id]; - } - scb.ui.static.InstructorFrame.refresh(); +scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_checkbox = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); + var antibody_id = $(element).attr('anti_body_id'); + + if ($(element).attr('checked')) { + parsed.assignment.background_band_list[antibody_id] = 1; + + // parsed.assignment.background_band_list = _.uniq(parsed.assignment.background_band_list); + } else { + delete parsed.assignment.background_band_list[antibody_id]; + } + scb.ui.static.InstructorFrame.refresh(); } -scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_weight_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); - var antibody_id = $(element).attr('anti_body_id'); - var marks = parsed.assignment.template.primary_anti_body[antibody_id].marks; - var mark_id = $(element).attr('mark_id') ? $(element).attr('mark_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - - var markExists = false; - _.each(marks, function(mark){ - if(mark_id == mark.id){ - mark.weight = $(element).val(); - markExists = true; - } - }); - - if(!markExists){ - marks.push({id: mark_id, weight: $(element).val(), intensity: 0}); - } - - scb.ui.static.InstructorFrame.refresh(); - +scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_weight_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); + var antibody_id = $(element).attr('anti_body_id'); + var marks = parsed.assignment.template.primary_anti_body[antibody_id].marks; + var mark_id = $(element).attr('mark_id') ? $(element).attr('mark_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + + var markExists = false; + _.each(marks, function(mark) { + if (mark_id == mark.id) { + mark.weight = $(element).val(); + markExists = true; + } + }); + + if (!markExists) { + marks.push({ + id: mark_id, + weight: $(element).val(), + intensity: 0 + }); + } + + scb.ui.static.InstructorFrame.refresh(); + } -scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_intensity_edit = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); - var antibody_id = $(element).attr('anti_body_id'); - var marks = parsed.assignment.template.primary_anti_body[antibody_id].marks; - var mark_id = $(element).attr('mark_id') ? $(element).attr('mark_id'): Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - - var markExists = false; - _.each(marks, function(mark){ - if(mark_id == mark.id){ - mark.intensity = $(element).val(); - markExists = true; - } - }); - - if(!markExists){ - marks.push({id: mark_id, weight: 0, intensity: $(element).val()}); - } - - scb.ui.static.InstructorFrame.refresh(); - +scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_intensity_edit = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); + var antibody_id = $(element).attr('anti_body_id'); + var marks = parsed.assignment.template.primary_anti_body[antibody_id].marks; + var mark_id = $(element).attr('mark_id') ? $(element).attr('mark_id') : Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + + var markExists = false; + _.each(marks, function(mark) { + if (mark_id == mark.id) { + mark.intensity = $(element).val(); + markExists = true; + } + }); + + if (!markExists) { + marks.push({ + id: mark_id, + weight: 0, + intensity: $(element).val() + }); + } + + scb.ui.static.InstructorFrame.refresh(); + } -scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_add_background_band = function(element, workarea){ - var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); - var antibody_id = $(element).attr('anti_body_id'); - var mark_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); +scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_add_background_band = function(element, workarea) { + var parsed = scb.ui.static.InstructorWesternBlotPage5View.parse(element); + var antibody_id = $(element).attr('anti_body_id'); + var mark_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - var marks = parsed.assignment.template.primary_anti_body[antibody_id].marks; + var marks = parsed.assignment.template.primary_anti_body[antibody_id].marks; - marks.push({id: mark_id, weight: 0, intensity: 0}); - scb.ui.static.InstructorFrame.refresh(); + marks.push({ + id: mark_id, + weight: 0, + intensity: 0 + }); + scb.ui.static.InstructorFrame.refresh(); } @@ -149,124 +162,130 @@ scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_add_backgr scb.ui.static.InstructorWesternBlotPage5View.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_save_assignment_button', function (e) { - scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_save_assignment_button(this, e); - }); - - - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_radio_no', function (e) { - scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_radio_no(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_radio_yes', function (e) { - scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_radio_yes(this, e); - }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_save_assignment_button', function(e) { + scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_save_assignment_button(this, e); + }); + + + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_radio_no', function(e) { + scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_radio_no(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_radio_yes', function(e) { + scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_radio_yes(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_antibody_checkbox', function(e) { + scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_checkbox(this, e); + }); + + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_page5_antibody_intensity_edit', function(e) { + scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_intensity_edit(this, e); + }); + + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_page5_antibody_weight_edit', function(e) { + scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_weight_edit(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_add_background_band', function(e) { + scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_add_background_band(this, e); + }); + + + - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_antibody_checkbox', function (e) { - scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_checkbox(this, e); - }); - - scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_page5_antibody_intensity_edit', function (e) { - scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_intensity_edit(this, e); - }); - - scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_page5_antibody_weight_edit', function (e) { - scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_antibody_weight_edit(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_page5_add_background_band', function (e) { - scb.ui.static.InstructorWesternBlotPage5View.scb_f_western_blot_page5_add_background_band(this, e); - }); - - - - }; -scb.ui.static.InstructorWesternBlotPage5View.rows = function(dialog){ - var rows =[]; - var headings = dialog.headings; - _.each(dialog.order, function(strain){ - _.each(dialog[strain].rows, function(row){ - var insert_row = {treatment_id:row.treatment_id, row: []}; - _.each(row.cells, function(cell){ - if(cell.kind=='text') - insert_row.row.push(cell.text); - else - insert_row.row.push('cell_plate'); - - }); - rows.push(insert_row); - }); - }); - - return rows; +scb.ui.static.InstructorWesternBlotPage5View.rows = function(dialog) { + var rows = []; + var headings = dialog.headings; + _.each(dialog.order, function(strain) { + _.each(dialog[strain].rows, function(row) { + var insert_row = { + treatment_id: row.treatment_id, + row: [] + }; + _.each(row.cells, function(cell) { + if (cell.kind == 'text') { + insert_row.row.push(cell.text); + } else { + insert_row.row.push('cell_plate'); + } + + }); + rows.push(insert_row); + }); + }); + + return rows; } scb.ui.InstructorWesternBlotPage5View = function scb_ui_InstructorWesternBlotPage5View(gstate) { - var self = this; - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - self.show = function (state) { - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - - var kind = 'select_course'; - - if(assignments.selected.course_prepared){ - kind = 'create_assignment'; - } - - - - - - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - - var rows = scb.ui.static.InstructorWesternBlotPage5View.rows(assignments.selected.template.ui.add_multiple_dialog); - - workarea.html(scb_instructor_western_blot_page5.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - kind: kind, - headings: assignments.selected.template.ui.add_multiple_dialog.headings, - rows: rows, - assignment: assignments.selected, - context: gstate.context, - courses: courses, - })); - - document.title = "Assignments - StarCellBio" - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); + }); + self.show = function(state) { + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + + var kind = 'select_course'; + + if (assignments.selected.course_prepared) { + kind = 'create_assignment'; + } + + + + + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; } + var rows = scb.ui.static.InstructorWesternBlotPage5View.rows(assignments.selected.template.ui.add_multiple_dialog); + + workarea.html(scb_instructor_western_blot_page5.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + kind: kind, + headings: assignments.selected.template.ui.add_multiple_dialog.headings, + rows: rows, + assignment: assignments.selected, + context: gstate.context, + courses: courses, + })); + + document.title = "Assignments - StarCellBio" + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); + }); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + } + } \ No newline at end of file diff --git a/html_app/master_model.js b/html_app/master_model.js index 17b7eb6f..88f9fefb 100644 --- a/html_app/master_model.js +++ b/html_app/master_model.js @@ -3,4478 +3,6215 @@ degreeEntity = $('
').html('°').text(); ///OLD ASSIGNMENTS////////// var __assigment_facs = { - id: 'assignment_3', - name: 'FACS prototype', - course: 'StarX', - course_name: 'Prototypes', - description: 'FACS prototype assignment.', - notebook: {}, - experiments: { + id: 'assignment_3', + name: 'FACS prototype', + course: 'StarX', + course_name: 'Prototypes', + description: 'FACS prototype assignment.', + notebook: {}, + experiments: { + }, + template: { + instructions: [ + ['Goal & Introduction', 'FACS prototype assignment.'] + ], + ui_configuration: { + experiment_steps_setup: true, // this is not even checked... + experiment_steps_western_blot: false, + experiment_steps_facs: true, + experiment_steps_microscopy: false, + treatment_options_display_temperature: false, + lysate_display_ip: false, + amount_of_protein_loaded: 50, + experiment_setup_duration: 3600, // seconds + experiment_setup_resolution_height: 3600, + experiment_setup_physical_height: 600, + facs_cell_cycle_length: 24 * 3600, //24h cell cycle + facs_cell_cycle_step: 300 // 5 minutes }, - template: { - instructions:[ - ['Goal & Introduction','FACS prototype assignment.'] - ], - ui_configuration: { - experiment_steps_setup: true, // this is not even checked... - experiment_steps_western_blot: false, - experiment_steps_facs: true, - experiment_steps_microscopy: false, - treatment_options_display_temperature: false, - lysate_display_ip: false, - amount_of_protein_loaded: 50, - experiment_setup_duration: 3600, // seconds - experiment_setup_resolution_height: 3600, - experiment_setup_physical_height: 600, - facs_cell_cycle_length: 24 * 3600, //24h cell cycle - facs_cell_cycle_step: 300 // 5 minutes - }, - drug_template: { - name: 'Negative Control', - drug_id: 'nc', - concentration_id: 0 - }, - experiment_templates: { - 'default': { - collection_schedule_list: {list: [ - {schedule: "10 min", schedule_value: 600, id: '10'}, - {schedule: "30 min", schedule_value: 1800, id: '30'}, - {schedule: "60 min", schedule_value: 3600, id: '60'} - ]} - }, - treatment_protocol_template: { - 'default': { - collection_schedule_list: {list: [ - {schedule: "10 min", schedule_value: 600, id: '10'}, - {schedule: "30 min", schedule_value: 1800, id: '30'}, - {schedule: "60 min", schedule_value: 3600, id: '60'} - ]} - } - } - }, - name: 'TUFTS CellBio Prototype Assignment', - concentrations: { - 1: { - name: '1ug/ml', - value: 1 - }, - 0: { - name: '0ug/ml', - value: 0 - } - }, - drugs: { - 1: { - name: 'Nocodazole', // G2 prometaphase drug - concentrations: [1] - }, - 'nc': { - name: 'Negative Control', - concentrations: [0] - } - }, - experiment_temperatures: { - '25': { name: "25" + degreeEntity + "C" } - }, - cell_lines: { - 'strain 1': { - name: 'Strain 1' - } - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order:[1,2,3], - 1: { - name: 'rabbit anti-goat beta-actin', - secondary: [2], - marks: [ - {weight: 100, intensity: .01}, - {weight: 129, intensity: .11} - ] - }, - 2: { - name: 'mouse anti-mouse phosphotyrosine', - secondary: [3], - marks: [ - {weight: 120, intensity: .01}, - {weight: 129, intensity: .11} - ] - }, - 3: { - name: 'mouse anti-mouse cdk2', - secondary: [3], - marks: [ - {weight: 140, intensity: .01}, - {weight: 129, intensity: .11} - ] - } - }, - secondary_anti_body: { - 1: { - name: 'donkey anti-rabbit' - }, - 2: { - name: 'rabbit anti-goat' - }, - 3: { - name: 'goat anti-mouse' + drug_template: { + name: 'Negative Control', + drug_id: 'nc', + concentration_id: 0 + }, + experiment_templates: { + 'default': { + collection_schedule_list: { + list: [ + { + schedule: "10 min", + schedule_value: 600, + id: '10' + }, + { + schedule: "30 min", + schedule_value: 1800, + id: '30' + }, + { + schedule: "60 min", + schedule_value: 3600, + id: '60' } - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - }, - 'cyto': { - name: 'Cytoplasm' - }, - 'nuclear': { - name: 'Nuclear' + ] + } + }, + treatment_protocol_template: { + 'default': { + collection_schedule_list: { + list: [ + { + schedule: "10 min", + schedule_value: 600, + id: '10' + }, + { + schedule: "30 min", + schedule_value: 1800, + id: '30' + }, + { + schedule: "60 min", + schedule_value: 3600, + id: '60' + } + ] + } + } + } + }, + name: 'TUFTS CellBio Prototype Assignment', + concentrations: { + 1: { + name: '1ug/ml', + value: 1 + }, + 0: { + name: '0ug/ml', + value: 0 + } + }, + drugs: { + 1: { + name: 'Nocodazole', // G2 prometaphase drug + concentrations: [1] + }, + 'nc': { + name: 'Negative Control', + concentrations: [0] + } + }, + experiment_temperatures: { + '25': { + name: "25" + degreeEntity + "C" + } + }, + cell_lines: { + 'strain 1': { + name: 'Strain 1' + } + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: [1, 2, 3], + 1: { + name: 'rabbit anti-goat beta-actin', + secondary: [2], + marks: [ + { + weight: 100, + intensity: .01 + }, + { + weight: 129, + intensity: .11 + } + ] + }, + 2: { + name: 'mouse anti-mouse phosphotyrosine', + secondary: [3], + marks: [ + { + weight: 120, + intensity: .01 + }, + { + weight: 129, + intensity: .11 + } + ] + }, + 3: { + name: 'mouse anti-mouse cdk2', + secondary: [3], + marks: [ + { + weight: 140, + intensity: .01 + }, + { + weight: 129, + intensity: .11 + } + ] + } + }, + secondary_anti_body: { + 1: { + name: 'donkey anti-rabbit' + }, + 2: { + name: 'rabbit anti-goat' + }, + 3: { + name: 'goat anti-mouse' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + }, + 'cyto': { + name: 'Cytoplasm' + }, + 'nuclear': { + name: 'Nuclear' + } + }, + model: { // model + facs: { + 'dna': { + 'parser_1': [ + { + 'cell_line': 'strain 1', + 'drug': 1, + 'action': 'block_cycle' } - }, - model: { // model - facs: { - 'dna': { - 'parser_1': [ - { - 'cell_line': 'strain 1', - 'drug': 1, - 'action': 'block_cycle' - } - ] + ] + } + }, + western_blot: { // this applies to western blot + 'cyto': { // it acts on cytoplasm (thus on whole cell lysate as well) + 'parser_1': [ + // simple models as documented + { + 'cell_line': 'strain 1', // as defined in cell_lines + 'drug': 1, // these are required preconditions + 'transfer_function': 'linear_concentration_duration_with_max', // this is transfer function + 'marks': [ + // these are the marks that will appear + { + weight: 50, + intensity_slope: -0.01, + intensity_intercept: 300, + intensity_max: 1000, + intensity_min: 5 + }, + { + weight: 75, + intensity_slope: 0.02, + intensity_intercept: .3, + intensity_max: 1000, + intensity_min: 5 + }, + { + weight: 35, + intensity_slope: 0.001, + intensity_intercept: 4, + intensity_max: 1000, + intensity_min: 5 } - }, - western_blot: { // this applies to western blot - 'cyto': { // it acts on cytoplasm (thus on whole cell lysate as well) - 'parser_1': [ - // simple models as documented - { - 'cell_line': 'strain 1', // as defined in cell_lines - 'drug': 1, // these are required preconditions - 'transfer_function': 'linear_concentration_duration_with_max', // this is transfer function - 'marks': [ - // these are the marks that will appear - { - weight: 50, - intensity_slope: -0.01, - intensity_intercept: 300, - intensity_max: 1000, - intensity_min: 5 - }, - { - weight: 75, - intensity_slope: 0.02, - intensity_intercept: .3, - intensity_max: 1000, - intensity_min: 5 - }, - { - weight: 35, - intensity_slope: 0.001, - intensity_intercept: 4, - intensity_max: 1000, - intensity_min: 5 - } - ] - } - ], - 'parser_fixed': [ - {'cell_line': 'wt', - 'transfer_function': 'static', // this is transfer function - 'marks': [ - // these are the marks that will appear - { - weight: 60, - intensity: 300 - } - ] - } - ] + ] + } + ], + 'parser_fixed': [ + { + 'cell_line': 'wt', + 'transfer_function': 'static', // this is transfer function + 'marks': [ + // these are the marks that will appear + { + weight: 60, + intensity: 300 } + ] } + ] } + } } + } }; var __basic_tests = { - id: 'basic_tests', - name: 'SCB Basic Tests', - course: 'StarX', - course_name: 'Prototypes', - description: 'Biochemical approach to analyzing vulva development in C. elegans.', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal & Introduction', '$DISPLAY_ASSIGNMENT_INSTRUCTIONS$'] + id: 'basic_tests', + name: 'SCB Basic Tests', + course: 'StarX', + course_name: 'Prototypes', + description: 'Biochemical approach to analyzing vulva development in C. elegans.', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal & Introduction', '$DISPLAY_ASSIGNMENT_INSTRUCTIONS$'] + + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs'] + }, + experiment_setup: { + table: [ + { + kind: "cell_line", + title: "Strain", + editable: false + }, + { + kind: "treatments", + children: [ + { + kind: "drug", + title: "Treatments", + editable: false + }, + { + kind: "concentration", + title: "Concentration", + editable: false + }, + { + kind: "start", + title: "Start", + editable: false + }, + { + kind: "duration", + title: "Duration", + editable: false + } + ] + }, + { + kind: "custom", + title: "Stimulation Time", + editable: false, + key: "stimulation_time" + }, + { + kind: "actions", + title: "Actions" + } ], + actions: [ + { + kind: "add_protocol", + title: "Add Treatment Protocol" + } + ] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%, %CONCENTRATION%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + '%CONCENTRATION%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], + map: ['concentrations', '%KEY%', 'name'] + } + } + } + }, - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs' ] - }, - experiment_setup: {table: [ - {kind: "cell_line", - title: "Strain", - editable: false - }, - {kind: "treatments", - children: [ - {kind: "drug", title: "Treatments", editable: false}, - {kind: "concentration", title: "Concentration", editable: false}, - {kind: "start", title: "Start", editable: false}, - {kind: "duration", title: "Duration", editable: false} - ] - }, - {kind: "custom", - title: "Stimulation Time", - editable: false, - key: "stimulation_time"}, - {kind: "actions", - title: "Actions" + experiment_setup_actions: { + cell_lines: [ + { + id: 'wt', + title: 'Wild Type', + cell_line: 'wt' + }, + { + id: 'm1', + title: 'Mutant 1', + cell_line: 'm1' + } + ], + treatment_protocol_list: [ + { + id: 'P1', + title: 'Buffer Only', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: 0 + } + ] } - ], actions: [ - {kind: "add_protocol", title: "Add Treatment Protocol"} + } ] - }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%, %CONCENTRATION%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], map: ['drugs', '%KEY%', 'name']}, - '%CONCENTRATION%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], map: ['concentrations', '%KEY%', 'name']} + } + }, + { + id: 'P2', + title: 'V1 low conc', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '1' + } + ] } - } + } + ] + } }, - - experiment_setup_actions: { - cell_lines: [ - { - id: 'wt', - title: 'Wild Type', - cell_line: 'wt' - }, - { - id: 'm1', - title: 'Mutant 1', - cell_line: 'm1' + { + id: 'P3', + title: 'V1 high conc', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '125' + } + ] } - ], - treatment_protocol_list: [ - { - id: 'P1', - title: 'Buffer Only', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: 0} - ]}} - ]} - }, - { - id: 'P2', - title: 'V1 low conc', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '1'} - ]}} - ]} - }, - { - id: 'P3', - title: 'V1 high conc', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '125'} - ]}} - ]} - }, - { - id: 'P4', - title: 'V2 low conc', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '50'} - ]}} - ]} - }, - { - id: 'P5', - title: 'Many drugs', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '0'}, - {drug_id: '2', concentration_id: '5'}, - {drug_id: '3', concentration_id: '10'} - ]}} - ]} - }, - { - id: 'P6', - title: 'Many drugs, Many times', - treatment_list: { - list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '0'}, - {drug_id: '2', concentration_id: '5'}, - {drug_id: '3', concentration_id: '10'} - ]}} - ]} + } + ] + } + }, + { + id: 'P4', + title: 'V2 low conc', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '50' + } + ] + } + } + ] + } + }, + { + id: 'P5', + title: 'Many drugs', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '0' + }, + { + drug_id: '2', + concentration_id: '5' + }, + { + drug_id: '3', + concentration_id: '10' + } + ] } - ], - collection_schedule_list: [ - {id: '3 d', title: '3 days'} + } ] + } }, + { + id: 'P6', + title: 'Many drugs, Many times', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '0' + }, + { + drug_id: '2', + concentration_id: '5' + }, + { + drug_id: '3', + concentration_id: '10' + } + ] + } + } + ] + } + } + ], + collection_schedule_list: [ + { + id: '3 d', + title: '3 days' + } + ] + }, - add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs, Vulvarines 1-4, identified in your chemical screen. ', + add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs, Vulvarines 1-4, identified in your chemical screen. ', - concentrations: { - '1': { - name: '1 ' + microEntity + 'M', - value: 1000 - }, - '5': { - name: '5 ' + microEntity + 'M', - value: 5000 - }, - '10': { - name: '10 ' + microEntity + 'M', - value: 10000 - }, - '20': { - name: '20 ' + microEntity + 'M', - value: 20000 - }, - '25': { - name: '25 ' + microEntity + 'M', - value: 25000 - }, - '40': { - name: '40 ' + microEntity + 'M', - value: 40000 - }, - '80': { - name: '80 ' + microEntity + 'M', - value: 80000 - }, - '125': { - name: '125 ' + microEntity + 'M', - value: 125000 - }, - '10n': { - name: '10 nM', - value: 10 - }, - '50': { - name: '50 nM', - value: 50 - }, - '100': { - name: '100 nM', - value: 100 - }, - '200': { - name: '200 nM', - value: 200 - }, - '400': { - name: '400 nM', - value: 400 - }, - '0': { - name: '0 nM', - value: 0 - } - }, - drugs: { - 'nc': { - name: 'Buffer only', - concentrations: [0] - }, - '1': { - name: 'Vulvarine 1', - concentrations: [5, 10, 20, 40, 80] - }, - '2': { - name: 'Vulvarine 2', - concentrations: [50, 100, 200, 400] - }, - '3': { - name: 'Vulvarine 3', - concentrations: [1, 5, 25, 125] - }, - '4': { - name: 'Vulvarine 4', - concentrations: ['10n', 50, 100, 200, 400] - } - }, - experiment_temperatures: { - '25': { - name: "25" + degreeEntity + "C" - } - }, - cell_lines: { - 'wt': { - name: 'Wild Type' - }, - 'm1': { - name: 'Mutant 1' - } + concentrations: { + '1': { + name: '1 ' + microEntity + 'M', + value: 1000 + }, + '5': { + name: '5 ' + microEntity + 'M', + value: 5000 + }, + '10': { + name: '10 ' + microEntity + 'M', + value: 10000 + }, + '20': { + name: '20 ' + microEntity + 'M', + value: 20000 + }, + '25': { + name: '25 ' + microEntity + 'M', + value: 25000 + }, + '40': { + name: '40 ' + microEntity + 'M', + value: 40000 + }, + '80': { + name: '80 ' + microEntity + 'M', + value: 80000 + }, + '125': { + name: '125 ' + microEntity + 'M', + value: 125000 + }, + '10n': { + name: '10 nM', + value: 10 + }, + '50': { + name: '50 nM', + value: 50 + }, + '100': { + name: '100 nM', + value: 100 + }, + '200': { + name: '200 nM', + value: 200 + }, + '400': { + name: '400 nM', + value: 400 + }, + '0': { + name: '0 nM', + value: 0 + } + }, + drugs: { + 'nc': { + name: 'Buffer only', + concentrations: [0] + }, + '1': { + name: 'Vulvarine 1', + concentrations: [5, 10, 20, 40, 80] + }, + '2': { + name: 'Vulvarine 2', + concentrations: [50, 100, 200, 400] + }, + '3': { + name: 'Vulvarine 3', + concentrations: [1, 5, 25, 125] + }, + '4': { + name: 'Vulvarine 4', + concentrations: ['10n', 50, 100, 200, 400] + } + }, + experiment_temperatures: { + '25': { + name: "25" + degreeEntity + "C" + } + }, + cell_lines: { + 'wt': { + name: 'Wild Type' + }, + 'm1': { + name: 'Mutant 1' + } - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order:[1,2,3,9,4,5,6,7,8], - 1: { - name: 'rabbit anti-let-23', - secondary: [1], - marks: [ - {weight: 24, intensity: .11}, - {weight: 36, intensity: .4}, - {weight: 48, intensity: .04} - ], - gel_name: 'anti-let-23' - }, - 2: { - name: 'mouse anti-let-60', - secondary: [3], - marks: [ - {weight: 48, intensity: .04} - ], - gel_name: 'anti-let-60' - }, - 3: { - name: 'goat anti-lin15A', - secondary: [2], - marks: [ - {weight: 12, intensity: .02} - ], - gel_name: 'anti-lin15A' - }, - 9: { - name: 'goat anti-lin15B', - secondary: [2], - marks: [ - {weight: 100, intensity: .01}, - {weight: 129, intensity: .11} - ], - gel_name: 'anti-lin15B' - }, - 4: { - name: 'goat anti-lin-1', - secondary: [2], - gel_name: 'anti-lin-1' - }, - 5: { - name: 'mouse anti-Dpy-5', - secondary: [3], - gel_name: 'anti-Dpy-5' - }, - 6: { - name: 'rabbit anti-Lon-2', - secondary: [1], - gel_name: 'anti-Lon-2' - }, - 7: { - name: 'mouse anti-Sma-4', - secondary: [3], - gel_name: 'anti-Sma-4' - }, - 8: { - name: 'goat anti-Unc-22', - secondary: [2], - gel_name: 'anti-Unc-22' - } - }, - secondary_anti_body: { - 1: { - name: 'donkey anti-rabbit' - }, - 2: { - name: 'rabbit anti-goat' - }, - 3: { - name: 'goat anti-mouse' - } - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - }, - 'cyto': { - name: 'Cytoplasm' - }, - 'nuclear': { - name: 'Nuclear' - } - }, - facs_kinds: { - 'whole': { - name: 'Whole Cell' - }, - 'cyto': { - name: 'Cytoplasm' + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: [1, 2, 3, 9, 4, 5, 6, 7, 8], + 1: { + name: 'rabbit anti-let-23', + secondary: [1], + marks: [ + { + weight: 24, + intensity: .11 + }, + { + weight: 36, + intensity: .4 + }, + { + weight: 48, + intensity: .04 + } + ], + gel_name: 'anti-let-23' + }, + 2: { + name: 'mouse anti-let-60', + secondary: [3], + marks: [ + { + weight: 48, + intensity: .04 + } + ], + gel_name: 'anti-let-60' + }, + 3: { + name: 'goat anti-lin15A', + secondary: [2], + marks: [ + { + weight: 12, + intensity: .02 + } + ], + gel_name: 'anti-lin15A' + }, + 9: { + name: 'goat anti-lin15B', + secondary: [2], + marks: [ + { + weight: 100, + intensity: .01 + }, + { + weight: 129, + intensity: .11 + } + ], + gel_name: 'anti-lin15B' + }, + 4: { + name: 'goat anti-lin-1', + secondary: [2], + gel_name: 'anti-lin-1' + }, + 5: { + name: 'mouse anti-Dpy-5', + secondary: [3], + gel_name: 'anti-Dpy-5' + }, + 6: { + name: 'rabbit anti-Lon-2', + secondary: [1], + gel_name: 'anti-Lon-2' + }, + 7: { + name: 'mouse anti-Sma-4', + secondary: [3], + gel_name: 'anti-Sma-4' + }, + 8: { + name: 'goat anti-Unc-22', + secondary: [2], + gel_name: 'anti-Unc-22' + } + }, + secondary_anti_body: { + 1: { + name: 'donkey anti-rabbit' + }, + 2: { + name: 'rabbit anti-goat' + }, + 3: { + name: 'goat anti-mouse' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + }, + 'cyto': { + name: 'Cytoplasm' + }, + 'nuclear': { + name: 'Nuclear' + } + }, + facs_kinds: { + 'whole': { + name: 'Whole Cell' + }, + 'cyto': { + name: 'Cytoplasm' + }, + 'nuclear': { + name: 'Nuclear' + } + }, + model: { // model + western_blot: { // this applies to western blot + 'cyto': { // it acts on cytoplasm (thus on whole cell lysate as well) + 'parser_fixed': [ + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 1, // Vul 1 + 'cutoff': 10000, + 'above_marks': [ + { + name: 'let-23', + weight: 150, + intensity: -40, + primary_anti_body: [1] + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 2, // Vul 2 + 'cutoff': 200, + 'above_marks': [ + { + name: 'let-60', + weight: 21, + intensity: -100, + primary_anti_body: [2] + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 3, // Vul 3 + 'cutoff': 25000, + 'above_marks': [ + { + name: 'let-15A', + weight: 79, + intensity: -100, + primary_anti_body: [3] + }, + { + name: 'let-15B', + weight: 163, + intensity: -100, + primary_anti_body: [9] + + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 4, // Vul 3 + 'cutoff': 400, + 'above_marks': [ + { + name: 'let-1', + weight: 48, + intensity: -100, + primary_anti_body: [4] + } + ], + 'below_marks': [] }, - 'nuclear': { - name: 'Nuclear' - } - }, - model: {// model - western_blot: {// this applies to western blot - 'cyto': {// it acts on cytoplasm (thus on whole cell lysate as well) - 'parser_fixed': [ - { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 1, // Vul 1 - 'cutoff': 10000, - 'above_marks': [ - { - name: 'let-23', - weight: 150, - intensity: -40, - primary_anti_body: [1] - } - ], - 'below_marks': [] - }, - { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 2, // Vul 2 - 'cutoff': 200, - 'above_marks': [ - { - name: 'let-60', - weight: 21, - intensity: -100, - primary_anti_body: [2] - } - ], - 'below_marks': [] - }, - { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 3, // Vul 3 - 'cutoff': 25000, - 'above_marks': [ - { - name: 'let-15A', - weight: 79, - intensity: -100, - primary_anti_body: [3] - }, - { - name: 'let-15B', - weight: 163, - intensity: -100, - primary_anti_body: [9] - - } - ], - 'below_marks': [] - }, - { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 4, // Vul 3 - 'cutoff': 400, - 'above_marks': [ - { - name: 'let-1', - weight: 48, - intensity: -100, - primary_anti_body: [4] - } - ], - 'below_marks': [] - }, - { - 'cell_line': 'wt', - 'transfer_function': 'static', - 'marks': [ - { - name: 'let-23', - weight: 150, - intensity: 40, - primary_anti_body: [1] - }, - { - name: 'let-60', - weight: 21, - intensity: 100, - primary_anti_body: [2] - }, - { - name: 'let-15A', - weight: 79, - intensity: 100, - primary_anti_body: [3] - }, - { - name: 'let-15B', - weight: 163, - intensity: 100, - primary_anti_body: [9] - }, - { - name: 'let-1', - weight: 48, - intensity: 100, - primary_anti_body: [4] - }, - { - name: 'Dpy-5', - weight: 20, - intensity: 60, - primary_anti_body: [5] - }, - { - name: 'Lan-2', - weight: 100, - intensity: 40, - primary_anti_body: [6] - }, - { - name: 'Sma-4', - weight: 75, - intensity: 25, - primary_anti_body: [7] - }, - { - name: 'Unc-22', - weight: 40, - intensity: 10, - primary_anti_body: [8] - } - ] - } - ] + { + 'cell_line': 'wt', + 'transfer_function': 'static', + 'marks': [ + { + name: 'let-23', + weight: 150, + intensity: 40, + primary_anti_body: [1] + }, + { + name: 'let-60', + weight: 21, + intensity: 100, + primary_anti_body: [2] + }, + { + name: 'let-15A', + weight: 79, + intensity: 100, + primary_anti_body: [3] + }, + { + name: 'let-15B', + weight: 163, + intensity: 100, + primary_anti_body: [9] + }, + { + name: 'let-1', + weight: 48, + intensity: 100, + primary_anti_body: [4] + }, + { + name: 'Dpy-5', + weight: 20, + intensity: 60, + primary_anti_body: [5] + }, + { + name: 'Lan-2', + weight: 100, + intensity: 40, + primary_anti_body: [6] + }, + { + name: 'Sma-4', + weight: 75, + intensity: 25, + primary_anti_body: [7] + }, + { + name: 'Unc-22', + weight: 40, + intensity: 10, + primary_anti_body: [8] } + ] } + ] } + } } + } }; var __assignment2 = { - id: 'assignment_2', - course:'7.02', - course_name: 'MIT Course 7.02', - name: 'StarCellBio Prototype Assignment', - description: 'Biochemical approach to analyzing vulva development in C. elegans.', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal & Introduction','Your new lab is studying vulva development in C. elegans. You screen a chemical library and identify four new drugs, which all affect vulva development, and you name them Vulvarine 1, 2, 3 and 4.

Increasing amounts of Vulvarines 1 and 2 result in a vulvaless phenotype in the wild-type worms whereas treatment of wild-type worms with Vulvarines 3 and 4 results in a multivulva phenotype. Your advisor tells you that some proteins involved in the vulva development pathway are already known and she advises you to do western blots to test if some of these proteins are affected by these treatments.

i) Use the StarCellBio software to analyze the western blots from worms treated with increasing doses of Vulvarines. Choose the gene products whose expression you would like to check.
ii) Which proteins are affected by Vulvarine treatment? What is the critical Vulvarine concentration for each treatment?
iii) Look up the biological function of each protein whose expression is affected by the drug and speculate as to how the change in its levels may have a role in vulva development.
'] + id: 'assignment_2', + course: '7.02', + course_name: 'MIT Course 7.02', + name: 'StarCellBio Prototype Assignment', + description: 'Biochemical approach to analyzing vulva development in C. elegans.', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal & Introduction', 'Your new lab is studying vulva development in C. elegans. You screen a chemical library and identify four new drugs, which all affect vulva development, and you name them Vulvarine 1, 2, 3 and 4.

Increasing amounts of Vulvarines 1 and 2 result in a vulvaless phenotype in the wild-type worms whereas treatment of wild-type worms with Vulvarines 3 and 4 results in a multivulva phenotype. Your advisor tells you that some proteins involved in the vulva development pathway are already known and she advises you to do western blots to test if some of these proteins are affected by these treatments.

i) Use the StarCellBio software to analyze the western blots from worms treated with increasing doses of Vulvarines. Choose the gene products whose expression you would like to check.
ii) Which proteins are affected by Vulvarine treatment? What is the critical Vulvarine concentration for each treatment?
iii) Look up the biological function of each protein whose expression is affected by the drug and speculate as to how the change in its levels may have a role in vulva development.
'] - ], - add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs, Vulvarines 1-4, identified in your chemical screen. ', - ui_configuration: { - experiment_steps_setup: true, // this is not even checked... - experiment_steps_western_blot: true, - experiment_steps_facs: false, - experiment_steps_microscopy: false, - treatment_options_display_temperature: false, - treatment_options_edit_schedule: false, - lysate_display_ip: false, - amount_of_protein_loaded: 50, - experiment_setup_duration: 3600, // seconds - experiment_setup_resolution_height: 3600, - experiment_setup_physical_height: 600, - collection_times_fixed: true, - maximum_number_of_treatments_per_protocol: 1, - show_add_new_experiment_rows: true - }, - drug_template: { - name: 'Buffer only', - drug_id: 'nc', - concentration_id: 0 + ], + add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs, Vulvarines 1-4, identified in your chemical screen. ', + ui_configuration: { + experiment_steps_setup: true, // this is not even checked... + experiment_steps_western_blot: true, + experiment_steps_facs: false, + experiment_steps_microscopy: false, + treatment_options_display_temperature: false, + treatment_options_edit_schedule: false, + lysate_display_ip: false, + amount_of_protein_loaded: 50, + experiment_setup_duration: 3600, // seconds + experiment_setup_resolution_height: 3600, + experiment_setup_physical_height: 600, + collection_times_fixed: true, + maximum_number_of_treatments_per_protocol: 1, + show_add_new_experiment_rows: true + }, + drug_template: { + name: 'Buffer only', + drug_id: 'nc', + concentration_id: 0 + }, + experiment_templates: { + 'default': { + collection_schedule_list: { + list: [ + { + schedule: "3 d", + schedule_value: 3600 * 24 * 3, + id: '3 d' + } + ] }, - experiment_templates: { - 'default': { - collection_schedule_list: { - list: [ - { - schedule: "3 d", - schedule_value: 3600 * 24 * 3, - id: '3 d' - } - ] + treatment: { + schedule_value: 0, + schedule: 'immediately', + duration_value: 3600 * 24 * 3, + duration: '3 d' + } + }, + 'treatment_protocol_template': { + 'P1': { + title: 'Basic protocol', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: 0 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "3 d", + schedule_value: 3600 * 24 * 3, + id: '3 d' + } + ] + } + } + } + }, + name: '7.02 StarCellBio Prototype Assignment', + concentrations: { + 1: { + name: '1 ' + microEntity + 'M', + value: 1000 + }, + 5: { + name: '5 ' + microEntity + 'M', + value: 5000 + }, + 10: { + name: '10 ' + microEntity + 'M', + value: 10000 + }, + 20: { + name: '20 ' + microEntity + 'M', + value: 20000 + }, + 25: { + name: '25 ' + microEntity + 'M', + value: 25000 + }, + 40: { + name: '40 ' + microEntity + 'M', + value: 40000 + }, + 80: { + name: '80 ' + microEntity + 'M', + value: 80000 + }, + 125: { + name: '125 ' + microEntity + 'M', + value: 125000 + }, + '10n': { + name: '10 nM', + value: 10 + }, + 50: { + name: '50 nM', + value: 50 + }, + 100: { + name: '100 nM', + value: 100 + }, + 200: { + name: '200 nM', + value: 200 + }, + 400: { + name: '400 nM', + value: 400 + }, + 0: { + name: '0 nM', + value: 0 + } + }, + drugs: { + 'nc': { + name: 'Buffer only', + concentrations: [0] + }, + 1: { + name: 'Vulvarine 1', + concentrations: [5, 10, 20, 40, 80] + }, + 2: { + name: 'Vulvarine 2', + concentrations: [50, 100, 200, 400] + }, + 3: { + name: 'Vulvarine 3', + concentrations: [1, 5, 25, 125] + }, + 4: { + name: 'Vulvarine 4', + concentrations: ['10n', 50, 100, 200, 400] + } + }, + experiment_temperatures: { + '25': { + name: "25" + degreeEntity + "C" + } + }, + cell_lines: { + 'wt': { + name: 'Wild Type' + } + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: [1, 2, 3, 9, 4, 5, 6, 7, 8], + 1: { + name: 'rabbit anti-let-23', + secondary: [1], + marks: [ + { + weight: 24, + intensity: .11 + }, + { + weight: 36, + intensity: .4 + }, + { + weight: 48, + intensity: .04 + } + ] + }, + 2: { + name: 'mouse anti-let-60', + secondary: [3], + marks: [ + { + weight: 48, + intensity: .04 + } + ] + }, + 3: { + name: 'goat anti-lin15A', + secondary: [2], + marks: [ + { + weight: 12, + intensity: .02 + } + ] + }, + 9: { + name: 'goat anti-lin15B', + secondary: [2], + marks: [ + { + weight: 100, + intensity: .01 + }, + { + weight: 129, + intensity: .11 + } + ] + }, + 4: { + name: 'goat anti-lin-1', + secondary: [2] + }, + 5: { + name: 'mouse anti-Dpy-5', + secondary: [3] + }, + 6: { + name: 'rabbit anti-Lon-2', + secondary: [1] + }, + 7: { + name: 'mouse anti-Sma-4', + secondary: [3] + }, + 8: { + name: 'goat anti-Unc-22', + secondary: [2] + } + }, + secondary_anti_body: { + 1: { + name: 'donkey anti-rabbit' + }, + 2: { + name: 'rabbit anti-goat' + }, + 3: { + name: 'goat anti-mouse' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + }, + 'cyto': { + name: 'Cytoplasm' + }, + 'nuclear': { + name: 'Nuclear' + } + }, + model: { // model + western_blot: { // this applies to western blot + 'cyto': { // it acts on cytoplasm (thus on whole cell lysate as well) + 'parser_fixed': [ + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 1, // Vul 1 + 'cutoff': 10000, + 'above_marks': [ + { + name: 'let-23', + weight: 150, + intensity: -40, + primary_anti_body: [1] + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 2, // Vul 2 + 'cutoff': 200, + 'above_marks': [ + { + name: 'let-60', + weight: 21, + intensity: -100, + primary_anti_body: [2] + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 3, // Vul 3 + 'cutoff': 25000, + 'above_marks': [ + { + name: 'let-15A', + weight: 79, + intensity: -100, + primary_anti_body: [3] }, - treatment: { - schedule_value: 0, - schedule: 'immediately', - duration_value: 3600 * 24 * 3, - duration: '3 d' + { + name: 'let-15B', + weight: 163, + intensity: -100, + primary_anti_body: [9] + } - }, - 'treatment_protocol_template': { - 'P1': { - title: 'Basic protocol', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', duration_value: 3600 * 24 * 3, duration: '3 d', drug_list: {list: [ - {drug_id: 'nc', concentration_id: 0} - ]}} - ]}, - collection_schedule_list: { - list: [ - { - schedule: "3 d", - schedule_value: 3600 * 24 * 3, - id: '3 d' - } - ] - } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 4, // Vul 3 + 'cutoff': 400, + 'above_marks': [ + { + name: 'let-1', + weight: 48, + intensity: -100, + primary_anti_body: [4] } - } - }, - name: '7.02 StarCellBio Prototype Assignment', - concentrations: { - 1: { - name: '1 ' + microEntity + 'M', - value: 1000 - }, - 5: { - name: '5 ' + microEntity + 'M', - value: 5000 - }, - 10: { - name: '10 ' + microEntity + 'M', - value: 10000 - }, - 20: { - name: '20 ' + microEntity + 'M', - value: 20000 - }, - 25: { - name: '25 ' + microEntity + 'M', - value: 25000 - }, - 40: { - name: '40 ' + microEntity + 'M', - value: 40000 - }, - 80: { - name: '80 ' + microEntity + 'M', - value: 80000 - }, - 125: { - name: '125 ' + microEntity + 'M', - value: 125000 - }, - '10n': { - name: '10 nM', - value: 10 - }, - 50: { - name: '50 nM', - value: 50 + ], + 'below_marks': [] }, - 100: { - name: '100 nM', - value: 100 - }, - 200: { - name: '200 nM', - value: 200 - }, - 400: { - name: '400 nM', - value: 400 - }, - 0: { - name: '0 nM', - value: 0 - } - }, - drugs: { - 'nc': { - name: 'Buffer only', - concentrations: [0] - }, - 1: { - name: 'Vulvarine 1', - concentrations: [5, 10, 20, 40, 80] - }, - 2: { - name: 'Vulvarine 2', - concentrations: [50, 100, 200, 400] - }, - 3: { - name: 'Vulvarine 3', - concentrations: [1, 5, 25, 125] - }, - 4: { - name: 'Vulvarine 4', - concentrations: ['10n', 50, 100, 200, 400] - } - }, - experiment_temperatures: { - '25': { - name: "25" + degreeEntity + "C" - } - }, - cell_lines: { - 'wt': { - name: 'Wild Type' + { + 'cell_line': 'wt', + 'transfer_function': 'static', + 'marks': [ + { + name: 'let-23', + weight: 150, + intensity: 40, + primary_anti_body: [1] + }, + { + name: 'let-60', + weight: 21, + intensity: 100, + primary_anti_body: [2] + }, + { + name: 'let-15A', + weight: 79, + intensity: 100, + primary_anti_body: [3] + }, + { + name: 'let-15B', + weight: 163, + intensity: 100, + primary_anti_body: [9] + }, + { + name: 'let-1', + weight: 48, + intensity: 100, + primary_anti_body: [4] + }, + { + name: 'Dpy-5', + weight: 20, + intensity: 60, + primary_anti_body: [5] + }, + { + name: 'Lan-2', + weight: 100, + intensity: 40, + primary_anti_body: [6] + }, + { + name: 'Sma-4', + weight: 75, + intensity: 25, + primary_anti_body: [7] + }, + { + name: 'Unc-22', + weight: 40, + intensity: 10, + primary_anti_body: [8] + } + ] } + ] + } + } + } + } +}; - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order:[1,2,3,9,4,5,6,7,8], - 1: { - name: 'rabbit anti-let-23', - secondary: [1], - marks: [ - {weight: 24, intensity: .11}, - {weight: 36, intensity: .4}, - {weight: 48, intensity: .04} - ] - }, - 2: { - name: 'mouse anti-let-60', - secondary: [3], - marks: [ - {weight: 48, intensity: .04} - ] - }, - 3: { - name: 'goat anti-lin15A', - secondary: [2], - marks: [ - {weight: 12, intensity: .02} - ] - }, - 9: { - name: 'goat anti-lin15B', - secondary: [2], - marks: [ - {weight: 100, intensity: .01}, - {weight: 129, intensity: .11} +var __assigment_tufts = { + id: 'assignment_tufts', + name: 'Bio52 Assignment', + course: 'Bio52', + course_name: 'Tufts Bio52', + description: 'Bio52 Homework Assignment.', + notebook: {}, + experiments: { + }, + template: { + instructions: [ + ['Goal & Introduction', "Here come instructions"] + ], + ui: { + experimental_design: { + techniques: ['wb'] + }, + experiment_setup: { + table: [ // + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, // + { + kind: 'treatments', + children: [ // + { + kind: 'drug', + title: 'Treatment', + editable: false + }, // + { + kind: 'concentration', + title: 'Concentration', + editable: false + }, // + { + kind: 'duration', + title: 'Time', + editable: false + }, // + + ] + }, // + { + kind: 'actions', + title: 'Actions' + } // + ], // + actions: [] // + + }, + + western_blot: {}, + add_multiple_dialog: { + 'wt': { + title: 'Strain: Wild Type', + headings: [ + 'Select', 'Treatment Protocol' + ], + rows: [ + { + cells: [ + { + kind: 'checkbox', + name: 'SEL' + }, + { + kind: 'text', + text: '0.1% FBS' + } + ], + treatment_id: 'P1', + cell_treatments: { + 'SEL': [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: '0 min', + duration_value: -1, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h", + schedule_value: 3600 * 18, + id: '3' + } + ] + }, + stimulation_time: '0 minutes', + name: '0.1% FBS' + } ] + } }, - 4: { - name: 'goat anti-lin-1', - secondary: [2] - }, - 5: { - name: 'mouse anti-Dpy-5', - secondary: [3] - }, - 6: { - name: 'rabbit anti-Lon-2', - secondary: [1] - }, - 7: { - name: 'mouse anti-Sma-4', - secondary: [3] - }, - 8: { - name: 'goat anti-Unc-22', - secondary: [2] - } - }, - secondary_anti_body: { - 1: { - name: 'donkey anti-rabbit' - }, - 2: { - name: 'rabbit anti-goat' - }, - 3: { - name: 'goat anti-mouse' - } - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - }, - 'cyto': { - name: 'Cytoplasm' - }, - 'nuclear': { - name: 'Nuclear' - } - }, - model: {// model - western_blot: {// this applies to western blot - 'cyto': {// it acts on cytoplasm (thus on whole cell lysate as well) - 'parser_fixed': [ + { + cells: [ + { + kind: 'checkbox', + name: 'SEL' + }, + { + kind: 'text', + text: '0.1% FBS & EGF' + } + ], + treatment_id: 'P2', + cell_treatments: { + 'SEL': [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 1, // Vul 1 - 'cutoff': 10000, - 'above_marks': [ - { - name: 'let-23', - weight: 150, - intensity: -40, - primary_anti_body: [1] - } - ], - 'below_marks': [] + schedule_value: 0, + schedule: '0 min', + duration_value: -1, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } }, { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 2, // Vul 2 - 'cutoff': 200, - 'above_marks': [ - { - name: 'let-60', - weight: 21, - intensity: -100, - primary_anti_body: [2] - } - ], - 'below_marks': [] - }, + schedule_value: 3600 * 18, + schedule: '18h', + duration_value: 600, + duration: '10 min', + drug_list: { + list: [ + { + drug_id: 2, + concentration_id: 1 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "3h 10 min", + schedule_value: 3600 * 18 + 600, + id: '31' + } + ] + }, + stimulation_time: '10 minutes', + name: '0.1% FBS & EGF' + } + ] + } + }, + { + cells: [ + { + kind: 'checkbox', + name: 'SEL' + }, + { + kind: 'text', + text: '0.1% FBS & Erlotinib & EGF' + } + ], + treatment_id: 'P3', + cell_treatments: { + 'SEL': [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 3, // Vul 3 - 'cutoff': 25000, - 'above_marks': [ - { - name: 'let-15A', - weight: 79, - intensity: -100, - primary_anti_body: [3] - }, - { - name: 'let-15B', - weight: 163, - intensity: -100, - primary_anti_body: [9] - - } - ], - 'below_marks': [] + schedule_value: 0, + schedule: '0 min', + duration_value: -1, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } }, { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 4, // Vul 3 - 'cutoff': 400, - 'above_marks': [ - { - name: 'let-1', - weight: 48, - intensity: -100, - primary_anti_body: [4] - } - ], - 'below_marks': [] + schedule_value: 3600 * 18, + schedule: '18h', + duration_value: -1, + duration: '15 min', + drug_list: { + list: [ + { + drug_id: 3, + concentration_id: 20 + } + ] + } }, { - 'cell_line': 'wt', - 'transfer_function': 'static', - 'marks': [ - { - name: 'let-23', - weight: 150, - intensity: 40, - primary_anti_body: [1] - }, - { - name: 'let-60', - weight: 21, - intensity: 100, - primary_anti_body: [2] - }, - { - name: 'let-15A', - weight: 79, - intensity: 100, - primary_anti_body: [3] - }, - { - name: 'let-15B', - weight: 163, - intensity: 100, - primary_anti_body: [9] - }, - { - name: 'let-1', - weight: 48, - intensity: 100, - primary_anti_body: [4] - }, - { - name: 'Dpy-5', - weight: 20, - intensity: 60, - primary_anti_body: [5] - }, - { - name: 'Lan-2', - weight: 100, - intensity: 40, - primary_anti_body: [6] - }, - { - name: 'Sma-4', - weight: 75, - intensity: 25, - primary_anti_body: [7] - }, - { - name: 'Unc-22', - weight: 40, - intensity: 10, - primary_anti_body: [8] - } + schedule_value: 3600 * 18 + 15 * 60, + schedule: '18h 15min', + duration_value: 600, + duration: '10 min', + drug_list: { + list: [ + { + drug_id: 2, + concentration_id: 1 + } ] + } } - ] - } - } - } - } -}; - -var __assigment_tufts = { - id: 'assignment_tufts', - name: 'Bio52 Assignment', - course:'Bio52', - course_name: 'Tufts Bio52', - description: 'Bio52 Homework Assignment.', - notebook: {}, - experiments: { - }, - template: { - instructions: [ - ['Goal & Introduction',"Here come instructions"] - ], - ui: { - experimental_design: { - techniques: [ 'wb' ] - }, - experiment_setup: { - table: [ // - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, // - {kind: 'treatments', - children: [// - {kind: 'drug', title: 'Treatment', editable: false},// - {kind: 'concentration', title: 'Concentration', editable: false},// - {kind: 'duration', title: 'Time', editable: false},// - - ] - },// - {kind: 'actions', title: 'Actions'}// - ],// - actions: []// - + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h 25 min", + schedule_value: 3600 * 18 + 25 * 60, + id: '325' + } + ] + }, + stimulation_time: '10 minutes', + name: '0.1% FBS & Erlotinib & EGF' + } + ] + } }, - - western_blot: {}, - add_multiple_dialog: { - 'wt': { - title: 'Strain: Wild Type', - headings: [ - 'Select', 'Treatment Protocol' - ], - rows: [ + { + cells: [ + { + kind: 'checkbox', + name: 'SEL' + }, + { + kind: 'text', + text: '0.1% FBS & U0126 & EGF' + } + ], + treatment_id: 'P4', + cell_treatments: { + 'SEL': [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - cells: [ - {kind: 'checkbox', name: 'SEL'}, - {kind: 'text', text: '0.1% FBS'} - ], - treatment_id: 'P1', - cell_treatments: { - 'SEL': [ - {cell_line: 'wt', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: -1, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "18h", schedule_value: 3600 * 18, id: '3'} - ]}, - stimulation_time: '0 minutes', - name: '0.1% FBS' - } - ] - } + schedule_value: 0, + schedule: '0 min', + duration_value: -1, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } }, { - cells: [ - {kind: 'checkbox', name: 'SEL'}, - {kind: 'text', text: '0.1% FBS & EGF'} - ], - treatment_id: 'P2', - cell_treatments: { - 'SEL': [ - {cell_line: 'wt', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: -1, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}}, - {schedule_value: 3600 * 18, schedule: '18h', duration_value: 600, duration: '10 min', drug_list: {list: [ - {drug_id: 2, concentration_id: 1} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "3h 10 min", schedule_value: 3600 * 18 + 600, id: '31'} - ]}, - stimulation_time: '10 minutes', - name: '0.1% FBS & EGF' - } - ] - } + schedule_value: 3600 * 18, + schedule: '18h', + duration_value: -1, + duration: '15 min', + drug_list: { + list: [ + { + drug_id: 4, + concentration_id: 10 + } + ] + } }, { - cells: [ - {kind: 'checkbox', name: 'SEL'}, - {kind: 'text', text: '0.1% FBS & Erlotinib & EGF'} - ], - treatment_id: 'P3', - cell_treatments: { - 'SEL': [ - {cell_line: 'wt', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: -1, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}}, - {schedule_value: 3600 * 18, schedule: '18h', duration_value: -1, duration: '15 min', drug_list: {list: [ - {drug_id: 3, concentration_id: 20} - ]}}, - {schedule_value: 3600 * 18 + 15 * 60, schedule: '18h 15min', duration_value: 600, duration: '10 min', drug_list: {list: [ - {drug_id: 2, concentration_id: 1} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "18h 25 min", schedule_value: 3600 * 18 + 25 * 60, id: '325'} - ]}, - stimulation_time: '10 minutes', - name: '0.1% FBS & Erlotinib & EGF' - } - ]} + schedule_value: 3600 * 18 + 15 * 60, + schedule: '18h 15min', + duration_value: 600, + duration: '10 min', + drug_list: { + list: [ + { + drug_id: 2, + concentration_id: 1 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h 25 min", + schedule_value: 3600 * 18 + 25 * 60, + id: '325' + } + ] + }, + stimulation_time: '10 minutes', + name: '0.1% FBS & U0126 & EGF' + } + ] + } + }, + { + cells: [ + { + kind: 'checkbox', + name: 'SEL' + }, + { + kind: 'text', + text: '0.1% FBS & Erlotinib & U0126 & EGF' + } + ], + treatment_id: 'P5', + cell_treatments: { + 'SEL': [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: '0 min', + duration_value: -1, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } }, { - cells: [ - {kind: 'checkbox', name: 'SEL'}, - {kind: 'text', text: '0.1% FBS & U0126 & EGF'} - ], - treatment_id: 'P4', - cell_treatments: { - 'SEL': [ - {cell_line: 'wt', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: -1, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}}, - {schedule_value: 3600 * 18, schedule: '18h', duration_value: -1, duration: '15 min', drug_list: {list: [ - {drug_id: 4, concentration_id: 10} - ]}}, - {schedule_value: 3600 * 18 + 15 * 60, schedule: '18h 15min', duration_value: 600, duration: '10 min', drug_list: {list: [ - {drug_id: 2, concentration_id: 1} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "18h 25 min", schedule_value: 3600 * 18 + 25 * 60, id: '325'} - ]}, - stimulation_time: '10 minutes', - name: '0.1% FBS & U0126 & EGF' - } - ]} + schedule_value: 3600 * 18, + schedule: '18h', + duration_value: -1, + duration: '15 min', + drug_list: { + list: [ + { + drug_id: 3, + concentration_id: 20 + }, + { + drug_id: 4, + concentration_id: 10 + } + ] + } }, { - cells: [ - {kind: 'checkbox', name: 'SEL'}, - {kind: 'text', text: '0.1% FBS & Erlotinib & U0126 & EGF'} - ], - treatment_id: 'P5', - cell_treatments: { - 'SEL': [ - {cell_line: 'wt', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: -1, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}}, - {schedule_value: 3600 * 18, schedule: '18h', duration_value: -1, duration: '15 min', drug_list: {list: [ - {drug_id: 3, concentration_id: 20}, - {drug_id: 4, concentration_id: 10} - ]}}, - {schedule_value: 3600 * 18 + 15 * 60, schedule: '18h 15min', duration_value: 600, duration: '10 min', drug_list: {list: [ - {drug_id: 2, concentration_id: 1} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "18h 25 min", schedule_value: 3600 * 18 + 25 * 60, id: '325'} - ]}, - stimulation_time: '10 minutes', - name: '0.1% FBS & Erlotinib & U0126 & EGF' - } - ]} + schedule_value: 3600 * 18 + 15 * 60, + schedule: '18h 15min', + duration_value: 600, + duration: '10 min', + drug_list: { + list: [ + { + drug_id: 2, + concentration_id: 1 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h 25 min", + schedule_value: 3600 * 18 + 25 * 60, + id: '325' } + ] + }, + stimulation_time: '10 minutes', + name: '0.1% FBS & Erlotinib & U0126 & EGF' + } + ] + } + } - ] + ] - } + } + } + }, + drug_template: { + name: 'Serum Starvation', + drug_id: 1, + concentration_id: 0 + }, + + experiment_templates: { + 'default': { + collection_schedule_list: { + list: [ + { + schedule: "10 min", + schedule_value: 600, + id: '10' } + ] + } + }, + 'treatment_protocol_template': { + 'P1': { + title: 'Serum starvation alone', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: '0 min', + duration_value: 3600 * 18, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h", + schedule_value: 3600 * 18, + id: '3' + } + ] + }, + stimulation_time: '0 minutes' }, - drug_template: { - name: 'Serum Starvation', - drug_id: 1, - concentration_id: 0 + 'P2': { + title: 'Serum starvation + agonist treatment', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: '0 min', + duration_value: 3600 * 18, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } + }, + { + schedule_value: 3600 * 18, + schedule: '18h', + duration_value: 600, + duration: '10 min', + drug_list: { + list: [ + { + drug_id: 2, + concentration_id: 1 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "3h 10 min", + schedule_value: 3600 * 18 + 600, + id: '31' + } + ] + }, + stimulation_time: '10 minutes' }, - - experiment_templates: { - 'default': { - collection_schedule_list: {list: [ - {schedule: "10 min", schedule_value: 600, id: '10'} - ]} - }, - 'treatment_protocol_template': { - 'P1': { - title: 'Serum starvation alone', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: 3600 * 18, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "18h", schedule_value: 3600 * 18, id: '3'} - ]}, - stimulation_time: '0 minutes' - }, - 'P2': { - title: 'Serum starvation + agonist treatment', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: 3600 * 18, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}}, - {schedule_value: 3600 * 18, schedule: '18h', duration_value: 600, duration: '10 min', drug_list: {list: [ - {drug_id: 2, concentration_id: 1} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "3h 10 min", schedule_value: 3600 * 18 + 600, id: '31'} - ]}, - stimulation_time: '10 minutes' - }, - 'P3': { - title: 'Serum starvation + EGFR inhibitor + agonist', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: 3600 * 18, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}}, - {schedule_value: 3600 * 18, schedule: '18h', duration_value: 900, duration: '15 min', drug_list: {list: [ - {drug_id: 3, concentration_id: 20} - ]}}, - {schedule_value: 3600 * 18 + 15 * 60, schedule: '18h 15min', duration_value: 600, duration: '10 min', drug_list: {list: [ - {drug_id: 2, concentration_id: 1} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "18h 25 min", schedule_value: 3600 * 18 + 25 * 60, id: '325'} - ]}, - stimulation_time: '10 minutes' - }, - 'P4': { - title: 'Serum starvation + MEK inhibitor + agonist', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: 3600 * 18, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}}, - {schedule_value: 3600 * 18, schedule: '18h', duration_value: 900, duration: '15 min', drug_list: {list: [ - {drug_id: 4, concentration_id: 10} - ]}}, - {schedule_value: 3600 * 18 + 15 * 60, schedule: '18h 15min', duration_value: 600, duration: '10 min', drug_list: {list: [ - {drug_id: 2, concentration_id: 1} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "18h 25 min", schedule_value: 3600 * 18 + 25 * 60, id: '325'} - ]}, - stimulation_time: '10 minutes' - }, - 'P5': { - title: 'Serum starvation + EGFR inhibitor & MEK inhibitor + agonist', - treatment_list: {list: [ - {schedule_value: 0, schedule: '0 min', duration_value: 3600 * 18, duration: '18h', drug_list: {list: [ - {drug_id: 1, concentration_id: 0} - ]}}, - {schedule_value: 3600 * 18, schedule: '18h', duration_value: 900, duration: '15 min', drug_list: {list: [ - {drug_id: 3, concentration_id: 20}, - {drug_id: 4, concentration_id: 10} - ]}}, - {schedule_value: 3600 * 18 + 15 * 60, schedule: '18h 15min', duration_value: 600, duration: '10 min', drug_list: {list: [ - {drug_id: 2, concentration_id: 1} - ]}} - ]}, - collection_schedule_list: {list: [ - {schedule: "18h 25 min", schedule_value: 3600 * 18 + 25 * 60, id: '325'} - ]}, - stimulation_time: '10 minutes' + 'P3': { + title: 'Serum starvation + EGFR inhibitor + agonist', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: '0 min', + duration_value: 3600 * 18, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] } - } + }, + { + schedule_value: 3600 * 18, + schedule: '18h', + duration_value: 900, + duration: '15 min', + drug_list: { + list: [ + { + drug_id: 3, + concentration_id: 20 + } + ] + } + }, + { + schedule_value: 3600 * 18 + 15 * 60, + schedule: '18h 15min', + duration_value: 600, + duration: '10 min', + drug_list: { + list: [ + { + drug_id: 2, + concentration_id: 1 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h 25 min", + schedule_value: 3600 * 18 + 25 * 60, + id: '325' + } + ] + }, + stimulation_time: '10 minutes' }, - name: 'TUFTS CellBio Prototype Assignment', - concentrations: { - 0: { - name: '0.1%', - value: 0 - }, - 1: { - name: '100ng/mL', - value: 100 - }, - 20: { - name: '20'+microEntity+'M', - value: 20 - }, - 10: { - name: '10'+microEntity+'M', - value: 10 - } - + 'P4': { + title: 'Serum starvation + MEK inhibitor + agonist', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: '0 min', + duration_value: 3600 * 18, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } + }, + { + schedule_value: 3600 * 18, + schedule: '18h', + duration_value: 900, + duration: '15 min', + drug_list: { + list: [ + { + drug_id: 4, + concentration_id: 10 + } + ] + } + }, + { + schedule_value: 3600 * 18 + 15 * 60, + schedule: '18h 15min', + duration_value: 600, + duration: '10 min', + drug_list: { + list: [ + { + drug_id: 2, + concentration_id: 1 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h 25 min", + schedule_value: 3600 * 18 + 25 * 60, + id: '325' + } + ] + }, + stimulation_time: '10 minutes' }, + 'P5': { + title: 'Serum starvation + EGFR inhibitor & MEK inhibitor + agonist', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: '0 min', + duration_value: 3600 * 18, + duration: '18h', + drug_list: { + list: [ + { + drug_id: 1, + concentration_id: 0 + } + ] + } + }, + { + schedule_value: 3600 * 18, + schedule: '18h', + duration_value: 900, + duration: '15 min', + drug_list: { + list: [ + { + drug_id: 3, + concentration_id: 20 + }, + { + drug_id: 4, + concentration_id: 10 + } + ] + } + }, + { + schedule_value: 3600 * 18 + 15 * 60, + schedule: '18h 15min', + duration_value: 600, + duration: '10 min', + drug_list: { + list: [ + { + drug_id: 2, + concentration_id: 1 + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h 25 min", + schedule_value: 3600 * 18 + 25 * 60, + id: '325' + } + ] + }, + stimulation_time: '10 minutes' + } + } + }, + name: 'TUFTS CellBio Prototype Assignment', + concentrations: { + 0: { + name: '0.1%', + value: 0 + }, + 1: { + name: '100ng/mL', + value: 100 + }, + 20: { + name: '20' + microEntity + 'M', + value: 20 + }, + 10: { + name: '10' + microEntity + 'M', + value: 10 + } - drugs: { + }, - 1: {name: 'FBS', - concentrations: [0] - }, - 2: { - name: 'EGF', - concentrations: [1] - }, - 3: { - name: 'Erlotinib', - concentrations: [20] - }, - 4: { - name: 'U0126', - concentrations: [10] - } - }, - experiment_temperatures: { - '25': { name: "25" + degreeEntity + "C" } - }, - cell_lines: { - 'wt': { - name: 'Wild Type' - } - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: [1,2,3,4,5], - 1: { - name: 'rabbit anti P-ERK1/2', - secondary: [1], - marks: [ - {weight: 44, intensity: .1}, - {weight: 42, intensity: .1} - ], - gel_name: 'P-ERK1/2' - }, - 2: { - name: 'rabbit anti ERK1/2', - secondary: [1], - marks: [ - {weight: 44, intensity: 1}, - {weight: 42, intensity: 1} - ], - gel_name: 'ERK1/2' - }, - 3: { - name: 'rabbit anti P-EGFR', - secondary: [1], - marks: [ - {weight: 175, intensity: 0} - ], - gel_name: 'P-EGFR' - }, - 4: { - name: 'rabbit anti EGFR', - secondary: [1], - marks: [ - {weight: 134, intensity: 1} - ], - gel_name: 'EGFR' - }, - 5: { - name: 'rabbit anti tubulin', - secondary: [1], - marks: [ - {weight: 50, intensity: 20} - ], - gel_name: 'tubulin' - } - }, - secondary_anti_body: { - 1: { - name: 'goat anti rabbit HRP' - }, - 2: { - name: 'goat anti mouse HRP' - } - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' + drugs: { + + 1: { + name: 'FBS', + concentrations: [0] + }, + 2: { + name: 'EGF', + concentrations: [1] + }, + 3: { + name: 'Erlotinib', + concentrations: [20] + }, + 4: { + name: 'U0126', + concentrations: [10] + } + }, + experiment_temperatures: { + '25': { + name: "25" + degreeEntity + "C" + } + }, + cell_lines: { + 'wt': { + name: 'Wild Type' + } + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: [1, 2, 3, 4, 5], + 1: { + name: 'rabbit anti P-ERK1/2', + secondary: [1], + marks: [ + { + weight: 44, + intensity: .1 + }, + { + weight: 42, + intensity: .1 + } + ], + gel_name: 'P-ERK1/2' + }, + 2: { + name: 'rabbit anti ERK1/2', + secondary: [1], + marks: [ + { + weight: 44, + intensity: 1 + }, + { + weight: 42, + intensity: 1 + } + ], + gel_name: 'ERK1/2' + }, + 3: { + name: 'rabbit anti P-EGFR', + secondary: [1], + marks: [ + { + weight: 175, + intensity: 0 + } + ], + gel_name: 'P-EGFR' + }, + 4: { + name: 'rabbit anti EGFR', + secondary: [1], + marks: [ + { + weight: 134, + intensity: 1 + } + ], + gel_name: 'EGFR' + }, + 5: { + name: 'rabbit anti tubulin', + secondary: [1], + marks: [ + { + weight: 50, + intensity: 20 + } + ], + gel_name: 'tubulin' + } + }, + secondary_anti_body: { + 1: { + name: 'goat anti rabbit HRP' + }, + 2: { + name: 'goat anti mouse HRP' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + model: { // model + western_blot: { // this applies to western blot + 'cyto': { // it acts on cytoplasm (thus on whole cell lysate as well) + 'parser_fixed': [ + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 2, // FBS + 'cutoff': 50, + 'above_marks': [ + { + name: 'P-ERK', + weight: 44, + intensity: .1, + primary_anti_body: [1] + }, + { + name: 'P-ERK', + weight: 42, + intensity: .1, + primary_anti_body: [1] + }, + { + name: 'P-EGFR', + weight: 175, + intensity: .2, + primary_anti_body: [3] + } + ], + 'below_marks': [ + { + name: 'P-ERK', + weight: 44, + intensity: -.1, + primary_anti_body: [1] + }, + { + name: 'P-ERK', + weight: 42, + intensity: -.1, + primary_anti_body: [1] + } + ] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 3, // Erlotinib + 'cutoff': 10, + 'above_marks': [ + { + name: 'P-ERK', + weight: 44, + intensity: -.1, + primary_anti_body: [1] + }, + { + name: 'P-ERK', + weight: 42, + intensity: -.1, + primary_anti_body: [1] + }, + { + name: 'P-EGFR', + weight: 175, + intensity: -.2, + primary_anti_body: [3] + } + ] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 4, // U0126 + 'cutoff': 10, + 'above_marks': [ + { + name: 'P-ERK', + weight: 44, + intensity: -.1, + primary_anti_body: [1] + }, + { + name: 'P-ERK', + weight: 42, + intensity: -.1, + primary_anti_body: [1] + }, + { + name: 'P-EGFR', + weight: 175, + intensity: 0, + primary_anti_body: [3] + } + ], + 'below_marks': [] } + ] + } + } + } + } +}; + +var __decusability_newfacs = { + id: 'decusability2', + name: 'StarCellBio Usability Test2', + course: 'usability', + course_name: 'December 2013 Usability Testing', + description: 'FACS and Western Blot for temperature sensitive mutants', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal & Introduction', 'Here come instructions when we build them'] + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs'] + }, + experiment_setup: { + table: [ // + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, // + { + kind: 'treatments', + children: [ // + { + kind: 'drug', + title: 'Treatment', + editable: false + }, // + ] + }, // + { + kind: 'temperature', + title: 'Temperature', + editable: false + }, // + { + kind: 'actions', + title: 'Actions' + } // + ], // + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%, %PP1% %TEMPERATURE%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + '%CONCENTRATION%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], + map: ['concentrations', '%KEY%', 'name'] + }, + '%TEMPERATURE%': { + attr: ['treatment_list', 'list', '0', 'temperature'], + map: ['experiment_temperatures', '%KEY%', 'name'] + }, + '%PP1%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '1', 'drug_id'], + map: ['drugs', '%KEY%', 'short_name'], + default: '' + } + } + }, + add_multiple_dialog: { + 'wt': { + title: 'Strain: Wild Type', + headings: ['Treatment', 'Temperature', ''], + rows: [ + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,25', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '25' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,40', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '40' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '40' + } + ] + } + } + ] + } + } + + ] + }, + 'm1': { + title: 'Strain: Mutant 1', + + headings: ['Treatment', 'Temperature', ''], + rows: [ + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,25', + cell_treatments: { + PP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '25' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,40', + cell_treatments: { + PP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '40' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '40' + } + ] + } + } + ] + } + } + ] + + }, + 'm2': { + title: 'Strain: Mutant 2', + + headings: ['Treatment', 'Temperature', ''], + rows: [ + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,25', + cell_treatments: { + PP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '25' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + } + ], + treatment_id: 'media_only,40', + cell_treatments: { + PP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '40' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ + { + facs: { + 'whole': 1, + 'a': 1 + }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '40' + } + ] + } + } + ] + } + } + ] + + } + } + }, + add_new_row_instructions: 'add new row instructions', + + concentrations: { + '0': { + name: '', + value: 0 + }, + '2': { + name: '2 ' + microEntity + 'g/mL', + value: 5 + }, + '15': { + name: '15 ' + microEntity + 'g/mL', + value: 5 + }, + '200': { + name: '200 mM', + value: 5 + }, + '1u': { + name: '1 unit', + value: 1000 + } + }, + drugs: { + 'nc': { + name: 'Growth Media', + concentrations: [0] + }, + 'Nocodazole': { + name: 'Nocodazole', + concentrations: [15] + }, + 'Alpha': { + name: 'Alpha Factor', + concentrations: [2] + }, + 'Hydroxyurea': { + name: 'Hydroxyurea', + concentrations: [200] + }, + 'pp1': { + name: 'Protein Phosphatase 1', + concentrations: ['1u'], + short_name: 'PP1' + } + + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + }, + '40': { + name: "37" + degreeEntity + "C" + } + }, + + cell_lines: { + 'wt': { + name: 'Wild Type' + }, + 'm1': { + name: 'Mutant 1' + }, + 'm2': { + name: 'Mutant 2' + } + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['cdk2', 'cyclin', 'cyclinE', 'pgk1'], + 'cdk2': { + name: 'rabbit anti-cdk2', + secondary: ['r'], + marks: [ + { + weight: 33, + intensity: 0 + }, + { + weight: 34, + intensity: 0 + }, + { + weight: 35, + intensity: 0 + } + ], + gel_name: 'cdk2' + }, + 'cyclin': { + name: 'mouse anti-cyclin B', + secondary: ['m'], + marks: [ + { + weight: 58, + intensity: 0 + }, + ], + gel_name: 'cyclin B' + }, + 'cyclinE': { + name: 'mouse anti-cyclin E', + secondary: ['m'], + marks: [ + { + weight: 48, + intensity: 0 + }, + ], + gel_name: 'cyclin E' + }, + 'pgk1': { + name: 'rabbit anti-pgk1', + secondary: ['r'], + marks: [ + { + weight: 45, + intensity: 0 + }, + ], + gel_name: 'pgk1' + } + }, // + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, // + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'Dye': { + name: 'Dye/Stain', + conditions: { + 'whole': { + name: 'PI', + short_name: 'PI' + } + } + }, + 'Anti': { + name: 'Antibody-labeling ', + conditions: { + 'a': { + name: 'Antibody', + short_name: 'Antibody' + } + } + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '*ANY*', + marks: [ + { + name: 'Cyclin B', + weight: 58, + intensity: 2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 4, + primary_anti_body: ['cyclinE'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } + + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'pp1', + cell_line: '*ANY*', + above_marks: [ + { + name: 'Cdk2', + weight: 33, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + } + ], + below_marks: [ + { + name: 'Cdk2', + weight: 34, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + } + ] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'wt', + marks: [] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm1', + temperature: '40', + marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + } + ] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm2', + temperature: '40', + marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Nocodazole', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Hydroxyurea', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Alpha', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 34, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + } + ] + } + ] + } + }, + facs: { + 'dna': { + 'parser_simple': [ + { + match: [], + shape: 'normal' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm1', + temperature: 40, + shape: 'g2-block' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm2', + temperature: 40, + shape: 'S-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Nocodazole', + shape: 'g2-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Alpha', + shape: 'alpha-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Hydroxyurea', + shape: 'S-block' + } + ] + + } + } + } + } +}; + +var __usability_test = { + id: 'usability_test', + name: 'SCB Usability Test', + course: 'StarX', + course_name: 'Prototypes', + description: "Placeholder", + notebook: {}, + experiments: {}, + template: { + instructions: [['Placeholder', 'Usability test']], + ui: { + experimental_design: { + techniques: ['wb', 'facs'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: "cell_line", + title: "Strain", + editable: false + }, + { + kind: "treatments", + children: [ + { + kind: "drug", + title: "Treatment", + editable: true + }, + { + kind: "concentration", + title: "Concentration", + editable: true + }, + { + kind: "start", + title: "Start", + editable: false + }, + { + kind: "duration", + title: "Duration", + editable: false + } + ] + }, + { + kind: "actions", + title: "Actions" + } + ], + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%, %CONCENTRATION%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + '%CONCENTRATION%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], + map: ['concentrations', '%KEY%', 'name'] + } + } + } + }, + + experiment_setup_actions: { + cell_lines: [ + { + id: 'wt', + title: 'Wild Type', + cell_line: 'wt' + } + ], + treatment_protocol_list: [ + { + id: 'P1', + title: 'Buffer Only', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: 0 + } + ] + } + } + ] + } + }, + { + id: 'P2', + title: 'V1 low conc', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '1' + } + ] + } + } + ] + } + }, + { + id: 'P3', + title: 'V1 high conc', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '125' + } + ] + } + } + ] + } + }, + { + id: 'P4', + title: 'V2 low conc', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '50' + } + ] + } + } + ] + } + }, + { + id: 'P5', + title: 'Many drugs', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '0' + }, + { + drug_id: '2', + concentration_id: '5' + }, + { + drug_id: '3', + concentration_id: '10' + } + ] + } + } + ] + } + }, + { + id: 'P6', + title: 'Many drugs, Many times', + treatment_list: { + list: [ + { + schedule_value: 0, + schedule: 'immediately', // start + duration_value: 3600 * 24 * 3, + duration: '3 d', // end + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: '1', + concentration_id: '0' + }, + { + drug_id: '2', + concentration_id: '5' + }, + { + drug_id: '3', + concentration_id: '10' + } + ] + } + } + ] + } + } + ], + collection_schedule_list: [ + { + id: '3 d', + title: '3 days' + } + ] + }, + + add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs, Vulvarines 1-4, identified in your chemical screen. ', + + concentrations: { + '1': { + name: '1 ' + microEntity + 'M', + value: 1000 + }, + '5': { + name: '5 ' + microEntity + 'M', + value: 5000 + }, + '10': { + name: '10 ' + microEntity + 'M', + value: 10000 + }, + '20': { + name: '20 ' + microEntity + 'M', + value: 20000 + }, + '25': { + name: '25 ' + microEntity + 'M', + value: 25000 + }, + '40': { + name: '40 ' + microEntity + 'M', + value: 40000 + }, + '80': { + name: '80 ' + microEntity + 'M', + value: 80000 + }, + '125': { + name: '125 ' + microEntity + 'M', + value: 125000 + }, + '10n': { + name: '10 nM', + value: 10 + }, + '50': { + name: '50 nM', + value: 50 + }, + '100': { + name: '100 nM', + value: 100 + }, + '200': { + name: '200 nM', + value: 200 + }, + '400': { + name: '400 nM', + value: 400 + }, + '0': { + name: '0 nM', + value: 0 + } + }, + drugs: { + 'nc': { + name: 'Buffer only', + concentrations: [0] + }, + '1': { + name: 'Vulvarine 1', + concentrations: [5, 10, 20, 40, 80] + }, + '2': { + name: 'Vulvarine 2', + concentrations: [50, 100, 200, 400] + }, + '3': { + name: 'Vulvarine 3', + concentrations: [1, 5, 25, 125] + }, + '4': { + name: 'Vulvarine 4', + concentrations: ['10n', 50, 100, 200, 400] + } + }, + experiment_temperatures: { + '25': { + name: "25" + degreeEntity + "C" + } + }, + cell_lines: { + 'wt': { + name: 'Wild Type' + } + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: [1, 2, 3, 9, 4, 5, 6, 7, 8, 9], + 1: { + name: 'rabbit anti-let-23', + secondary: [1], + marks: [ + { + weight: 24, + intensity: .11 + }, + { + weight: 36, + intensity: .4 + }, + { + weight: 48, + intensity: .04 + } + ], + gel_name: 'let-23' + }, + 2: { + name: 'mouse anti-let-60', + secondary: [3], + marks: [ + { + weight: 48, + intensity: .04 + } + ], + gel_name: 'let-60' + }, + 3: { + name: 'goat anti-lin15A', + secondary: [2], + marks: [ + { + weight: 12, + intensity: .02 + } + ], + gel_name: 'lin15A' + }, + 9: { + name: 'goat anti-lin15B', + secondary: [2], + marks: [ + { + weight: 100, + intensity: .01 + }, + { + weight: 129, + intensity: .11 + } + ], + gel_name: 'lin15B' + }, + 4: { + name: 'goat anti-lin-1', + secondary: [2], + gel_name: 'lin-1' + }, + 5: { + name: 'mouse anti-Dpy-5', + secondary: [3], + gel_name: 'Dpy-5' + }, + 6: { + name: 'rabbit anti-Lon-2', + secondary: [1], + gel_name: 'Lon-2' + }, + 7: { + name: 'mouse anti-Sma-4', + secondary: [3], + gel_name: 'Sma-4' + }, + 8: { + name: 'goat anti-Unc-22', + secondary: [2], + gel_name: 'Unc-22' + }, + 9: { + name: 'rabbit anti-tubulin', + secondary: [1], + gel_name: 'anti-tubulin', + marks: [ + { + weight: 50, + intensity: 25.1 + } + ] + } + }, + secondary_anti_body: { + 1: { + name: 'donkey anti-rabbit' + }, + 2: { + name: 'rabbit anti-goat' + }, + 3: { + name: 'goat anti-mouse' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + }, /* + 'cyto':{ + name:'Cytoplasm' + }, + 'nuclear':{ + name:'Nuclear' + }*/ + }, + model: { // model + western_blot: { // this applies to western blot + 'cyto': { // it acts on cytoplasm (thus on whole cell lysate as well) + 'parser_fixed': [ + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 1, // Vul 1 + 'cutoff': 10000, + 'above_marks': [ + { + name: 'let-23', + weight: 150, + intensity: -40, + primary_anti_body: [1] + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 2, // Vul 2 + 'cutoff': 200, + 'above_marks': [ + { + name: 'let-60', + weight: 21, + intensity: -100, + primary_anti_body: [2] + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 3, // Vul 3 + 'cutoff': 25000, + 'above_marks': [ + { + name: 'let-15A', + weight: 79, + intensity: -100, + primary_anti_body: [3] + }, + { + name: 'let-15B', + weight: 163, + intensity: -100, + primary_anti_body: [9] + + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'delta', + 'drug': 4, // Vul 3 + 'cutoff': 400, + 'above_marks': [ + { + name: 'let-1', + weight: 48, + intensity: -100, + primary_anti_body: [4] + } + ], + 'below_marks': [] + }, + { + 'cell_line': 'wt', + 'transfer_function': 'static', + 'marks': [ + { + name: 'let-23', + weight: 150, + intensity: 40, + primary_anti_body: [1] + }, + { + name: 'let-60', + weight: 21, + intensity: 100, + primary_anti_body: [2] + }, + { + name: 'let-15A', + weight: 79, + intensity: 100, + primary_anti_body: [3] + }, + { + name: 'let-15B', + weight: 163, + intensity: 100, + primary_anti_body: [9] + }, + { + name: 'let-1', + weight: 48, + intensity: 100, + primary_anti_body: [4] + }, + { + name: 'Dpy-5', + weight: 20, + intensity: 60, + primary_anti_body: [5] + }, + { + name: 'Lan-2', + weight: 100, + intensity: 40, + primary_anti_body: [6] + }, + { + name: 'Sma-4', + weight: 75, + intensity: 25, + primary_anti_body: [7] + }, + { + name: 'Unc-22', + weight: 40, + intensity: 10, + primary_anti_body: [8] + } + ] + } + ] + } + } + } + } +}; + +var __microscopy_test = { + id: 'microscopy_test', + name: 'StarCellBio Microscopy Test', + course: 'StarX', + course_name: 'Prototypes', + description: 'Microscopy Test of images', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal & Introduction', 'Here come instructions when we build them'] + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs', 'micro'] + }, + experiment_setup: { + table: [ + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: true + }, + { + kind: 'treatments', + children: [ + { + kind: 'drug', + title: 'Treatment', + editable: true + }, + { + kind: 'concentration', + title: 'Treatment Concentration/Dose', + editable: false + }, + { + kind: "start", + title: "Treatment Start Time", + editable: false + }, + { + kind: "collection", + title: "Collection Timepoints", + editable: true + } + ] + }, + { + kind: 'actions', + title: 'Actions' + } + ], + actions: [] + }, + microscopy: { + disable_blur: false, + disable_brightness: false + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%, %COLLECTION%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + '%COLLECTION%': { + attr: ['treatment_list', 'list', '0', 'collection_id'], + map: ['collections', '%KEY%', 'name'] + } + } + } + + }, + + + experiment_setup_actions: { + cell_lines: [ + { + id: 'p+', + title: 'p53+/+;Rb+/+', + cell_line: 'p+' + }, + { + id: 'pfl', + title: 'p53fl/fl;Rbfl/fl', + cell_line: 'pfl' + } + ], + treatment_protocol_list: [ + { + id: 'ADC', + title: 'Adenovirus-Cre', + treatment_list: { + list: [ + { + schedule_value: 5000, + collection_id: '6 m', + schedule: 'immediately', // start + drug_list: { + list: [ + { + drug_id: 'ac', + concentration_id: 108 + } + ] + } + } + ] + } + }, + { + id: 'ADE', + title: 'Adenovirus-Empty', + treatment_list: { + list: [ + { + schedule_value: 5000, + collection_id: '6 m', + schedule: 'immediately', // start + drug_list: { + list: [ + { + drug_id: 'ae', + concentration_id: '108' + } + ] + } + } + ] + } + } + ], + collection_schedule_list: [] + }, + + add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs', + collections: { + '3 m': { + name: '3 months' + }, + '6 m': { + name: '6 months' + }, + '1 yr': { + name: '1 year' + } + }, + + + concentrations: { + + '108': { + name: '10^8 PFU', + value: 1000 + } + }, + drugs: { + 'ac': { + name: 'Adenovirus-Cre', + concentrations: ['108'] + }, + 'ae': { + name: 'Adenovirus-Empty', + concentrations: ['108'] + } + }, + experiment_temperatures: { + '22': { + name: "22" + degreeEntity + "C" + } + }, + + cell_lines: { + 'p+': { + name: 'p53+/+;Rb+/+' + }, + 'pfl': { + name: 'p53fl/fl;Rbfl/fl' + } + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['cdk2', 'cyclin', 'cyclinE', 'pgk1'], + 'cdk2': { + name: 'rabbit anti-cdk2', + secondary: ['r'], + marks: [ + { + weight: 33, + intensity: 0 + }, + { + weight: 34, + intensity: 0 + }, + { + weight: 35, + intensity: 0 + } + ], + gel_name: 'cdk2' + }, + 'cyclin': { + name: 'mouse anti-cyclin B', + secondary: ['m'], + marks: [ + { + weight: 58, + intensity: 0 + }, + ], + gel_name: 'cyclin B' + }, + 'cyclinE': { + name: 'mouse anti-cyclin E', + secondary: ['m'], + marks: [ + { + weight: 48, + intensity: 0 + }, + ], + gel_name: 'cyclin E' + }, + 'pgk1': { + name: 'rabbit anti-pgk1', + secondary: ['r'], + marks: [ + { + weight: 45, + intensity: 0 + }, + ], + gel_name: 'pgk1' + } + }, // + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, // + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'whole': { + name: 'PI', + conditions: { + 'whole': { + name: 'PI' + } + } + } + }, + micro_kinds: { + 'IF': { + name: 'Antibody-labeling IF', + conditions: { + 'rgb': { + name: 'NFIB (red), DAPI (blue), control (green)', + short_name: 'IF: RGB' + } + } + }, + 'IHC': { + name: 'Antibody-labeling IHC', + conditions: { + 'NFIB': { + name: 'NFIB', + short_name: 'IHC: NFIB' + }, + 'ki67': { + name: 'Ki-67', + short_name: 'IHC: Ki-67' + }, + 'secondary': { + name: 'Secondary only control', + short_name: 'IHC: Secondary' + } + } + }, + 'Dye': { + name: 'Dye/Stain', + conditions: { + 'HnE': { + name: 'H&E', + short_name: 'Dye: H&E' + } + } + + } + }, + slides: { + // 'img1': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_1/AD20E1_20x.jpg', + 'img2': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_2/AD20E2_20x.jpg', + 'img3': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_3/AD22E1_20x.jpg', + 'img4': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_3/AD22E1_40x.jpg', + 'img5': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_4/AD27E2_20x.jpg', + 'img6': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_5/AD1024E_3_20x.jpg', + 'img7': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_6/AD901_8_4x.jpg', + 'img8': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_7/AD901_50_4x.jpg', + 'img9': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_8/AD901_52_4x.jpg', + 'img10': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_9/AD1021E_20x.jpg', + + 'img11': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_1/AD1024E_2_20x.jpg', + 'img12': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_2/AD1024E_10x.jpeg', + 'img13': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_2/AD1024E_20x.jpeg', + + 'img14': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_1/AD900E1_40x.jpg', + 'img15': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_2/AD900E3_20x.jpg', + 'img16': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_2/AD900E3_40x.jpg', + 'img17': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_3/AD987E1_40x-3.jpg', + 'img18': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_4m/AD901E25-1_he_20x.jpg', + 'img19': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_4m/AD901E25-1_he_40x.jpg', + 'img20': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_5m/AD901E25-2_he_40x-2.jpg', + 'img21': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_6m/AD901E25-3_he_20x.jpg', + 'img22': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_6m/AD901E25-3_he_40x.jpg', + 'img23': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_2only_20x.jpeg', + 'img24': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_2only_40x.jpeg', + 'img25': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_ki-67_20x.jpeg', + 'img26': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_ki-67_40xadj.jpg', + 'img27': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_2/AD901E25-2_2only_40x.jpg', + 'img28': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_2/AD901E25-2_ki-67_40xadj.jpg', + 'img29': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_2only_20x-2.jpeg', + 'img30': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_2only_40x-2.jpeg', + 'img31': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_ki-67_20x-2.jpeg', + 'img32': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_ki-67_40x-2.jpeg', + + 'img33': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_1/AD985E-1_20x-2.jpg', + 'img34': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_2/AD985E-1_20x.jpg', + 'img35': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_4X-2.jpg', + 'img36': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_10X.jpg', + 'img37': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_20X.jpg', + 'img38': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_4/AD990E-1_20x.jpg', + 'img39': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_5m/AD1017_HE_20X.jpg', + 'img40': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_6m/AD3587E_HE_20X-1-2.jpg', + 'img41': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_blue_advanced4.jpeg', + 'img42': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_green_advanced4.jpeg', + 'img43': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_merge_advanced4.jpeg', + 'img44': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_red_advanced4.jpeg', + 'img45': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_2/AD3172E-02_60X_merge.jpg', + 'img46': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_3/AD984E2-01_R3D_D3D_PRJ_617_528_457_60X_merge.jpg', + 'img47': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_blue.jpeg', + 'img48': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_green.jpeg', + 'img49': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_merge.jpeg', + 'img50': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_red.jpeg', + 'img51': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_blue.jpeg', + 'img52': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_green.jpeg', + 'img53': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_merge.jpeg', + 'img54': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_red.jpeg', + 'img55': 'images/microscopy/microscopy_test/lung_1yr/match/Sample_1/AD1017_NFIB_20X.jpg', + 'img56': 'images/microscopy/microscopy_test/lung_1yr/match/Sample_2/AD3587E_NFIB_20X-1.jpg' + }, + slide_parser: { + 'default': { + 'Dye': { + 'HnE': { + // '1': [{ + // hash: 'img1', + // mag: '20x' + // }], + '1': [{ + hash: 'img2', + mag: '20x' + }], + '2': [{ + hash: 'img3', + mag: '20x' + }], + '3': [{ + hash: 'img5', + mag: '20x' + }], + '4': [{ + hash: 'img6', + mag: '20x' + }], + '5': [{ + hash: 'img7', + mag: '4x' + }], + '6': [{ + hash: 'img8', + mag: '4x' + }], + '7': [{ + hash: 'img9', + mag: '4x' + }], + '8': [{ + hash: 'img10', + mag: '20x' + }], + '9': [{ + hash: 'img4', + mag: '40x' + }] + } + } + }, + '3 m': { + 'Dye': { + 'HnE': { + '1': [{ + hash: 'img11', + mag: '20x' + }], + '2': [{ + hash: 'img12', + mag: '10x' + }], + '3': [{ + hash: 'img13', + mag: '20x' + }] + } + } + }, + '6 m': { + 'Dye': { + 'HnE': { + '1': [{ + hash: 'img14', + mag: '40x' + }], + '2': [{ + hash: 'img15', + mag: '20x' + }], + '3': [{ + hash: 'img17', + mag: '40x' + }], + '4': [{ + hash: 'img18', + mag: '20x' + }], + '5': [{ + hash: 'img20', + mag: '40x' + }], + '6': [{ + hash: 'img21', + mag: '20x' + }], + '7': [{ + hash: 'img16', + mag: '40x' + }], + '8': [{ + hash: 'img22', + mag: '40x' + }], + '9': [{ + hash: 'img19', + mag: '40x' + }] + } + }, + 'IHC': { + 'secondary': { + '1': [{ + hash: 'img23', + mag: '20x' + }], + '2': [{ + hash: 'img27', + mag: '40x' + }], + '3': [{ + hash: 'img29', + mag: '20x' + }], + '4': [{ + hash: 'img30', + mag: '40x' + }], + '5': [{ + hash: 'img24', + mag: '40x' + }] + }, + 'ki67': { + '1': [{ + hash: 'img25', + mag: '20x' + }], + '2': [{ + hash: 'img28', + mag: '40x' + }], + '3': [{ + hash: 'img31', + mag: '20x' + }], + '4': [{ + hash: 'img26', + mag: '40x' + }], + '5': [{ + hash: 'img32', + mag: '40x' + }] + } + } + }, + '1 yr': { + 'Dye': { + 'HnE': { + '1': [{ + hash: 'img33', + mag: '20x' + }], + '2': [{ + hash: 'img34', + mag: '20x' + }], + '3': [{ + hash: 'img35', + mag: '4x' + }], + '4': [{ + hash: 'img38', + mag: '20x' + }], + '5': [{ + hash: 'img39', + mag: '20x' + }], + '6': [{ + hash: 'img40', + mag: '20x' + }], + '7': [{ + hash: 'img36', + mag: '10x' + }], + '8': [{ + hash: 'img37', + mag: '20x' + }] + } }, - model: { // model - western_blot: { // this applies to western blot - 'cyto': { // it acts on cytoplasm (thus on whole cell lysate as well) - 'parser_fixed': [ + 'IF': { + 'rgb': { + '1': [{ + hash: 'img44', + if_type: 'red', + mag: '60x' + }, + { + hash: 'img41', + if_type: 'blue', + mag: '60x' + }, + { + hash: 'img42', + if_type: 'green', + mag: '60x' + }, + { + hash: 'img43', + if_type: 'merge', + mag: '60x' + }], + '2': [{ + hash: 'img45', + if_type: 'merge', + mag: '60x' + }], + '3': [{ + hash: 'img46', + if_type: 'merge', + mag: '60x' + }], + '4': [{ + hash: 'img50', + if_type: 'red', + mag: '60x' + }, + { + hash: 'img47', + if_type: 'blue', + mag: '60x' + }, + { + hash: 'img48', + if_type: 'green', + mag: '60x' + }, + { + hash: 'img49', + if_type: 'merge', + mag: '60x' + }], + '5': [{ + hash: 'img54', + if_type: 'red', + mag: '60x' + }, + { + hash: 'img51', + if_type: 'blue', + mag: '60x' + }, + { + hash: 'img52', + if_type: 'green', + mag: '60x' + }, + { + hash: 'img53', + if_type: 'merge', + mag: '60x' + }] + } + }, + 'IHC': { + 'NFIB': { + '1': [{ + hash: 'img55', + mag: '20x' + }], + '2': [{ + hash: 'img56', + mag: '20x' + }] + } + } + + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '*ANY*', + marks: [ + { + name: 'Cyclin B', + weight: 58, + intensity: 2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: 4, + primary_anti_body: ['cyclinE'] + }, + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] + } + + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'pp1', + cell_line: '*ANY*', + above_marks: [ + { + name: 'Cdk2', + weight: 33, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + } + ], + below_marks: [ + { + name: 'Cdk2', + weight: 34, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + } + ] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'wt', + marks: [] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm1', + temperature: '40', + marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + } + ] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm2', + temperature: '40', + marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Nocodazole', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Hydroxyurea', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Alpha', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdk2', + weight: 34, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + } + ] + } + ] + } + }, + facs: { + 'dna': { + 'parser_simple': [ + { + match: [], + shape: 'normal' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm1', + temperature: 40, + shape: 'g2-block' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm2', + temperature: 40, + shape: 'S-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Nocodazole', + shape: 'g2-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Alpha', + shape: 'alpha-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Hydroxyurea', + shape: 'S-block' + } + ] + + } + }, + microscopy: { + 'valid': ['pfl', 'ac'], + 'slide': { + + 'parser_simple': [ + { + match: [], + + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'pfl', + drug_id: 'ac', + collection_id: '3 m', + kind: 'Dye', + conditions: 'HnE' + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'pfl', + drug_id: 'ac', + collection_id: '6 m', + kind: 'Dye', + conditions: 'HnE' + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'pfl', + drug_id: 'ac', + collection_id: '6 m', + kind: 'IHC', + conditions: 'secondary' + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'pfl', + drug_id: 'ac', + collection_id: '6 m', + kind: 'IHC', + conditions: 'ki67' + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'pfl', + drug_id: 'ac', + collection_id: '1 yr', + kind: 'Dye', + conditions: 'HnE' + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'pfl', + drug_id: 'ac', + collection_id: '1 yr', + kind: 'IF', + conditions: 'rgb' + }, + { + match: ['cell_line', 'drug_id', 'collection_id', 'kind', 'conditions'], + cell_line: 'pfl', + drug_id: 'ac', + collection_id: '1 yr', + kind: 'IHC', + conditions: 'NFIB' + } + + ] + + } + } + + } + } +}; + +var __assigment_706 = { + id: 'mit_7_06_0313', + name: '7.06 Spring 2013', + course: '7.06', + course_name: 'MIT Course 7.06', + description: 'FACS and Western Blot for temperature sensitive mutants', + notebook: {}, + experiments: {}, + template: { + instructions: [ + ['Goal & Introduction', 'Here come instructions when we build them'] + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs'] + }, + experiment_setup: { + table: [ // + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, // + { + kind: 'treatments', + children: [ // + { + kind: 'drug', + title: 'Treatment', + editable: false + }, // + { + kind: 'concentration', + title: 'Concentration', + editable: false + } // + ] + }, // + { + kind: 'temperature', + title: 'Temperature', + editable: false + }, // + { + kind: 'actions', + title: 'Actions' + } // + ], // + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%, %PP1% %TEMPERATURE%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + '%CONCENTRATION%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], + map: ['concentrations', '%KEY%', 'name'] + }, + '%TEMPERATURE%': { + attr: ['treatment_list', 'list', '0', 'temperature'], + map: ['experiment_temperatures', '%KEY%', 'name'] + }, + '%PP1%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '1', 'drug_id'], + map: ['drugs', '%KEY%', 'short_name'], + default: '' + } + } + }, + add_multiple_dialog: { + 'wt': { + title: 'Strain: Wild Type', + headings: [ + 'Treatment', 'Temperature', '- PP1', '+ PP1' + ], + rows: [ + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' + } + ], + treatment_id: 'media_only,25', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '25' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' + } + ], + treatment_id: 'media_only,40', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '40' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '40' + } + ] + } + } + ] + } + }, + { + cells: [ + { + kind: 'text', + text: 'Nocodazole' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' + } + ], + treatment_id: 'nocodazole,25', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Nocodazole', + concentration_id: '15' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '25' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Nocodazole', + concentration_id: '15' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + } + , + { + cells: [ + { + kind: 'text', + text: 'Nocodazole' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' + } + ], + treatment_id: 'nocodazole,40', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Nocodazole', + concentration_id: '15' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '40' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Nocodazole', + concentration_id: '15' + } + ] + }, + temperature: '40' + } + ] + } + } + ] + } + } + , + + { + cells: [ + { + kind: 'text', + text: 'Hydroxyurea' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' + } + ], + treatment_id: 'hydroxyurea,25', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Hydroxyurea', + concentration_id: '200' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '25' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Hydroxyurea', + concentration_id: '200' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } + } + , + { + cells: [ + { + kind: 'text', + text: 'Hydroxyurea' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' + } + ], + treatment_id: 'hydroxyurea,40', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 2, // FBS - 'cutoff': 50, - 'above_marks': [ - { - name: 'P-ERK', - weight: 44, - intensity: .1, - primary_anti_body: [1] - }, - { - name: 'P-ERK', - weight: 42, - intensity: .1, - primary_anti_body: [1] - }, - { - name: 'P-EGFR', - weight: 175, - intensity: .2, - primary_anti_body: [3] - } - ], - 'below_marks': [ - { - name: 'P-ERK', - weight: 44, - intensity: -.1, - primary_anti_body: [1] - }, - { - name: 'P-ERK', - weight: 42, - intensity: -.1, - primary_anti_body: [1] - } + drug_list: { + list: [ + { + drug_id: 'Hydroxyurea', + concentration_id: '200' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } ] - }, + }, + temperature: '40' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 3, // Erlotinib - 'cutoff': 10, - 'above_marks': [ - { - name: 'P-ERK', - weight: 44, - intensity: -.1, - primary_anti_body: [1] - }, - { - name: 'P-ERK', - weight: 42, - intensity: -.1, - primary_anti_body: [1] - }, - { - name: 'P-EGFR', - weight: 175, - intensity: -.2, - primary_anti_body: [3] - } + drug_list: { + list: [ + { + drug_id: 'Hydroxyurea', + concentration_id: '200' + } ] - }, - { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 4, // U0126 - 'cutoff': 10, - 'above_marks': [ - { - name: 'P-ERK', - weight: 44, - intensity: -.1, - primary_anti_body: [1] - }, - { - name: 'P-ERK', - weight: 42, - intensity: -.1, - primary_anti_body: [1] - }, - { - name: 'P-EGFR', - weight: 175, - intensity: 0, - primary_anti_body: [3] - } - ], - 'below_marks': [] + }, + temperature: '40' } - ] - } + ] + } + } + ] + } } - } - } -}; - -var __decusability_newfacs = { - id: 'decusability2', - name: 'StarCellBio Usability Test2', - course: 'usability', - course_name: 'December 2013 Usability Testing', - description: 'FACS and Western Blot for temperature sensitive mutants', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal & Introduction','Here come instructions when we build them'] - ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs'] - }, - experiment_setup: { - table: [ // - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, // - {kind: 'treatments', - children: [// - {kind: 'drug', title: 'Treatment', editable: false},// + , + { + cells: [ + { + kind: 'text', + text: 'Alpha Factor' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' + } + ], + treatment_id: 'alpha_factor,25', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Alpha', + concentration_id: '2' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } ] - },// - {kind: 'temperature', title: 'Temperature', editable: false},// - {kind: 'actions', title: 'Actions'}// - ],// - actions: [ - - ] - }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%, %PP1% %TEMPERATURE%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], map: ['drugs', '%KEY%', 'name']}, - '%CONCENTRATION%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], map: ['concentrations', '%KEY%', 'name']}, - '%TEMPERATURE%': {attr: ['treatment_list', 'list', '0', 'temperature'], map: ['experiment_temperatures', '%KEY%', 'name']}, - '%PP1%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '1', 'drug_id'], map: ['drugs', '%KEY%', 'short_name'], default: ''} + }, + temperature: '25' + } + ] } - }, - add_multiple_dialog: { - 'wt': { - title: 'Strain: Wild Type', - headings: ['Treatment', 'Temperature', ''], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } - } - - ] - }, - 'm1': { - title: 'Strain: Mutant 1', - - headings: ['Treatment', 'Temperature', ''], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - PP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - PP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } - } - ] - - }, - 'm2': { - title: 'Strain: Mutant 2', - - headings: [ 'Treatment', 'Temperature', ''], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - PP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - PP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - { - facs: {'whole': 1, 'a': 1}, - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } - } - ] - + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Alpha', + concentration_id: '2' + } + ] + }, + temperature: '25' + } + ] } - } - }, - add_new_row_instructions: 'add new row instructions', - - concentrations: { - '0': { - name: '', - value: 0 - }, - '2': { - name: '2 ' + microEntity + 'g/mL', - value: 5 + } + ] + } + } + , + { + cells: [ + { + kind: 'text', + text: 'Alpha Factor' }, - '15': { - name: '15 ' + microEntity + 'g/mL', - value: 5 + { + kind: 'text', + text: "37 " + degreeEntity + "C" }, - '200': { - name: '200 mM', - value: 5 + { + kind: 'checkbox', + name: 'NOPP1' }, - '1u': { - name: '1 unit', - value: 1000 - } - }, - drugs: { - 'nc': { - name: 'Growth Media', - concentrations: [0] - }, - 'Nocodazole': { - name: 'Nocodazole', - concentrations: [15] - }, - 'Alpha': { - name: 'Alpha Factor', - concentrations: [2] - }, - 'Hydroxyurea': { - name: 'Hydroxyurea', - concentrations: [200] - }, - 'pp1': { - name: 'Protein Phosphatase 1', - concentrations: ['1u'], - short_name: 'PP1' + { + kind: 'checkbox', + name: 'PP1' } + ], + treatment_id: 'alpha_factor,40', + cell_treatments: { + PP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Alpha', + concentration_id: '2' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '40' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'wt', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'Alpha', + concentration_id: '2' + } + ] + }, + temperature: '40' + } + ] + } + } + ] + } + } - }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" - }, - '40': { - name: "37" + degreeEntity + "C" - } - }, + ] + }, + 'm1': { + title: 'Strain: Mutant 1', - cell_lines: { - 'wt': { - name: 'Wild Type' + headings: [ + 'Treatment', 'Temperature', '- PP1', '+ PP1' + ], + rows: [ + { + cells: [ + { + kind: 'text', + text: 'Growth Media' }, - 'm1': { - name: 'Mutant 1' + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' }, - 'm2': { - name: 'Mutant 2' + { + kind: 'checkbox', + name: 'PP1' } - - }, - time_unit: { - kind: 'minutes' + ], + treatment_id: 'media_only,25', + cell_treatments: { + PP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '25' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' + } + ] + } + } + ] + } }, - primary_anti_body: { - order: ['cdk2', 'cyclin', 'cyclinE', 'pgk1'], - 'cdk2': { - name: 'rabbit anti-cdk2', - secondary: ['r'], - marks: [ - {weight: 33, intensity: 0}, - {weight: 34, intensity: 0}, - {weight: 35, intensity: 0} - ], - gel_name: 'cdk2' - }, - 'cyclin': { - name: 'mouse anti-cyclin B', - secondary: ['m'], - marks: [ - {weight: 58, intensity: 0}, - ], - gel_name: 'cyclin B' - }, - 'cyclinE': { - name: 'mouse anti-cyclin E', - secondary: ['m'], - marks: [ - {weight: 48, intensity: 0}, - ], - gel_name: 'cyclin E' - }, - 'pgk1': { - name: 'rabbit anti-pgk1', - secondary: ['r'], - marks: [ - {weight: 45, intensity: 0}, - ], - gel_name: 'pgk1' - } - },// - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' + { + cells: [ + { + kind: 'text', + text: 'Growth Media' }, - 'r': { - name: 'goat anti-rabbit' - } - },// - lysate_kinds: { - 'whole': { - name: 'Whole Cell' + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' } - }, - facs_kinds: { - 'Dye':{ - name:'Dye/Stain', - conditions: { - 'whole': {name: 'PI', - short_name: 'PI'} - } - }, - 'Anti':{ - name:'Antibody-labeling ', - conditions: { - 'a': {name: 'Antibody', - short_name: 'Antibody'} - } - } - }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '*ANY*', - marks: [ - { - name: 'Cyclin B', - weight: 58, - intensity: 2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } - - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'pp1', - cell_line: '*ANY*', - above_marks: [ - { - name: 'Cdk2', - weight: 33, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - } - ], - below_marks: [ - { - name: 'Cdk2', - weight: 34, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'wt', - marks: [ - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm1', - temperature: '40', - marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm2', - temperature: '40', - marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Nocodazole', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Hydroxyurea', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Alpha', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 34, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - } - ] + ], + treatment_id: 'media_only,40', + cell_treatments: { + PP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '40' + } + ] } - }, - facs: { - 'dna': { - 'parser_simple': [ - { - match: [], - shape: 'normal' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm1', - temperature: 40, - shape: 'g2-block' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm2', - temperature: 40, - shape: 'S-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Nocodazole', - shape: 'g2-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Alpha', - shape: 'alpha-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Hydroxyurea', - shape: 'S-block' - } - ] - + } + ], + NOPP1: [ + { + cell_line: 'm1', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '40' + } + ] } - } + } + ] + } } - } - }; + ] -var __usability_test = { - id: 'usability_test', - name: 'SCB Usability Test', - course: 'StarX', - course_name: 'Prototypes', - description: "Placeholder", - notebook: {}, - experiments: {}, - template: { - instructions: [['Placeholder', 'Usability test']], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs' ] - }, - experiment_setup: {table: [ - {kind: "cell_plate", - title: " ", - editable: false}, - {kind: "cell_line", - title: "Strain", - editable: false - }, - {kind: "treatments", - children: [ - {kind: "drug", title: "Treatment", editable: true}, - {kind: "concentration", title: "Concentration", editable: true}, - {kind: "start", title: "Start", editable: false}, - {kind: "duration", title: "Duration", editable: false} - ] - }, - {kind: "actions", - title: "Actions" - } - ], actions: [ - ] - }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%, %CONCENTRATION%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], map: ['drugs', '%KEY%', 'name']}, - '%CONCENTRATION%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], map: ['concentrations', '%KEY%', 'name']} - } - } }, + 'm2': { + title: 'Strain: Mutant 2', - experiment_setup_actions: { - cell_lines: [ + headings: [ + 'Treatment', 'Temperature', '- PP1', '+ PP1' + ], + rows: [ + { + cells: [ { - id: 'wt', - title: 'Wild Type', - cell_line: 'wt' + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "30 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' } - ], - treatment_protocol_list: [ - { - id: 'P1', - title: 'Buffer Only', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: 0} - ]}} - ]} - }, - { - id: 'P2', - title: 'V1 low conc', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '1'} - ]}} - ]} - }, - { - id: 'P3', - title: 'V1 high conc', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '125'} - ]}} - ]} - }, - { - id: 'P4', - title: 'V2 low conc', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '50'} - ]}} - ]} - }, - { - id: 'P5', - title: 'Many drugs', - treatment_list: {list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '0'}, - {drug_id: '2', concentration_id: '5'}, - {drug_id: '3', concentration_id: '10'} - ]}} - ]} - }, - { - id: 'P6', - title: 'Many drugs, Many times', + ], + treatment_id: 'media_only,25', + cell_treatments: { + PP1: [ + { + cell_line: 'm2', treatment_list: { - list: [ - {schedule_value: 0, schedule: 'immediately', // start - duration_value: 3600 * 24 * 3, duration: '3 d', // end - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: '1', concentration_id: '0'}, - {drug_id: '2', concentration_id: '5'}, - {drug_id: '3', concentration_id: '10'} - ]}} - ]} - } - ], - collection_schedule_list: [ - {id: '3 d', title: '3 days'} - ] - }, - - add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs, Vulvarines 1-4, identified in your chemical screen. ', - - concentrations: { - '1': { - name: '1 ' + microEntity + 'M', - value: 1000 - }, - '5': { - name: '5 ' + microEntity + 'M', - value: 5000 - }, - '10': { - name: '10 ' + microEntity + 'M', - value: 10000 - }, - '20': { - name: '20 ' + microEntity + 'M', - value: 20000 - }, - '25': { - name: '25 ' + microEntity + 'M', - value: 25000 - }, - '40': { - name: '40 ' + microEntity + 'M', - value: 40000 - }, - '80': { - name: '80 ' + microEntity + 'M', - value: 80000 - }, - '125': { - name: '125 ' + microEntity + 'M', - value: 125000 - }, - '10n': { - name: '10 nM', - value: 10 - }, - '50': { - name: '50 nM', - value: 50 - }, - '100': { - name: '100 nM', - value: 100 - }, - '200': { - name: '200 nM', - value: 200 - }, - '400': { - name: '400 nM', - value: 400 - }, - '0': { - name: '0 nM', - value: 0 - } - }, - drugs: { - 'nc': { - name: 'Buffer only', - concentrations: [0] - }, - '1': { - name: 'Vulvarine 1', - concentrations: [5, 10, 20, 40, 80] - }, - '2': { - name: 'Vulvarine 2', - concentrations: [50, 100, 200, 400] - }, - '3': { - name: 'Vulvarine 3', - concentrations: [1, 5, 25, 125] - }, - '4': { - name: 'Vulvarine 4', - concentrations: ['10n', 50, 100, 200, 400] - } - }, - experiment_temperatures: { - '25': { - name: "25" + degreeEntity + "C" - } - }, - cell_lines: { - 'wt': { - name: 'Wild Type' - } - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order:[1,2,3,9,4,5,6,7,8,9], - 1: { - name: 'rabbit anti-let-23', - secondary: [1], - marks: [ - {weight: 24, intensity: .11}, - {weight: 36, intensity: .4}, - {weight: 48, intensity: .04} - ], - gel_name: 'let-23' - }, - 2: { - name: 'mouse anti-let-60', - secondary: [3], - marks: [ - {weight: 48, intensity: .04} - ], - gel_name: 'let-60' - }, - 3: { - name: 'goat anti-lin15A', - secondary: [2], - marks: [ - {weight: 12, intensity: .02} - ], - gel_name: 'lin15A' - }, - 9: { - name: 'goat anti-lin15B', - secondary: [2], - marks: [ - {weight: 100, intensity: .01}, - {weight: 129, intensity: .11} + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '25' + } + ] + } + } ], - gel_name: 'lin15B' - }, - 4: { - name: 'goat anti-lin-1', - secondary: [2], - gel_name: 'lin-1' - }, - 5: { - name: 'mouse anti-Dpy-5', - secondary: [3], - gel_name: 'Dpy-5' - }, - 6: { - name: 'rabbit anti-Lon-2', - secondary: [1], - gel_name: 'Lon-2' - }, - 7: { - name: 'mouse anti-Sma-4', - secondary: [3], - gel_name: 'Sma-4' - }, - 8: { - name: 'goat anti-Unc-22', - secondary: [2], - gel_name: 'Unc-22' - }, - 9: { - name: 'rabbit anti-tubulin', - secondary: [1], - gel_name: 'anti-tubulin', - marks: [ - {weight: 50, intensity: 25.1} + NOPP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ + { + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } + ] + }, + temperature: '25' + } + ] + } + } ] - } - }, - secondary_anti_body: { - 1: { - name: 'donkey anti-rabbit' + } }, - 2: { - name: 'rabbit anti-goat' - }, - 3: { - name: 'goat anti-mouse' - } - }, - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - }, /* - 'cyto':{ - name:'Cytoplasm' - }, - 'nuclear':{ - name:'Nuclear' - }*/ - }, - model: {// model - western_blot: {// this applies to western blot - 'cyto': {// it acts on cytoplasm (thus on whole cell lysate as well) - 'parser_fixed': [ - { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 1, // Vul 1 - 'cutoff': 10000, - 'above_marks': [ - { - name: 'let-23', - weight: 150, - intensity: -40, - primary_anti_body: [1] - } - ], - 'below_marks': [] - }, - { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 2, // Vul 2 - 'cutoff': 200, - 'above_marks': [ - { - name: 'let-60', - weight: 21, - intensity: -100, - primary_anti_body: [2] - } - ], - 'below_marks': [] - }, - { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 3, // Vul 3 - 'cutoff': 25000, - 'above_marks': [ - { - name: 'let-15A', - weight: 79, - intensity: -100, - primary_anti_body: [3] - }, - { - name: 'let-15B', - weight: 163, - intensity: -100, - primary_anti_body: [9] - - } - ], - 'below_marks': [] - }, + { + cells: [ + { + kind: 'text', + text: 'Growth Media' + }, + { + kind: 'text', + text: "37 " + degreeEntity + "C" + }, + { + kind: 'checkbox', + name: 'NOPP1' + }, + { + kind: 'checkbox', + name: 'PP1' + } + ], + treatment_id: 'media_only,40', + cell_treatments: { + PP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ { - 'cell_line': 'wt', - 'transfer_function': 'delta', - 'drug': 4, // Vul 3 - 'cutoff': 400, - 'above_marks': [ - { - name: 'let-1', - weight: 48, - intensity: -100, - primary_anti_body: [4] - } - ], - 'below_marks': [] - }, + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + }, + { + drug_id: 'pp1', + concentration_id: '1u' + } + ] + }, + temperature: '40' + } + ] + } + } + ], + NOPP1: [ + { + cell_line: 'm2', + treatment_list: { + list: [ { - 'cell_line': 'wt', - 'transfer_function': 'static', - 'marks': [ - { - name: 'let-23', - weight: 150, - intensity: 40, - primary_anti_body: [1] - }, - { - name: 'let-60', - weight: 21, - intensity: 100, - primary_anti_body: [2] - }, - { - name: 'let-15A', - weight: 79, - intensity: 100, - primary_anti_body: [3] - }, - { - name: 'let-15B', - weight: 163, - intensity: 100, - primary_anti_body: [9] - }, - { - name: 'let-1', - weight: 48, - intensity: 100, - primary_anti_body: [4] - }, - { - name: 'Dpy-5', - weight: 20, - intensity: 60, - primary_anti_body: [5] - }, - { - name: 'Lan-2', - weight: 100, - intensity: 40, - primary_anti_body: [6] - }, - { - name: 'Sma-4', - weight: 75, - intensity: 25, - primary_anti_body: [7] - }, - { - name: 'Unc-22', - weight: 40, - intensity: 10, - primary_anti_body: [8] - } + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '0' + } ] + }, + temperature: '40' } - ] - } + ] + } + } + ] + } } + ] + } - } -}; + } + }, + add_new_row_instructions: 'add new row instructions', -var __microscopy_test = { - id: 'microscopy_test', - name: 'StarCellBio Microscopy Test', - course: 'StarX', - course_name: 'Prototypes', - description: 'Microscopy Test of images', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal & Introduction','Here come instructions when we build them'] - ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs' , 'micro'] - }, - experiment_setup: { - table: [ - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: true}, - {kind: 'treatments', - children: [ - {kind: 'drug', title: 'Treatment', editable: true}, - {kind: 'concentration', title: 'Treatment Concentration/Dose', editable: false}, - {kind: "start", title: "Treatment Start Time", editable: false}, - {kind: "collection", title: "Collection Timepoints", editable: true} - ] - }, - {kind: 'actions', title: 'Actions'} - ], - actions: [ - ] - }, - microscopy: { - disable_blur: false, - disable_brightness: false - }, - western_blot: { - format: "%CELL_LINE%, %TREATMENT%, %COLLECTION%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], map: ['drugs', '%KEY%', 'name']}, - '%COLLECTION%': {attr: ['treatment_list', 'list', '0', 'collection_id'], map:['collections', '%KEY%', 'name']} - } - } - - }, - - - experiment_setup_actions: { - cell_lines: [ - { - id: 'p+', - title: 'p53+/+;Rb+/+', - cell_line: 'p+' - }, - { - id: 'pfl', - title: 'p53fl/fl;Rbfl/fl', - cell_line: 'pfl' - } - ], - treatment_protocol_list: [ - { - id: 'ADC', - title: 'Adenovirus-Cre', - treatment_list: {list: [ - {schedule_value: 5000, collection_id: '6 m', schedule: 'immediately', // start - drug_list: {list: [ - {drug_id: 'ac', concentration_id: 108} - ]}} - ]} - }, - { - id: 'ADE', - title: 'Adenovirus-Empty', - treatment_list: {list: [ - {schedule_value: 5000, collection_id: '6 m',schedule: 'immediately', // start - drug_list: {list: [ - {drug_id: 'ae', concentration_id: '108'} - ]}} - ]} - } - ], - collection_schedule_list: [ - ] - }, - - add_new_row_instructions: 'On this page, set up your experiment to treat the wild-type worms with the four new drugs', - collections:{ - '3 m': { - name: '3 months' - }, - '6 m': { - name: '6 months' - }, - '1 yr': { - name: '1 year' - } - }, - - - concentrations: { - - '108': { - name: '10^8 PFU', - value: 1000 - } - }, - drugs: { - 'ac': { - name: 'Adenovirus-Cre', - concentrations: ['108'] - }, - 'ae': { - name: 'Adenovirus-Empty', - concentrations: ['108'] - } - }, - experiment_temperatures: { - '22': { - name: "22" + degreeEntity + "C" - } - }, + concentrations: { + '0': { + name: '', + value: 0 + }, + '2': { + name: '2 ' + microEntity + 'g/mL', + value: 5 + }, + '15': { + name: '15 ' + microEntity + 'g/mL', + value: 5 + }, + '200': { + name: '200 mM', + value: 5 + }, + '1u': { + name: '1 unit', + value: 1000 + } + }, + drugs: { + 'nc': { + name: 'Growth Media', + concentrations: [0] + }, + 'Nocodazole': { + name: 'Nocodazole', + concentrations: [15] + }, + 'Alpha': { + name: 'Alpha Factor', + concentrations: [2] + }, + 'Hydroxyurea': { + name: 'Hydroxyurea', + concentrations: [200] + }, + 'pp1': { + name: 'Protein Phosphatase 1', + concentrations: ['1u'], + short_name: 'PP1' + } + + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + }, + '40': { + name: "37" + degreeEntity + "C" + } + }, - cell_lines: { - 'p+': { - name: 'p53+/+;Rb+/+' - }, - 'pfl': { - name: 'p53fl/fl;Rbfl/fl' - } + cell_lines: { + 'wt': { + name: 'Wild Type' + }, + 'm1': { + name: 'Mutant 1' + }, + 'm2': { + name: 'Mutant 2' + } + + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['cdk1', 'cdk2', 'cdt1', 'cyclin', 'cyclinE', 'pgk1', 'rad21', 'securin'], + 'cdk1': { + name: 'rabbit anti-cdk1', + secondary: ['r'], + marks: [ + { + weight: 34, + intensity: 0 + }, + { + weight: 35, + intensity: 0 + }, + { + weight: 36, + intensity: 0 + } + ], + gel_name: 'cdk1' + }, + 'cdk2': { + name: 'rabbit anti-cdk2', + secondary: ['r'], + marks: [ + { + weight: 33, + intensity: 0 + }, + { + weight: 34, + intensity: 0 + }, + { + weight: 35, + intensity: 0 + } + ], + gel_name: 'cdk2' + }, + 'cdt1': { + name: 'rabbit anti-cdt1', + secondary: ['r'], + marks: [ + { + weight: 65, + intensity: 0 + }, + ], + gel_name: 'cdt1' + }, + 'cyclin': { + name: 'mouse anti-cyclin B', + secondary: ['m'], + marks: [ + { + weight: 58, + intensity: 0 + }, + ], + gel_name: 'cyclin B' + }, + 'cyclinE': { + name: 'mouse anti-cyclin E', + secondary: ['m'], + marks: [ + { + weight: 48, + intensity: 0 + }, + ], + gel_name: 'cyclin E' + }, + 'pgk1': { + name: 'rabbit anti-pgk1', + secondary: ['r'], + marks: [ + { + weight: 45, + intensity: 0 + }, + ], + gel_name: 'pgk1' + }, + 'rad21': { + name: 'rabbit anti-rad21', + secondary: ['r'], + marks: [ + { + weight: 68, + intensity: 0 + }, + ], + gel_name: 'rad21' + }, + 'securin': { + name: 'rabbit anti-securin', + secondary: ['r'], + marks: [ + { + weight: 41.8, + intensity: 0 + }, + ], + gel_name: 'securin' + } + }, // + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + }, + 'r': { + name: 'goat anti-rabbit' + } + }, // + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'whole': { + name: 'PI', + conditions: { + 'whole': { + name: 'PI' + } + } + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '*ANY*', + marks: [ + { + name: 'Cdt1', + weight: 65, + intensity: 1, + primary_anti_body: ['cdt1'] + }, - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['cdk2', 'cyclin', 'cyclinE', 'pgk1'], - 'cdk2': { - name: 'rabbit anti-cdk2', - secondary: ['r'], - marks: [ - {weight: 33, intensity: 0}, - {weight: 34, intensity: 0}, - {weight: 35, intensity: 0} - ], - gel_name: 'cdk2' - }, - 'cyclin': { - name: 'mouse anti-cyclin B', - secondary: ['m'], - marks: [ - {weight: 58, intensity: 0}, - ], - gel_name: 'cyclin B' - }, - 'cyclinE': { - name: 'mouse anti-cyclin E', - secondary: ['m'], - marks: [ - {weight: 48, intensity: 0}, - ], - gel_name: 'cyclin E' - }, - 'pgk1': { - name: 'rabbit anti-pgk1', - secondary: ['r'], - marks: [ - {weight: 45, intensity: 0}, - ], - gel_name: 'pgk1' - } - },// - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' + { + name: 'Cyclin B', + weight: 58, + intensity: 2, + primary_anti_body: ['cyclin'] }, - 'r': { - name: 'goat anti-rabbit' - } - },// - lysate_kinds: { - 'whole': { - name: 'Whole Cell' - } - }, - facs_kinds: { - 'whole':{ - name:'PI', - conditions: { - 'whole': {name: 'PI'} - } - } - }, - micro_kinds: { - 'IF':{ - name:'Antibody-labeling IF', - conditions: { - 'rgb': {name: 'NFIB (red), DAPI (blue), control (green)', - short_name: 'IF: RGB'} - } - }, - 'IHC':{ - name:'Antibody-labeling IHC', - conditions: { - 'NFIB': {name: 'NFIB', - short_name: 'IHC: NFIB'}, - 'ki67': {name: 'Ki-67', - short_name: 'IHC: Ki-67'}, - 'secondary': {name: 'Secondary only control', - short_name: 'IHC: Secondary'} - } - }, - 'Dye':{ - name: 'Dye/Stain', - conditions: { - 'HnE': {name: 'H&E', - short_name: 'Dye: H&E'} - } - - } - }, - slides:{ -// 'img1': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_1/AD20E1_20x.jpg', - 'img2': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_2/AD20E2_20x.jpg', - 'img3': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_3/AD22E1_20x.jpg', - 'img4': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_3/AD22E1_40x.jpg', - 'img5': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_4/AD27E2_20x.jpg', - 'img6': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_5/AD1024E_3_20x.jpg', - 'img7': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_6/AD901_8_4x.jpg', - 'img8': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_7/AD901_50_4x.jpg', - 'img9': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_8/AD901_52_4x.jpg', - 'img10': 'images/microscopy/microscopy_test/Normal_lung/HnE/Sample_9/AD1021E_20x.jpg', - - 'img11': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_1/AD1024E_2_20x.jpg', - 'img12': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_2/AD1024E_10x.jpeg', - 'img13': 'images/microscopy/microscopy_test/lung_3m/HnE/Sample_2/AD1024E_20x.jpeg', - - 'img14': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_1/AD900E1_40x.jpg', - 'img15': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_2/AD900E3_20x.jpg', - 'img16': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_2/AD900E3_40x.jpg', - 'img17': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_3/AD987E1_40x-3.jpg', - 'img18': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_4m/AD901E25-1_he_20x.jpg', - 'img19': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_4m/AD901E25-1_he_40x.jpg', - 'img20': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_5m/AD901E25-2_he_40x-2.jpg', - 'img21': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_6m/AD901E25-3_he_20x.jpg', - 'img22': 'images/microscopy/microscopy_test/lung_6m/HnE/Sample_6m/AD901E25-3_he_40x.jpg', - 'img23': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_2only_20x.jpeg', - 'img24': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_2only_40x.jpeg', - 'img25': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_ki-67_20x.jpeg', - 'img26': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_1/AD901E25-1_ki-67_40xadj.jpg', - 'img27': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_2/AD901E25-2_2only_40x.jpg', - 'img28': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_2/AD901E25-2_ki-67_40xadj.jpg', - 'img29': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_2only_20x-2.jpeg', - 'img30': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_2only_40x-2.jpeg', - 'img31': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_ki-67_20x-2.jpeg', - 'img32': 'images/microscopy/microscopy_test/lung_6m/matching/Sample_3/AD901E25-3_ki-67_40x-2.jpeg', - - 'img33': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_1/AD985E-1_20x-2.jpg', - 'img34': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_2/AD985E-1_20x.jpg', - 'img35': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_4X-2.jpg', - 'img36': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_10X.jpg', - 'img37': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_3/ad985T1_20X.jpg', - 'img38': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_4/AD990E-1_20x.jpg', - 'img39': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_5m/AD1017_HE_20X.jpg', - 'img40': 'images/microscopy/microscopy_test/lung_1yr/HnE/Sample_6m/AD3587E_HE_20X-1-2.jpg', - 'img41': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_blue_advanced4.jpeg', - 'img42': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_green_advanced4.jpeg', - 'img43': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_merge_advanced4.jpeg', - 'img44': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_1/AD3172EAD3172E_60X_red_advanced4.jpeg', - 'img45': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_2/AD3172E-02_60X_merge.jpg', - 'img46': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_3/AD984E2-01_R3D_D3D_PRJ_617_528_457_60X_merge.jpg', - 'img47': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_blue.jpeg', - 'img48': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_green.jpeg', - 'img49': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_merge.jpeg', - 'img50': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_4/G5G5_60X_red.jpeg', - 'img51': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_blue.jpeg', - 'img52': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_green.jpeg', - 'img53': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_merge.jpeg', - 'img54': 'images/microscopy/microscopy_test/lung_1yr/IF/Sample_5/J5J5_60X_red.jpeg', - 'img55': 'images/microscopy/microscopy_test/lung_1yr/match/Sample_1/AD1017_NFIB_20X.jpg', - 'img56': 'images/microscopy/microscopy_test/lung_1yr/match/Sample_2/AD3587E_NFIB_20X-1.jpg' - }, - slide_parser:{ - 'default':{ - 'Dye':{ - 'HnE':{ - // '1': [{ -// hash: 'img1', -// mag: '20x' -// }], - '1': [{ - hash: 'img2', - mag: '20x' - }], - '2': [{ - hash: 'img3', - mag: '20x' - }], - '3': [{ - hash: 'img5', - mag: '20x' - }], - '4': [{ - hash: 'img6', - mag: '20x' - }], - '5': [{ - hash: 'img7', - mag: '4x' - }], - '6': [{ - hash: 'img8', - mag: '4x' - }], - '7': [{ - hash: 'img9', - mag: '4x' - }], - '8': [{ - hash: 'img10', - mag: '20x' - }], - '9':[{ - hash: 'img4', - mag: '40x' - }] - } - } - }, - '3 m':{ - 'Dye':{ - 'HnE':{ - '1':[{ - hash: 'img11', - mag: '20x' - }], - '2':[{ - hash: 'img12', - mag:'10x' - }], - '3':[{ - hash: 'img13', - mag: '20x' - }] - } - } - }, - '6 m':{ - 'Dye':{ - 'HnE':{ - '1':[{ - hash: 'img14', - mag: '40x' - }], - '2':[{ - hash: 'img15', - mag:'20x' - }], - '3':[{ - hash: 'img17', - mag:'40x' - }], - '4':[{ - hash: 'img18', - mag:'20x' - }], - '5':[{ - hash: 'img20', - mag: '40x' - }], - '6':[{ - hash: 'img21', - mag:'20x' - }], - '7':[{ - hash: 'img16', - mag: '40x' - }], - '8':[{ - hash: 'img22', - mag: '40x' - }], - '9':[{ - hash: 'img19', - mag: '40x' - }] - } - }, - 'IHC':{ - 'secondary':{ - '1':[{ - hash: 'img23', - mag:'20x' - }], - '2':[{ - hash: 'img27', - mag: '40x' - }], - '3':[{ - hash: 'img29', - mag:'20x' - }], - '4':[{ - hash: 'img30', - mag: '40x' - }], - '5': [{ - hash: 'img24', - mag: '40x' - }] - }, - 'ki67':{ - '1':[{ - hash: 'img25', - mag:'20x' - }], - '2':[{ - hash: 'img28', - mag: '40x' - }], - '3':[{ - hash: 'img31', - mag:'20x' - }], - '4':[{ - hash: 'img26', - mag: '40x' - }], - '5':[{ - hash: 'img32', - mag: '40x' - }] - } - } - }, - '1 yr':{ - 'Dye':{ - 'HnE':{ - '1':[{ - hash: 'img33', - mag:'20x' - }], - '2': [{ - hash: 'img34', - mag:'20x' - }], - '3':[{ - hash: 'img35', - mag:'4x' - }], - '4':[{ - hash: 'img38', - mag:'20x' - }], - '5':[{ - hash: 'img39', - mag:'20x' - }], - '6':[{ - hash: 'img40', - mag:'20x' - }], - '7': [{ - hash: 'img36', - mag:'10x' - }], - '8': [{ - hash: 'img37', - mag:'20x' - }] - } - }, - 'IF': { - 'rgb':{ - '1':[{ - hash: 'img44', - if_type: 'red', - mag:'60x' - }, - { - hash: 'img41', - if_type: 'blue', - mag:'60x' - }, - { - hash: 'img42', - if_type: 'green', - mag:'60x' - }, - { - hash: 'img43', - if_type: 'merge', - mag:'60x' - }], - '2':[{ - hash: 'img45', - if_type: 'merge', - mag:'60x' - }], - '3':[{ - hash: 'img46', - if_type: 'merge', - mag:'60x' - }], - '4':[{ - hash: 'img50', - if_type: 'red', - mag:'60x' - }, - { - hash: 'img47', - if_type: 'blue', - mag:'60x' - }, - { - hash: 'img48', - if_type: 'green', - mag:'60x' - }, - { - hash: 'img49', - if_type: 'merge', - mag:'60x' - }], - '5':[{ - hash: 'img54', - if_type: 'red', - mag:'60x' - }, - { - hash: 'img51', - if_type: 'blue', - mag:'60x' - }, - { - hash: 'img52', - if_type: 'green', - mag:'60x' - }, - { - hash: 'img53', - if_type: 'merge', - mag:'60x' - }] - } - }, - 'IHC': { - 'NFIB':{ - '1':[{ - hash: 'img55', - mag:'20x' - }], - '2':[{ - hash: 'img56', - mag:'20x' - }] - } - } - - } - }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '*ANY*', - marks: [ - { - name: 'Cyclin B', - weight: 58, - intensity: 2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: 4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } - - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'pp1', - cell_line: '*ANY*', - above_marks: [ - { - name: 'Cdk2', - weight: 33, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - } - ], - below_marks: [ - { - name: 'Cdk2', - weight: 34, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'wt', - marks: [ - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm1', - temperature: '40', - marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm2', - temperature: '40', - marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Nocodazole', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Hydroxyurea', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Alpha', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdk2', - weight: 34, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - } - ] - } + { + name: 'Securin', + weight: 41.8, + intensity: 1, + primary_anti_body: ['securin'] }, - facs: { - 'dna': { - 'parser_simple': [ - { - match: [], - shape: 'normal' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm1', - temperature: 40, - shape: 'g2-block' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm2', - temperature: 40, - shape: 'S-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Nocodazole', - shape: 'g2-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Alpha', - shape: 'alpha-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Hydroxyurea', - shape: 'S-block' - } - ] - } + { + name: 'Cyclin E', + weight: 48, + intensity: 4, + primary_anti_body: ['cyclinE'] }, - microscopy: { - 'valid': ['pfl', 'ac'], - 'slide': { - - 'parser_simple':[ - { - match: [], - - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind','conditions'], - cell_line: 'pfl', - drug_id: 'ac', - collection_id: '3 m', - kind: 'Dye', - conditions: 'HnE' - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind','conditions'], - cell_line: 'pfl', - drug_id: 'ac', - collection_id: '6 m', - kind: 'Dye', - conditions: 'HnE' - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind','conditions'], - cell_line: 'pfl', - drug_id: 'ac', - collection_id: '6 m', - kind: 'IHC', - conditions: 'secondary' - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind','conditions'], - cell_line: 'pfl', - drug_id: 'ac', - collection_id: '6 m', - kind: 'IHC', - conditions: 'ki67' - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind','conditions'], - cell_line: 'pfl', - drug_id: 'ac', - collection_id: '1 yr', - kind: 'Dye', - conditions: 'HnE' - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind','conditions'], - cell_line: 'pfl', - drug_id: 'ac', - collection_id: '1 yr', - kind: 'IF', - conditions: 'rgb' - }, - { - match: ['cell_line', 'drug_id', 'collection_id', 'kind','conditions'], - cell_line: 'pfl', - drug_id: 'ac', - collection_id: '1 yr', - kind: 'IHC', - conditions: 'NFIB' - } - - ] - - } - } - - } - } - }; - -var __assigment_706 = { - id: 'mit_7_06_0313', - name: '7.06 Spring 2013', - course: '7.06', - course_name: 'MIT Course 7.06', - description: 'FACS and Western Blot for temperature sensitive mutants', - notebook: {}, - experiments: {}, - template: { - instructions: [ - ['Goal & Introduction','Here come instructions when we build them'] - ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs' ] - }, - experiment_setup: { - table: [ // - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, // - {kind: 'treatments', - children: [// - {kind: 'drug', title: 'Treatment', editable: false},// - {kind: 'concentration', title: 'Concentration', editable: false}// - ] - },// - {kind: 'temperature', title: 'Temperature', editable: false},// - {kind: 'actions', title: 'Actions'}// - ],// - actions: [ - - ] - }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%, %PP1% %TEMPERATURE%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], map: ['drugs', '%KEY%', 'name']}, - '%CONCENTRATION%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'concentration_id'], map: ['concentrations', '%KEY%', 'name']}, - '%TEMPERATURE%': {attr: ['treatment_list', 'list', '0', 'temperature'], map: ['experiment_temperatures', '%KEY%', 'name']}, - '%PP1%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '1', 'drug_id'], map: ['drugs', '%KEY%', 'short_name'], default: ''} - } + { + name: 'rad21', + weight: 68, + intensity: 1, + primary_anti_body: ['rad21'] }, - add_multiple_dialog: { - 'wt': { - title: 'Strain: Wild Type', - headings: [ - 'Treatment', 'Temperature', '- PP1', '+ PP1' - ], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'text', text: 'Nocodazole'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'nocodazole,25', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Nocodazole', concentration_id: '15'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Nocodazole', concentration_id: '15'} - ]}, temperature: '25' - } - ]}} - ] - } - } - , - { - cells: [ - {kind: 'text', text: 'Nocodazole'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'nocodazole,40', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Nocodazole', concentration_id: '15'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Nocodazole', concentration_id: '15'} - ]}, temperature: '40' - } - ]}} - ] - } - } - , - - { - cells: [ - {kind: 'text', text: 'Hydroxyurea'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'hydroxyurea,25', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Hydroxyurea', concentration_id: '200'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Hydroxyurea', concentration_id: '200'} - ]}, temperature: '25' - } - ]}} - ] - } - } - , - { - cells: [ - {kind: 'text', text: 'Hydroxyurea'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'hydroxyurea,40', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Hydroxyurea', concentration_id: '200'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Hydroxyurea', concentration_id: '200'} - ]}, temperature: '40' - } - ]}} - ] - } - } - , - { - cells: [ - {kind: 'text', text: 'Alpha Factor'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'alpha_factor,25', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Alpha', concentration_id: '2'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Alpha', concentration_id: '2'} - ]}, temperature: '25' - } - ]}} - ] - } - } - , - { - cells: [ - {kind: 'text', text: 'Alpha Factor'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'alpha_factor,40', - cell_treatments: { - PP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Alpha', concentration_id: '2'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'wt', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'Alpha', concentration_id: '2'} - ]}, temperature: '40' - } - ]}} - ] - } - } - - ] - }, - 'm1': { - title: 'Strain: Mutant 1', - - headings: [ - 'Treatment', 'Temperature', '- PP1', '+ PP1' - ], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - PP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - PP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'm1', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } - } - ] - - }, - 'm2': { - title: 'Strain: Mutant 2', - - headings: [ - 'Treatment', 'Temperature', '- PP1', '+ PP1' - ], - rows: [ - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "30 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'media_only,25', - cell_treatments: { - PP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '25' - } - ]}} - ], NOPP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '25' - } - ]}} - ] - } - }, - { - cells: [ - {kind: 'text', text: 'Growth Media'}, - {kind: 'text', text: "37 " + degreeEntity + "C"}, - {kind: 'checkbox', name: 'NOPP1'}, - {kind: 'checkbox', name: 'PP1'} - ], - treatment_id: 'media_only,40', - cell_treatments: { - PP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'}, - {drug_id: 'pp1', concentration_id: '1u'} - ]}, temperature: '40' - } - ]}} - ], NOPP1: [ - {cell_line: 'm2', - treatment_list: {list: [ - {drug_list: {list: [ - {drug_id: 'nc', concentration_id: '0'} - ]}, temperature: '40' - } - ]}} - ] - } - } - ] - - } + { + name: 'pgk1', + weight: 45, + intensity: 10, + primary_anti_body: ['pgk1'] } - }, - add_new_row_instructions: 'add new row instructions', - concentrations: { - '0': { - name: '', - value: 0 + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'pp1', + cell_line: '*ANY*', + above_marks: [ + { + name: 'Cdk1', + weight: 34, //35&36 + intensity: .5, + primary_anti_body: ['cdk1'] }, - '2': { - name: '2 ' + microEntity + 'g/mL', - value: 5 + { + name: 'Cdk2', + weight: 33, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] + } + ], + below_marks: [ + { + name: 'Cdk1', + weight: 35, //35&36 + intensity: .5, + primary_anti_body: ['cdk1'] }, - '15': { - name: '15 ' + microEntity + 'g/mL', - value: 5 + { + name: 'Cdk1', + weight: 36, //35&36 + intensity: .5, + primary_anti_body: ['cdk1'] }, - '200': { - name: '200 mM', - value: 5 + { + name: 'Cdk2', + weight: 34, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] }, - '1u': { - name: '1 unit', - value: 1000 - } - }, - drugs: { - 'nc': { - name: 'Growth Media', - concentrations: [0] - }, - 'Nocodazole': { - name: 'Nocodazole', - concentrations: [15] - }, - 'Alpha': { - name: 'Alpha Factor', - concentrations: [2] - }, - 'Hydroxyurea': { - name: 'Hydroxyurea', - concentrations: [200] - }, - 'pp1': { - name: 'Protein Phosphatase 1', - concentrations: ['1u'], - short_name: 'PP1' + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: .3, + primary_anti_body: ['cdk2'] } - - }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" + ] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'wt', + marks: [ + { + name: 'Rad21', + weight: 29.5, // 34&35 + intensity: .1, + primary_anti_body: ['rad21'] }, - '40': { - name: "37" + degreeEntity + "C" + { + name: 'Rad21', + weight: 19.9, // 34&35 + intensity: .1, + primary_anti_body: ['rad21'] } - }, - - cell_lines: { - 'wt': { - name: 'Wild Type' + ] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm1', + temperature: '40', + marks: [ + { + name: 'Cdt1', + weight: 65, + intensity: -1, + primary_anti_body: ['cdt1'] + }, + { + name: 'Cdk1', + weight: 36, //35&36 + intensity: -1, + primary_anti_body: ['cdk1'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Securin', + weight: 41.8, + intensity: -1, + primary_anti_body: ['securin'] + }, + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: -1, + primary_anti_body: ['rad21'] }, - 'm1': { - name: 'Mutant 1' + { + name: 'Rad21', + weight: 29.5, // 34&35 + intensity: 1, + primary_anti_body: ['rad21'] }, - 'm2': { - name: 'Mutant 2' + { + name: 'Rad21', + weight: 19.9, // 34&35 + intensity: 1, + primary_anti_body: ['rad21'] } - - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['cdk1', 'cdk2', 'cdt1', 'cyclin', 'cyclinE', 'pgk1', 'rad21', 'securin'], - 'cdk1': { - name: 'rabbit anti-cdk1', - secondary: ['r'], - marks: [ - {weight: 34, intensity: 0}, - {weight: 35, intensity: 0}, - {weight: 36, intensity: 0} - ], - gel_name: 'cdk1' - }, - 'cdk2': { - name: 'rabbit anti-cdk2', - secondary: ['r'], - marks: [ - {weight: 33, intensity: 0}, - {weight: 34, intensity: 0}, - {weight: 35, intensity: 0} - ], - gel_name: 'cdk2' - }, - 'cdt1': { - name: 'rabbit anti-cdt1', - secondary: ['r'], - marks: [ - {weight: 65, intensity: 0}, - ], - gel_name: 'cdt1' - }, - 'cyclin': { - name: 'mouse anti-cyclin B', - secondary: ['m'], - marks: [ - {weight: 58, intensity: 0}, - ], - gel_name: 'cyclin B' - }, - 'cyclinE': { - name: 'mouse anti-cyclin E', - secondary: ['m'], - marks: [ - {weight: 48, intensity: 0}, - ], - gel_name: 'cyclin E' - }, - 'pgk1': { - name: 'rabbit anti-pgk1', - secondary: ['r'], - marks: [ - {weight: 45, intensity: 0}, - ], - gel_name: 'pgk1' - }, - 'rad21': { - name: 'rabbit anti-rad21', - secondary: ['r'], - marks: [ - {weight: 68, intensity: 0}, - ], - gel_name: 'rad21' - }, - 'securin': { - name: 'rabbit anti-securin', - secondary: ['r'], - marks: [ - {weight: 41.8, intensity: 0}, - ], - gel_name: 'securin' + ] + }, + { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: 'm2', + temperature: '40', + marks: [ + { + name: 'Cdt1', + weight: 65, + intensity: -.8, + primary_anti_body: ['cdt1'] + }, + { + name: 'Cdk1', + weight: 35, //35&36 + intensity: -1, + primary_anti_body: ['cdk1'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] } - },// - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Nocodazole', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdt1', + weight: 65, + intensity: -2, + primary_anti_body: ['cdt1'] }, - 'r': { - name: 'goat anti-rabbit' + { + name: 'Cdk1', + weight: 36, //35&36 + intensity: -1, + primary_anti_body: ['cdk1'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + }, + , + { + name: 'Rad21', + weight: 29.5, // 34&35 + intensity: -1, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 19.9, // 34&35 + intensity: -1, + primary_anti_body: ['rad21'] } - },// - lysate_kinds: { - 'whole': { - name: 'Whole Cell' + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Hydroxyurea', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdt1', + weight: 65, + intensity: -.8, + primary_anti_body: ['cdt1'] + }, + { + name: 'Cdk1', + weight: 35, //35&36 + intensity: -1, + primary_anti_body: ['cdk1'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Rad21', + weight: 29.5, // 34&35 + intensity: -1, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 19.9, // 34&35 + intensity: -1, + primary_anti_body: ['rad21'] } - }, - facs_kinds: { - 'whole':{ - name:'PI', - conditions: { - 'whole': {name: 'PI'} - } - } - }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '*ANY*', - marks: [ - { - name: 'Cdt1', - weight: 65, - intensity: 1, - primary_anti_body: ['cdt1'] - }, - - { - name: 'Cyclin B', - weight: 58, - intensity: 2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Securin', - weight: 41.8, - intensity: 1, - primary_anti_body: ['securin'] - }, - - { - name: 'Cyclin E', - weight: 48, - intensity: 4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'rad21', - weight: 68, - intensity: 1, - primary_anti_body: ['rad21'] - }, - { - name: 'pgk1', - weight: 45, - intensity: 10, - primary_anti_body: ['pgk1'] - } - - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'pp1', - cell_line: '*ANY*', - above_marks: [ - { - name: 'Cdk1', - weight: 34, //35&36 - intensity: .5, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 33, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - } - ], - below_marks: [ - { - name: 'Cdk1', - weight: 35, //35&36 - intensity: .5, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk1', - weight: 36, //35&36 - intensity: .5, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 34, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: .3, - primary_anti_body: ['cdk2'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'wt', - marks: [ - { - name: 'Rad21', - weight: 29.5, // 34&35 - intensity: .1, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, // 34&35 - intensity: .1, - primary_anti_body: ['rad21'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm1', - temperature: '40', - marks: [ - { - name: 'Cdt1', - weight: 65, - intensity: -1, - primary_anti_body: ['cdt1'] - }, - { - name: 'Cdk1', - weight: 36, //35&36 - intensity: -1, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Securin', - weight: 41.8, - intensity: -1, - primary_anti_body: ['securin'] - }, - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: -1, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 29.5, // 34&35 - intensity: 1, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, // 34&35 - intensity: 1, - primary_anti_body: ['rad21'] - } - ] - }, - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: 'm2', - temperature: '40', - marks: [ - { - name: 'Cdt1', - weight: 65, - intensity: -.8, - primary_anti_body: ['cdt1'] - }, - { - name: 'Cdk1', - weight: 35, //35&36 - intensity: -1, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Nocodazole', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdt1', - weight: 65, - intensity: -2, - primary_anti_body: ['cdt1'] - }, - { - name: 'Cdk1', - weight: 36, //35&36 - intensity: -1, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - }, - , - { - name: 'Rad21', - weight: 29.5, // 34&35 - intensity: -1, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, // 34&35 - intensity: -1, - primary_anti_body: ['rad21'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Hydroxyurea', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdt1', - weight: 65, - intensity: -.8, - primary_anti_body: ['cdt1'] - }, - { - name: 'Cdk1', - weight: 35, //35&36 - intensity: -1, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Rad21', - weight: 29.5, // 34&35 - intensity: -1, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, // 34&35 - intensity: -1, - primary_anti_body: ['rad21'] - } - ] - }, - { - transfer_function: 'delta', - cutoff: 1, - drug: 'Alpha', - cell_line: 'wt', - above_marks: [ - { - name: 'Cdt1', - weight: 65, - intensity: 0, - primary_anti_body: ['cdt1'] - }, - { - name: 'Cdk1', - weight: 35, //35&36 - intensity: -1, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 34, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Rad21', - weight: 29.5, // 34&35 - intensity: -1, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, // 34&35 - intensity: -1, - primary_anti_body: ['rad21'] - } - ] - } - ] - } + ] + }, + { + transfer_function: 'delta', + cutoff: 1, + drug: 'Alpha', + cell_line: 'wt', + above_marks: [ + { + name: 'Cdt1', + weight: 65, + intensity: 0, + primary_anti_body: ['cdt1'] }, - facs: { - 'dna': { - 'parser_simple': [ - { - match: [], - shape: 'normal' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm1', - temperature: 40, - shape: 'g2-block' - }, - { - match: ['cell_line', 'temperature'], - cell_line: 'm2', - temperature: 40, - shape: 'S-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Nocodazole', - shape: 'g2-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Alpha', - shape: 'alpha-block' - }, - { - match: ['cell_line', 'drug_id'], - cell_line: 'wt', - drug_id: 'Hydroxyurea', - shape: 'S-block' - } - ] - - } + { + name: 'Cdk1', + weight: 35, //35&36 + intensity: -1, + primary_anti_body: ['cdk1'] + }, + { + name: 'Cdk2', + weight: 34, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Rad21', + weight: 29.5, // 34&35 + intensity: -1, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 19.9, // 34&35 + intensity: -1, + primary_anti_body: ['rad21'] } + ] + } + ] + } + }, + facs: { + 'dna': { + 'parser_simple': [ + { + match: [], + shape: 'normal' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm1', + temperature: 40, + shape: 'g2-block' + }, + { + match: ['cell_line', 'temperature'], + cell_line: 'm2', + temperature: 40, + shape: 'S-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Nocodazole', + shape: 'g2-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Alpha', + shape: 'alpha-block' + }, + { + match: ['cell_line', 'drug_id'], + cell_line: 'wt', + drug_id: 'Hydroxyurea', + shape: 'S-block' } + ] + } - }; + } + } + } +}; ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// @@ -4483,732 +6220,787 @@ var __assigment_706 = { ///NEW ASSIGNMENTS////////// - -var blank_model = { - id: '', - name: '', - course: '', - course_name: '', - description: '', - notebook: {}, - experiments: {}, - template: { - random_choose: true, - randomize_all: false, - random_order: [], - finished_random: false, - instructions: [ - ['',''] - ], - ui: { - experimental_design: { - techniques: [ 'wb' , 'facs', 'micro' ] - }, - experiment_setup: { - table: [ // - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, // - {kind: 'treatments', - children: [// - {kind: 'drug', title: 'Treatment', editable: false},// - {kind: 'duration', title: 'Time', editable: false}, - ] - },// - {kind: 'actions', title: 'Actions'}// - ],// - actions: [ - ] +var blank_model = { + id: '', + name: '', + course: '', + course_name: '', + description: '', + notebook: {}, + experiments: {}, + template: { + random_choose: true, + randomize_all: false, + random_order: [], + finished_random: false, + instructions: [ + ['', ''] + ], + ui: { + experimental_design: { + techniques: ['wb', 'facs', 'micro'] + }, + experiment_setup: { + table: [ // + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, // + { + kind: 'treatments', + children: [ // + { + kind: 'drug', + title: 'Treatment', + editable: false + }, // + { + kind: 'duration', + title: 'Time', + editable: false + }, + ] + }, // + { + kind: 'actions', + title: 'Actions' + } // + ], // + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + } + }, + microscopy: { + disable_blur: true, + disable_brightness: true + }, + add_multiple_dialog: { + order: ['S2'], + headings: [ + '', 'Strain', 'Treatment', 'Treatment Duration' + ], + 'S2': { + rows: [ + { + cells: [ + { + kind: 'checkbox', + name: "B", + treatment_id: 'buffer' }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], map: ['drugs', '%KEY%', 'name']}, - } + { + kind: 'text', + text: 'S2' }, - microscopy: { - disable_blur: true, - disable_brightness: true - }, - add_multiple_dialog: { - order: ['S2'], - headings: [ - '','Strain', 'Treatment', 'Treatment Duration' - ], - 'S2': { - rows: [ - { - cells: [ - {kind: 'checkbox', name: "B", treatment_id: 'buffer'}, - {kind: 'text', text: 'S2'}, - {kind: 'text', text: 'Control siRNA'}, - {kind: 'text', text: "3 days"} - ], - treatment_id: 'buffer', - cell_treatments: { - B: [ - {cell_line: 'S2', - treatment_list: {list: [ - {collection_id: 'default', microscope: ['rgb', 'g', 'gr', 'rb'], - duration_value: 3600 * 24 * 3, duration: '3 d', - drug_list: {list: [ - {drug_id: 'nc', concentration_id: '100'}, - ]}, temperature: '25' - } - ]}} - ] - } - } - ] - } - } - }, - add_new_row_instructions: 'add new row instructions', - collections:{ - '': { - name: '' - } - }, - concentrations: { - 100: { - name: '', - value: 100 - } - }, - drugs: { - 'nc': { - name: 'Control siRNA', - concentrations: [100] + { + kind: 'text', + text: 'Control siRNA' + }, + { + kind: 'text', + text: "3 days" } + ], + treatment_id: 'buffer', + cell_treatments: { + B: [ + { + cell_line: 'S2', + treatment_list: { + list: [ + { + collection_id: 'default', + microscope: ['rgb', 'g', 'gr', 'rb'], + duration_value: 3600 * 24 * 3, + duration: '3 d', + drug_list: { + list: [ + { + drug_id: 'nc', + concentration_id: '100' + }, + ] + }, + temperature: '25' + } + ] + } + } + ] + } + } + ] + } + } + }, + add_new_row_instructions: 'add new row instructions', + collections: { + '': { + name: '' + } + }, + concentrations: { + 100: { + name: '', + value: 100 + } + }, + drugs: { + 'nc': { + name: 'Control siRNA', + concentrations: [100] + } - }, - experiment_temperatures: { - '25': { - name: "30" + degreeEntity + "C" - } - }, - cell_lines: { - 'S2': { - name: 'S2' - } + }, + experiment_temperatures: { + '25': { + name: "30" + degreeEntity + "C" + } + }, + cell_lines: { + 'S2': { + name: 'S2' + } - }, - time_unit: { - kind: 'minutes' - }, - primary_anti_body: { - order: ['chk1'], - 'chk1': { - name: 'rabbit anti-chk1', - secondary: ['r'], - marks: [ - {weight: 54, intensity: 0} - ], - gel_name: 'chk1' - }, - },// - secondary_anti_body: { - 'm': { - name: 'rabbit anti-mouse' - } - },// - lysate_kinds: { - 'whole': { - name: 'Whole Cell' + }, + time_unit: { + kind: 'minutes' + }, + primary_anti_body: { + order: ['chk1'], + 'chk1': { + name: 'rabbit anti-chk1', + secondary: ['r'], + marks: [ + { + weight: 54, + intensity: 0 + } + ], + gel_name: 'chk1' + }, + }, // + secondary_anti_body: { + 'm': { + name: 'rabbit anti-mouse' + } + }, // + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + } + }, + facs_kinds: { + 'whole': { + name: 'PI', + conditions: { + 'whole': { + name: 'PI' + } + } + } + }, + micro_kinds: { + 'IF': { + name: 'Antibody-labeling IF', + conditions: { + 'rgb': { + name: 'γ-tubulin (red), α-tubulin (green), DAPI (blue)', + short_name: 'R:γ-tub, G:α-tub, B:DAPI' + }, + 'g': { + name: 'H2B (green)', + short_name: 'G:H2B' + } + } + } + }, + slides: { + 'img0001': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_DNA-blue_Mad2-red/Mad2_off_kinetochores/Mad2_Cytoplasm_cropped.jpg' + }, + slide_parser: { + 'default': { + 'IF': { + 'rgb': { + 'interphase': [ + [{ + 'hash': 'img0004', + 'if_type': 'merge', + 'mag': 'N/A' + }] + ] + } + } + } + }, + model: { // models + western_blot: { + 'cyto': { + 'parser_fixed': [ + { + transfer_function: 'delta', + cutoff: 1, + drug: 'nc', + cell_line: 'S2', + above_marks: [ + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: 4, + primary_anti_body: ['rad21'] } - }, - facs_kinds: { - 'whole':{ - name:'PI', - conditions: { - 'whole': {name: 'PI'} - } - } - }, - micro_kinds: { - 'IF':{ - name:'Antibody-labeling IF', - conditions: { - 'rgb': {name: 'γ-tubulin (red), α-tubulin (green), DAPI (blue)', - short_name: 'R:γ-tub, G:α-tub, B:DAPI'}, - 'g': {name: 'H2B (green)', - short_name: 'G:H2B'} - } - } - }, - slides: { - 'img0001': 'images/microscopy/assignment_706_2014_ps2/Antibody_Labeling_DNA-blue_Mad2-red/Mad2_off_kinetochores/Mad2_Cytoplasm_cropped.jpg' - }, - slide_parser: { - 'default':{ - 'IF':{ - 'rgb':{ - 'interphase':[ - [{'hash': 'img0004', 'if_type': 'merge', 'mag': 'N/A'}] - ] - } - } - } - }, - model: { // models - western_blot: { - 'cyto': { - 'parser_fixed': [ - { - transfer_function: 'delta', - cutoff: 1, - drug: 'nc', - cell_line: 'S2', - above_marks: [ - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: 4, - primary_anti_body: ['rad21'] - } - ] - } - ] - } - }, - facs: { - 'ticks': [50, 100, 150, 250], - 'max': 250, - 'dna': { - 'parser_simple': [ - { - match: [], - shape: '2-peak-normal-400' - }, - { - match: ['drug_id'], - drug_id: 'nc', - shape: '2-peak-normal-400' - } - ] + ] + } + ] + } + }, + facs: { + 'ticks': [50, 100, 150, 250], + 'max': 250, + 'dna': { + 'parser_simple': [ + { + match: [], + shape: '2-peak-normal-400' + }, + { + match: ['drug_id'], + drug_id: 'nc', + shape: '2-peak-normal-400' + } + ] - } - }, - microscopy: { - 'valid': ['S2', 'nc'], - 'slide': { - - 'conditions_parser':[ - { - match: [], - - }, - { - match: ['cell_line', 'drug_id', 'conditions'], - cell_line: 'S2', - drug_id: ['nc'], - conditions: 'rgb', - phenotype: 'composite3' - } - ] - - } - } - + } + }, + microscopy: { + 'valid': ['S2', 'nc'], + 'slide': { + + 'conditions_parser': [ + { + match: [], + + }, + { + match: ['cell_line', 'drug_id', 'conditions'], + cell_line: 'S2', + drug_id: ['nc'], + conditions: 'rgb', + phenotype: 'composite3' } + ] + } - } - - + } + + } + } +} + + var ps2_strain_A = { - 'western_blot': - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '', - temperature: '40', - marks: [ - { - name: 'Cdt1', - weight: 65, - intensity: -1, - primary_anti_body: ['cdt1'] - }, - { - name: 'Cdk1', - weight: 36, //35&36 - intensity: -1, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - }, - { - name: 'Cyclin E', - weight: 48, - intensity: -4, - primary_anti_body: ['cyclinE'] - }, - { - name: 'Securin', - weight: 41.8, - intensity: -1, - primary_anti_body: ['securin'] - }, - { - name: 'Rad21', - weight: 68, // 34&35 - intensity: -1, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 29.5, // 34&35 - intensity: 1, - primary_anti_body: ['rad21'] - }, - { - name: 'Rad21', - weight: 19.9, // 34&35 - intensity: 1, - primary_anti_body: ['rad21'] - } - ] - }, - 'facs': - { - match: ['cell_line', 'temperature'], - cell_line: '', - temperature: 40, - shape: 'g2-block' - } - - }; - -var ps2_strain_B = { - 'western_blot': - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '', - temperature: '40', - marks: [ - { - name: 'Cdt1', - weight: 65, - intensity: -.8, - primary_anti_body: ['cdt1'] - }, - { - name: 'Cdk1', - weight: 35, //35&36 - intensity: -1, - primary_anti_body: ['cdk1'] - }, - { - name: 'Cdk2', - weight: 35, // 34&35 - intensity: -1, - primary_anti_body: ['cdk2'] - }, - { - name: 'Cyclin B', - weight: 58, - intensity: -2, - primary_anti_body: ['cyclin'] - } - ] - }, - 'facs': - { - match: ['cell_line', 'temperature'], - cell_line: '', - temperature: 40, - shape: 'S-block' - } - }; + 'western_blot': { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '', + temperature: '40', + marks: [ + { + name: 'Cdt1', + weight: 65, + intensity: -1, + primary_anti_body: ['cdt1'] + }, + { + name: 'Cdk1', + weight: 36, //35&36 + intensity: -1, + primary_anti_body: ['cdk1'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + }, + { + name: 'Cyclin E', + weight: 48, + intensity: -4, + primary_anti_body: ['cyclinE'] + }, + { + name: 'Securin', + weight: 41.8, + intensity: -1, + primary_anti_body: ['securin'] + }, + { + name: 'Rad21', + weight: 68, // 34&35 + intensity: -1, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 29.5, // 34&35 + intensity: 1, + primary_anti_body: ['rad21'] + }, + { + name: 'Rad21', + weight: 19.9, // 34&35 + intensity: 1, + primary_anti_body: ['rad21'] + } + ] + }, + 'facs': { + match: ['cell_line', 'temperature'], + cell_line: '', + temperature: 40, + shape: 'g2-block' + } + +}; + +var ps2_strain_B = { + 'western_blot': { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '', + temperature: '40', + marks: [ + { + name: 'Cdt1', + weight: 65, + intensity: -.8, + primary_anti_body: ['cdt1'] + }, + { + name: 'Cdk1', + weight: 35, //35&36 + intensity: -1, + primary_anti_body: ['cdk1'] + }, + { + name: 'Cdk2', + weight: 35, // 34&35 + intensity: -1, + primary_anti_body: ['cdk2'] + }, + { + name: 'Cyclin B', + weight: 58, + intensity: -2, + primary_anti_body: ['cyclin'] + } + ] + }, + 'facs': { + match: ['cell_line', 'temperature'], + cell_line: '', + temperature: 40, + shape: 'S-block' + } +}; var ps2_strain_C = { - 'western_blot': - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '', - temperature: '40', - marks: [ - { - name: 'Cyclin E', - weight: 148, - intensity: 4, - primary_anti_body: ['cyclinE'] - } - ] - }, - 'facs': - { - match: ['cell_line', 'temperature'], - cell_line: '', - temperature: 40, - shape: 'g1-block' - } - - }; - -var ps2_strain_D = { - 'western_blot': - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '', - temperature: '40', - marks: [ - { - name: 'Cyclin E', - weight: 25, - intensity: 4, - primary_anti_body: ['cyclinE'] - } - ] - }, - 'facs': - { - match: ['cell_line', 'temperature'], - cell_line: '', - temperature: 40, - shape: 'alpha-block' - } - - - }; - -var ps2_strain_E = { - 'western_blot': - { - transfer_function: 'static', - cutoff: -1, - drug: 'nc', - cell_line: '', - temperature: '40', - marks: [ - { - name: 'Cyclin E', - weight: 15, - intensity: 4, - primary_anti_body: ['cyclinE'] - } - ] - }, - 'facs': - { - match: ['cell_line', 'temperature'], - cell_line: '', - temperature: 40, - shape: 'g2-block' - } - - }; + 'western_blot': { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '', + temperature: '40', + marks: [ + { + name: 'Cyclin E', + weight: 148, + intensity: 4, + primary_anti_body: ['cyclinE'] + } + ] + }, + 'facs': { + match: ['cell_line', 'temperature'], + cell_line: '', + temperature: 40, + shape: 'g1-block' + } + +}; + +var ps2_strain_D = { + 'western_blot': { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '', + temperature: '40', + marks: [ + { + name: 'Cyclin E', + weight: 25, + intensity: 4, + primary_anti_body: ['cyclinE'] + } + ] + }, + 'facs': { + match: ['cell_line', 'temperature'], + cell_line: '', + temperature: 40, + shape: 'alpha-block' + } + + +}; + +var ps2_strain_E = { + 'western_blot': { + transfer_function: 'static', + cutoff: -1, + drug: 'nc', + cell_line: '', + temperature: '40', + marks: [ + { + name: 'Cyclin E', + weight: 15, + intensity: 4, + primary_anti_body: ['cyclinE'] + } + ] + }, + 'facs': { + match: ['cell_line', 'temperature'], + cell_line: '', + temperature: 40, + shape: 'g2-block' + } + +}; master_model_data = { - app_title: 'StarCellBio', - app_description: 'StarCellBio Placeholder', - assignments: { - list: [ - __decusability, __assignment_706_2014, __assignment_706_2014_ps2, __june_2014_usability, __sutd_intro_biology, - __scb_sample_1, __scb_sample_2, __scb_sample_3,__sutd_intro_biology_ps2 - ] - }, - ui: {} + app_title: 'StarCellBio', + app_description: 'StarCellBio Placeholder', + assignments: { + list: [ + __decusability, __assignment_706_2014, __assignment_706_2014_ps2, __june_2014_usability, __sutd_intro_biology, + __scb_sample_1, __scb_sample_2, __scb_sample_3, __sutd_intro_biology_ps2 + ] + }, + ui: {} }; window.master_model_data = master_model_data; -var fix_assignment_models = function (assignment_result) { - console.log(assignment_result); - var usability_test = {}; - var assignment_706 = {}; - var decusability = {}; - var decusability_newfacs = {}; - var assignment_tufts = {}; - var microscopy_test ={}; - var assignment_706_2014 ={}; - var assignment_706_2014_ps2 ={}; - var june_2014_usability = {}; - var sutd_intro_biology = {}; - for (var x = 0; x < assignment_result.length; x++){ - if(assignment_result[x].id == 'usability_test'){ - usability_test = assignment_result[x]; - usability_test.description = scb_model_microscopy.abstract(); - usability_test.template.setup_video_box = scb_model_microscopy.setup_video_box(); - usability_test.template.setup_video_box_kind = 'coin-slider'; - - usability_test.template.experiment_setup = scb_model_usability.experiment_setup(); - - assignment_result[x] = usability_test; - } - if(assignment_result[x].id == 'microscopy_test'){ - microscopy_test = assignment_result[x]; - microscopy_test.description = scb_model_microscopy.abstract(); - microscopy_test.template.setup_video_box = scb_model_microscopy.setup_video_box(); - microscopy_test.template.setup_video_box_kind = 'coin-slider'; - - microscopy_test.template.experiment_setup = scb_model_microscopy.experiment_setup(); - - assignment_result[x] = microscopy_test; - } - if(assignment_result[x].id == 'mit_7_06_0313'){ - assignment_706 = assignment_result[x]; - assignment_706.description = scb_assignment_specific_mit706s13.assignment_overview(); - assignment_706.template.instructions = [ - ['Goal & Introduction', scb_assignment_specific_mit706s13.goal_and_introduction()], - ['Question 1',scb_assignment_specific_mit706s13.question_1()], - ['Question 2', scb_assignment_specific_mit706s13.question_2()], - ['Question 3', scb_assignment_specific_mit706s13.question_3()], - ['Reference Information', scb_assignment_specific_mit706s13.reference_information()] - ]; - assignment_706.template.experiment_setup = scb_assignment_specific_mit706s13.experiment_setup(); - - assignment_706.template.ui.experiment_setup.actions.push({ - name: 'ADD SAMPLES', - open: 'mit706s13.setup', - css: { - width: '800px', - height: '900px', - left: 'inherit', - top: '000px' - } - }); - assignment_result[x] = assignment_706; - } - if(assignment_result[x].id == 'assignment_706_2014'){ - assignment_706_2014 = assignment_result[x]; - assignment_706_2014.template.instructions = [ - ['Introduction', scb_assignment_specific_mit706s14.introduction()], - ['Background Information',scb_assignment_specific_mit706s14.background_information()], - ['Question 1', scb_assignment_specific_mit706s14.question_1()], - ['Question 2', scb_assignment_specific_mit706s14.question_2()] - ]; - assignment_706_2014.template.experiment_setup = scb_assignment_specific_mit706s14.experiment_setup(); - - assignment_706_2014.template.ui.experiment_setup.actions.push({ - name: 'ADD SAMPLES', - open: 'mit706s14.setup', - css: { - width: '885px', - height: '540px', - left: 'inherit', - top: '15%' - } - }); - assignment_result[x] = assignment_706_2014; - } - if(assignment_result[x].id == 'assignment_706_2014_ps2'){ - assignment_706_2014_ps2 = assignment_result[x]; - //assignment_706_2014_ps2 = choose_n_mutant_strains(assignment_706_2014_ps2.template.random_order, ['m1', 'm2'], assignment_706_2014_ps2); - if(assignment_706_2014_ps2.template.finished_random){} - else{ - var element1 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[1]; - var element2 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[2]; - var element3 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[3]; - var element4 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[4]; - var element5 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[5]; - - - //based on the random order, reinsert the elements in the appropriate spot - for(var y = 0; y < assignment_706_2014_ps2.template.random_order.length; y++){ - var element = null; - if(assignment_706_2014_ps2.template.random_order[y] == 1){ - element = element1; - } - else if(assignment_706_2014_ps2.template.random_order[y] == 2){ - element = element2; - } - else if(assignment_706_2014_ps2.template.random_order[y] == 3){ - element = element3; - } - else if(assignment_706_2014_ps2.template.random_order[y] == 4){ - element = element4; - } - else if(assignment_706_2014_ps2.template.random_order[y] == 5){ - element = element5; - } - assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[y+1] = element; - - } - - //In the order I replace each of the numbers with their corresponding rna name - var order_array = ps2_change(assignment_706_2014_ps2.template.random_order); - - - //rename the 5 proteins to their new order, determined by the for loop above - assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[1].cells[2].text = 'siRNA #1'; - assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[2].cells[2].text = 'siRNA #2'; - assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[3].cells[2].text = 'siRNA #3'; - assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[4].cells[2].text = 'siRNA #4' ; - assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[5].cells[2].text = 'siRNA #5'; - - //replace the names of the drugs in the template with the new order array. - replace_names(assignment_706_2014_ps2.template.drugs, order_array, ['siRNA #1', 'siRNA #2', 'siRNA #3', 'siRNA #4' , 'siRNA #5']); - assignment_706_2014_ps2.template.finished_random = true; - } - - assignment_706_2014_ps2.template.instructions = [ - ['Getting Started', scb_assignment_specific_mit706s14ps2.page1()], - ['Background Information',scb_assignment_specific_mit706s14ps2.page2()], - ['Questions', scb_assignment_specific_mit706s14ps2.page3()] - ]; - assignment_706_2014_ps2.template.experiment_setup = scb_assignment_specific_mit706s14.experiment_setup(); - - assignment_706_2014_ps2.template.ui.experiment_setup.actions.push({ - name: 'ADD SAMPLES', - open: 'mit706s14ps2.setup', - css: { - width: '885px', - height: '600px', - left: 'inherit', - top: '000px' - } - }); - assignment_result[x] = assignment_706_2014_ps2; - } - if(assignment_result[x].id == 'sutd_intro_biology'){ - sutd_intro_biology = assignment_result[x]; - sutd_intro_biology.template.experiment_setup = scb_assignment_sutd_intro_biology.experiment_setup(); - - sutd_intro_biology.template.ui.experiment_setup.actions.push({ - name: 'ADD SAMPLES', - open: 'mit706s14.setup', - css: { - width: '885px', - height: '600px', - left: 'inherit', - top: '000px' - } - }); - assignment_result[x] = sutd_intro_biology; - } - if(assignment_result[x].id == 'decusability'){ - decusability = assignment_result[x]; - decusability.template.instructions = [ - ['Welcome to the Usability Evaluation', scb_assignment_specific_decusability.welcome_usability()], - ['Introduction',scb_assignment_specific_decusability.intro()], - ['Reference Material',scb_assignment_specific_decusability.ref()], - ['Question 1', scb_assignment_specific_decusability.question_1()], - ['Question 2', scb_assignment_specific_decusability.question_2()] - ]; - decusability.template.experiment_setup = scb_assignment_specific_decusability.experiment_setup(); - - decusability.template.ui.experiment_setup.actions.push({ - name: 'ADD SAMPLES', - open: 'decusability.setup', - css: { - width: '800px', - height: '700px', - left: 'inherit', - top: '000px' - } - }); - assignment_result[x] = decusability; - } - if(assignment_result[x].id == 'microscopy_usability'){ - june_2014_usability = assignment_result[x]; - june_2014_usability.template.instructions = [ - ['Welcome to the Usability Evaluation', scb_assignment_specific_microscopy_usability.welcome_usability()], - ['Introduction',scb_assignment_specific_microscopy_usability.intro()], - ['Background Information',scb_assignment_specific_microscopy_usability.ref()], - ['Question 1', scb_assignment_specific_microscopy_usability.question_1()] - ]; - june_2014_usability.template.experiment_setup = scb_assignment_specific_microscopy_usability.experiment_setup(); - - june_2014_usability.template.ui.experiment_setup.actions.push({ - name: 'ADD SAMPLES', - open: 'microscopy_usability.setup', - css: { - width: '680px', - height: '566px', - left: 'inherit', - top: '000px' - } - }); - assignment_result[x] = june_2014_usability; - } - if(assignment_result[x].id == 'decusability2'){ - decusability_newfacs = assignment_result[x]; - decusability_newfacs.template.instructions = [ - ['Welcome to the Usability Evaluation', scb_assignment_specific_decusability.welcome_usability()], - ['Introduction',scb_assignment_specific_decusability.intro()], - ['Reference Material',scb_assignment_specific_decusability.ref()], - ['Question 1', scb_assignment_specific_decusability.question_1()], - ['Question 2', scb_assignment_specific_decusability.question_2()] - ]; - decusability_newfacs.template.experiment_setup = scb_assignment_specific_decusability.experiment_setup(); - - decusability_newfacs.template.ui.experiment_setup.actions.push({ - name: 'ADD SAMPLES', - open: 'decusability.setup', - css: { - width: '800px', - height: '700px', - left: 'inherit', - top: '000px' - } - }); - assignment_result[x] = decusability_newfacs; - } - if(assignment_result[x].id == 'assignment_tufts'){ - assignment_tufts = assignment_result[x]; - assignment_tufts.template.ui.experiment_setup.actions.push({ - name: 'ADD SAMPLES', - open: 'mit706s13.setup', - css: { - width: '600px', - height: '400px', - left: 'inherit', - top: '000px' - } - }); - assignment_tufts.template.experiment_setup = scb_assignment_specific_tufts.experiment_setup(); - assignment_tufts.description = scb_assignment_specific_tufts.assignment_overview(); - assignment_result[x] = assignment_tufts; - - } - } - return assignment_result; +var fix_assignment_models = function(assignment_result) { + console.log(assignment_result); + var usability_test = {}; + var assignment_706 = {}; + var decusability = {}; + var decusability_newfacs = {}; + var assignment_tufts = {}; + var microscopy_test = {}; + var assignment_706_2014 = {}; + var assignment_706_2014_ps2 = {}; + var june_2014_usability = {}; + var sutd_intro_biology = {}; + for (var x = 0; x < assignment_result.length; x++) { + if (assignment_result[x].id == 'usability_test') { + usability_test = assignment_result[x]; + usability_test.description = scb_model_microscopy.abstract(); + usability_test.template.setup_video_box = scb_model_microscopy.setup_video_box(); + usability_test.template.setup_video_box_kind = 'coin-slider'; + + usability_test.template.experiment_setup = scb_model_usability.experiment_setup(); + + assignment_result[x] = usability_test; + } + if (assignment_result[x].id == 'microscopy_test') { + microscopy_test = assignment_result[x]; + microscopy_test.description = scb_model_microscopy.abstract(); + microscopy_test.template.setup_video_box = scb_model_microscopy.setup_video_box(); + microscopy_test.template.setup_video_box_kind = 'coin-slider'; + + microscopy_test.template.experiment_setup = scb_model_microscopy.experiment_setup(); + + assignment_result[x] = microscopy_test; + } + if (assignment_result[x].id == 'mit_7_06_0313') { + assignment_706 = assignment_result[x]; + assignment_706.description = scb_assignment_specific_mit706s13.assignment_overview(); + assignment_706.template.instructions = [ + ['Goal & Introduction', scb_assignment_specific_mit706s13.goal_and_introduction()], + ['Question 1', scb_assignment_specific_mit706s13.question_1()], + ['Question 2', scb_assignment_specific_mit706s13.question_2()], + ['Question 3', scb_assignment_specific_mit706s13.question_3()], + ['Reference Information', scb_assignment_specific_mit706s13.reference_information()] + ]; + assignment_706.template.experiment_setup = scb_assignment_specific_mit706s13.experiment_setup(); + + assignment_706.template.ui.experiment_setup.actions.push({ + name: 'ADD SAMPLES', + open: 'mit706s13.setup', + css: { + width: '800px', + height: '900px', + left: 'inherit', + top: '000px' + } + }); + assignment_result[x] = assignment_706; + } + if (assignment_result[x].id == 'assignment_706_2014') { + assignment_706_2014 = assignment_result[x]; + assignment_706_2014.template.instructions = [ + ['Introduction', scb_assignment_specific_mit706s14.introduction()], + ['Background Information', scb_assignment_specific_mit706s14.background_information()], + ['Question 1', scb_assignment_specific_mit706s14.question_1()], + ['Question 2', scb_assignment_specific_mit706s14.question_2()] + ]; + assignment_706_2014.template.experiment_setup = scb_assignment_specific_mit706s14.experiment_setup(); + + assignment_706_2014.template.ui.experiment_setup.actions.push({ + name: 'ADD SAMPLES', + open: 'mit706s14.setup', + css: { + width: '885px', + height: '540px', + left: 'inherit', + top: '15%' + } + }); + assignment_result[x] = assignment_706_2014; + } + if (assignment_result[x].id == 'assignment_706_2014_ps2') { + assignment_706_2014_ps2 = assignment_result[x]; + //assignment_706_2014_ps2 = choose_n_mutant_strains(assignment_706_2014_ps2.template.random_order, ['m1', 'm2'], assignment_706_2014_ps2); + if (assignment_706_2014_ps2.template.finished_random) { + } else { + var element1 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[1]; + var element2 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[2]; + var element3 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[3]; + var element4 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[4]; + var element5 = assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[5]; + + + //based on the random order, reinsert the elements in the appropriate spot + for (var y = 0; y < assignment_706_2014_ps2.template.random_order.length; y++) { + var element = null; + if (assignment_706_2014_ps2.template.random_order[y] == 1) { + element = element1; + } else if (assignment_706_2014_ps2.template.random_order[y] == 2) { + element = element2; + } else if (assignment_706_2014_ps2.template.random_order[y] == 3) { + element = element3; + } else if (assignment_706_2014_ps2.template.random_order[y] == 4) { + element = element4; + } else if (assignment_706_2014_ps2.template.random_order[y] == 5) { + element = element5; + } + assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[y + 1] = element; + + } + + //In the order I replace each of the numbers with their corresponding rna name + var order_array = ps2_change(assignment_706_2014_ps2.template.random_order); + + + //rename the 5 proteins to their new order, determined by the for loop above + assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[1].cells[2].text = 'siRNA #1'; + assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[2].cells[2].text = 'siRNA #2'; + assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[3].cells[2].text = 'siRNA #3'; + assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[4].cells[2].text = 'siRNA #4' ; + assignment_706_2014_ps2.template.ui.add_multiple_dialog.S2.rows[5].cells[2].text = 'siRNA #5'; + + //replace the names of the drugs in the template with the new order array. + replace_names(assignment_706_2014_ps2.template.drugs, order_array, ['siRNA #1', 'siRNA #2', 'siRNA #3', 'siRNA #4', 'siRNA #5']); + assignment_706_2014_ps2.template.finished_random = true; + } + + assignment_706_2014_ps2.template.instructions = [ + ['Getting Started', scb_assignment_specific_mit706s14ps2.page1()], + ['Background Information', scb_assignment_specific_mit706s14ps2.page2()], + ['Questions', scb_assignment_specific_mit706s14ps2.page3()] + ]; + assignment_706_2014_ps2.template.experiment_setup = scb_assignment_specific_mit706s14.experiment_setup(); + + assignment_706_2014_ps2.template.ui.experiment_setup.actions.push({ + name: 'ADD SAMPLES', + open: 'mit706s14ps2.setup', + css: { + width: '885px', + height: '600px', + left: 'inherit', + top: '000px' + } + }); + assignment_result[x] = assignment_706_2014_ps2; + } + if (assignment_result[x].id == 'sutd_intro_biology') { + sutd_intro_biology = assignment_result[x]; + sutd_intro_biology.template.experiment_setup = scb_assignment_sutd_intro_biology.experiment_setup(); + + sutd_intro_biology.template.ui.experiment_setup.actions.push({ + name: 'ADD SAMPLES', + open: 'mit706s14.setup', + css: { + width: '885px', + height: '600px', + left: 'inherit', + top: '000px' + } + }); + assignment_result[x] = sutd_intro_biology; + } + if (assignment_result[x].id == 'decusability') { + decusability = assignment_result[x]; + decusability.template.instructions = [ + ['Welcome to the Usability Evaluation', scb_assignment_specific_decusability.welcome_usability()], + ['Introduction', scb_assignment_specific_decusability.intro()], + ['Reference Material', scb_assignment_specific_decusability.ref()], + ['Question 1', scb_assignment_specific_decusability.question_1()], + ['Question 2', scb_assignment_specific_decusability.question_2()] + ]; + decusability.template.experiment_setup = scb_assignment_specific_decusability.experiment_setup(); + + decusability.template.ui.experiment_setup.actions.push({ + name: 'ADD SAMPLES', + open: 'decusability.setup', + css: { + width: '800px', + height: '700px', + left: 'inherit', + top: '000px' + } + }); + assignment_result[x] = decusability; + } + if (assignment_result[x].id == 'microscopy_usability') { + june_2014_usability = assignment_result[x]; + june_2014_usability.template.instructions = [ + ['Welcome to the Usability Evaluation', scb_assignment_specific_microscopy_usability.welcome_usability()], + ['Introduction', scb_assignment_specific_microscopy_usability.intro()], + ['Background Information', scb_assignment_specific_microscopy_usability.ref()], + ['Question 1', scb_assignment_specific_microscopy_usability.question_1()] + ]; + june_2014_usability.template.experiment_setup = scb_assignment_specific_microscopy_usability.experiment_setup(); + + june_2014_usability.template.ui.experiment_setup.actions.push({ + name: 'ADD SAMPLES', + open: 'microscopy_usability.setup', + css: { + width: '680px', + height: '566px', + left: 'inherit', + top: '000px' + } + }); + assignment_result[x] = june_2014_usability; + } + if (assignment_result[x].id == 'decusability2') { + decusability_newfacs = assignment_result[x]; + decusability_newfacs.template.instructions = [ + ['Welcome to the Usability Evaluation', scb_assignment_specific_decusability.welcome_usability()], + ['Introduction', scb_assignment_specific_decusability.intro()], + ['Reference Material', scb_assignment_specific_decusability.ref()], + ['Question 1', scb_assignment_specific_decusability.question_1()], + ['Question 2', scb_assignment_specific_decusability.question_2()] + ]; + decusability_newfacs.template.experiment_setup = scb_assignment_specific_decusability.experiment_setup(); + + decusability_newfacs.template.ui.experiment_setup.actions.push({ + name: 'ADD SAMPLES', + open: 'decusability.setup', + css: { + width: '800px', + height: '700px', + left: 'inherit', + top: '000px' + } + }); + assignment_result[x] = decusability_newfacs; + } + if (assignment_result[x].id == 'assignment_tufts') { + assignment_tufts = assignment_result[x]; + assignment_tufts.template.ui.experiment_setup.actions.push({ + name: 'ADD SAMPLES', + open: 'mit706s13.setup', + css: { + width: '600px', + height: '400px', + left: 'inherit', + top: '000px' + } + }); + assignment_tufts.template.experiment_setup = scb_assignment_specific_tufts.experiment_setup(); + assignment_tufts.description = scb_assignment_specific_tufts.assignment_overview(); + assignment_result[x] = assignment_tufts; + + } + } + return assignment_result; }; -function ps2_change(array){ - var return_array = [] - for(var x =0; x
"); - dialog.html(scb_mit706s16.dialog({ - assignment: assignment, - experiment: experiment, - template: template - })); + var dialog = $("
"); + dialog.html(scb_mit706s16.dialog({ + assignment: assignment, + experiment: experiment, + template: template + })); - dialog.appendTo($(workarea)); - mit706s13.register($(dialog), state); + dialog.appendTo($(workarea)); + mit706s13.register($(dialog), state); - var css = scb.utils.get(state, ['source_state', 'css']); - _.each( css , function(v,k){ - dialog.css(k,v); - }); + var css = scb.utils.get(state, ['source_state', 'css']); + _.each(css, function(v, k) { + dialog.css(k, v); + }); - $('.scb_mit706s16_dialog').draggable({handle:'.scb_mit706s16_inner_dialog_title'}) + $('.scb_mit706s16_dialog').draggable({ + handle: '.scb_mit706s16_inner_dialog_title' + }) } diff --git a/html_app/model.js b/html_app/model.js index dfd2bce0..fef9b88b 100644 --- a/html_app/model.js +++ b/html_app/model.js @@ -1,277 +1,316 @@ -var MASTER_TEMPLATE={ - random_choose: true, - randomize_all: false, - random_order: [], - finished_random: false, - instructions: [ - ['',''] - ], - ui: { - experimental_design: { - techniques: [ ''] - }, - experiment_setup: { - table: [ // - {kind: "cell_plate", title: " ", editable: false}, - {kind: 'cell_line', title: 'Strain', editable: false}, // - {kind: 'treatments', - children: [// - {kind: 'drug', title: 'Treatment', editable: false}, - {kind: 'concentration', title: 'Treatment Concentration', editable: false} +var MASTER_TEMPLATE = { + random_choose: true, + randomize_all: false, + random_order: [], + finished_random: false, + instructions: [ + ['', ''] + ], + ui: { + experimental_design: { + techniques: [''] + }, + experiment_setup: { + table: [ // + { + kind: "cell_plate", + title: " ", + editable: false + }, + { + kind: 'cell_line', + title: 'Strain', + editable: false + }, // + { + kind: 'treatments', + children: [ // + { + kind: 'drug', + title: 'Treatment', + editable: false + }, + { + kind: 'concentration', + title: 'Treatment Concentration', + editable: false + } - ] - },// - {kind: 'actions', title: 'Actions'}// - ],// - actions: [ + ] + }, // + { + kind: 'actions', + title: 'Actions' + } // + ], // + actions: [] + }, + western_blot: { + format: "%CELL_LINE%, %TREATMENT%", + keys: { + '%CELL_LINE%': { + attr: ['cell_line'], + map: ['cell_lines', '%KEY%', 'name'] + }, + '%TREATMENT%': { + attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], + map: ['drugs', '%KEY%', 'name'] + }, + } + }, + microscopy: { + disable_blur: true, + disable_brightness: true + }, + add_multiple_dialog: { + order: [], + headings: [ + '', 'Strain', 'Treatment', 'Treatment Concentration' + ], + } + }, + collections: {}, + concentrations: {}, + drugs: {}, + experiment_temperatures: {}, + cell_lines: {}, + start_times: {}, + durations: {}, + + time_unit: { + kind: '' + }, + primary_anti_body: {}, // + secondary_anti_body: {}, // + lysate_kinds: { + }, + facs_kinds: { + '': { + name: '', + conditions: { + '': { + name: '' + } + } + } + }, + micro_kinds: { + '': { + name: '', + conditions: { + '': { + name: '', + short_name: '' + } + } + } + }, + slides: { + '': '' + }, + slide_parser: { + '': { + '': { + '': { + '': [ + [{ + 'hash': '', + 'if_type': '', + 'mag': '' + }] + ] + } + } + } + }, + model: { // models + western_blot: { + }, + facs: { + 'ticks': [], + 'max': 0, + 'dna': { + 'parser_simple': [ + { + match: [], + shape: '' + }, + { + match: [], + drug_id: '', + shape: '' + } + ] + + } + }, + microscopy: { + 'valid': [], + 'slide': { + + 'conditions_parser': [ + { + match: [], + + }, + { + match: [], + cell_line: '', + drug_id: [''], + conditions: '', + phenotype: '' + } + ] + + } + } + + } - ] - }, - western_blot: {format: "%CELL_LINE%, %TREATMENT%", - keys: { - '%CELL_LINE%': {attr: ['cell_line'], map: ['cell_lines', '%KEY%', 'name']}, - '%TREATMENT%': {attr: ['treatment_list', 'list', '0', 'drug_list', 'list', '0', 'drug_id'], map: ['drugs', '%KEY%', 'name']}, - } - }, - microscopy: { - disable_blur: true, - disable_brightness: true - }, - add_multiple_dialog: { - order: [], - headings: [ - '','Strain', 'Treatment', 'Treatment Concentration' - ], - } - }, - collections:{}, - concentrations: {}, - drugs: {}, - experiment_temperatures: {}, - cell_lines: {}, - start_times:{}, - durations: {}, - - time_unit: { - kind: '' - }, - primary_anti_body: {},// - secondary_anti_body: {},// - lysate_kinds: { - }, - facs_kinds: { - '':{ - name:'', - conditions: { - '': {name: ''} - } - } - }, - micro_kinds: { - '':{ - name:'', - conditions: { - '': {name: '', - short_name: ''} - } - } - }, - slides: { - '': '' - }, - slide_parser: { - '':{ - '':{ - '':{ - '':[ - [{ - 'hash': '', - 'if_type': '', - 'mag': '' - }] - ] - } - } - } - }, - model: { // models - western_blot: { - }, - facs: { - 'ticks': [], - 'max': 0, - 'dna': { - 'parser_simple': [ - { - match: [], - shape: '' - }, - { - match: [], - drug_id: '', - shape: '' - } - ] - } - }, - microscopy: { - 'valid': [], - 'slide': { - - 'conditions_parser':[ - { - match: [], - - }, - { - match: [], - cell_line: '', - drug_id: [''], - conditions: '', - phenotype: '' - } - ] - - } - } - - } - - } var MASTER_TEMPLATE_OLD = { - name : 'Basic Template', - concentrations : { - 1 : { - name : '1ug/ml', - value : 1 - }, - 2 : { - name : '2ug/ml', - value : 2 - }, - 5 : { - name : '5ug/ml', - value : 5 - } - }, - drugs : { - 1 : { - name : 'Nocodazole', - concentrations : [1, 2, 5] - }, - 2 : { - name : 'Hydroxyurea', - concentrations : [1, 5] - }, - 3 : { - name : 'Aminopterin', - concentrations : [1, 2] - } - }, - experiment_temperatures : { - '25' : { - name : "25'C" - }, - '20' : { - name : "20'C" - }, - '30' : { - name : "30'C" - } - }, - cell_lines : { - 'hela' : { - name : 'HeLa' - }, - 'mfc-7' : { - name : 'MFC-7' - }, - '293t' : { - name : '293T' - }, - 'cho' : { - name : 'CHO' - } - }, - time_unit : { - kind : 'hours' - }, - primary_anti_body : { - 1 : { - name : 'rabbit anti-goat beta-actin' - }, - 2 : { - name : 'mouse anti-mouse phosphotyrosine' - }, - 3 : { - name : 'mouse anti-mouse cdk2' - } - }, - secondary_anti_body : { - 1 : { - name : 'donkey anti-rabbit' - }, - 2 : { - name : 'rabbit anti-goat' - }, - 3 : { - name : 'goat anti-mouse' - } - }, - ip_primary_anti_body : { - 1 : { - name : 'ip primary 1' - }, - 2 : { - name : 'ip primary 2' - } - }, - ip_secondary_anti_body : { - 1 : { - name : 'ip secondary 1' - }, - 2 : { - name : 'ip secondary 2' - } - }, - lysate_kinds : { - 'whole' : { - name : 'Whole Cell' - }, - 'cyto' : { - name : 'Cytoplasm' - }, - 'nuclear' : { - name : 'Nuclear' - } - }, - micro_kinds : { - 'IF':{ - name:'Antibody-labeling IF', - conditions: { - 'NFIB': {name: 'NFIB (red), DAPI (blue), control (green)'} - } - }, - 'IHC':{ - name:'Antibody-labeling IHC', - conditions: { - 'NFIB': {name: 'NFIB'}, - 'KI67': {name: 'Ki-67'}, - '2nd': {name: 'Secondary only control'} - } - }, - 'Dye':{ - name: 'Dye/Stain', - conditions: { - 'HnE': {name: 'H&E'} - } + name: 'Basic Template', + concentrations: { + 1: { + name: '1ug/ml', + value: 1 + }, + 2: { + name: '2ug/ml', + value: 2 + }, + 5: { + name: '5ug/ml', + value: 5 + } + }, + drugs: { + 1: { + name: 'Nocodazole', + concentrations: [1, 2, 5] + }, + 2: { + name: 'Hydroxyurea', + concentrations: [1, 5] + }, + 3: { + name: 'Aminopterin', + concentrations: [1, 2] + } + }, + experiment_temperatures: { + '25': { + name: "25'C" + }, + '20': { + name: "20'C" + }, + '30': { + name: "30'C" + } + }, + cell_lines: { + 'hela': { + name: 'HeLa' + }, + 'mfc-7': { + name: 'MFC-7' + }, + '293t': { + name: '293T' + }, + 'cho': { + name: 'CHO' + } + }, + time_unit: { + kind: 'hours' + }, + primary_anti_body: { + 1: { + name: 'rabbit anti-goat beta-actin' + }, + 2: { + name: 'mouse anti-mouse phosphotyrosine' + }, + 3: { + name: 'mouse anti-mouse cdk2' + } + }, + secondary_anti_body: { + 1: { + name: 'donkey anti-rabbit' + }, + 2: { + name: 'rabbit anti-goat' + }, + 3: { + name: 'goat anti-mouse' + } + }, + ip_primary_anti_body: { + 1: { + name: 'ip primary 1' + }, + 2: { + name: 'ip primary 2' + } + }, + ip_secondary_anti_body: { + 1: { + name: 'ip secondary 1' + }, + 2: { + name: 'ip secondary 2' + } + }, + lysate_kinds: { + 'whole': { + name: 'Whole Cell' + }, + 'cyto': { + name: 'Cytoplasm' + }, + 'nuclear': { + name: 'Nuclear' + } + }, + micro_kinds: { + 'IF': { + name: 'Antibody-labeling IF', + conditions: { + 'NFIB': { + name: 'NFIB (red), DAPI (blue), control (green)' + } + } + }, + 'IHC': { + name: 'Antibody-labeling IHC', + conditions: { + 'NFIB': { + name: 'NFIB' + }, + 'KI67': { + name: 'Ki-67' + }, + '2nd': { + name: 'Secondary only control' + } + } + }, + 'Dye': { + name: 'Dye/Stain', + conditions: { + 'HnE': { + name: 'H&E' + } + } - } - } + } + } }; diff --git a/html_app/model/Assignments.js b/html_app/model/Assignments.js index 306499a2..856a602a 100644 --- a/html_app/model/Assignments.js +++ b/html_app/model/Assignments.js @@ -2,55 +2,55 @@ scb.AssignmentList = function scb_AssignmentList(data, context) { - var self = this; - self.parent = null; - var proto = scb.Assignment; - scb.utils.accessor2_with_setter(self, 'selected_id', data, function(e) { - context.js_model.current_assignment = self.selected; - }); - scb.ModelHelpers.common_list_code(self, data, proto, context, self); - - self.selected_id = data.selected_id; - - self.start = function (d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.Assignment(d, context, self); - data.list.push(d); - return ret; - } + var self = this; + self.parent = null; + var proto = scb.Assignment; + scb.utils.accessor2_with_setter(self, 'selected_id', data, function(e) { + context.js_model.current_assignment = self.selected; + }); + scb.ModelHelpers.common_list_code(self, data, proto, context, self); + + self.selected_id = data.selected_id; + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.Assignment(d, context, self); + data.list.push(d); + return ret; + } } scb.Assignment = function scb_Assignment(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self,data,'notebook',{},scb.Notebook,context); - scb.Utils.initialize_accessor_field(self,data,'experiments',{},scb.ExperimentList,context); - scb.Utils.initialize_accessor_field(self,data,'template',{},scb.Template,context); - scb.Utils.initialize_accessor_field(self,data,'course','',null,context); - scb.Utils.initialize_accessor_field(self,data,'course_name','',null,context); - scb.Utils.initialize_accessor_field(self,data,'last_instruction',0,null,context); - scb.Utils.initialize_accessor_field(self,data,'operation','',null,context); - scb.Utils.initialize_accessor_field(self,data,'permission','',null,context); - scb.Utils.initialize_accessor_field(self,data,'template_id',null,null,context); - scb.Utils.initialize_accessor_field(self,data,'students',0,null,context); - scb.Utils.initialize_accessor_field(self,data,'sort',[],null,context); + scb.Utils.initialize_accessor_field(self, data, 'notebook', {}, scb.Notebook, context); + scb.Utils.initialize_accessor_field(self, data, 'experiments', {}, scb.ExperimentList, context); + scb.Utils.initialize_accessor_field(self, data, 'template', {}, scb.Template, context); + scb.Utils.initialize_accessor_field(self, data, 'course', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'course_name', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'last_instruction', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'operation', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'permission', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'template_id', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'students', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'sort', [], null, context); - scb.Utils.initialize_accessor_field(self,data,'is_new_assignment',true,null,context); - scb.Utils.initialize_accessor_field(self,data,'is_new_course',true,null,context); + scb.Utils.initialize_accessor_field(self, data, 'is_new_assignment', true, null, context); + scb.Utils.initialize_accessor_field(self, data, 'is_new_course', true, null, context); - scb.Utils.initialize_accessor_field(self,data,'has_background_bands',false,null,context); - scb.Utils.initialize_accessor_field(self,data,'background_band_list',{},null,context); + scb.Utils.initialize_accessor_field(self, data, 'has_background_bands', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'background_band_list', {}, null, context); - scb.Utils.initialize_accessor_field(self,data,'course_prepared',null,null,context); - scb.Utils.initialize_accessor_field(self,data,'assignment_prepared',null,null,context); + scb.Utils.initialize_accessor_field(self, data, 'course_prepared', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'assignment_prepared', null, null, context); - scb.Utils.initialize_accessor_field(self,data,'has_temperature',false,null,context); - scb.Utils.initialize_accessor_field(self,data,'has_start_time',false,null,context); - scb.Utils.initialize_accessor_field(self,data,'has_duration',false,null,context); - scb.Utils.initialize_accessor_field(self,data,'has_collection_time',false,null,context); + scb.Utils.initialize_accessor_field(self, data, 'has_temperature', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'has_start_time', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'has_duration', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'has_collection_time', false, null, context); } diff --git a/html_app/model/CellTreatment.js b/html_app/model/CellTreatment.js index 9f49da77..35916246 100644 --- a/html_app/model/CellTreatment.js +++ b/html_app/model/CellTreatment.js @@ -1,102 +1,91 @@ 'use strict'; scb.CellTreatmentList = function scb_CellTreatmentList(data, context, parent) { - var self = this; - self.parent = parent; + var self = this; + self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.CellTreatment, context); + scb.ModelHelpers.common_list_code(self, data, scb.CellTreatment, context); - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.CellTreatment(d, context, self); - data.list.push(d); - return ret; - } + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.CellTreatment(d, context, self); + data.list.push(d); + return ret; + } - self.duplicate = function(id) { - var new_list = []; - var list = data.list ; - for( var i in list ) - { - var elem = list[i]; - new_list.push(elem) - if( id == elem.id) - { - var new_elem = scb.Utils.clone_and_clear(elem); - new_list.push( new_elem ); - } - } - data.list = new_list; -// return self.start(scb.Utils.clone_and_clear(scb.utils.find(data.list,id))); - } + self.duplicate = function(id) { + var new_list = []; + var list = data.list; + for (var i in list) { + var elem = list[i]; + new_list.push(elem) + if (id == elem.id) { + var new_elem = scb.Utils.clone_and_clear(elem); + new_list.push(new_elem); + } + } + data.list = new_list; + // return self.start(scb.Utils.clone_and_clear(scb.utils.find(data.list,id))); + } } scb.CellTreatment = function scb_CellTreatment(data, context, parent) { - var self = this; - self.parent = parent; - - scb.ModelHelpers.common_entry_code(self, data, context); + var self = this; + self.parent = parent; - scb.Utils.initialize_accessor_field(self,data,'cell_line','',null,context); - scb.Utils.initialize_accessor_field(self,data,'treatment_list',{},scb.TreatmentList,context); - scb.Utils.initialize_accessor_field(self,data,'stimulation_time','',null,context); - scb.Utils.initialize_accessor_field(self,data,'collection_schedule_list',{},scb.CollectionScheduleList, context); - scb.Utils.initialize_accessor_field(self,data,'identifier','',null,context); + scb.ModelHelpers.common_entry_code(self, data, context); - self.format_row = function() - { - var display_text = self.name; - var template = context.template; - if( template.ui.western_blot.format ) - { - var orig_template = template.ui.western_blot.format; - var new_text = '' + orig_template - var keys = template.ui.western_blot.keys; - var resolve = function(value) - { - var ret = self; - var success = true; - _.each(value.attr,function(e){ - if(!_.isUndefined(ret[e])) - { - ret = ret[e]; - } - else - { - success = false; - } - }); - var text = template; - if(value.hasOwnProperty('map')){ - _.each(value.map,function(e){ - if(!_.isUndefined(text[e])) - { - text = text[e]; - } - if(e=='%KEY%' && !_.isUndefined(text[ret])) - { - text = text[ret]; - } - }); - }else{ - text = ret; - } + scb.Utils.initialize_accessor_field(self, data, 'cell_line', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'treatment_list', {}, scb.TreatmentList, context); + scb.Utils.initialize_accessor_field(self, data, 'stimulation_time', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'collection_schedule_list', {}, scb.CollectionScheduleList, context); + scb.Utils.initialize_accessor_field(self, data, 'identifier', '', null, context); - if(! success && scb.utils.isDefined(value.default) ) - { - text = value.default; - } - return text; + self.format_row = function() { + var display_text = self.name; + var template = context.template; + if (template.ui.western_blot.format) { + var orig_template = template.ui.western_blot.format; + var new_text = '' + orig_template + var keys = template.ui.western_blot.keys; + var resolve = function(value) { + var ret = self; + var success = true; + _.each(value.attr, function(e) { + if (!_.isUndefined(ret[e])) { + ret = ret[e]; + } else { + success = false; + } + }); + var text = template; + if (value.hasOwnProperty('map')) { + _.each(value.map, function(e) { + if (!_.isUndefined(text[e])) { + text = text[e]; } - _.each(keys, function(value,key,keys){ - var regexp = new RegExp(key); - new_text = new_text.replace( regexp , resolve(value)); - }); - display_text = new_text == orig_template ? display_text : new_text; - display_text = display_text.replace(/(, *)+/g, ", "); + if (e == '%KEY%' && !_.isUndefined(text[ret])) { + text = text[ret]; + } + }); + } else { + text = ret; + } + + if (!success && scb.utils.isDefined(value.default)) { + text = value.default; } - return display_text; - }; + return text; + } + _.each(keys, function(value, key, keys) { + var regexp = new RegExp(key); + new_text = new_text.replace(regexp, resolve(value)); + }); + display_text = new_text == orig_template ? display_text : new_text; + display_text = display_text.replace(/(, *)+/g, ", "); + } + return display_text; + }; - scb.Utils.accessor_toString(self.cell_line); + scb.Utils.accessor_toString(self.cell_line); } \ No newline at end of file diff --git a/html_app/model/CollectionSchedule.js b/html_app/model/CollectionSchedule.js index dd540bbe..685d4c9f 100644 --- a/html_app/model/CollectionSchedule.js +++ b/html_app/model/CollectionSchedule.js @@ -1,58 +1,58 @@ 'use strict'; scb.CollectionScheduleList = function scb_CollectionScheduleList(data, context, parent) { - var self = this; - self.parent = parent; - - scb.ModelHelpers.common_list_code(self, data, scb.CollectionSchedule, context, self); - - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - d.name = d.name || "Schedule " + data.counter++; - var ret = new scb.CollectionSchedule(d, context, self); - data.list.push(d); - return ret; - } + var self = this; + self.parent = parent; + + scb.ModelHelpers.common_list_code(self, data, scb.CollectionSchedule, context, self); + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + d.name = d.name || "Schedule " + data.counter++; + var ret = new scb.CollectionSchedule(d, context, self); + data.list.push(d); + return ret; + } } scb.CollectionSchedule = function scb_CollectionSchedule(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - - // should be getter only - scb.Utils.initialize_accessor_field(self, data, 'schedule_value', "0", null, context); - - scb.Utils.initialize_field(data, 'schedule', "now"); - - self.schedule = function(v) { - if ( typeof (v) == 'undefined') { - // getter - var time = parseFloat(data.schedule_value); - var days = Math.floor((time % 604800) / 86400); - //var days = Math.floor(time / 86400); - var months = Math.floor(time /2592000); - - var weeks = Math.floor((time % 2592000) / 604800); - var hours = Math.floor((time % 86400) / 3600); - var minutes = Math.round((time % 3600) / 60); - var now = (time < 60 ); - return scb_common.format_time_detailed({ - weeks: weeks, - days : days, - hours : hours, - minutes : minutes, - months: months, - now : now - }).trim(); - } else { - // setter - var time = scb.Utils.parse_time(v, context.template.time_unit.kind); - data.schedule_value = time; - data.schedule = self.schedule(); - } - } - - scb.Utils.accessor_toString(self.schedule); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + + // should be getter only + scb.Utils.initialize_accessor_field(self, data, 'schedule_value', "0", null, context); + + scb.Utils.initialize_field(data, 'schedule', "now"); + + self.schedule = function(v) { + if (typeof (v) == 'undefined') { + // getter + var time = parseFloat(data.schedule_value); + var days = Math.floor((time % 604800) / 86400); + //var days = Math.floor(time / 86400); + var months = Math.floor(time / 2592000); + + var weeks = Math.floor((time % 2592000) / 604800); + var hours = Math.floor((time % 86400) / 3600); + var minutes = Math.round((time % 3600) / 60); + var now = (time < 60); + return scb_common.format_time_detailed({ + weeks: weeks, + days: days, + hours: hours, + minutes: minutes, + months: months, + now: now + }).trim(); + } else { + // setter + var time = scb.Utils.parse_time(v, context.template.time_unit.kind); + data.schedule_value = time; + data.schedule = self.schedule(); + } + } + + scb.Utils.accessor_toString(self.schedule); } \ No newline at end of file diff --git a/html_app/model/Drugs.js b/html_app/model/Drugs.js index 3b1dad75..9fb69286 100644 --- a/html_app/model/Drugs.js +++ b/html_app/model/Drugs.js @@ -1,61 +1,61 @@ 'use strict'; -scb.DrugList = function scb_DrugList(data, context,parent) { - var self = this; - self.parent = parent; - - scb.ModelHelpers.common_list_code(self, data, scb.Drug, context); - - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.Drug(d, context); - data.list.push(d); - return ret; - } - - self.start_default = function(d) { - d = context.template.drug_template ? context.template.drug_template : d ; - d = d ? d : {} ; - d = scb.Utils.clone_and_clear(d); - var ret = new scb.Drug(d, context,self); - data.list.push(d); - return ret; - } - - self.set_list = function(drug_list) { - data.list.length = 0; - for(var i in drug_list) { - var drug = drug_list[i]; - data.list.push(drug._data); - } - } +scb.DrugList = function scb_DrugList(data, context, parent) { + var self = this; + self.parent = parent; + + scb.ModelHelpers.common_list_code(self, data, scb.Drug, context); + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.Drug(d, context); + data.list.push(d); + return ret; + } + + self.start_default = function(d) { + d = context.template.drug_template ? context.template.drug_template : d ; + d = d ? d : {} ; + d = scb.Utils.clone_and_clear(d); + var ret = new scb.Drug(d, context, self); + data.list.push(d); + return ret; + } + + self.set_list = function(drug_list) { + data.list.length = 0; + for (var i in drug_list) { + var drug = drug_list[i]; + data.list.push(drug._data); + } + } } -scb.Drug = function scb_Drug(data, context,parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - - scb.Utils.initialize_field(data, 'drug_id', null); - scb.Utils.initialize_field(data, 'concentration_id', null); - scb.Utils.initialize_field(data, 'collection_id', null); - - scb.Utils.initialize_accessor_field(self, data, 'drug_id', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'concentration_id', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'collection_id', null, null, context); - - scb.utils.accessor2_custom(self, 'drug_name', function() { - return data.drug_id != null ? context.template.drugs[data.drug_id].name : ''; - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'drug_concentration' , function() { - if(data.concentration_id != null && data.concentration_id != '' ) { - return context.template.concentrations[data.concentration_id].name; - }else{ - return ''; - } - }, scb.utils.read_only_exception); - - scb.Utils.accessor_toString(self.drug_id); - scb.Utils.accessor_toString(self.concentration_id); +scb.Drug = function scb_Drug(data, context, parent) { + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + + scb.Utils.initialize_field(data, 'drug_id', null); + scb.Utils.initialize_field(data, 'concentration_id', null); + scb.Utils.initialize_field(data, 'collection_id', null); + + scb.Utils.initialize_accessor_field(self, data, 'drug_id', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'concentration_id', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'collection_id', null, null, context); + + scb.utils.accessor2_custom(self, 'drug_name', function() { + return data.drug_id != null ? context.template.drugs[data.drug_id].name : ''; + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'drug_concentration', function() { + if (data.concentration_id != null && data.concentration_id != '') { + return context.template.concentrations[data.concentration_id].name; + } else { + return ''; + } + }, scb.utils.read_only_exception); + + scb.Utils.accessor_toString(self.drug_id); + scb.Utils.accessor_toString(self.concentration_id); } \ No newline at end of file diff --git a/html_app/model/Experiment.js b/html_app/model/Experiment.js index e6f957a6..0d985a91 100644 --- a/html_app/model/Experiment.js +++ b/html_app/model/Experiment.js @@ -1,67 +1,67 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.ExperimentList = function scb_ExperimentList(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.Experiment, context, self); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_list_code(self, data, scb.Experiment, context, self); - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - if (Object.keys(d).length == 0) { - if (this.parent.template.experiment_templates && this.parent.template.experiment_templates['default']) { - d = scb.utils.clone_and_clear(this.parent.template.experiment_templates['default']); - } - } - if (! d.hasOwnProperty('name')) { - d.name = self.next_name(true); - } - var ret = new scb.Experiment(d, context, self); - data.list.push(d); - return ret; - } + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + if (Object.keys(d).length == 0) { + if (this.parent.template.experiment_templates && this.parent.template.experiment_templates['default']) { + d = scb.utils.clone_and_clear(this.parent.template.experiment_templates['default']); + } + } + if (!d.hasOwnProperty('name')) { + d.name = self.next_name(true); + } + var ret = new scb.Experiment(d, context, self); + data.list.push(d); + return ret; + } - self.next_name = function(please_increment) { - var ret = 'Experiment ' + data.counter; - if (please_increment == true) { - data.counter++; - } - return ret; - } + self.next_name = function(please_increment) { + var ret = 'Experiment ' + data.counter; + if (please_increment == true) { + data.counter++; + } + return ret; + } } scb.Experiment = function scb_Experiment(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - // experiment_design_fields - scb.Utils.initialize_accessor_field(self,data,'hypothesis','',null,context); - scb.Utils.initialize_accessor_field(self,data,'objective','',null,context); - scb.Utils.initialize_accessor_field(self,data,'technique','',null,context); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + // experiment_design_fields + scb.Utils.initialize_accessor_field(self, data, 'hypothesis', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'objective', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'technique', '', null, context); - // ui state - - scb.Utils.initialize_accessor_field(self,data,'last_view','experiment_design',null,context); - scb.Utils.initialize_accessor_field(self,data, 'prev_step', 0, null,context); + // ui state - scb.Utils.initialize_accessor_field(self,data, 'last_step', 0, null,context); - scb.Utils.initialize_accessor_field(self,data, 'last_scroll', 0, null,context); - scb.Utils.initialize_accessor_field(self,data, 'last_technique', 'undefined', null, context); - scb.Utils.initialize_accessor_field(self,data, 'last_id', 'undefined', null, context); - scb.Utils.initialize_accessor_field(self,data, 'last_technique_view', 'undefined', null, context); - + scb.Utils.initialize_accessor_field(self, data, 'last_view', 'experiment_design', null, context); + scb.Utils.initialize_accessor_field(self, data, 'prev_step', 0, null, context); - scb.Utils.initialize_accessor_field(self,data, 'last_param', 'undefined', null, context); + scb.Utils.initialize_accessor_field(self, data, 'last_step', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'last_scroll', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'last_technique', 'undefined', null, context); + scb.Utils.initialize_accessor_field(self, data, 'last_id', 'undefined', null, context); + scb.Utils.initialize_accessor_field(self, data, 'last_technique_view', 'undefined', null, context); - scb.Utils.initialize_accessor_field(self,data,'cell_treatment_list',{},scb.CellTreatmentList,context); - scb.Utils.initialize_accessor_field(self,data,'western_blot_list',{},scb.WesternBlotList,context); - scb.Utils.initialize_accessor_field(self,data,'facs_list',{},scb.FacsList,context); - scb.Utils.initialize_accessor_field(self,data,'microscopy_list',{},scb.MicroscopyList,context); - scb.Utils.initialize_accessor_field(self,data,'setup_finished',false,null,context); - scb.Utils.initialize_accessor_field(self,data,'setup_visible',true,null,context); - scb.Utils.initialize_accessor_field(self,data,'new_row',{},null,context); - scb.Utils.initialize_accessor_field(self,data,'design_wb_cb',false,null,context); - scb.Utils.initialize_accessor_field(self,data,'design_fc_cb',false,null,context); - scb.Utils.initialize_accessor_field(self,data,'design_mi_cb',false,null,context); + + scb.Utils.initialize_accessor_field(self, data, 'last_param', 'undefined', null, context); + + scb.Utils.initialize_accessor_field(self, data, 'cell_treatment_list', {}, scb.CellTreatmentList, context); + scb.Utils.initialize_accessor_field(self, data, 'western_blot_list', {}, scb.WesternBlotList, context); + scb.Utils.initialize_accessor_field(self, data, 'facs_list', {}, scb.FacsList, context); + scb.Utils.initialize_accessor_field(self, data, 'microscopy_list', {}, scb.MicroscopyList, context); + scb.Utils.initialize_accessor_field(self, data, 'setup_finished', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'setup_visible', true, null, context); + scb.Utils.initialize_accessor_field(self, data, 'new_row', {}, null, context); + scb.Utils.initialize_accessor_field(self, data, 'design_wb_cb', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'design_fc_cb', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'design_mi_cb', false, null, context); } \ No newline at end of file diff --git a/html_app/model/Facs.js b/html_app/model/Facs.js index 97b951b2..a2443ef8 100644 --- a/html_app/model/Facs.js +++ b/html_app/model/Facs.js @@ -1,220 +1,231 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.FacsList = function scb_FacsList(data, context, parent) { - var self = this; - self.parent = parent; - - scb.ModelHelpers.common_list_code(self, data, scb.Facs, context, self); - scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', 0, null, context); - - - self.start = function (d) { - d = ( typeof (d) == 'undefined' ? {} : d); - d.name = d.name || "F. C. " + data.counter++; - var ret = new scb.Facs(d, context, self); - data.list.push(d); - return ret; - } - - self.new_using_making_lysates = function (making_lysates_id) { - var experiment = context.js_model.current_session.making_lysate_list.get(making_lysates_id); - var d = { - name: "Facs " + data.counter++, - display_lysates_id: making_lysates_id - }; - var ml = new scb.Facs(d, context, self); - //TODO here we will count lysates and if there are less than 10 we will fill lanes up - data.list.push(d); - return ml; - } - - self.duplicate = function (id) { - var orig = self.get(id); - var clone = JSON.parse(JSON.stringify(orig.__data__)); - delete clone.id; - if (("" + clone.name).indexOf('(Copy)') == -1) { - clone.name = clone.name + " (Copy)"; - } - delete clone.created_at; - clone.finished = false; - delete clone.canvas_data; - clone.gels_list = _.clone(clone.gels_list); - clone.exposure_list = _.clone(clone.exposure_list); - try { - for (var i in clone.lanes_list.list) { - var lane = clone.lanes_list.list[i]; - lane.marks = []; - } - for (var i in clone.exposure_list.list) { - var exp = clone.exposure_list.list[i]; - exp.canvas_data = null; - } - } catch (err) { - } - ; - var ml = new scb.Facs(clone, context, self); - data.list.push(clone); - return ml; + var self = this; + self.parent = parent; + + scb.ModelHelpers.common_list_code(self, data, scb.Facs, context, self); + scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', 0, null, context); + + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + d.name = d.name || "F. C. " + data.counter++; + var ret = new scb.Facs(d, context, self); + data.list.push(d); + return ret; + } + + self.new_using_making_lysates = function(making_lysates_id) { + var experiment = context.js_model.current_session.making_lysate_list.get(making_lysates_id); + var d = { + name: "Facs " + data.counter++, + display_lysates_id: making_lysates_id + }; + var ml = new scb.Facs(d, context, self); + //TODO here we will count lysates and if there are less than 10 we will fill lanes up + data.list.push(d); + return ml; + } + + self.duplicate = function(id) { + var orig = self.get(id); + var clone = JSON.parse(JSON.stringify(orig.__data__)); + delete clone.id; + if (("" + clone.name).indexOf('(Copy)') == -1) { + clone.name = clone.name + " (Copy)"; } + delete clone.created_at; + clone.finished = false; + delete clone.canvas_data; + clone.gels_list = _.clone(clone.gels_list); + clone.exposure_list = _.clone(clone.exposure_list); + try { + for (var i in clone.lanes_list.list) { + var lane = clone.lanes_list.list[i]; + lane.marks = []; + } + for (var i in clone.exposure_list.list) { + var exp = clone.exposure_list.list[i]; + exp.canvas_data = null; + } + } catch ( err ) {} + ; + var ml = new scb.Facs(clone, context, self); + data.list.push(clone); + return ml; + } } scb.Facs = function scb_Facs(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - - scb.Utils.initialize_accessor_field(self, data, 'lanes_list', {}, scb.FacsLaneList, context); - scb.Utils.initialize_accessor_field(self, data, 'samples_finished', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'sample_prepared', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'sample_analysis', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'double_analysis', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'gate_count', 0, null, context); - scb.Utils.initialize_accessor_field(self, data, 'midpoint', {}, null, context); - scb.Utils.initialize_accessor_field(self, data, 'prep_scroll', 0, null, context); - scb.Utils.initialize_accessor_field(self, data, 'samples_scroll', 0, null, context); - - scb.Utils.initialize_accessor_field(self, data, 'show_analysis', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'apply_dna_analysis_to_all', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'instructions_show_state', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'samples_show_state', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'lane_selected', null, null, context); - scb.utils.accessor2_custom(self, 'selected_lane', function () { - if (self.lane_selected) { - return self.lanes_list.get(self.lane_selected); - } - else { - return null; + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + + scb.Utils.initialize_accessor_field(self, data, 'lanes_list', {}, scb.FacsLaneList, context); + scb.Utils.initialize_accessor_field(self, data, 'samples_finished', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'sample_prepared', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'sample_analysis', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'double_analysis', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'gate_count', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'midpoint', {}, null, context); + scb.Utils.initialize_accessor_field(self, data, 'prep_scroll', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'samples_scroll', 0, null, context); + + scb.Utils.initialize_accessor_field(self, data, 'show_analysis', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'apply_dna_analysis_to_all', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'instructions_show_state', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'samples_show_state', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'lane_selected', null, null, context); + scb.utils.accessor2_custom(self, 'selected_lane', function() { + if (self.lane_selected) { + return self.lanes_list.get(self.lane_selected); + } else { + return null; + } + }, scb.utils.noop); + + scb.Utils.initialize_accessor_field(self, data, 'is_cell_treatment_enabled', {}, null, context); + /* Values are 'fixed' or 'live' */ + scb.Utils.initialize_accessor_field(self, data, 'is_cell_treatment_live', {}, null, context); + + /* to save selected lane for each cell_treatment */ + scb.Utils.initialize_accessor_field(self, data, 'is_tab_selected', {}, null, context); + self.rows_state = function(exp) { + var skip_placeholders = false; + if (_.keys(context.template.facs_kinds).length == 1 && _.keys(context.template.facs_kinds[Object.keys(context.template.facs_kinds)[0]].conditions).length == 1) { + skip_placeholders = true; + } + var experiment = exp || self.parent.parent; + var template = context.template; + var grouped_rows = self.lanes_list.grouped_list; + var rows = []; + _.each(experiment.cell_treatment_list.list, function(e) { + if (grouped_rows[e.id]) { + /* a list of already chosen conditions for this sample */ + var chosen_conditions = _.map(grouped_rows[e.id], function(z) { + return z.conditions + }).sort(); + var avail_conditions = []; + /* the conditions available for this sample can be + specified in two ways: + 1) In the cell_treatment list under 'facs' + 2) or in 'facs_kinds', that applies to all samples + */ + var facs_kinds = e.treatment_list.list[0].facs; + if (_.isEmpty(facs_kinds)) { + facs_kinds = template.facs_kinds; + _.each(_.keys(facs_kinds), function(a) { + _.each(_.keys(facs_kinds[a].conditions), function(c) { + avail_conditions.push(c); + }); + }); + } else { + /* Make a list of all conditions available for this sample */ + _.each(_.keys(facs_kinds), function(a) { + _.each(facs_kinds[a], function(c) { + avail_conditions.push(c); + }); + }); } - }, scb.utils.noop); - scb.Utils.initialize_accessor_field(self, data, 'is_cell_treatment_enabled', {}, null, context); - /* Values are 'fixed' or 'live' */ - scb.Utils.initialize_accessor_field(self, data, 'is_cell_treatment_live', {}, null, context); - - /* to save selected lane for each cell_treatment */ - scb.Utils.initialize_accessor_field(self, data, 'is_tab_selected', {}, null, context); - self.rows_state = function (exp) { var skip_placeholders = false; - if (_.keys(context.template.facs_kinds).length == 1 && _.keys(context.template.facs_kinds[Object.keys(context.template.facs_kinds)[0]].conditions).length == 1) { - skip_placeholders = true; + /* if there are more conditions available add a placeholder */ + if (chosen_conditions.length >= avail_conditions.length) { + skip_placeholders = true; } - var experiment = exp || self.parent.parent; - var template = context.template; - var grouped_rows = self.lanes_list.grouped_list; - var rows = []; - _.each(experiment.cell_treatment_list.list, function (e) { - if (grouped_rows[e.id]) { - /* a list of already chosen conditions for this sample */ - var chosen_conditions = _.map(grouped_rows[e.id], function(z){return z.conditions}).sort(); - var avail_conditions = []; - /* the conditions available for this sample can be - specified in two ways: - 1) In the cell_treatment list under 'facs' - 2) or in 'facs_kinds', that applies to all samples - */ - var facs_kinds= e.treatment_list.list[0].facs; - if (_.isEmpty(facs_kinds)){ - facs_kinds = template.facs_kinds; - _.each(_.keys(facs_kinds), function (a) { - _.each(_.keys(facs_kinds[a].conditions), function (c) { - avail_conditions.push(c); - }); - }); - }else { - /* Make a list of all conditions available for this sample */ - _.each(_.keys(facs_kinds), function (a) { - _.each(facs_kinds[a], function (c) { - avail_conditions.push(c); - }); - }); - } - - var skip_placeholders = false; - /* if there are more conditions available add a placeholder */ - if(chosen_conditions.length >= avail_conditions.length) { - skip_placeholders = true; - } - /* - after samples were prepared want to initialize dict with - first lane for each cell_treatment - */ - if(self.sample_prepared){ - if(!self.is_tab_selected.hasOwnProperty(e.id)){ - self.is_tab_selected[e.id]= grouped_rows[e.id][0].id; - } - } - _.each(grouped_rows[e.id], function (ee, index) { - - rows.push({ - kind: 'existing', - cell_treatment: e, - lane: ee, - display_sample: index == 0, - is_sample_enabled: self.is_cell_treatment_enabled[e.id], - index: index, - is_valid: self.is_cell_treatment_enabled[e.id] && ee && ee.conditions, - live: self.is_cell_treatment_live[e.id+'_'+ee.id], - is_tab_selected: self.is_tab_selected[e.id] === ee.id, - more_conditions: !skip_placeholders - }); - }); - if (!skip_placeholders) { - rows.push({ - kind: 'placeholder', - display_sample: false, - cell_treatment: e, - is_sample_enabled: self.is_cell_treatment_enabled[e.id], - is_valid: false, - live: self.is_cell_treatment_live[e.id+'_'] - }); - } - } else { - rows.push({ - kind: 'new', - row_type: 'new', - display_sample: true, - cell_treatment: e, - is_sample_enabled: self.is_cell_treatment_enabled[e.id], - is_valid: false, - live: self.is_cell_treatment_live[e.id+'_'] - }) - } - }); - var count = 0; - _.each(rows, function (e) { - if (e.is_valid) count++; - if(!self.is_cell_treatment_live[e.id]) - { - self.is_cell_treatment_live[e.id] = false; - } - }); - _.each(rows, function (r, index, rows) { - r.display_text = r.cell_treatment.format_row(); - }); - - _.each(rows, function (r, index, rows) { - var identifier = r.cell_treatment.identifier; - var facs_kinds = context.template.facs_kinds; - var list = { 'Live': [], 'Fixed': []}; - _.each(facs_kinds, function (obj, key) { - if (obj['Live'] && obj['Live'].indexOf(identifier)>=0) { - r.has_live = true; - list['Live'].push(key); - } - if (obj['Fixed'] && obj['Fixed'].indexOf(identifier)>=0) { - r.has_fixed = true; - list['Fixed'].push(key); - } - }); - r.lysate_types = list; - }); - - rows = _.sortBy(rows, function (obj) { - if (obj.kind == 'existing')return obj.lane.order_id; else return; + /* + after samples were prepared want to initialize dict with + first lane for each cell_treatment + */ + if (self.sample_prepared) { + if (!self.is_tab_selected.hasOwnProperty(e.id)) { + self.is_tab_selected[e.id] = grouped_rows[e.id][0].id; + } + } + _.each(grouped_rows[e.id], function(ee, index) { + + rows.push({ + kind: 'existing', + cell_treatment: e, + lane: ee, + display_sample: index == 0, + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + index: index, + is_valid: self.is_cell_treatment_enabled[e.id] && ee && ee.conditions, + live: self.is_cell_treatment_live[e.id + '_' + ee.id], + is_tab_selected: self.is_tab_selected[e.id] === ee.id, + more_conditions: !skip_placeholders + }); }); - - return {rows: rows, valid: count}; - } + if (!skip_placeholders) { + rows.push({ + kind: 'placeholder', + display_sample: false, + cell_treatment: e, + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + is_valid: false, + live: self.is_cell_treatment_live[e.id + '_'] + }); + } + } else { + rows.push({ + kind: 'new', + row_type: 'new', + display_sample: true, + cell_treatment: e, + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + is_valid: false, + live: self.is_cell_treatment_live[e.id + '_'] + }) + } + }); + var count = 0; + _.each(rows, function(e) { + if (e.is_valid) { + count++; + } + if (!self.is_cell_treatment_live[e.id]) { + self.is_cell_treatment_live[e.id] = false; + } + }); + _.each(rows, function(r, index, rows) { + r.display_text = r.cell_treatment.format_row(); + }); + + _.each(rows, function(r, index, rows) { + var identifier = r.cell_treatment.identifier; + var facs_kinds = context.template.facs_kinds; + var list = { + 'Live': [], + 'Fixed': [] + }; + _.each(facs_kinds, function(obj, key) { + if (obj['Live'] && obj['Live'].indexOf(identifier) >= 0) { + r.has_live = true; + list['Live'].push(key); + } + if (obj['Fixed'] && obj['Fixed'].indexOf(identifier) >= 0) { + r.has_fixed = true; + list['Fixed'].push(key); + } + }); + r.lysate_types = list; + }); + + rows = _.sortBy(rows, function(obj) { + if (obj.kind == 'existing') { + return obj.lane.order_id; + } else { + return; + } + }); + + return { + rows: rows, + valid: count + }; + } } diff --git a/html_app/model/FacsLanes.js b/html_app/model/FacsLanes.js index 1ee6117d..9f86ddcd 100644 --- a/html_app/model/FacsLanes.js +++ b/html_app/model/FacsLanes.js @@ -1,160 +1,162 @@ 'use strict'; scb.FacsLaneList = function scb_FacsLaneList(data, context, parent) { - var self = this; - self.parent = parent; - - scb.Utils.initialize_field(data, 'list', []); - - Object.defineProperty(self, "list", { - get: function () { - var ret = []; - for (var i in data.list) { - var d = data.list[i]; - ret.push(new scb.FacsLane(d, context, self)); - } - return ret; - } - }); - - self.start = function (d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.FacsLane(d, context, self); - data.list.push(d); - return ret; + var self = this; + self.parent = parent; + + scb.Utils.initialize_field(data, 'list', []); + + Object.defineProperty(self, "list", { + get: function() { + var ret = []; + for (var i in data.list) { + var d = data.list[i]; + ret.push(new scb.FacsLane(d, context, self)); + } + return ret; } - - self.ensure_experiment_lanes_for_experiment = function (experiment_id) { - var assignment = context.js_model.current_assignment; - var experiment = assignment.experiments.get(experiment_id); - var ctl = experiment.cell_treatment_list.list; - for (var cti in ctl) { - var ct = ctl[cti]; - var csl = ct.collection_schedule_list.list; - for (var csi in csl) { - var cs = csl[csi]; - var list = self.filter(experiment.id, ct.id, cs.id); - if (list.length == 0) { - self.start({ - experiment_id: experiment_id, - cell_treatment_id: ct.id, - collection_schedule_id: cs.id, - }); - } - } + }); + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.FacsLane(d, context, self); + data.list.push(d); + return ret; + } + + self.ensure_experiment_lanes_for_experiment = function(experiment_id) { + var assignment = context.js_model.current_assignment; + var experiment = assignment.experiments.get(experiment_id); + var ctl = experiment.cell_treatment_list.list; + for (var cti in ctl) { + var ct = ctl[cti]; + var csl = ct.collection_schedule_list.list; + for (var csi in csl) { + var cs = csl[csi]; + var list = self.filter(experiment.id, ct.id, cs.id); + if (list.length == 0) { + self.start({ + experiment_id: experiment_id, + cell_treatment_id: ct.id, + collection_schedule_id: cs.id, + }); } + } } + } - self.duplicate = function (id) { - var orig = _.find(data.list, function (e) { - return e.id == id; - }); - if (scb.utils.isDefined(orig)) { - var clone = scb.utils.clone_and_clear(orig) - return self.start(clone); - } + self.duplicate = function(id) { + var orig = _.find(data.list, function(e) { + return e.id == id; + }); + if (scb.utils.isDefined(orig)) { + var clone = scb.utils.clone_and_clear(orig) + return self.start(clone); } + } - self.remove = function (id) { - var new_list = _.reject(data.list, function (s) { - return s.id == id - }); - data.list.length = 0; - for (var i in new_list) { - data.list.push(new_list[i]); - } - console.info(data.list); + self.remove = function(id) { + var new_list = _.reject(data.list, function(s) { + return s.id == id + }); + data.list.length = 0; + for (var i in new_list) { + data.list.push(new_list[i]); } - - self.get = function (id) { - return new scb.FacsLane(_.find(data.list, function (e) { - return e.id == id; - }), context, self); + console.info(data.list); + } + + self.get = function(id) { + return new scb.FacsLane(_.find(data.list, function(e) { + return e.id == id; + }), context, self); + } + + self.reorder = function(new_order) { + var new_list = []; + for (var i in new_order) { + var new_id = new_order[i]; + new_list.push(_.find(data.list, function(e) { + return e.id == new_id + })); } - - self.reorder = function (new_order) { - var new_list = []; - for (var i in new_order) { - var new_id = new_order[i]; - new_list.push(_.find(data.list, function (e) { - return e.id == new_id - })); - } - if (new_list.length == data.list.length) { - data.list = new_list; - } else { - throw "NEW ORDER LENGTH != ORDER_LENGTH"; - } + if (new_list.length == data.list.length) { + data.list = new_list; + } else { + throw "NEW ORDER LENGTH != ORDER_LENGTH"; } - - self.filter = function (experiment_id, cell_treatment_id, collection_schedule_id) { - var all = self.list; - var ret = []; - for (var i in all) { - var x = all[i]; - if (x.experiment.id == experiment_id && x.cell_treatment.id == cell_treatment_id && x.collection_schedule.id == collection_schedule_id) { - ret.push(x); - } - } - return ret; + } + + self.filter = function(experiment_id, cell_treatment_id, collection_schedule_id) { + var all = self.list; + var ret = []; + for (var i in all) { + var x = all[i]; + if (x.experiment.id == experiment_id && x.cell_treatment.id == cell_treatment_id && x.collection_schedule.id == collection_schedule_id) { + ret.push(x); + } } + return ret; + } - self.reset = function () { - data.list = []; - } + self.reset = function() { + data.list = []; + } - scb.utils.accessor2_custom(self, 'length', function () { - return data.list.length; - }, scb.utils.read_only_exception); + scb.utils.accessor2_custom(self, 'length', function() { + return data.list.length; + }, scb.utils.read_only_exception); - scb.ModelHelpers.grouped_list(self, 'cell_treatment_id'); + scb.ModelHelpers.grouped_list(self, 'cell_treatment_id'); } scb.FacsLane = function scb_FacsLane(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'kind', _.keys(context.template.facs_kinds)[0], null, context); - scb.Utils.initialize_accessor_field(self, data, 'conditions', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'live', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'cell_treatment_id', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'gates_id', 0, null, context); - scb.Utils.initialize_accessor_field(self, data, 'exp_id', 0, null, context); - scb.Utils.initialize_accessor_field(self, data, 'bisector_gate_created', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'canvas_metadata', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'canvas_metadata_analysis', {points: [], ranges: []}, null, context); - scb.Utils.initialize_accessor_field(self, data, 'gate_selected', null, null, context); - scb.Utils.initialize_field(data, 'experiment_id', self.parent.parent.parent.parent); - - scb.utils.accessor2_custom(self, 'selected_gate', function () { - if (self.gate_selected) { - return _.find(self.canvas_metadata_analysis.points, function(e) { - return self.gate_selected == e.unique_id; - }); - } - else { - return null; - } - }, scb.utils.noop); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, 'kind', _.keys(context.template.facs_kinds)[0], null, context); + scb.Utils.initialize_accessor_field(self, data, 'conditions', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'live', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'cell_treatment_id', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'gates_id', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'exp_id', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'bisector_gate_created', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'canvas_metadata', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'canvas_metadata_analysis', { + points: [], + ranges: [] + }, null, context); + scb.Utils.initialize_accessor_field(self, data, 'gate_selected', null, null, context); + scb.Utils.initialize_field(data, 'experiment_id', self.parent.parent.parent.parent); + + scb.utils.accessor2_custom(self, 'selected_gate', function() { + if (self.gate_selected) { + return _.find(self.canvas_metadata_analysis.points, function(e) { + return self.gate_selected == e.unique_id; + }); + } else { + return null; + } + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'experiment', function () { - var assignment = context.js_model.current_assignment; - var experiment = assignment.experiments.get(data.experiment_id); - return experiment; - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'experiment', function() { + var assignment = context.js_model.current_assignment; + var experiment = assignment.experiments.get(data.experiment_id); + return experiment; + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'cell_treatment', function () { - return self.experiment.cell_treatment_list.get(data.cell_treatment_id); - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'cell_treatment', function() { + return self.experiment.cell_treatment_list.get(data.cell_treatment_id); + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'collection_schedule', function () { - return self.cell_treatment.collection_schedule_list.get(data.collection_schedule_id); - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'collection_schedule', function() { + return self.cell_treatment.collection_schedule_list.get(data.collection_schedule_id); + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'kinds', function () { - return context.template.facs_kinds; - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'kinds', function() { + return context.template.facs_kinds; + }, scb.utils.noop); - self.display_text = self.parent.parent.parent.parent.cell_treatment_list.get(self.cell_treatment_id).format_row(); + self.display_text = self.parent.parent.parent.parent.cell_treatment_list.get(self.cell_treatment_id).format_row(); } \ No newline at end of file diff --git a/html_app/model/FacsLanesPreparation.js b/html_app/model/FacsLanesPreparation.js index abb00feb..e5013945 100644 --- a/html_app/model/FacsLanesPreparation.js +++ b/html_app/model/FacsLanesPreparation.js @@ -1,66 +1,66 @@ 'use strict'; scb.FacsLanePreparationList = function scb_FacsLanePreparationList(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.FacsLanePreparation, context, self); - - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.FacsLanePreparation(d, context, self); - data.list.push(d); - return ret; - }; + var self = this; + self.parent = parent; + scb.ModelHelpers.common_list_code(self, data, scb.FacsLanePreparation, context, self); - self.duplicate = function(id) { - var orig = _.find(data.list, function(e) { - return e.id == id; - }); - if (scb.utils.isDefined(orig)) { - var clone = scb.utils.clone_and_clear(orig) - return self.start(clone); - } - }; + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.FacsLanePreparation(d, context, self); + data.list.push(d); + return ret; + }; - self.reorder = function(new_order) { - var new_list = []; - for (var i in new_order ) { - var new_id = new_order[i]; - new_list.push(_.find(data.list, function(e) { - return e.id == new_id - })); - } - if (new_list.length == data.list.length) { - data.list = new_list; - } else { - throw "NEW ORDER LENGTH != ORDER_LENGTH"; - } - } + self.duplicate = function(id) { + var orig = _.find(data.list, function(e) { + return e.id == id; + }); + if (scb.utils.isDefined(orig)) { + var clone = scb.utils.clone_and_clear(orig) + return self.start(clone); + } + }; - self.filter = function(experiment_id, cell_treatment_id, collection_schedule_id) { - var all = self.list; - var ret = []; - for (var i in all ) { - var x = all[i]; - if (x.experiment.id == experiment_id && x.cell_treatment.id == cell_treatment_id && x.collection_schedule.id == collection_schedule_id) { - ret.push(x); - } - } - return ret; - } + self.reorder = function(new_order) { + var new_list = []; + for (var i in new_order) { + var new_id = new_order[i]; + new_list.push(_.find(data.list, function(e) { + return e.id == new_id + })); + } + if (new_list.length == data.list.length) { + data.list = new_list; + } else { + throw "NEW ORDER LENGTH != ORDER_LENGTH"; + } + } - self.reset = function() { - data.list = []; - } + self.filter = function(experiment_id, cell_treatment_id, collection_schedule_id) { + var all = self.list; + var ret = []; + for (var i in all) { + var x = all[i]; + if (x.experiment.id == experiment_id && x.cell_treatment.id == cell_treatment_id && x.collection_schedule.id == collection_schedule_id) { + ret.push(x); + } + } + return ret; + } + + self.reset = function() { + data.list = []; + } } scb.FacsLanePreparation = function scb_FacsLanePreparation(data, context, parent) { - var self = this; - self.parent = parent; - - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'kind', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'treatment', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'sub_treatment', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'chart_data', null, null, context); + var self = this; + self.parent = parent; + + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, 'kind', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'treatment', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'sub_treatment', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'chart_data', null, null, context); } \ No newline at end of file diff --git a/html_app/model/LensMap.js b/html_app/model/LensMap.js index 765ebcc8..e13e98bc 100644 --- a/html_app/model/LensMap.js +++ b/html_app/model/LensMap.js @@ -1,52 +1,52 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs -scb.LensMapProxy = { -'original': null, -'display' :null, -'cache': null +scb.LensMapProxy = { + 'original': null, + 'display': null, + 'cache': null }; scb.LensMap = function scb_LensMap(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'action', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'blur', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'brightness', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'cache_blur', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'cache_brightness', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'height', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'width', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'src', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'xparam', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'mag', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'if_type', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'yparam', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'isFirstDrag', true, null, context); - - self.lane_id = self.parent.id; - var template = context.template; - - self.disable_blur = template.ui.microscopy.disable_blur; - self.disable_brightness = template.ui.microscopy.disable_brightness; - - - scb.utils.accessor2_custom(self, 'orig', function () { - return scb.LensMapProxy.original; - }, function (d) { - scb.LensMapProxy.original = d; - }); - scb.utils.accessor2_custom(self, 'cache', function () { - return scb.LensMapProxy.cache; - }, function (d) { - scb.LensMapProxy.cache = d; - }); - - scb.utils.accessor2_custom(self, 'display', function () { - return scb.LensMapProxy.display; - }, function (d) { - scb.LensMapProxy.display = d; - }); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, 'action', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'blur', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'brightness', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'cache_blur', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'cache_brightness', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'height', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'width', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'src', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'xparam', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'mag', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'if_type', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'yparam', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'isFirstDrag', true, null, context); + + self.lane_id = self.parent.id; + var template = context.template; + + self.disable_blur = template.ui.microscopy.disable_blur; + self.disable_brightness = template.ui.microscopy.disable_brightness; + + + scb.utils.accessor2_custom(self, 'orig', function() { + return scb.LensMapProxy.original; + }, function(d) { + scb.LensMapProxy.original = d; + }); + scb.utils.accessor2_custom(self, 'cache', function() { + return scb.LensMapProxy.cache; + }, function(d) { + scb.LensMapProxy.cache = d; + }); + + scb.utils.accessor2_custom(self, 'display', function() { + return scb.LensMapProxy.display; + }, function(d) { + scb.LensMapProxy.display = d; + }); } \ No newline at end of file diff --git a/html_app/model/LysateKind.js b/html_app/model/LysateKind.js index 65edfedb..c638cbc3 100644 --- a/html_app/model/LysateKind.js +++ b/html_app/model/LysateKind.js @@ -1,92 +1,92 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.LysateKindList = function scb_LysateKindList(data, context) { - var self = this; + var self = this; - scb.ModelHelpers.common_list_code(self, data, scb.LysateKind, context, self); + scb.ModelHelpers.common_list_code(self, data, scb.LysateKind, context, self); - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.LysateKind(d, context); - data.list.push(d); - return ret; - } + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.LysateKind(d, context); + data.list.push(d); + return ret; + } } scb.LysateKind = function scb_LysateKind(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, "whole_cell", false, null, context); - scb.Utils.initialize_accessor_field(self, data, "cytoplasm", false, null, context); - scb.Utils.initialize_accessor_field(self, data, "nuclear", false, null, context); - scb.Utils.initialize_accessor_field(self, data, "ip", false, null, context); - scb.Utils.initialize_accessor_field(self, data, "ip_primary_anti_body", "", null, context); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, "whole_cell", false, null, context); + scb.Utils.initialize_accessor_field(self, data, "cytoplasm", false, null, context); + scb.Utils.initialize_accessor_field(self, data, "nuclear", false, null, context); + scb.Utils.initialize_accessor_field(self, data, "ip", false, null, context); + scb.Utils.initialize_accessor_field(self, data, "ip_primary_anti_body", "", null, context); - scb.Utils.initialize_field(data, 'experiment_id', ""); - scb.Utils.initialize_field(data, 'cell_treatment_id', ""); - scb.Utils.initialize_field(data, 'collection_time_id', ""); - scb.Utils.initialize_field(data, 'ip_secondary_anti_body', ""); + scb.Utils.initialize_field(data, 'experiment_id', ""); + scb.Utils.initialize_field(data, 'cell_treatment_id', ""); + scb.Utils.initialize_field(data, 'collection_time_id', ""); + scb.Utils.initialize_field(data, 'ip_secondary_anti_body', ""); - var experiment = context.js_model.current_session.experiment_setup_list.get(data.experiment_id); - var cell_treatment = experiment.cell_treatment_list.get(data.cell_treatment_id); - var collection_time = experiment.collection_schedule_list.get(data.collection_time_id); + var experiment = context.js_model.current_session.experiment_setup_list.get(data.experiment_id); + var cell_treatment = experiment.cell_treatment_list.get(data.cell_treatment_id); + var collection_time = experiment.collection_schedule_list.get(data.collection_time_id); - self.cell_line_id = cell_treatment.cell_line(); - self.treatment_list = []; - for (var ti in cell_treatment.treatment_list.list ) { - var tid = cell_treatment.treatment_list.list[ti].id; - var treatment = cell_treatment.treatment_list.get(tid); - var drug_list = treatment.drug_list; - var drugs = []; - for (var di in drug_list.list ) { - var dit = drug_list.list[di].id; - var drug = drug_list.get(dit); - var name = drug.drug_name; - var concentration = drug.drug_concentration(); - drugs.push({ - name : name, - concentration : concentration - }); - } - self.treatment_list.push({ - schedule : treatment.schedule, - temperature : treatment.temperature, - drug_list : drugs - }); - } - self.collection_time = collection_time.schedule(); + self.cell_line_id = cell_treatment.cell_line(); + self.treatment_list = []; + for (var ti in cell_treatment.treatment_list.list) { + var tid = cell_treatment.treatment_list.list[ti].id; + var treatment = cell_treatment.treatment_list.get(tid); + var drug_list = treatment.drug_list; + var drugs = []; + for (var di in drug_list.list) { + var dit = drug_list.list[di].id; + var drug = drug_list.get(dit); + var name = drug.drug_name; + var concentration = drug.drug_concentration(); + drugs.push({ + name: name, + concentration: concentration + }); + } + self.treatment_list.push({ + schedule: treatment.schedule, + temperature: treatment.temperature, + drug_list: drugs + }); + } + self.collection_time = collection_time.schedule(); - self.lysates = function() { - var ret = []; - var template = { - lysate_kind_id : self.id - }; - var kinds = ['whole_cell', 'cytoplasm', 'nuclear']; - for (var i in kinds ) { - if (data[kinds[i]]) { - var t = _.clone(template); - t.kind = kinds[i]; - ret.push(t); - } - } - if (data.ip) { - var t = _.clone(template); - t.kind = 'ip'; - t.ip_primary_anti_body = data.ip_primary_anti_body; - ret.push(t); - } - return ret; - } + self.lysates = function() { + var ret = []; + var template = { + lysate_kind_id: self.id + }; + var kinds = ['whole_cell', 'cytoplasm', 'nuclear']; + for (var i in kinds) { + if (data[kinds[i]]) { + var t = _.clone(template); + t.kind = kinds[i]; + ret.push(t); + } + } + if (data.ip) { + var t = _.clone(template); + t.kind = 'ip'; + t.ip_primary_anti_body = data.ip_primary_anti_body; + ret.push(t); + } + return ret; + } - self.__defineGetter__('empty', function() { - var kinds = ['whole_cell', 'cytoplasm', 'nuclear', 'ip']; - for (var i in kinds ) { - if (data[kinds[i]]) { - return false; - } - } - return true; - }); + self.__defineGetter__('empty', function() { + var kinds = ['whole_cell', 'cytoplasm', 'nuclear', 'ip']; + for (var i in kinds) { + if (data[kinds[i]]) { + return false; + } + } + return true; + }); } \ No newline at end of file diff --git a/html_app/model/MakingLysates.js b/html_app/model/MakingLysates.js index 560c8677..02ab3033 100644 --- a/html_app/model/MakingLysates.js +++ b/html_app/model/MakingLysates.js @@ -1,48 +1,48 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.MakingLysateList = function scb_MakingLysateList(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.MakingLysate, context, self); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_list_code(self, data, scb.MakingLysate, context, self); - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - if (!d.hasOwnProperty('name')) { - d.name = 'Setup ' + data.counter++; - } + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + if (!d.hasOwnProperty('name')) { + d.name = 'Setup ' + data.counter++; + } - var ret = new scb.MakingLysate(d, context); - data.list.push(d); - return ret; - } + var ret = new scb.MakingLysate(d, context); + data.list.push(d); + return ret; + } - self.new_using_experiment = function(experiment_setup_id) { - var experiment = context.js_model.current_session.experiment_setup_list.get(experiment_setup_id); - var d = { - name : "Lysate prep " + data.counter++ - }; - var ml = new scb.MakingLysate(d, context); - for (var ct in experiment.cell_treatment_list.list ) { - var cell_treatment_data = experiment.cell_treatment_list.list[ct]; - for (var st in experiment.collection_schedule_list.list ) { - var collection_time_data = experiment.collection_schedule_list.list[st]; - ml.lysate_kind_list.start({ - experiment_id : experiment.id, - cell_treatment_id : cell_treatment_data.id, - collection_time_id : collection_time_data.id - }); - } - } - data.list.push(d); - self.select_id(ml.id); - return ml; - } + self.new_using_experiment = function(experiment_setup_id) { + var experiment = context.js_model.current_session.experiment_setup_list.get(experiment_setup_id); + var d = { + name: "Lysate prep " + data.counter++ + }; + var ml = new scb.MakingLysate(d, context); + for (var ct in experiment.cell_treatment_list.list) { + var cell_treatment_data = experiment.cell_treatment_list.list[ct]; + for (var st in experiment.collection_schedule_list.list) { + var collection_time_data = experiment.collection_schedule_list.list[st]; + ml.lysate_kind_list.start({ + experiment_id: experiment.id, + cell_treatment_id: cell_treatment_data.id, + collection_time_id: collection_time_data.id + }); + } + } + data.list.push(d); + self.select_id(ml.id); + return ml; + } } -scb.MakingLysate = function scb_MakingLysate(data, context,parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'finished', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'lysate_kind_list', {}, scb.LysateKindList, context); +scb.MakingLysate = function scb_MakingLysate(data, context, parent) { + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, 'finished', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'lysate_kind_list', {}, scb.LysateKindList, context); } \ No newline at end of file diff --git a/html_app/model/Microscopy.js b/html_app/model/Microscopy.js index a9b02113..0149a537 100644 --- a/html_app/model/Microscopy.js +++ b/html_app/model/Microscopy.js @@ -1,239 +1,249 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.MicroscopyList = function scb_MicroscopyList(data, context, parent) { - var self = this; - self.parent = parent; + var self = this; + self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.Microscopy, context, self); - - scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', 0, null, context); + scb.ModelHelpers.common_list_code(self, data, scb.Microscopy, context, self); + scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', 0, null, context); - self.start = function (d) { - d = ( typeof (d) == 'undefined' ? {} : d); - d.name = d.name || "M. " + data.counter++; - var ret = new scb.Microscopy(d, context, self); - data.list.push(d); - return ret; - } - self.new_using_making_lysates = function (making_lysates_id) { - var experiment = context.js_model.current_session.making_lysate_list.get(making_lysates_id); - var d = { - name:"Microscopy " + data.counter++, - display_lysates_id:making_lysates_id - }; - var ml = new scb.Microscopy(d, context); - //TODO here we will count lysates and if there are less than 10 we will fill lanes up - data.list.push(d); - return ml; - } + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + d.name = d.name || "M. " + data.counter++; + var ret = new scb.Microscopy(d, context, self); + data.list.push(d); + return ret; + } - self.duplicate = function (id) { - var orig = self.get(id); - var clone = JSON.parse(JSON.stringify(orig.__data__)); - delete clone.id; - if (("" + clone.name).indexOf('(Copy)') == -1) { - clone.name = clone.name + " (Copy)"; - } - delete clone.created_at; - clone.finished = false; - delete clone.canvas_data; - clone.gels_list = _.clone(clone.gels_list); - clone.exposure_list = _.clone(clone.exposure_list); - try { - for (var i in clone.lanes_list.list) { - var lane = clone.lanes_list.list[i]; - lane.marks = []; - } - for (var i in clone.exposure_list.list) { - var exp = clone.exposure_list.list[i]; - exp.canvas_data = null; - } - } catch (err) { - } - ; - var ml = new scb.Microscopy(clone, context, self); - data.list.push(clone); - return ml; + self.new_using_making_lysates = function(making_lysates_id) { + var experiment = context.js_model.current_session.making_lysate_list.get(making_lysates_id); + var d = { + name: "Microscopy " + data.counter++, + display_lysates_id: making_lysates_id + }; + var ml = new scb.Microscopy(d, context); + //TODO here we will count lysates and if there are less than 10 we will fill lanes up + data.list.push(d); + return ml; + } + + self.duplicate = function(id) { + var orig = self.get(id); + var clone = JSON.parse(JSON.stringify(orig.__data__)); + delete clone.id; + if (("" + clone.name).indexOf('(Copy)') == -1) { + clone.name = clone.name + " (Copy)"; } + delete clone.created_at; + clone.finished = false; + delete clone.canvas_data; + clone.gels_list = _.clone(clone.gels_list); + clone.exposure_list = _.clone(clone.exposure_list); + try { + for (var i in clone.lanes_list.list) { + var lane = clone.lanes_list.list[i]; + lane.marks = []; + } + for (var i in clone.exposure_list.list) { + var exp = clone.exposure_list.list[i]; + exp.canvas_data = null; + } + } catch ( err ) {} + ; + var ml = new scb.Microscopy(clone, context, self); + data.list.push(clone); + return ml; + } } scb.Microscopy = function scb_Microscopy(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'slide_prepared', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'lanes_list', {}, scb.MicroscopyLaneList, context); - /* samples_finished is true after LOAD was clicked */ - scb.Utils.initialize_accessor_field(self, data, 'samples_finished', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'lane_selected', null, null, context); - /* Has a dict of all lane_ids and corresponding value: 'checked' or 'undefined' - * it is set in MicroscopyView */ - scb.Utils.initialize_accessor_field(self, data, 'is_cell_treatment_enabled', {}, null, context); - /* to save selected lane for each cell_treatment */ - scb.Utils.initialize_accessor_field(self, data, 'is_tab_selected', {}, null, context); - /* for each cell_treatment want to save starting tab */ - scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', {}, null, context); - - scb.Utils.initialize_accessor_field(self, data, 'warning_fired', false, null, context); - - scb.Utils.initialize_accessor_field(self, data, 'laser_on', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'red_enabled', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'blue_enabled', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'green_enabled', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'merge_enabled', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'scroll', 0, null, context); - scb.Utils.initialize_accessor_field(self, data, 'prep_scroll', 0, null, context); - scb.Utils.initialize_accessor_field(self, data, 'samples_show_state', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'navigation_show_state', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'enable_samples', false, null, context); - /* The total number of lanes for the currently selected sample (cell_treatment_id), - * used for display and navigation through the small tabs */ - scb.Utils.initialize_accessor_field(self, data, 'total_num_tabs', 0, null, context); - - var template = context.template; - - self.disable_blur = template.ui.microscopy.disable_blur; - self.disable_brightness = template.ui.microscopy.disable_brightness; - - - - scb.Utils.initialize_accessor_field(self, data, 'light_on', false, null, context); - scb.utils.accessor2_custom(self, 'selected_lane', function () { - if (self.lane_selected) { - return self.lanes_list.get(self.lane_selected); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, 'slide_prepared', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'lanes_list', {}, scb.MicroscopyLaneList, context); + /* samples_finished is true after LOAD was clicked */ + scb.Utils.initialize_accessor_field(self, data, 'samples_finished', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'lane_selected', null, null, context); + /* Has a dict of all lane_ids and corresponding value: 'checked' or 'undefined' + * it is set in MicroscopyView */ + scb.Utils.initialize_accessor_field(self, data, 'is_cell_treatment_enabled', {}, null, context); + /* to save selected lane for each cell_treatment */ + scb.Utils.initialize_accessor_field(self, data, 'is_tab_selected', {}, null, context); + /* for each cell_treatment want to save starting tab */ + scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', {}, null, context); + + scb.Utils.initialize_accessor_field(self, data, 'warning_fired', false, null, context); + + scb.Utils.initialize_accessor_field(self, data, 'laser_on', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'red_enabled', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'blue_enabled', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'green_enabled', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'merge_enabled', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'scroll', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'prep_scroll', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'samples_show_state', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'navigation_show_state', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'enable_samples', false, null, context); + /* The total number of lanes for the currently selected sample (cell_treatment_id), + * used for display and navigation through the small tabs */ + scb.Utils.initialize_accessor_field(self, data, 'total_num_tabs', 0, null, context); + + var template = context.template; + + self.disable_blur = template.ui.microscopy.disable_blur; + self.disable_brightness = template.ui.microscopy.disable_brightness; + + + + scb.Utils.initialize_accessor_field(self, data, 'light_on', false, null, context); + scb.utils.accessor2_custom(self, 'selected_lane', function() { + if (self.lane_selected) { + return self.lanes_list.get(self.lane_selected); + } else { + return null; + } + }, scb.utils.noop); + + self.rows_state = function(exp) { + var experiment = exp || self.parent.parent; + var grouped_rows = self.lanes_list.grouped_list; + var rows = []; + _.each(experiment.cell_treatment_list.list, function(e) { + if (grouped_rows[e.id] && !('na' in e.treatment_list.list[0].conditions)) { + /*find all conditions already chosen for this lane*/ + var chosen_conditions = _.map(grouped_rows[e.id], function(z) { + return z.slide_conditions + }).sort(); + /*find all conditions available for this lane*/ + var avail_conditions = []; + var lane_conditions_dict = e.treatment_list.list[0].conditions; + _.each(_.keys(lane_conditions_dict), function(a) { + _.each(lane_conditions_dict[a], function(c) { + avail_conditions.push(c); + }) + }); + var skip_placeholders = false; + /* number of chosen conditions should not exceed the number available*/ + if (chosen_conditions.length >= avail_conditions.length) { + skip_placeholders = true; } - else { - return null; + /* after samples were prepared want to initialize dict with + initial tab value */ + if (self.slide_prepared) { + if (!self.start_tabs_index.hasOwnProperty(e.id)) { + self.start_tabs_index[e.id] = 0; + } } - }, scb.utils.noop); - - self.rows_state = function (exp) { - var experiment = exp || self.parent.parent; - var grouped_rows = self.lanes_list.grouped_list; - var rows = []; - _.each(experiment.cell_treatment_list.list, function (e) { - if (grouped_rows[e.id] && !('na' in e.treatment_list.list[0].conditions)) { - /*find all conditions already chosen for this lane*/ - var chosen_conditions= _.map(grouped_rows[e.id], function(z){return z.slide_conditions}).sort(); - /*find all conditions available for this lane*/ - var avail_conditions= []; - var lane_conditions_dict=e.treatment_list.list[0].conditions; - _.each(_.keys(lane_conditions_dict), function(a){ - _.each(lane_conditions_dict[a],function(c){ - avail_conditions.push(c); - }) - }); - var skip_placeholders=false; - /* number of chosen conditions should not exceed the number available*/ - if(chosen_conditions.length >= avail_conditions.length){ - skip_placeholders = true; - } - /* after samples were prepared want to initialize dict with - initial tab value */ - if(self.slide_prepared){ - if(!self.start_tabs_index.hasOwnProperty(e.id)){ - self.start_tabs_index[e.id] = 0; - } - } - - /* find total number of tabs for this sample*/ - /* the number of valid lanes for this CellTreatment*/ - var num_tabs=0; - _.each(grouped_rows[e.id], function(ee){ - if(self.is_cell_treatment_enabled[e.id] && ee && ee.slide_conditions){ - num_tabs+=1; - } - }); - var is_valid; - _.each(grouped_rows[e.id], function (ee, index) { - is_valid=false; - /* identifies a complete lane, an enabled treatment with analysis and condition */ - if( - self.is_cell_treatment_enabled.hasOwnProperty(e.id) && - typeof ee !== 'undefined' && - ee.slide_conditions !== null) - { - is_valid = true; - } - /* - after samples were prepared want to initialize dict with - first valid lane for each cell_treatment - */ - if(self.slide_prepared && !self.is_tab_selected.hasOwnProperty(e.id) && is_valid){ - self.is_tab_selected[e.id]= ee.id; - } - rows.push({ - /* existing means that lane was created */ - kind:'existing', - cell_treatment:e, - lane:ee, - /* used in sample prep */ - display_sample:index == 0, - /* if checkbox is checked*/ - is_sample_enabled:self.is_cell_treatment_enabled[e.id], - index:index, - is_valid: is_valid, - /* used for displaying the selected lane in the samples list*/ - is_tab_selected: self.is_tab_selected[e.id] == ee.id, - display_text: e.format_row(), - /* at most 4 tabs can be displayed */ - display_tab: false, - num_tabs: num_tabs, - more_conditions: !skip_placeholders - }); - }); - if (!skip_placeholders) { - rows.push({ - kind:'placeholder', - display_sample:false, - cell_treatment:e, - is_sample_enabled:self.is_cell_treatment_enabled[e.id], - is_valid:false - }); - } - } else { - rows.push({ - kind:'new', - row_type:'new', - display_sample:true, - cell_treatment:e, - is_sample_enabled:self.is_cell_treatment_enabled[e.id], - is_valid:false, - display_text: e.format_row() - }) - } + + /* find total number of tabs for this sample*/ + /* the number of valid lanes for this CellTreatment*/ + var num_tabs = 0; + _.each(grouped_rows[e.id], function(ee) { + if (self.is_cell_treatment_enabled[e.id] && ee && ee.slide_conditions) { + num_tabs += 1; + } }); - var valid_lane_index=0; - /* for each valid lane, that belongs to the selected cell_treatment, - check if it is withing the bound of 4 tabs */ - if(self.samples_finished) { - _.each(rows, function (e) { - /* Make sure that lane e is complete and belongs to the selected cell_treatment */ - if (e.is_valid && e.cell_treatment.id == self.selected_lane.cell_treatment_id) { - if (valid_lane_index >= self.start_tabs_index[e.cell_treatment.id] && - valid_lane_index < self.start_tabs_index[e.cell_treatment.id] + 4) { - e.display_tab = true; - } - valid_lane_index++; - /* total number of tabs for this sample */ - if (e.lane.id === self.lane_selected) { - self.total_num_tabs = e.num_tabs; - } - } - - }); - } - var count = 0; - _.each(rows, function (e) { - if (e.is_valid) count++; + var is_valid; + _.each(grouped_rows[e.id], function(ee, index) { + is_valid = false; + /* identifies a complete lane, an enabled treatment with analysis and condition */ + if ( + self.is_cell_treatment_enabled.hasOwnProperty(e.id) && + typeof ee !== 'undefined' && + ee.slide_conditions !== null) { + is_valid = true; + } + /* + after samples were prepared want to initialize dict with + first valid lane for each cell_treatment + */ + if (self.slide_prepared && !self.is_tab_selected.hasOwnProperty(e.id) && is_valid) { + self.is_tab_selected[e.id] = ee.id; + } + rows.push({ + /* existing means that lane was created */ + kind: 'existing', + cell_treatment: e, + lane: ee, + /* used in sample prep */ + display_sample: index == 0, + /* if checkbox is checked*/ + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + index: index, + is_valid: is_valid, + /* used for displaying the selected lane in the samples list*/ + is_tab_selected: self.is_tab_selected[e.id] == ee.id, + display_text: e.format_row(), + /* at most 4 tabs can be displayed */ + display_tab: false, + num_tabs: num_tabs, + more_conditions: !skip_placeholders + }); }); - rows = _.sortBy(rows, function(obj){ if(obj.kind=='existing')return obj.lane.order_id; else return;}); - return {rows:rows, valid:count}; + if (!skip_placeholders) { + rows.push({ + kind: 'placeholder', + display_sample: false, + cell_treatment: e, + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + is_valid: false + }); + } + } else { + rows.push({ + kind: 'new', + row_type: 'new', + display_sample: true, + cell_treatment: e, + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + is_valid: false, + display_text: e.format_row() + }) + } + }); + var valid_lane_index = 0; + /* for each valid lane, that belongs to the selected cell_treatment, + check if it is withing the bound of 4 tabs */ + if (self.samples_finished) { + _.each(rows, function(e) { + /* Make sure that lane e is complete and belongs to the selected cell_treatment */ + if (e.is_valid && e.cell_treatment.id == self.selected_lane.cell_treatment_id) { + if (valid_lane_index >= self.start_tabs_index[e.cell_treatment.id] && + valid_lane_index < self.start_tabs_index[e.cell_treatment.id] + 4) { + e.display_tab = true; + } + valid_lane_index++; + /* total number of tabs for this sample */ + if (e.lane.id === self.lane_selected) { + self.total_num_tabs = e.num_tabs; + } + } + + }); } - - + var count = 0; + _.each(rows, function(e) { + if (e.is_valid) { + count++; + } + }); + rows = _.sortBy(rows, function(obj) { + if (obj.kind == 'existing') { + return obj.lane.order_id; + } else { + return; + } + }); + return { + rows: rows, + valid: count + }; + } + + } \ No newline at end of file diff --git a/html_app/model/MicroscopyLanes.js b/html_app/model/MicroscopyLanes.js index ad06a684..9b8169ec 100644 --- a/html_app/model/MicroscopyLanes.js +++ b/html_app/model/MicroscopyLanes.js @@ -1,149 +1,149 @@ 'use strict'; scb.MicroscopyLaneList = function scb_MicroscopyLaneList(data, context, parent) { - var self = this; - self.parent = parent; - - scb.Utils.initialize_field(data, 'list', []); - - Object.defineProperty(self, "list", { - get: function () { - var ret = []; - for (var i in data.list) { - var d = data.list[i]; - ret.push(new scb.MicroscopyLane(d, context, self)); - } - return ret; - } - }); - - self.start = function (d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.MicroscopyLane(d, context, self); - data.list.push(d); - return ret; + var self = this; + self.parent = parent; + + scb.Utils.initialize_field(data, 'list', []); + + Object.defineProperty(self, "list", { + get: function() { + var ret = []; + for (var i in data.list) { + var d = data.list[i]; + ret.push(new scb.MicroscopyLane(d, context, self)); + } + return ret; } - - self.ensure_experiment_lanes_for_experiment = function (experiment_id) { - var assignment = context.js_model.current_assignment; - var experiment = assignment.experiments.get(experiment_id); - var ctl = experiment.cell_treatment_list.list; - for (var cti in ctl) { - var ct = ctl[cti]; - var csl = ct.collection_schedule_list.list; - for (var csi in csl) { - var cs = csl[csi]; - var list = self.filter(experiment.id, ct.id, cs.id); - if (list.length == 0) { - self.start({ - experiment_id: experiment_id, - cell_treatment_id: ct.id, - collection_schedule_id: cs.id, - }); - } - } + }); + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.MicroscopyLane(d, context, self); + data.list.push(d); + return ret; + } + + self.ensure_experiment_lanes_for_experiment = function(experiment_id) { + var assignment = context.js_model.current_assignment; + var experiment = assignment.experiments.get(experiment_id); + var ctl = experiment.cell_treatment_list.list; + for (var cti in ctl) { + var ct = ctl[cti]; + var csl = ct.collection_schedule_list.list; + for (var csi in csl) { + var cs = csl[csi]; + var list = self.filter(experiment.id, ct.id, cs.id); + if (list.length == 0) { + self.start({ + experiment_id: experiment_id, + cell_treatment_id: ct.id, + collection_schedule_id: cs.id, + }); } + } } + } - self.duplicate = function (id) { - var orig = _.find(data.list, function (e) { - return e.id == id; - }); - if (scb.utils.isDefined(orig)) { - var clone = scb.utils.clone_and_clear(orig) - return self.start(clone); - } + self.duplicate = function(id) { + var orig = _.find(data.list, function(e) { + return e.id == id; + }); + if (scb.utils.isDefined(orig)) { + var clone = scb.utils.clone_and_clear(orig) + return self.start(clone); } + } - self.remove = function (id) { - var new_list = _.reject(data.list, function (s) { - return s.id == id - }); - data.list.length = 0; - for (var i in new_list) { - data.list.push(new_list[i]); - } - console.info(data.list); + self.remove = function(id) { + var new_list = _.reject(data.list, function(s) { + return s.id == id + }); + data.list.length = 0; + for (var i in new_list) { + data.list.push(new_list[i]); } - - self.get = function (id) { - return new scb.MicroscopyLane(_.find(data.list, function (e) { - return e.id == id; - }), context, self); + console.info(data.list); + } + + self.get = function(id) { + return new scb.MicroscopyLane(_.find(data.list, function(e) { + return e.id == id; + }), context, self); + } + + self.reorder = function(new_order) { + var new_list = []; + for (var i in new_order) { + var new_id = new_order[i]; + new_list.push(_.find(data.list, function(e) { + return e.id == new_id + })); } - - self.reorder = function (new_order) { - var new_list = []; - for (var i in new_order) { - var new_id = new_order[i]; - new_list.push(_.find(data.list, function (e) { - return e.id == new_id - })); - } - if (new_list.length == data.list.length) { - data.list = new_list; - } else { - throw "NEW ORDER LENGTH != ORDER_LENGTH"; - } + if (new_list.length == data.list.length) { + data.list = new_list; + } else { + throw "NEW ORDER LENGTH != ORDER_LENGTH"; } - - self.filter = function (experiment_id, cell_treatment_id, collection_schedule_id) { - var all = self.list; - var ret = []; - for (var i in all) { - var x = all[i]; - if (x.experiment.id == experiment_id && x.cell_treatment.id == cell_treatment_id && x.collection_schedule.id == collection_schedule_id) { - ret.push(x); - } - } - return ret; + } + + self.filter = function(experiment_id, cell_treatment_id, collection_schedule_id) { + var all = self.list; + var ret = []; + for (var i in all) { + var x = all[i]; + if (x.experiment.id == experiment_id && x.cell_treatment.id == cell_treatment_id && x.collection_schedule.id == collection_schedule_id) { + ret.push(x); + } } + return ret; + } - self.reset = function () { - data.list = []; - } + self.reset = function() { + data.list = []; + } - scb.utils.accessor2_custom(self, 'length', function () { - return data.list.length; - }, scb.utils.read_only_exception); + scb.utils.accessor2_custom(self, 'length', function() { + return data.list.length; + }, scb.utils.read_only_exception); - scb.ModelHelpers.grouped_list(self, 'cell_treatment_id'); + scb.ModelHelpers.grouped_list(self, 'cell_treatment_id'); } scb.MicroscopyLane = function scb_MicroscopyLane(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'kind', _.keys(context.template.micro_kinds)[0], null, context); - //scb.Utils.initialize_accessor_field(self, data, 'lens_map', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'lens_map', {}, scb.LensMap, context); - scb.Utils.initialize_accessor_field(self, data, 'slide_conditions', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'cell_treatment_id', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'current_slides', [], null, context); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, 'kind', _.keys(context.template.micro_kinds)[0], null, context); + //scb.Utils.initialize_accessor_field(self, data, 'lens_map', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'lens_map', {}, scb.LensMap, context); + scb.Utils.initialize_accessor_field(self, data, 'slide_conditions', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'cell_treatment_id', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'current_slides', [], null, context); - scb.Utils.initialize_accessor_field(self, data, 'mag', '0', null, context); + scb.Utils.initialize_accessor_field(self, data, 'mag', '0', null, context); - scb.Utils.initialize_field(data, 'experiment_id', self.parent.parent.parent.parent); + scb.Utils.initialize_field(data, 'experiment_id', self.parent.parent.parent.parent); - scb.utils.accessor2_custom(self, 'experiment', function () { - var assignment = context.js_model.current_assignment; - var experiment = assignment.experiments.get(data.experiment_id); - return experiment; - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'experiment', function() { + var assignment = context.js_model.current_assignment; + var experiment = assignment.experiments.get(data.experiment_id); + return experiment; + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'cell_treatment', function () { - return self.experiment.cell_treatment_list.get(data.cell_treatment_id); - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'cell_treatment', function() { + return self.experiment.cell_treatment_list.get(data.cell_treatment_id); + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'collection_schedule', function () { - return self.cell_treatment.collection_schedule_list.get(data.collection_schedule_id); - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'collection_schedule', function() { + return self.cell_treatment.collection_schedule_list.get(data.collection_schedule_id); + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'kinds', function () { - return context.template.micro_kinds; - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'kinds', function() { + return context.template.micro_kinds; + }, scb.utils.noop); - self.display_text = self.parent.parent.parent.parent.cell_treatment_list.get(self.cell_treatment_id).format_row(); + self.display_text = self.parent.parent.parent.parent.cell_treatment_list.get(self.cell_treatment_id).format_row(); } \ No newline at end of file diff --git a/html_app/model/ModelHelpers.js b/html_app/model/ModelHelpers.js index b34a45c3..22d95fb7 100644 --- a/html_app/model/ModelHelpers.js +++ b/html_app/model/ModelHelpers.js @@ -1,75 +1,74 @@ 'use strict'; scb.ModelHelpers = {}; -scb.ModelHelpers.common_list_code = function (self, data, proto, context) { +scb.ModelHelpers.common_list_code = function(self, data, proto, context) { - scb.utils.initialize_field(data, 'list', []); - scb.utils.initialize_field(data, 'selected_id', null); - scb.utils.initialize_field(data, 'counter', 1); + scb.utils.initialize_field(data, 'list', []); + scb.utils.initialize_field(data, 'selected_id', null); + scb.utils.initialize_field(data, 'counter', 1); - scb.utils.initialize_field(self, 'selected', null); - scb.utils.wrap_list(self, 'list', data, proto, context); + scb.utils.initialize_field(self, 'selected', null); + scb.utils.wrap_list(self, 'list', data, proto, context); - if (!scb.utils.isDefined(self.selected_id)) { - scb.utils.accessor2(self, 'selected_id', data); + if (!scb.utils.isDefined(self.selected_id)) { + scb.utils.accessor2(self, 'selected_id', data); + } + scb.utils.accessor2_custom(self, 'selected', function() { + var selected_id = self.selected_id; + if (selected_id != null) { + return new proto(scb.utils.find(data.list, selected_id), context, self); + } else { + return null; } - scb.utils.accessor2_custom(self, 'selected', function () { - var selected_id = self.selected_id; - if (selected_id != null) { - return new proto(scb.utils.find(data.list, selected_id), context, self); - } else { - return null; - } - }, scb.utils.read_only_exception); + }, scb.utils.read_only_exception); - self.get = function (id) { - var d = scb.utils.find(data.list, id); - return scb.utils.isDefined(d) ? new proto(d, context, self) : null; - } + self.get = function(id) { + var d = scb.utils.find(data.list, id); + return scb.utils.isDefined(d) ? new proto(d, context, self) : null; + } - self.remove = function (id) { - var new_list = scb.utils.reject(data.list, id); - data.list.length = 0; - for (var i in new_list) { - data.list.push(new_list[i]); - } - if (id == data.selected_id) { - data.selected_id = null; - } + self.remove = function(id) { + var new_list = scb.utils.reject(data.list, id); + data.list.length = 0; + for (var i in new_list) { + data.list.push(new_list[i]); + } + if (id == data.selected_id) { + data.selected_id = null; } + } - scb.utils.accessor2_custom(self, 'length', function () { - return data.list.length; - }, scb.utils.read_only_exception); + scb.utils.accessor2_custom(self, 'length', function() { + return data.list.length; + }, scb.utils.read_only_exception); - self.__data__ = data; + self.__data__ = data; } -scb.ModelHelpers.grouped_list = function(self,childs_field) {// is called from FacsLanes, childs_field == 'cell_treatment_id' - scb.utils.accessor2_custom(self, 'grouped_list', function () { - var list = self.list; - var ret = _.groupBy(_.sortBy(list, function (e) { - return e.created_at; - }), function (e) { - return e[childs_field]; - }); - return ret; - }, scb.utils.read_only_exception); +scb.ModelHelpers.grouped_list = function(self, childs_field) { // is called from FacsLanes, childs_field == 'cell_treatment_id' + scb.utils.accessor2_custom(self, 'grouped_list', function() { + var list = self.list; + var ret = _.groupBy(_.sortBy(list, function(e) { + return e.created_at; + }), function(e) { + return e[childs_field]; + }); + return ret; + }, scb.utils.read_only_exception); } -scb.ModelHelpers.common_entry_code = function (self, data, context) { - if(! data ) - { - console.info( "HERE" ) ; - } - scb.Utils.initialize_field(data, 'id', scb.Utils.generateUUID(self.constructor.name + '_')); - scb.Utils.initialize_field(data, 'name', data.id); - scb.Utils.initialize_field(data, 'description', ''); - scb.Utils.initialize_field(data, 'created_at', (new Date()).getTime()); +scb.ModelHelpers.common_entry_code = function(self, data, context) { + if (!data) { + console.info("HERE"); + } + scb.Utils.initialize_field(data, 'id', scb.Utils.generateUUID(self.constructor.name + '_')); + scb.Utils.initialize_field(data, 'name', data.id); + scb.Utils.initialize_field(data, 'description', ''); + scb.Utils.initialize_field(data, 'created_at', (new Date()).getTime()); - scb.utils.accessor2_getter_only(self, 'id', data); - scb.utils.accessor2(self, 'name', data); - scb.utils.accessor2(self, 'description', data); + scb.utils.accessor2_getter_only(self, 'id', data); + scb.utils.accessor2(self, 'name', data); + scb.utils.accessor2(self, 'description', data); - self.__data__ = data; + self.__data__ = data; } diff --git a/html_app/model/Notebook.js b/html_app/model/Notebook.js index 51cd123d..b5e933f4 100644 --- a/html_app/model/Notebook.js +++ b/html_app/model/Notebook.js @@ -1,97 +1,96 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.Notebook = function scb_Notebook(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'scroll', 0, null, context); - scb.Utils.initialize_accessor_field(self, data, 'edit_text', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'edit_image', false, null, context); - scb.Utils.initialize_accessor_field(self,data,'sections',{},scb.NotebookSectionList,context); - scb.Utils.initialize_accessor_field(self, data, 'image_experiment_id', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'image_western_blot_id', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'image_western_blot_gel_id', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'image_facs_id', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'image_facs_lane_id', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'image_microscopy_id', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'image_microscopy_lane_id', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'section_selected', null, null, context); - scb.utils.accessor2_custom(self, 'selected_section', function () { - if (self.section_selected) { - return self.sections.get(self.section_selected); - } - else { - return null; - } - }, scb.utils.noop); + scb.Utils.initialize_accessor_field(self, data, 'scroll', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'edit_text', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'edit_image', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'sections', {}, scb.NotebookSectionList, context); + scb.Utils.initialize_accessor_field(self, data, 'image_experiment_id', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'image_western_blot_id', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'image_western_blot_gel_id', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'image_facs_id', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'image_facs_lane_id', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'image_microscopy_id', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'image_microscopy_lane_id', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'section_selected', null, null, context); + scb.utils.accessor2_custom(self, 'selected_section', function() { + if (self.section_selected) { + return self.sections.get(self.section_selected); + } else { + return null; + } + }, scb.utils.noop); + + scb.utils.accessor2_custom(self, 'selected_experiment', function() { + var selected_id = self.image_experiment_id; + if (selected_id != null) { + return self.parent.experiments.get(selected_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'selected_western_blot', function() { + var selected_id = self.image_experiment_id; + if (selected_id != null) { + return self.parent.experiments.get(self.image_experiment_id).western_blot_list.get(self.image_western_blot_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'selected_western_blot_gel', function() { + var selected_id = self.image_experiment_id; + if (selected_id != null) { + return self.parent.experiments.get(self.image_experiment_id).western_blot_list.get(self.image_western_blot_id).gel_list.get(self.image_western_blot_gel_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + + scb.utils.accessor2_custom(self, 'selected_facs', function() { + var selected_id = self.image_experiment_id; + if (selected_id != null) { + return self.parent.experiments.get(self.image_experiment_id).facs_list.get(self.image_facs_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'selected_facs_lane', function() { + var selected_id = self.image_experiment_id; + if (selected_id != null) { + return self.parent.experiments.get(self.image_experiment_id).facs_list.get(self.image_facs_id).lanes_list.get(self.image_facs_lane_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + + scb.utils.accessor2_custom(self, 'selected_microscopy', function() { + var selected_id = self.image_experiment_id; + if (selected_id != null) { + return self.parent.experiments.get(self.image_experiment_id).microscopy_list.get(self.image_microscopy_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'selected_microscopy_lane', function() { + var selected_id = self.image_experiment_id; + if (selected_id != null) { + return self.parent.experiments.get(self.image_experiment_id).microscopy_list.get(self.image_microscopy_id).lanes_list.get(self.image_microscopy_lane_id); + } else { + return null; + } + }, scb.utils.read_only_exception); - scb.utils.accessor2_custom(self, 'selected_experiment', function () { - var selected_id = self.image_experiment_id; - if (selected_id != null) { - return self.parent.experiments.get(selected_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'selected_western_blot', function () { - var selected_id = self.image_experiment_id; - if (selected_id != null) { - return self.parent.experiments.get(self.image_experiment_id).western_blot_list.get(self.image_western_blot_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'selected_western_blot_gel', function () { - var selected_id = self.image_experiment_id; - if (selected_id != null) { - return self.parent.experiments.get(self.image_experiment_id).western_blot_list.get(self.image_western_blot_id).gel_list.get(self.image_western_blot_gel_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - - scb.utils.accessor2_custom(self, 'selected_facs', function () { - var selected_id = self.image_experiment_id; - if (selected_id != null) { - return self.parent.experiments.get(self.image_experiment_id).facs_list.get(self.image_facs_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'selected_facs_lane', function () { - var selected_id = self.image_experiment_id; - if (selected_id != null) { - return self.parent.experiments.get(self.image_experiment_id).facs_list.get(self.image_facs_id).lanes_list.get(self.image_facs_lane_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - - scb.utils.accessor2_custom(self, 'selected_microscopy', function () { - var selected_id = self.image_experiment_id; - if (selected_id != null) { - return self.parent.experiments.get(self.image_experiment_id).microscopy_list.get(self.image_microscopy_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'selected_microscopy_lane', function () { - var selected_id = self.image_experiment_id; - if (selected_id != null) { - return self.parent.experiments.get(self.image_experiment_id).microscopy_list.get(self.image_microscopy_id).lanes_list.get(self.image_microscopy_lane_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - } \ No newline at end of file diff --git a/html_app/model/NotebookElement.js b/html_app/model/NotebookElement.js index 39da7ddc..1143f0f3 100644 --- a/html_app/model/NotebookElement.js +++ b/html_app/model/NotebookElement.js @@ -1,106 +1,106 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.NotebookElementList = function scb_NotebookElementList(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.NotebookElement, context, self); - - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - d.name = d.name || "Section. " + data.counter++; - var ret = new scb.NotebookElement(d, context, self); - data.list.push(d); - return ret; - } - - + var self = this; + self.parent = parent; + scb.ModelHelpers.common_list_code(self, data, scb.NotebookElement, context, self); + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + d.name = d.name || "Section. " + data.counter++; + var ret = new scb.NotebookElement(d, context, self); + data.list.push(d); + return ret; + } + + } scb.NotebookElement = function scb_NotebookElement(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - // experiment_design_fields - scb.Utils.initialize_accessor_field(self,data,'type','',null,context); - scb.Utils.initialize_accessor_field(self,data,'data',null,null,context); - scb.Utils.initialize_accessor_field(self,data,'view','',null,context); - scb.Utils.initialize_accessor_field(self,data,'experiment_id','',null,context); - - scb.Utils.initialize_accessor_field(self,data,'headings',null,null,context); - scb.Utils.initialize_accessor_field(self,data,'rows',[],null,context); - - scb.Utils.initialize_accessor_field(self,data,'western_blot_id','',null,context); - scb.Utils.initialize_accessor_field(self,data,'gel_id','',null,context); - - scb.Utils.initialize_accessor_field(self,data,'exposure_time','',null,context); - scb.Utils.initialize_accessor_field(self,data,'facs_id','',null,context); - scb.Utils.initialize_accessor_field(self,data,'facs_lane_id','',null,context); - scb.Utils.initialize_accessor_field(self,data,'microscopy_id','',null,context); - scb.Utils.initialize_accessor_field(self,data,'microscopy_lane_id','',null,context); - - scb.utils.accessor2_custom(self, 'selected_experiment', function () { - var selected_id = self.experiment_id; - if (selected_id != null) { - return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'selected_western_blot', function () { - var selected_id = self.experiment_id; - if (selected_id != null) { - return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).western_blot_list.get(self.western_blot_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'selected_western_blot_gel', function () { - var selected_id = self.experiment_id; - if (selected_id != null) { - return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).western_blot_list.get(self.western_blot_id).gel_list.get(self.gel_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - - scb.utils.accessor2_custom(self, 'selected_facs', function () { - var selected_id = self.experiment_id; - if (selected_id != null) { - return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).facs_list.get(self.facs_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'selected_facs_lane', function () { - var selected_id = self.experiment_id; - if (selected_id != null) { - return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).facs_list.get(self.facs_id).lanes_list.get(self.facs_lane_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - - scb.utils.accessor2_custom(self, 'selected_microscopy', function () { - var selected_id = self.experiment_id; - if (selected_id != null) { - return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).microscopy_list.get(self.microscopy_id); - } else { - return null; - } - }, scb.utils.read_only_exception); - - scb.utils.accessor2_custom(self, 'selected_microscopy_lane', function () { - var selected_id = self.experiment_id; - if (selected_id != null) { - return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).microscopy_list.get(self.microscopy_id).lanes_list.get(self.microscopy_lane_id); - } else { - return null; - } - }, scb.utils.read_only_exception); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + // experiment_design_fields + scb.Utils.initialize_accessor_field(self, data, 'type', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'data', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'view', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'experiment_id', '', null, context); + + scb.Utils.initialize_accessor_field(self, data, 'headings', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'rows', [], null, context); + + scb.Utils.initialize_accessor_field(self, data, 'western_blot_id', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'gel_id', '', null, context); + + scb.Utils.initialize_accessor_field(self, data, 'exposure_time', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'facs_id', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'facs_lane_id', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'microscopy_id', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'microscopy_lane_id', '', null, context); + + scb.utils.accessor2_custom(self, 'selected_experiment', function() { + var selected_id = self.experiment_id; + if (selected_id != null) { + return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'selected_western_blot', function() { + var selected_id = self.experiment_id; + if (selected_id != null) { + return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).western_blot_list.get(self.western_blot_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'selected_western_blot_gel', function() { + var selected_id = self.experiment_id; + if (selected_id != null) { + return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).western_blot_list.get(self.western_blot_id).gel_list.get(self.gel_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + + scb.utils.accessor2_custom(self, 'selected_facs', function() { + var selected_id = self.experiment_id; + if (selected_id != null) { + return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).facs_list.get(self.facs_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'selected_facs_lane', function() { + var selected_id = self.experiment_id; + if (selected_id != null) { + return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).facs_list.get(self.facs_id).lanes_list.get(self.facs_lane_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + + scb.utils.accessor2_custom(self, 'selected_microscopy', function() { + var selected_id = self.experiment_id; + if (selected_id != null) { + return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).microscopy_list.get(self.microscopy_id); + } else { + return null; + } + }, scb.utils.read_only_exception); + + scb.utils.accessor2_custom(self, 'selected_microscopy_lane', function() { + var selected_id = self.experiment_id; + if (selected_id != null) { + return self.parent.parent.parent.parent.parent.experiments.get(self.experiment_id).microscopy_list.get(self.microscopy_id).lanes_list.get(self.microscopy_lane_id); + } else { + return null; + } + }, scb.utils.read_only_exception); } \ No newline at end of file diff --git a/html_app/model/NotebookSection.js b/html_app/model/NotebookSection.js index f468605f..0635f0dd 100644 --- a/html_app/model/NotebookSection.js +++ b/html_app/model/NotebookSection.js @@ -1,32 +1,32 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.NotebookSectionList = function scb_NotebookSectionList(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.NotebookSection, context, self); - - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - d.name = d.name || "Section. " + data.counter++; - var ret = new scb.NotebookSection(d, context, self); - data.list.push(d); - return ret; - } - - + var self = this; + self.parent = parent; + scb.ModelHelpers.common_list_code(self, data, scb.NotebookSection, context, self); + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + d.name = d.name || "Section. " + data.counter++; + var ret = new scb.NotebookSection(d, context, self); + data.list.push(d); + return ret; + } + + } scb.NotebookSection = function scb_NotebookSection(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - // experiment_design_fields - scb.Utils.initialize_accessor_field(self,data,'hypothesis','',null,context); - scb.Utils.initialize_accessor_field(self,data,'objective','',null,context); - scb.Utils.initialize_accessor_field(self,data,'technique','',null,context); - scb.Utils.initialize_accessor_field(self,data,'order_id',0,null,context); - scb.Utils.initialize_accessor_field(self,data,'elements',{},scb.NotebookElementList,context); - - - + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + // experiment_design_fields + scb.Utils.initialize_accessor_field(self, data, 'hypothesis', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'objective', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'technique', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'order_id', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'elements', {}, scb.NotebookElementList, context); + + + } \ No newline at end of file diff --git a/html_app/model/Template.js b/html_app/model/Template.js index c930f6f4..f3c24f6e 100644 --- a/html_app/model/Template.js +++ b/html_app/model/Template.js @@ -1,369 +1,367 @@ 'use strict'; -if (typeof (scb.template ) == 'undefined') { - scb.template = {}; +if (typeof (scb.template) == 'undefined') { + scb.template = {}; } scb.template.DEBUGGER = function scb_template_DEBUGGER(self, data, name) { - _.each(data, function (value, key) { - if (!_.contains(_.keys(self), key)) { - scb.utils.accessor2_custom(self, key, function () { - try { - throw new Error(name + " Read field " + key); - } catch (e) { - console.info(e.message, e.stack); - } - return data[key]; - }, function (v) { - data[key] = v; - }); + _.each(data, function(value, key) { + if (!_.contains(_.keys(self), key)) { + scb.utils.accessor2_custom(self, key, function() { + try { + throw new Error(name + " Read field " + key); + } catch ( e ) { + console.info(e.message, e.stack); } - }); + return data[key]; + }, function(v) { + data[key] = v; + }); + } + }); } scb.TemplateWrapper = function scb_Template(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - scb.Utils.initialize_accessor_field(self, data, key, value, null, context); - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + scb.Utils.initialize_accessor_field(self, data, key, value, null, context); + }); } scb.template.ui_experiment_setup = function scb_template_ui_experiment_setup(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - /* - table - format of table - array - kind, title, editable, children: [table] - */ - scb.Utils.initialize_accessor_field(self, data, 'table', [], null, context); - /* - actions - available actions - array - scb_f_experiment_setup_action_open_add_samples_dialog - */ - scb.Utils.initialize_accessor_field(self, data, 'actions', [], null, context); - - scb.template.DEBUGGER(self, data, "scb.template.ui_experiment_setup"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + /* + table - format of table - array - kind, title, editable, children: [table] + */ + scb.Utils.initialize_accessor_field(self, data, 'table', [], null, context); + /* + actions - available actions - array - scb_f_experiment_setup_action_open_add_samples_dialog + */ + scb.Utils.initialize_accessor_field(self, data, 'actions', [], null, context); + + scb.template.DEBUGGER(self, data, "scb.template.ui_experiment_setup"); } scb.template.ui_experimental_design = function scb_template_ui_experimental_design(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'techniques', [], null, context); - scb.Utils.initialize_accessor_field(self, data, 'gel_types', [], null, context); - scb.template.DEBUGGER(self, data, "scb.template.ui_experimental_design"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'techniques', [], null, context); + scb.Utils.initialize_accessor_field(self, data, 'gel_types', [], null, context); + scb.template.DEBUGGER(self, data, "scb.template.ui_experimental_design"); } scb.template.WesternBlot = function scb_TemplateUI_WesternBlot(data, context, parent) { - /* this is used to format cell lines */ - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'format', '', null, context); - scb.Utils.initialize_accessor_field(self, data, 'keys', {}, null, context); - scb.template.DEBUGGER(self, data, "scb.template.WesternBlot"); + /* this is used to format cell lines */ + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'format', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'keys', {}, null, context); + scb.template.DEBUGGER(self, data, "scb.template.WesternBlot"); } scb.template.Microscopy = function scb_template_Microscopy(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'disable_brightness', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'disable_blur', false, null, context); - scb.template.DEBUGGER(self, data, "scb.template.Microscopy"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'disable_brightness', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'disable_blur', false, null, context); + scb.template.DEBUGGER(self, data, "scb.template.Microscopy"); } scb.template.UI = function scb_TemplateUI(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'experimental_design', {}, scb.template.ui_experimental_design, context); - scb.Utils.initialize_accessor_field(self, data, 'experiment_setup', {}, scb.template.ui_experiment_setup, context); - scb.Utils.initialize_accessor_field(self, data, 'microscopy', {}, scb.template.Microscopy, context); - /** - add_multiple_dialog - */ - scb.Utils.initialize_accessor_field(self, data, 'add_multiple_dialog', {}, null, context); - /* - western_blot - */ - scb.Utils.initialize_accessor_field(self, data, 'western_blot', {}, scb.template.WesternBlot, context); - - _.each(data, function (value, key) { - if (!_.contains(_.keys(self), key)) { - scb.utils.accessor2_custom(self, key, function () { - try { - throw new Error("scb.template.UI Read field '" + key + "'"); - } catch (e) { - console.info(e.message, e.stack, _.keys(self)); - } - return data[key]; - }, function (v) { - data[key] = v; - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'experimental_design', {}, scb.template.ui_experimental_design, context); + scb.Utils.initialize_accessor_field(self, data, 'experiment_setup', {}, scb.template.ui_experiment_setup, context); + scb.Utils.initialize_accessor_field(self, data, 'microscopy', {}, scb.template.Microscopy, context); + /** + add_multiple_dialog + */ + scb.Utils.initialize_accessor_field(self, data, 'add_multiple_dialog', {}, null, context); + /* + western_blot + */ + scb.Utils.initialize_accessor_field(self, data, 'western_blot', {}, scb.template.WesternBlot, context); + + _.each(data, function(value, key) { + if (!_.contains(_.keys(self), key)) { + scb.utils.accessor2_custom(self, key, function() { + try { + throw new Error("scb.template.UI Read field '" + key + "'"); + } catch ( e ) { + console.info(e.message, e.stack, _.keys(self)); } - }); + return data[key]; + }, function(v) { + data[key] = v; + }); + } + }); } scb.Instructions = function scb_Instructions(data, context, parent) { - //TODO: make this accessors (custom) - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, index) { - self[index] = value; - }) - self.length = data.length; - self['title'] = data[0]; - self['text'] = data[1]; + //TODO: make this accessors (custom) + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, index) { + self[index] = value; + }) + self.length = data.length; + self['title'] = data[0]; + self['text'] = data[1]; } scb.InstructionsList = function scb_InstructionsList(data, context, parent) { - var self = this; - //TODO: make this accessors (custom) - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, index) { - self[index] = value; - }) - self.length = data.length; + var self = this; + //TODO: make this accessors (custom) + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, index) { + self[index] = value; + }) + self.length = data.length; } scb.template.CellLine = function scb_CellLine(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); - scb.template.DEBUGGER(self, data, "scb.template.CellLine"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); + scb.template.DEBUGGER(self, data, "scb.template.CellLine"); } scb.template.CellLines = function scb_CellLines(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.CellLine, context); - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.CellLine, context); + }); } scb.template.Drug = function scb_Drug(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); - scb.Utils.initialize_accessor_field(self, data, 'concentrations', [], null, context); - scb.template.DEBUGGER(self, data, "scb.template.Drug"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'concentrations', [], null, context); + scb.template.DEBUGGER(self, data, "scb.template.Drug"); } scb.template.Drugs = function scb_Drugs(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.Drug, context); - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.Drug, context); + }); } scb.template.LysateKind = function scb_LysateKind(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); - scb.template.DEBUGGER(self, data, "scb.template.LysateKind"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); + scb.template.DEBUGGER(self, data, "scb.template.LysateKind"); } scb.template.LysateKinds = function scb_LysateKinds(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.LysateKind, context); - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.LysateKind, context); + }); } scb.template.PrimaryAntiBody = function scb_template_PrimaryAntiBody(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); - scb.Utils.initialize_accessor_field(self, data, 'secondary', '', null, context); - scb.Utils.initialize_accessor_field(self, data, 'marks', [], null, context); - scb.Utils.initialize_accessor_field(self, data, 'gel_name', '', null, context); - scb.template.DEBUGGER(self, data, "scb.template.PrimaryAntiBody"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'secondary', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'marks', [], null, context); + scb.Utils.initialize_accessor_field(self, data, 'gel_name', '', null, context); + scb.template.DEBUGGER(self, data, "scb.template.PrimaryAntiBody"); } scb.template.PrimaryAntiBodies = function scb_template_PrimaryAntiBodies(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'order', [], null, context); - _.each(data, function (value, key) { - if (key != 'order') { - scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.PrimaryAntiBody, context); - } - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'order', [], null, context); + _.each(data, function(value, key) { + if (key != 'order') { + scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.PrimaryAntiBody, context); + } + }); } scb.template.SecondaryAntiBody = function scb_template_SecondaryAntiBody(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); - scb.template.DEBUGGER(self, data, "scb.template.SecondaryAntiBody"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); + scb.template.DEBUGGER(self, data, "scb.template.SecondaryAntiBody"); } scb.template.SecondaryAntiBodies = function scb_template_SecondaryAntiBodies(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - if (key != 'order') { - scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.SecondaryAntiBody, context); - } - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + if (key != 'order') { + scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.SecondaryAntiBody, context); + } + }); } scb.template.Concentration = function scb_template_Concentration(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); - scb.Utils.initialize_accessor_field(self, data, 'value', 0, null, context); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'value', 0, null, context); } scb.template.Concentrations = function scb_template_Concentrations(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.Concentration, context); - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.Concentration, context); + }); } -scb.template.MicroscopyKindCondition = function scb_template_MicroscopyKindCondition(data,context, parent ) -{ - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'name', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'short_name', null, null, context); - scb.template.DEBUGGER(self, data, "scb.template.MicroscopyKindCondition"); +scb.template.MicroscopyKindCondition = function scb_template_MicroscopyKindCondition(data, context, parent) { + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'name', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'short_name', null, null, context); + scb.template.DEBUGGER(self, data, "scb.template.MicroscopyKindCondition"); } -scb.template.MicroscopyKindConditions = function scb_template_MicroscopyKindConditions(data, context, parent) -{ - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.MicroscopyKindCondition, context); - }); +scb.template.MicroscopyKindConditions = function scb_template_MicroscopyKindConditions(data, context, parent) { + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.MicroscopyKindCondition, context); + }); } scb.template.MicroscopyKind = function scb_template_MicroscopyKind(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'name', '', null , context); - scb.Utils.initialize_accessor_field(self, data, 'conditions', {}, scb.template.MicroscopyKindConditions, context); - scb.template.DEBUGGER(self, data, "scb.template.MicroscopyKind"); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'name', '', null, context); + scb.Utils.initialize_accessor_field(self, data, 'conditions', {}, scb.template.MicroscopyKindConditions, context); + scb.template.DEBUGGER(self, data, "scb.template.MicroscopyKind"); } scb.template.MicroscopyKinds = function scb_template_MicroscopyKinds(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.MicroscopyKind, context); - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + scb.Utils.initialize_accessor_field(self, data, key, {}, scb.template.MicroscopyKind, context); + }); } scb.template.Slides = function scb_template_Slides(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - _.each(data, function (value, key) { - scb.Utils.initialize_accessor_field(self, data, key, '', null, context); - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + _.each(data, function(value, key) { + scb.Utils.initialize_accessor_field(self, data, key, '', null, context); + }); } scb.Template = function scb_Template(data, context, parent) { - var self = this; - scb.utils.value_hidden(self, '__data__', data); - scb.utils.value_hidden(self, 'parent', parent); - scb.Utils.initialize_accessor_field(self, data, 'instructions', [], scb.InstructionsList, context); - scb.Utils.initialize_accessor_field(self, data, 'ui', {}, scb.template.UI, context); - - /* - experiment_setup - text to display for experiment setup - scb_s_experiment_setup_instructions - */ - scb.Utils.initialize_accessor_field(self, data, 'experiment_setup', null, null, context); - /* - cell_lines - */ - scb.Utils.initialize_accessor_field(self, data, 'cell_lines', {}, scb.template.CellLines, context); - /* - drugs - */ - scb.Utils.initialize_accessor_field(self, data, 'drugs', {}, scb.template.Drugs, context); - /* - lysate_kinds - */ - scb.Utils.initialize_accessor_field(self, data, 'lysate_kinds', {}, scb.template.LysateKinds, context); - /* - primary_anti_body - */ - scb.Utils.initialize_accessor_field(self, data, 'primary_anti_body', {}, scb.template.PrimaryAntiBodies, context); - /* - secondary_anti_body - */ - scb.Utils.initialize_accessor_field(self, data, 'secondary_anti_body', {}, scb.template.SecondaryAntiBodies, context); - /* - concentrations - */ - scb.Utils.initialize_accessor_field(self, data, 'concentrations', {}, scb.template.Concentrations, context); - /* - micro_kinds - */ - scb.Utils.initialize_accessor_field(self, data, 'micro_kinds', {}, scb.template.MicroscopyKinds, context); - /* - slide_parser - TODO: understand slide_parser - scb_components_MicroscopyModelFactory.self.slide - */ - /* - slides - */ - scb.Utils.initialize_accessor_field(self, data, 'slides', {}, scb.template.MicroscopySlides, context); - /* - experiment_temperatures !!! - */ - - /* - model - TODO: this will be a big one! - */ - scb.Utils.initialize_accessor_field(self, data, 'model', {}, null, context); - _.each(data, function (value, key) { - if (!_.contains(_.keys(self), key)) { - scb.utils.accessor2_custom(self, key, function () { - try { - throw new Error("scb.Template Read field " + key); - } catch (e) { - console.info(e.message, e.stack); - } - return data[key]; - }, function (v) { - data[key] = v; - }); + var self = this; + scb.utils.value_hidden(self, '__data__', data); + scb.utils.value_hidden(self, 'parent', parent); + scb.Utils.initialize_accessor_field(self, data, 'instructions', [], scb.InstructionsList, context); + scb.Utils.initialize_accessor_field(self, data, 'ui', {}, scb.template.UI, context); + + /* + experiment_setup - text to display for experiment setup - scb_s_experiment_setup_instructions + */ + scb.Utils.initialize_accessor_field(self, data, 'experiment_setup', null, null, context); + /* + cell_lines + */ + scb.Utils.initialize_accessor_field(self, data, 'cell_lines', {}, scb.template.CellLines, context); + /* + drugs + */ + scb.Utils.initialize_accessor_field(self, data, 'drugs', {}, scb.template.Drugs, context); + /* + lysate_kinds + */ + scb.Utils.initialize_accessor_field(self, data, 'lysate_kinds', {}, scb.template.LysateKinds, context); + /* + primary_anti_body + */ + scb.Utils.initialize_accessor_field(self, data, 'primary_anti_body', {}, scb.template.PrimaryAntiBodies, context); + /* + secondary_anti_body + */ + scb.Utils.initialize_accessor_field(self, data, 'secondary_anti_body', {}, scb.template.SecondaryAntiBodies, context); + /* + concentrations + */ + scb.Utils.initialize_accessor_field(self, data, 'concentrations', {}, scb.template.Concentrations, context); + /* + micro_kinds + */ + scb.Utils.initialize_accessor_field(self, data, 'micro_kinds', {}, scb.template.MicroscopyKinds, context); + /* + slide_parser + TODO: understand slide_parser + scb_components_MicroscopyModelFactory.self.slide + */ + /* + slides + */ + scb.Utils.initialize_accessor_field(self, data, 'slides', {}, scb.template.MicroscopySlides, context); + /* + experiment_temperatures !!! + */ + + /* + model - TODO: this will be a big one! + */ + scb.Utils.initialize_accessor_field(self, data, 'model', {}, null, context); + _.each(data, function(value, key) { + if (!_.contains(_.keys(self), key)) { + scb.utils.accessor2_custom(self, key, function() { + try { + throw new Error("scb.Template Read field " + key); + } catch ( e ) { + console.info(e.message, e.stack); } - }); + return data[key]; + }, function(v) { + data[key] = v; + }); + } + }); } diff --git a/html_app/model/Treatment.js b/html_app/model/Treatment.js index 5ebfcf10..a4a548d6 100644 --- a/html_app/model/Treatment.js +++ b/html_app/model/Treatment.js @@ -1,126 +1,129 @@ 'use strict'; scb.TreatmentList = function scb_TreatmentList(data, context) { - var self = this; - - scb.ModelHelpers.common_list_code(self, data, scb.Treatment, context); - self.first_state = function(){ - if(self.list.length ==1){ - return self.list[0]; - } - else return null; - } - self.first = self.first_state(); - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? _.clone(scb.utils.get(context, ['template', 'experiment_templates', 'default', 'treatment'], {})) : d); - var ret = new scb.Treatment(d, context, self); - if (ret.drug_list.length == 0) { - ret.drug_list.start_default({}); - } - data.list.push(d); - return ret; - } + var self = this; + + scb.ModelHelpers.common_list_code(self, data, scb.Treatment, context); + self.first_state = function() { + if (self.list.length == 1) { + return self.list[0]; + } else { + return null; + } + } + self.first = self.first_state(); + self.start = function(d) { + d = (typeof (d) == 'undefined' ? _.clone(scb.utils.get(context, ['template', 'experiment_templates', 'default', 'treatment'], {})) : d); + var ret = new scb.Treatment(d, context, self); + if (ret.drug_list.length == 0) { + ret.drug_list.start_default({}); + } + data.list.push(d); + return ret; + } } scb.Treatment = function scb_Treatment(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'drug_list', {}, scb.DrugList, context); - scb.Utils.initialize_accessor_field(self, data, 'temperature', "20", null, context); - scb.Utils.initialize_accessor_field(self, data, 'collection_id', "0", null, context); - scb.Utils.initialize_accessor_field(self, data, 'collection_time', "0", null, context); - scb.Utils.initialize_accessor_field(self, data, 'microscope', {}, null, context); - scb.Utils.initialize_accessor_field(self, data, 'conditions', {}, null, context); - scb.Utils.initialize_accessor_field(self, data, 'facs', {}, null, context); + scb.Utils.initialize_accessor_field(self, data, 'drug_list', {}, scb.DrugList, context); + scb.Utils.initialize_accessor_field(self, data, 'temperature', "20", null, context); + scb.Utils.initialize_accessor_field(self, data, 'collection_id', "0", null, context); + scb.Utils.initialize_accessor_field(self, data, 'collection_time', "0", null, context); + scb.Utils.initialize_accessor_field(self, data, 'microscope', {}, null, context); + scb.Utils.initialize_accessor_field(self, data, 'conditions', {}, null, context); + scb.Utils.initialize_accessor_field(self, data, 'facs', {}, null, context); - // should be getter only - scb.Utils.initialize_accessor_field(self, data, 'start_time_value', "0", null, context); - // should be getter only - scb.Utils.initialize_accessor_field(self, data, 'duration_value', "0", null, context); - if(data.start_time_value !== "0"){ - scb.Utils.initialize_field(data, 'start_time', self.schedule_value); - Object.defineProperty(self, 'start_time', { - get : function() { - var time = parseFloat(data.schedule_value); - var days = Math.floor((time % 604800) / 86400); + // should be getter only + scb.Utils.initialize_accessor_field(self, data, 'start_time_value', "0", null, context); + // should be getter only + scb.Utils.initialize_accessor_field(self, data, 'duration_value', "0", null, context); + if (data.start_time_value !== "0") { + scb.Utils.initialize_field(data, 'start_time', self.schedule_value); + Object.defineProperty(self, 'start_time', { + get: function() { + var time = parseFloat(data.schedule_value); + var days = Math.floor((time % 604800) / 86400); - var hours = Math.floor((time % 86400) / 3600); - var minutes = Math.round((time % 3600) / 60); + var hours = Math.floor((time % 86400) / 3600); + var minutes = Math.round((time % 3600) / 60); - var months = Math.floor(time /2592000); + var months = Math.floor(time / 2592000); - var weeks = Math.floor((time % 2592000) / 604800); - var now = (time < 60 ); - return scb_common.format_time_detailed({ - weeks: weeks, - days : days, - hours : hours, - minutes : minutes, - months: months, - now : now - }).trim(); - }, - set : function(v) { - var time = scb.Utils.parse_time(v, context.template.time_unit.kind); - data.schedule_value = time; - data.schedule = self.schedule; - } - }); - }else{ - scb.Utils.initialize_accessor_field(self, data, 'start_time', "", null, context); - } - if(data.duration_value !== "0"){ - scb.Utils.initialize_field(data, 'duration', self.duration_value); - Object.defineProperty(self, 'duration', { - get : function() { - var time = parseFloat(data.duration_value); - var days = Math.floor((time % 604800) / 86400); - var hours = Math.floor((time % 86400) / 3600); - var minutes = Math.floor((time % 3600) / 60); - var months = Math.floor(time /2592000); - var weeks = Math.floor((time % 2592000) / 604800); - var now = (time < 30 ); - if( time < 0 ) return '' ; - if(time < 60){ - var seconds= Math.round(time%60); - return scb_common.format_time_detailed_w_sec({ - days : days, - hours : hours, - minutes : minutes, - seconds: seconds, - now : now - }).trim(); + var weeks = Math.floor((time % 2592000) / 604800); + var now = (time < 60); + return scb_common.format_time_detailed({ + weeks: weeks, + days: days, + hours: hours, + minutes: minutes, + months: months, + now: now + }).trim(); + }, + set: function(v) { + var time = scb.Utils.parse_time(v, context.template.time_unit.kind); + data.schedule_value = time; + data.schedule = self.schedule; + } + }); + } else { + scb.Utils.initialize_accessor_field(self, data, 'start_time', "", null, context); + } + if (data.duration_value !== "0") { + scb.Utils.initialize_field(data, 'duration', self.duration_value); + Object.defineProperty(self, 'duration', { + get: function() { + var time = parseFloat(data.duration_value); + var days = Math.floor((time % 604800) / 86400); + var hours = Math.floor((time % 86400) / 3600); + var minutes = Math.floor((time % 3600) / 60); + var months = Math.floor(time / 2592000); + var weeks = Math.floor((time % 2592000) / 604800); + var now = (time < 30); + if (time < 0) { + return ''; + } + if (time < 60) { + var seconds = Math.round(time % 60); + return scb_common.format_time_detailed_w_sec({ + days: days, + hours: hours, + minutes: minutes, + seconds: seconds, + now: now + }).trim(); - }else { - return scb_common.format_time_detailed({ - weeks: weeks, - days: days, - hours: hours, - minutes: minutes, - seconds: seconds, - months: months, - now: now - }).trim(); - } - }, - set : function(v) { - var time = scb.Utils.parse_time(v, context.template.time_unit.kind); - data.duration_value = time; - data.duration = self.duration; - } - }); + } else { + return scb_common.format_time_detailed({ + weeks: weeks, + days: days, + hours: hours, + minutes: minutes, + seconds: seconds, + months: months, + now: now + }).trim(); + } + }, + set: function(v) { + var time = scb.Utils.parse_time(v, context.template.time_unit.kind); + data.duration_value = time; + data.duration = self.duration; + } + }); - }else{ - scb.Utils.initialize_accessor_field(self, data, 'duration', "", null, context); - } + } else { + scb.Utils.initialize_accessor_field(self, data, 'duration', "", null, context); + } - self.temperature_name = function() { - return context.template.experiment_temperatures[data.temperature].name; - } + self.temperature_name = function() { + return context.template.experiment_temperatures[data.temperature].name; + } - scb.Utils.accessor_toString(self.temperature); + scb.Utils.accessor_toString(self.temperature); } \ No newline at end of file diff --git a/html_app/model/WesternBlot.js b/html_app/model/WesternBlot.js index d106b6aa..c11cfd6e 100644 --- a/html_app/model/WesternBlot.js +++ b/html_app/model/WesternBlot.js @@ -1,183 +1,188 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.WesternBlotList = function scb_WesternBlotList(data, context, parent) { - var self = this; - self.parent = parent; - - scb.ModelHelpers.common_list_code(self, data, scb.WesternBlot, context, self); - - scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', 0, null, context); - - - self.start = function (d) { - d = ( typeof (d) == 'undefined' ? {} : d); - d.name = d.name || "W. B. " + data.counter++; - var ret = new scb.WesternBlot(d, context, self); - data.list.push(d); - return ret; - } + var self = this; + self.parent = parent; - self.new_using_making_lysates = function (making_lysates_id) { - var experiment = context.js_model.current_session.making_lysate_list.get(making_lysates_id); - var d = { - name:"Western Blot " + data.counter++, - display_lysates_id:making_lysates_id - }; - var ml = new scb.WesternBlot(d, context); - //TODO here we will count lysates and if there are less than 10 we will fill lanes up - data.list.push(d); - return ml; - } + scb.ModelHelpers.common_list_code(self, data, scb.WesternBlot, context, self); - self.duplicate = function (id) { - var orig = self.get(id); - var clone = JSON.parse(JSON.stringify(orig.__data__)); - delete clone.id; - if (("" + clone.name).indexOf('(Copy)') == -1) { - clone.name = clone.name + " (Copy)"; - } - delete clone.created_at; - clone.finished = false; - delete clone.canvas_data; - clone.gels_list = _.clone(clone.gels_list); - clone.exposure_list = _.clone(clone.exposure_list); - try { - for (var i in clone.lanes_list.list) { - var lane = clone.lanes_list.list[i]; - lane.marks = []; - } - for (var i in clone.exposure_list.list) { - var exp = clone.exposure_list.list[i]; - exp.canvas_data = null; - } - } catch (err) { - } - ; - var ml = new scb.WesternBlot(clone, context, self); - data.list.push(clone); - return ml; + scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', 0, null, context); + + + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + d.name = d.name || "W. B. " + data.counter++; + var ret = new scb.WesternBlot(d, context, self); + data.list.push(d); + return ret; + } + + self.new_using_making_lysates = function(making_lysates_id) { + var experiment = context.js_model.current_session.making_lysate_list.get(making_lysates_id); + var d = { + name: "Western Blot " + data.counter++, + display_lysates_id: making_lysates_id + }; + var ml = new scb.WesternBlot(d, context); + //TODO here we will count lysates and if there are less than 10 we will fill lanes up + data.list.push(d); + return ml; + } + + self.duplicate = function(id) { + var orig = self.get(id); + var clone = JSON.parse(JSON.stringify(orig.__data__)); + delete clone.id; + if (("" + clone.name).indexOf('(Copy)') == -1) { + clone.name = clone.name + " (Copy)"; } + delete clone.created_at; + clone.finished = false; + delete clone.canvas_data; + clone.gels_list = _.clone(clone.gels_list); + clone.exposure_list = _.clone(clone.exposure_list); + try { + for (var i in clone.lanes_list.list) { + var lane = clone.lanes_list.list[i]; + lane.marks = []; + } + for (var i in clone.exposure_list.list) { + var exp = clone.exposure_list.list[i]; + exp.canvas_data = null; + } + } catch ( err ) {} + ; + var ml = new scb.WesternBlot(clone, context, self); + data.list.push(clone); + return ml; + } } scb.WesternBlot = function scb_WesternBlot(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'lysate_prepared', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'marker_loaded', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'wells_loaded', false, null, context); - - scb.Utils.initialize_accessor_field(self, data, 'gel_type', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'is_transfered', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'lanes_list', {}, scb.WesternBlotLaneList, context); - scb.Utils.initialize_accessor_field(self, data, 'gel_list', {}, scb.WesternBlotGelList, context); - scb.Utils.initialize_accessor_field(self, data, 'last_gel', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'canvas_metadata', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'prep_scroll', 0, null, context); - scb.Utils.initialize_accessor_field(self, data, 'is_cell_treatment_enabled', {}, null, context); - scb.Utils.initialize_accessor_field(self, data, 'samples_show_state', false, null, context); - - scb.Utils.initialize_accessor_field(self, data, 'measure_show_state', false, null, context); - - self.rows_state = function (exp) { - var skip_placeholders = false; - if (_.keys(context.template.lysate_kinds).length == 1) { - skip_placeholders = true; - } - var experiment = exp || self.parent.parent; - var grouped_rows = self.lanes_list.grouped_list; - var rows = []; - _.each(experiment.cell_treatment_list.list, function (e) { - if (grouped_rows[e.id]) { - _.each(grouped_rows[e.id], function (ee, index) { - rows.push({ - kind:'existing', - cell_treatment:e, - lane:ee, - display_sample:index == 0, - is_sample_enabled:self.is_cell_treatment_enabled[e.id], - index:index, - is_valid:self.is_cell_treatment_enabled[e.id] && ee, - is_marker: false, - display_text: e.format_row() - }); - - }); - if (!skip_placeholders) { - rows.push({ - kind:'placeholder', - display_sample:false, - cell_treatment:e, - is_sample_enabled:self.is_cell_treatment_enabled[e.id], - is_marker: false, - is_valid:false - }); - } - } else { - rows.push({ - kind:'new', - row_type:'new', - display_sample:true, - cell_treatment:e, - is_sample_enabled:self.is_cell_treatment_enabled[e.id], - is_marker: false, - is_valid:false, - display_text: e.format_row() - }) - } + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, 'lysate_prepared', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'marker_loaded', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'wells_loaded', false, null, context); + + scb.Utils.initialize_accessor_field(self, data, 'gel_type', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'is_transfered', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'lanes_list', {}, scb.WesternBlotLaneList, context); + scb.Utils.initialize_accessor_field(self, data, 'gel_list', {}, scb.WesternBlotGelList, context); + scb.Utils.initialize_accessor_field(self, data, 'last_gel', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'canvas_metadata', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'prep_scroll', 0, null, context); + scb.Utils.initialize_accessor_field(self, data, 'is_cell_treatment_enabled', {}, null, context); + scb.Utils.initialize_accessor_field(self, data, 'samples_show_state', false, null, context); + + scb.Utils.initialize_accessor_field(self, data, 'measure_show_state', false, null, context); + + self.rows_state = function(exp) { + var skip_placeholders = false; + if (_.keys(context.template.lysate_kinds).length == 1) { + skip_placeholders = true; + } + var experiment = exp || self.parent.parent; + var grouped_rows = self.lanes_list.grouped_list; + var rows = []; + _.each(experiment.cell_treatment_list.list, function(e) { + if (grouped_rows[e.id]) { + _.each(grouped_rows[e.id], function(ee, index) { + rows.push({ + kind: 'existing', + cell_treatment: e, + lane: ee, + display_sample: index == 0, + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + index: index, + is_valid: self.is_cell_treatment_enabled[e.id] && ee, + is_marker: false, + display_text: e.format_row() + }); + }); - if(grouped_rows['marker_treatment']){ - _.each(grouped_rows['marker_treatment'], function (ee, index) { - //ee.order_id = rows.length; - rows.push({ - kind:'existing', - lane:ee, - display_sample:index == 0, - index:index, - is_valid:false, - is_marker: true, - display_text: ee.name - }); - - }); + if (!skip_placeholders) { + rows.push({ + kind: 'placeholder', + display_sample: false, + cell_treatment: e, + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + is_marker: false, + is_valid: false + }); } - var count = 0; - _.each(rows, function (e) { - if (e.is_valid) count++; - + } else { + rows.push({ + kind: 'new', + row_type: 'new', + display_sample: true, + cell_treatment: e, + is_sample_enabled: self.is_cell_treatment_enabled[e.id], + is_marker: false, + is_valid: false, + display_text: e.format_row() + }) + } + }); + if (grouped_rows['marker_treatment']) { + _.each(grouped_rows['marker_treatment'], function(ee, index) { + //ee.order_id = rows.length; + rows.push({ + kind: 'existing', + lane: ee, + display_sample: index == 0, + index: index, + is_valid: false, + is_marker: true, + display_text: ee.name }); - if(self.lysate_prepared){ - var existing_rows = 0; - rows = _.sortBy(rows, function(obj){ - if(obj.kind == 'existing' && (obj.is_valid || obj.is_marker)){ - existing_rows ++; - return obj.lane.order_id; - } - else return; - }); - if(self.marker_loaded) { - if (rows[1].is_marker) { - var marker = rows[1]; - rows.splice(1, 1); - rows.splice(existing_rows, 0, marker); - } - if (rows[rows.length - 1].is_marker) { - var marker = rows[rows.length - 1]; - rows.splice(rows.length - 1, 1); - rows.splice(existing_rows, 0, marker); - } - } - } + }); + } + var count = 0; + _.each(rows, function(e) { + if (e.is_valid) { + count++; + } + + }); - - return {rows:rows, valid:count}; + if (self.lysate_prepared) { + var existing_rows = 0; + rows = _.sortBy(rows, function(obj) { + if (obj.kind == 'existing' && (obj.is_valid || obj.is_marker)) { + existing_rows++; + return obj.lane.order_id; + } else { + return; + } + }); + if (self.marker_loaded) { + if (rows[1].is_marker) { + var marker = rows[1]; + rows.splice(1, 1); + rows.splice(existing_rows, 0, marker); + } + if (rows[rows.length - 1].is_marker) { + var marker = rows[rows.length - 1]; + rows.splice(rows.length - 1, 1); + rows.splice(existing_rows, 0, marker); + } + } } - - scb.utils.accessor2_custom(self, 'rows_state_count', function(){ - return self.rows_state().valid; - }, scb.utils.read_only_exception); - //self.rows_state_count = self.rows_state().valid; + + + return { + rows: rows, + valid: count + }; + } + + scb.utils.accessor2_custom(self, 'rows_state_count', function() { + return self.rows_state().valid; + }, scb.utils.read_only_exception); + //self.rows_state_count = self.rows_state().valid; } \ No newline at end of file diff --git a/html_app/model/WesternBlotExposure.js b/html_app/model/WesternBlotExposure.js index ca4cd6fd..adcf471d 100644 --- a/html_app/model/WesternBlotExposure.js +++ b/html_app/model/WesternBlotExposure.js @@ -1,54 +1,54 @@ 'use strict'; scb.WesternBlotExposureList = function scb_WesternBlotExposureList(data, context, parent) { - var self = this; - self.parent = parent; + var self = this; + self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.WesternBlotExposure, context, self); + scb.ModelHelpers.common_list_code(self, data, scb.WesternBlotExposure, context, self); - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.WesternBlotExposure(d, context, self); - data.list.push(d); - return ret; - } + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.WesternBlotExposure(d, context, self); + data.list.push(d); + return ret; + } } scb.WesternBlotExposure = function scb_WesternBlotExposure(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - - scb.Utils.initialize_accessor_field(self, data, 'canvas_data', null, null, context); - // should be getter only - scb.Utils.initialize_accessor_field(self, data, 'schedule_value', "30", null, context); - scb.Utils.initialize_field(data, 'schedule', "1 min"); - - self.schedule = function(v) { - if ( typeof (v) == 'undefined') { - // getter - var time = parseFloat(data.schedule_value); - //var weeks = Math.floor(time / 604800); - - var days = Math.floor(time / 86400); - var hours = Math.floor((time % 86400) / 3600); - var minutes = Math.floor((time % 3600) / 60); - var seconds = time % 60; - var now = (time == 0); - return scb_common.format_time_detailed_w_sec({ - days : days, - hours : hours, - minutes : minutes, - seconds : seconds, - now : now - }).trim(); - } else { - // setter - var time = scb.Utils.parse_time(v, context.template.time_unit.kind); - data.schedule_value = time; - data.schedule = self.schedule(); - } - } - scb.Utils.accessor_toString(self.schedule); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + + scb.Utils.initialize_accessor_field(self, data, 'canvas_data', null, null, context); + // should be getter only + scb.Utils.initialize_accessor_field(self, data, 'schedule_value', "30", null, context); + scb.Utils.initialize_field(data, 'schedule', "1 min"); + + self.schedule = function(v) { + if (typeof (v) == 'undefined') { + // getter + var time = parseFloat(data.schedule_value); + //var weeks = Math.floor(time / 604800); + + var days = Math.floor(time / 86400); + var hours = Math.floor((time % 86400) / 3600); + var minutes = Math.floor((time % 3600) / 60); + var seconds = time % 60; + var now = (time == 0); + return scb_common.format_time_detailed_w_sec({ + days: days, + hours: hours, + minutes: minutes, + seconds: seconds, + now: now + }).trim(); + } else { + // setter + var time = scb.Utils.parse_time(v, context.template.time_unit.kind); + data.schedule_value = time; + data.schedule = self.schedule(); + } + } + scb.Utils.accessor_toString(self.schedule); } \ No newline at end of file diff --git a/html_app/model/WesternBlotGel.js b/html_app/model/WesternBlotGel.js index 3480682d..e1cbe5c1 100644 --- a/html_app/model/WesternBlotGel.js +++ b/html_app/model/WesternBlotGel.js @@ -1,34 +1,34 @@ -'use strict';// strict mode to eliminate some common bugs +'use strict'; // strict mode to eliminate some common bugs scb.WesternBlotGelList = function scb_WesternBlotGelList(data, context, parent) { - var self = this; - self.parent = parent; + var self = this; + self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.WesternBlotGel, context, self); - scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', 0, null, context); - self.start = function(d) { - d = ( typeof (d) == 'undefined' ? {} : d); - d.name = d.name || "BLOT"; - data.counter++; - var ret = new scb.WesternBlotGel(d, context, self); - data.list.push(d); - return ret; - } + scb.ModelHelpers.common_list_code(self, data, scb.WesternBlotGel, context, self); + scb.Utils.initialize_accessor_field(self, data, 'start_tabs_index', 0, null, context); + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + d.name = d.name || "BLOT"; + data.counter++; + var ret = new scb.WesternBlotGel(d, context, self); + data.list.push(d); + return ret; + } } scb.WesternBlotGel = function scb_WesternBlotGel(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'primary_anti_body', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'secondary_anti_body', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'exposure_time', "60", null, context); - scb.Utils.initialize_accessor_field(self, data, 'is_developed', false, null, context); - scb.Utils.initialize_accessor_field(self, data, 'canvas_data', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'canvas_metadata', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'marks', [], null, context); + scb.Utils.initialize_accessor_field(self, data, 'primary_anti_body', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'secondary_anti_body', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'exposure_time', "60", null, context); + scb.Utils.initialize_accessor_field(self, data, 'is_developed', false, null, context); + scb.Utils.initialize_accessor_field(self, data, 'canvas_data', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'canvas_metadata', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'marks', [], null, context); } \ No newline at end of file diff --git a/html_app/model/WesternBlotLanes.js b/html_app/model/WesternBlotLanes.js index adaeee1a..46aec198 100644 --- a/html_app/model/WesternBlotLanes.js +++ b/html_app/model/WesternBlotLanes.js @@ -1,91 +1,89 @@ 'use strict'; scb.WesternBlotLaneList = function scb_WesternBlotLaneList(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_list_code(self, data, scb.WesternBlotLane, context, self); - - - self.start = function (d) { - d = ( typeof (d) == 'undefined' ? {} : d); - var ret = new scb.WesternBlotLane(d, context, self); - data.list.push(d); - return ret; - }; + var self = this; + self.parent = parent; + scb.ModelHelpers.common_list_code(self, data, scb.WesternBlotLane, context, self); - self.duplicate = function (id) { - var orig = _.find(data.list, function (e) { - return e.id == id; - }); - if (scb.utils.isDefined(orig)) { - var clone = scb.utils.clone_and_clear(orig) - return self.start(clone); - } - }; - self.reorder = function (new_order) { - var new_list = []; - for (var i in new_order) { - var new_id = new_order[i]; - for(var x in data.list){ - if(data.list[x].id ==new_id){ - data.list[x].order_id=parseInt(i); - new_list.push(data.list[x]); - } -// if(new_id == 'marker'){ -// new_list.push(data.list[x]); -// } - } - } - if (new_list.length == data.list.length ) { - //|| ($.inArray("marker", new_list) && new_list.length == data.list.length+1) - data.list = new_list; - } - - else { - throw "NEW ORDER LENGTH != ORDER_LENGTH"; + self.start = function(d) { + d = (typeof (d) == 'undefined' ? {} : d); + var ret = new scb.WesternBlotLane(d, context, self); + data.list.push(d); + return ret; + }; + + self.duplicate = function(id) { + var orig = _.find(data.list, function(e) { + return e.id == id; + }); + if (scb.utils.isDefined(orig)) { + var clone = scb.utils.clone_and_clear(orig) + return self.start(clone); + } + }; + + self.reorder = function(new_order) { + var new_list = []; + for (var i in new_order) { + var new_id = new_order[i]; + for (var x in data.list) { + if (data.list[x].id == new_id) { + data.list[x].order_id = parseInt(i); + new_list.push(data.list[x]); } - }; + // if(new_id == 'marker'){ + // new_list.push(data.list[x]); + // } + } + } + if (new_list.length == data.list.length) { + //|| ($.inArray("marker", new_list) && new_list.length == data.list.length+1) + data.list = new_list; + } else { + throw "NEW ORDER LENGTH != ORDER_LENGTH"; + } + }; - scb.ModelHelpers.grouped_list(self,'cell_treatment_id'); + scb.ModelHelpers.grouped_list(self, 'cell_treatment_id'); } scb.WesternBlotLane = function scb_WesternBlotLane(data, context, parent) { - var self = this; - self.parent = parent; - scb.ModelHelpers.common_entry_code(self, data, context); - scb.Utils.initialize_accessor_field(self, data, 'kind', _.keys(context.template.lysate_kinds)[0], null, context); - scb.Utils.initialize_accessor_field(self, data, 'ip', false, null, context); -// scb.Utils.initialize_accessor_field(self, data, 'amount_of_protein_loaded', context.template.ui_configuration.amount_of_protein_loaded, null, context); - scb.Utils.initialize_accessor_field(self, data, 'marks', [], null, context); - scb.Utils.initialize_accessor_field(self, data, 'cell_treatment_id', null, null, context); - scb.Utils.initialize_accessor_field(self, data, 'collection_schedule_id', null, null, context); - - scb.Utils.initialize_accessor_field(self, data, 'order_id', 0, null, context); -// if (context.template.ui_configuration.lysate_display_ip) { -// scb.Utils.initialize_accessor_field(self, data, 'ip_primary_anti_body', _.keys(context.template.ip_primary_anti_body)[0], null, context); -// scb.Utils.initialize_accessor_field(self, data, 'ip_secondary_anti_body', _.keys(context.template.ip_secondary_anti_body)[0], null, context); -// } + var self = this; + self.parent = parent; + scb.ModelHelpers.common_entry_code(self, data, context); + scb.Utils.initialize_accessor_field(self, data, 'kind', _.keys(context.template.lysate_kinds)[0], null, context); + scb.Utils.initialize_accessor_field(self, data, 'ip', false, null, context); + // scb.Utils.initialize_accessor_field(self, data, 'amount_of_protein_loaded', context.template.ui_configuration.amount_of_protein_loaded, null, context); + scb.Utils.initialize_accessor_field(self, data, 'marks', [], null, context); + scb.Utils.initialize_accessor_field(self, data, 'cell_treatment_id', null, null, context); + scb.Utils.initialize_accessor_field(self, data, 'collection_schedule_id', null, null, context); + + scb.Utils.initialize_accessor_field(self, data, 'order_id', 0, null, context); + // if (context.template.ui_configuration.lysate_display_ip) { + // scb.Utils.initialize_accessor_field(self, data, 'ip_primary_anti_body', _.keys(context.template.ip_primary_anti_body)[0], null, context); + // scb.Utils.initialize_accessor_field(self, data, 'ip_secondary_anti_body', _.keys(context.template.ip_secondary_anti_body)[0], null, context); + // } + - - scb.Utils.initialize_field(data, 'experiment_id', null); + scb.Utils.initialize_field(data, 'experiment_id', null); - scb.Utils.accessor2(self, 'making_lysate_id', data); - scb.utils.accessor2_custom(self, 'experiment', function () { - var experiment = self.parent.parent.parent.parent; - return experiment; - }, scb.utils.noop); + scb.Utils.accessor2(self, 'making_lysate_id', data); + scb.utils.accessor2_custom(self, 'experiment', function() { + var experiment = self.parent.parent.parent.parent; + return experiment; + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'cell_treatment', function () { - return self.experiment.cell_treatment_list.get(data.cell_treatment_id); - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'cell_treatment', function() { + return self.experiment.cell_treatment_list.get(data.cell_treatment_id); + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'collection_schedule', function () { - return self.cell_treatment.collection_schedule_list.get(data.collection_schedule_id); - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'collection_schedule', function() { + return self.cell_treatment.collection_schedule_list.get(data.collection_schedule_id); + }, scb.utils.noop); - scb.utils.accessor2_custom(self, 'kinds', function () { - return context.template.lysate_kinds; - }, scb.utils.noop); + scb.utils.accessor2_custom(self, 'kinds', function() { + return context.template.lysate_kinds; + }, scb.utils.noop); } \ No newline at end of file diff --git a/html_app/ref_lib/rl.js b/html_app/ref_lib/rl.js index 5a490307..b487fe2e 100644 --- a/html_app/ref_lib/rl.js +++ b/html_app/ref_lib/rl.js @@ -1,218 +1,226 @@ -function getRL(){ - -$.get( "ref_library.html", function(data) { - var htmlObject = document.createElement('div'); - htmlObject.innerHTML = data; - document.body.innerHTML = data; - $('.SCBTOC1Allcaps').after("
"); - $('.SCBTOC1 > a')[1].href= $('.SCBTOC1 > a')[1].href.replace("Section", ''); - $('.SCBTOC2').css('margin-left', '25px'); - $('.SCBTOC3').css('margin-left', '50px'); - $('.SCBTOC4').css('margin-left', '75px'); - document.body.innerHTML= document.body.innerHTML.replace(//g, ""); - $('.header-small').remove(); - $('.related').remove(); - $('.footer').remove(); - $('.sphinxsidebar').remove(); - var main_headersp = $('.SCB-Heading1Allcaps'); - $(main_headersp).wrap('
'); - var subheadersp = $('.SCB-Heading1'); - var headers3 = $('.SCB-Heading3'); - var headers5 = $('.SCB-Heading5'); - var lists = $('ul'); - $(subheadersp).wrap('
'); - $(headers3).wrap('
'); - $(headers5).wrap('
'); - - - var main_headers = $('.heading'); - var subheaders = $('.subheading'); - - - //first attach everything to headings - var counter = 0; - for (var y=0; y.heading5').parent().children('.back_to_top').remove(); - $('.subheading >.heading3').parent().children('.back_to_top').remove(); - var divider = document.createElement('span') - divider.className = 'rl_dividing_line'; - $('.subheading').append(divider); - $($('.SCBTOC1')[2]).after('
'); - $('.body').prepend('Library'); - $('p a[name="_ftn1"]').parent().contents().not('a[name="_ftn1"]').wrap(""); - $('.heading3 ul').css('margin-left', '25px'); - var x = window.location.hash; - window.location.hash = ''; - setTimeout( function() { window.location.hash = x ;} , 20); - fixImages(); - - -}).done(function() { window.hash = window.location.hash}); +function getRL() { + + $.get("ref_library.html", function(data) { + var htmlObject = document.createElement('div'); + htmlObject.innerHTML = data; + document.body.innerHTML = data; + $('.SCBTOC1Allcaps').after("
"); + $('.SCBTOC1 > a')[1].href = $('.SCBTOC1 > a')[1].href.replace("Section", ''); + $('.SCBTOC2').css('margin-left', '25px'); + $('.SCBTOC3').css('margin-left', '50px'); + $('.SCBTOC4').css('margin-left', '75px'); + document.body.innerHTML = document.body.innerHTML.replace(//g, ""); + $('.header-small').remove(); + $('.related').remove(); + $('.footer').remove(); + $('.sphinxsidebar').remove(); + var main_headersp = $('.SCB-Heading1Allcaps'); + $(main_headersp).wrap('
'); + var subheadersp = $('.SCB-Heading1'); + var headers3 = $('.SCB-Heading3'); + var headers5 = $('.SCB-Heading5'); + var lists = $('ul'); + $(subheadersp).wrap('
'); + $(headers3).wrap('
'); + $(headers5).wrap('
'); + + + var main_headers = $('.heading'); + var subheaders = $('.subheading'); + + + //first attach everything to headings + var counter = 0; + for (var y = 0; y < main_headers.length; y++) { + var nextN = main_headers[y].nextElementSibling; + $(main_headers[y]).children('a').attr('name', $(main_headersp[y]).text().replace(/\s/g, '')); + while (nextN != null && nextN.className != 'heading') { + var next = nextN.nextElementSibling; + if (nextN.className == 'subheading') { + $(nextN).children('a').attr('name', $(subheadersp[counter]).text().trim().replace(/([A-Z]\.)|[\.\(\)\s\d]/g, '')); + counter++; + nextN.style.textIndent = '0px'; + var nextL = nextN.nextElementSibling; + while (nextL != null && nextL.className != 'subheading' && nextL.className != 'heading') { + if (nextL.className == 'heading3') { + var next3N = nextL.nextElementSibling; + while (next3N != null && next3N.className != 'heading3' && next3N.className != 'subheading' && next3N.className != 'heading') { + if (next3N.className == 'heading5') { + var next5N = next3N.nextElementSibling; + while (next5N != null && next5N.className != 'heading5' && next5N.className != 'heading3' && next5N.className != 'subheading' && next5N.className != 'heading') { + console.log('********' + next5N.className + '***********') + var temp5 = next5N.nextElementSibling; + //next5N.style.marginLeft = '75px'; + $(next3N).append(next5N); + next5N = temp5; + temp3 = temp5; + } + $(nextL).append(next3N); + addHyperlink5(next3N); + next3N = temp5; + } else { + var temp3 = next3N.nextElementSibling; + //next3N.style.marginLeft = '50px'; + + $(nextL).append(next3N); + next3N = temp3; + } + } + $(nextN).append(nextL); + addHyperlink(nextL); + nextL = temp3; + } else { + var temp = nextL.nextElementSibling; + nextL.style.marginLeft = '0px'; + $(nextN).append(nextL); + nextL = temp; + } + } + next = nextN.nextElementSibling; + $(nextN.previousElementSibling).append(nextN); + } else if (nextN.tagName == 'OL' || nextN.className == 'SCB-Normal') { + + $(nextN.previousElementSibling).append(nextN); + } + + nextN = next; + + } + } + + var footnote_links = $('a[href="#_ftn1"]') + for (var x = 0; x < footnote_links.length; x++) { + var anchor_node = $(footnote_links[x]); + if ($(anchor_node).text() == '[1]') { + $(anchor_node).attr('href', '#_ftn1'); + } else if ($(anchor_node).text() == '[2]') { + $(anchor_node).attr('href', '#_ftn2'); + } + } + + var footnote_links = $('a[href="#_ftn2"]') + for (var x = 0; x < footnote_links.length; x++) { + var anchor_node = $(footnote_links[x]); + if ($(anchor_node).text() == '[1]') { + $(anchor_node).attr('href', '#_ftn1'); + } else if ($(anchor_node).text() == '[2]') { + $(anchor_node).attr('href', '#_ftn2'); + } else if ($(anchor_node).text() == '[3]') { + $(anchor_node).attr('href', '#_ftn3'); + } + } + + //indent bullets + for (var x = 0; x < lists.length; x++) { + lists[x].style.marginLeft = '0px'; + + } + var footnotes = $('.SCB-Footer'); + for (var x = 0; x < footnotes.length; x++) { + var anchor_node = $(footnotes[x]).children('a')[0]; + if ($(anchor_node).text() == '[1]') { + $(anchor_node).attr('href', '#_ftnref1'); + } else if ($(anchor_node).text() == '[2]') { + $(anchor_node).attr('href', '#_ftnref2'); + } else if ($(anchor_node).text() == '[3]') { + $(anchor_node).attr('href', '#_ftnref3'); + } else if ($(anchor_node).text() == '[4]') { + $(anchor_node).attr('href', '#_ftnref4'); + } else if ($(anchor_node).text() == '[5]') { + $(anchor_node).attr('href', '#_ftnref5'); + } + $(anchor_node).css('text-decoration', 'none'); + $(anchor_node).css('color', 'black'); + //$(anchor_node).attr('name', $(anchor_node).attr('href').replace(/\#|(ref)/g, '')); + } + var back_to_top = document.createElement('a'); + back_to_top.href = "#"; + back_to_top.className = "back_to_top"; + back_to_top.style.color = 'blue'; + back_to_top.innerHTML = 'Back to Top

'; + $('.subheading').append(back_to_top); + $('.heading3').append(back_to_top); + $('.heading5').append(back_to_top); + $('.heading3 >.heading5').parent().children('.back_to_top').remove(); + $('.subheading >.heading3').parent().children('.back_to_top').remove(); + var divider = document.createElement('span') + divider.className = 'rl_dividing_line'; + $('.subheading').append(divider); + $($('.SCBTOC1')[2]).after('
'); + $('.body').prepend('Library'); + $('p a[name="_ftn1"]').parent().contents().not('a[name="_ftn1"]').wrap(""); + $('.heading3 ul').css('margin-left', '25px'); + var x = window.location.hash; + window.location.hash = ''; + setTimeout(function() { + window.location.hash = x ; + }, 20); + fixImages(); + + + }).done(function() { + window.hash = window.location.hash + }); } -function addHyperlink(parent){ - var element = $(parent).children().first(); - $(element).wrap(''); - $(element).parent().attr('name', $(element).text().trim().replace(/([A-Z]\.)|[\.\(\)\s\d]/g,'')); - - if($(element).text().indexOf('General')> -1) - if($(element).parent().parent().parent().first().children().first().text().indexOf('Western') > -1) - $(element).parent().attr('name', 'WB'+$(element).parent().attr('name')); - if($(element).parent().parent().parent().first().children().first().text().indexOf('Flow') > -1 && $(element).text().indexOf('Experimental')==-1) - $(element).parent().attr('name', 'FC'+$(element).parent().attr('name')); -// if($(element).parent().parent().parent().first().children().first().text().indexOf('Microscopy') > -1 && $(element).text().indexOf('Experimental')==-1) -// $(element).parent().attr('name', 'M'+$(element).parent().attr('name')); +function addHyperlink(parent) { + var element = $(parent).children().first(); + $(element).wrap(''); + $(element).parent().attr('name', $(element).text().trim().replace(/([A-Z]\.)|[\.\(\)\s\d]/g, '')); + + if ($(element).text().indexOf('General') > -1) { + if ($(element).parent().parent().parent().first().children().first().text().indexOf('Western') > -1) { + $(element).parent().attr('name', 'WB' + $(element).parent().attr('name')); + } + } + if ($(element).parent().parent().parent().first().children().first().text().indexOf('Flow') > -1 && $(element).text().indexOf('Experimental') == -1) { + $(element).parent().attr('name', 'FC' + $(element).parent().attr('name')); + } + // if($(element).parent().parent().parent().first().children().first().text().indexOf('Microscopy') > -1 && $(element).text().indexOf('Experimental')==-1) + // $(element).parent().attr('name', 'M'+$(element).parent().attr('name')); } -function addHyperlink5(parent){ - - var element = $(parent).children().first(); - $(element).wrap(''); - $(element).parent().attr('name', $(element).text().trim().replace(/([A-Z]\.)|[\.\(\)\s\d]/g,'')); - - if($(element).parent().parent().parent().first().children().first().text().indexOf('Flow') > -1) - $(element).parent().attr('name', 'FC'+$(element).parent().attr('name')); -// if($(element).parent().parent().parent().first().children().first().text().indexOf('Microscopy') > -1) -// $(element).parent().attr('name', 'M'+$(element).parent().attr('name')); +function addHyperlink5(parent) { + + var element = $(parent).children().first(); + $(element).wrap(''); + $(element).parent().attr('name', $(element).text().trim().replace(/([A-Z]\.)|[\.\(\)\s\d]/g, '')); + + if ($(element).parent().parent().parent().first().children().first().text().indexOf('Flow') > -1) { + $(element).parent().attr('name', 'FC' + $(element).parent().attr('name')); + } + // if($(element).parent().parent().parent().first().children().first().text().indexOf('Microscopy') > -1) + // $(element).parent().attr('name', 'M'+$(element).parent().attr('name')); } //toggle visibility of children, not used currently because toggle is made inactive -function bindToggle(item){ - $(item).click(function(){ - $(item).parent().children().toggle(); - }); +function bindToggle(item) { + $(item).click(function() { + $(item).parent().children().toggle(); + }); } -function fixImages(){ - //$('img[src="../media/uploads/principle_of_high_resolution_sds_gel_electrophoresis.png"]').after('

'); - $('img[src="../media/uploads/starcellbio/principle_of_high_resolution_sds_gel_electrophoresis.png"]').nextUntil('.SCB-Normal').wrapAll('

'); - $('img[src="../media/uploads/starcellbio/principle_of_high_resolution_sds_gel_electrophoresis.png"]').attr('src', '../../../images/ref_lib/principle_of_high_resolution_sds_gel_electrophoresis.png'); - //$('img[src="../media/uploads/gel_blue_coomassie.jpg"]').after('

'); - $('img[src="../media/uploads/starcellbio/gel_blue_coomassie.jpg"]').nextUntil('.SCB-Normal').wrapAll('

'); - $('img[src="../media/uploads/starcellbio/gel_blue_coomassie.jpg"]').attr('src', '../../../images/ref_lib/gel_blue_coomassie.jpg'); - //$('img[src="../media/uploads/antibody.png"]').after('

'); - $('img[src="../media/uploads/starcellbio/antibody.png"]').nextUntil('.SCB-Normal').wrapAll('

'); - $('img[src="../media/uploads/starcellbio/antibody.png"]').attr('src', '../../../images/ref_lib/antibody.png'); - //$('img[src="../media/uploads/sds-page.jpg"]').after('

'); - $('img[src="../media/uploads/starcellbio/sds-page.jpg"]').nextUntil('.SCB-Normal').wrapAll('

'); - $('img[src="../media/uploads/starcellbio/sds-page.jpg"]').attr('src', '../../../images/ref_lib/sds-page.jpg'); +function fixImages() { + //$('img[src="../media/uploads/principle_of_high_resolution_sds_gel_electrophoresis.png"]').after('

'); + $('img[src="../media/uploads/starcellbio/principle_of_high_resolution_sds_gel_electrophoresis.png"]').nextUntil('.SCB-Normal').wrapAll('

'); + $('img[src="../media/uploads/starcellbio/principle_of_high_resolution_sds_gel_electrophoresis.png"]').attr('src', '../../../images/ref_lib/principle_of_high_resolution_sds_gel_electrophoresis.png'); + //$('img[src="../media/uploads/gel_blue_coomassie.jpg"]').after('

'); + $('img[src="../media/uploads/starcellbio/gel_blue_coomassie.jpg"]').nextUntil('.SCB-Normal').wrapAll('

'); + $('img[src="../media/uploads/starcellbio/gel_blue_coomassie.jpg"]').attr('src', '../../../images/ref_lib/gel_blue_coomassie.jpg'); + //$('img[src="../media/uploads/antibody.png"]').after('

'); + $('img[src="../media/uploads/starcellbio/antibody.png"]').nextUntil('.SCB-Normal').wrapAll('

'); + $('img[src="../media/uploads/starcellbio/antibody.png"]').attr('src', '../../../images/ref_lib/antibody.png'); + //$('img[src="../media/uploads/sds-page.jpg"]').after('

'); + $('img[src="../media/uploads/starcellbio/sds-page.jpg"]').nextUntil('.SCB-Normal').wrapAll('

'); + $('img[src="../media/uploads/starcellbio/sds-page.jpg"]').attr('src', '../../../images/ref_lib/sds-page.jpg'); } \ No newline at end of file diff --git a/html_app/starcellbio.app.js b/html_app/starcellbio.app.js index 4ed9b87a..f2aec8d4 100644 --- a/html_app/starcellbio.app.js +++ b/html_app/starcellbio.app.js @@ -2,129 +2,123 @@ // this is first thing executed (after JQuery, thus I can setup workspaces here...) var console = console || { - info: function () { - }, - log: function (){ - } + info: function() {}, + log: function() {} }; var scb = scb || {}; -function init_scb(jquery_selector_main, master_model){ +function init_scb(jquery_selector_main, master_model) { - $.ajax({ - type: "POST", - url: 'scb/initialize_courses.js', - data: JSON.stringify(master_model_data), - async: false - }).done(starcellbio(jquery_selector_main, master_model)); + $.ajax({ + type: "POST", + url: 'scb/initialize_courses.js', + data: JSON.stringify(master_model_data), + async: false + }).done(starcellbio(jquery_selector_main, master_model)); } function starcellbio(jquery_selector_main, master_model) { - try { - var workarea = $(jquery_selector_main); - //TODO: index should use approprate master model, at this stage I'll just user window.master_model as a starting point. - // master model is JSON creature, context is JavaScript creature; thus master_model needs to be savable, whereas context will not be. - var master_model_local = JSON.parse(localStorage.getItem("scb_master_model")); - if( master_model_local ) - { - master_model = master_model_local; - } - - - if(get_user_result.account_type == '' || get_user_result.account_type == 'student') - { - $.ajax({ - type: "GET", - url: '../scb/get_student_courses.js', - }).done(function() { - get_student_courses_result.list = fix_assignment_models(get_student_courses_result.list); - master_model.assignments = get_student_courses_result; - var init_model = master_model.assignments ? master_model : master_model_data; - window.master_model = init_model; - for (var i in init_model.assignments.list) { - if (_.keys(init_model.assignments.list[i].template).length == 0) { - init_model.assignments.list[i].template = MASTER_TEMPLATE; - } - } - scb.Utils.initialize_field(init_model, 'templates', [MASTER_TEMPLATE]); - scb.Utils.initialize_field(init_model, 'sessions', {}); - - var context = new scb.Context(); - context.ui = workarea; - context.master_model = init_model; - - window.master_context = context; - - scb.Utils.initialize_field(context, 'js_model', {}); - scb.utils.accessor2_custom(context, 'template', function () { - return context.js_model.current_assignment.template; - }, scb.utils.read_only_exception); - var main_frame = new scb.ui.MainFrame(init_model, context); - }); - - } - else if(get_user_result.account_type == 'instructor'){ - location.href="ab/assignments"; + try { + var workarea = $(jquery_selector_main); + //TODO: index should use approprate master model, at this stage I'll just user window.master_model as a starting point. + // master model is JSON creature, context is JavaScript creature; thus master_model needs to be savable, whereas context will not be. + var master_model_local = JSON.parse(localStorage.getItem("scb_master_model")); + if (master_model_local) { + master_model = master_model_local; + } - } - else if(get_user_result.account_type == 'preview') { - master_model = master_model_preview; - $(jquery_selector_main).html( "This is preview" ); - var init_model = master_model.assignments ? master_model : master_model_data; - window.master_model = init_model; - for (var i in init_model.assignments.list) { - if (_.keys(init_model.assignments.list[i].template).length == 0) { - init_model.assignments.list[i].template = MASTER_TEMPLATE; - } - } - scb.Utils.initialize_field(init_model, 'templates', [MASTER_TEMPLATE]); - scb.Utils.initialize_field(init_model, 'sessions', {}); - - var context = new scb.Context(); - context.ui = workarea; - context.master_model = init_model; - - window.master_context = context; - - scb.Utils.initialize_field(context, 'js_model', {}); - scb.utils.accessor2_custom(context, 'template', function () { - return context.js_model.current_assignment.template; - }, scb.utils.read_only_exception); - var main_frame = new scb.ui.MainFrame(init_model, context); - } - } catch (err) { - if (document.documentMode < 9) { - alert("Only IE9+, Safari 5+, Chromium and Firefox 10+ are supported, please upgrade your browser "); + if (get_user_result.account_type == '' || get_user_result.account_type == 'student') { + $.ajax({ + type: "GET", + url: '../scb/get_student_courses.js', + }).done(function() { + get_student_courses_result.list = fix_assignment_models(get_student_courses_result.list); + master_model.assignments = get_student_courses_result; + var init_model = master_model.assignments ? master_model : master_model_data; + window.master_model = init_model; + for (var i in init_model.assignments.list) { + if (_.keys(init_model.assignments.list[i].template).length == 0) { + init_model.assignments.list[i].template = MASTER_TEMPLATE; + } } - alert("Unable to run due to an error: " + err); - } -} + scb.Utils.initialize_field(init_model, 'templates', [MASTER_TEMPLATE]); + scb.Utils.initialize_field(init_model, 'sessions', {}); + + var context = new scb.Context(); + context.ui = workarea; + context.master_model = init_model; + + window.master_context = context; + + scb.Utils.initialize_field(context, 'js_model', {}); + scb.utils.accessor2_custom(context, 'template', function() { + return context.js_model.current_assignment.template; + }, scb.utils.read_only_exception); + var main_frame = new scb.ui.MainFrame(init_model, context); + }); + + } else if (get_user_result.account_type == 'instructor') { + location.href = "ab/assignments"; + + } else if (get_user_result.account_type == 'preview') { + master_model = master_model_preview; + $(jquery_selector_main).html("This is preview"); + var init_model = master_model.assignments ? master_model : master_model_data; + window.master_model = init_model; + for (var i in init_model.assignments.list) { + if (_.keys(init_model.assignments.list[i].template).length == 0) { + init_model.assignments.list[i].template = MASTER_TEMPLATE; + } + } + scb.Utils.initialize_field(init_model, 'templates', [MASTER_TEMPLATE]); + scb.Utils.initialize_field(init_model, 'sessions', {}); -scb.Context = function scb_Context() { - var self = this; + var context = new scb.Context(); + context.ui = workarea; + context.master_model = init_model; - self['_event_map'] = {}; + window.master_context = context; - self.register = function (name, fn) { - scb.Utils.initialize_field(self['_event_map'], name, []); - self['_event_map'][name].push(fn); + scb.Utils.initialize_field(context, 'js_model', {}); + scb.utils.accessor2_custom(context, 'template', function() { + return context.js_model.current_assignment.template; + }, scb.utils.read_only_exception); + var main_frame = new scb.ui.MainFrame(init_model, context); } - self.unregister = function (name, fn) { - scb.Utils.initialize_field(self['_event_map'], name, []); - console.info("UNREGISTER NOT YET IMPLEMENTED"); + } catch ( err ) { + if (document.documentMode < 9) { + alert("Only IE9+, Safari 5+, Chromium and Firefox 10+ are supported, please upgrade your browser "); } + alert("Unable to run due to an error: " + err); + } +} - self.invoke = function (name) { - scb.Utils.initialize_field(self['_event_map'], name, []); - var array = self['_event_map'][name]; - for (var i in array) { - var fn = array[i]; - fn(); - } +scb.Context = function scb_Context() { + var self = this; + + self['_event_map'] = {}; + + self.register = function(name, fn) { + scb.Utils.initialize_field(self['_event_map'], name, []); + self['_event_map'][name].push(fn); + } + + self.unregister = function(name, fn) { + scb.Utils.initialize_field(self['_event_map'], name, []); + console.info("UNREGISTER NOT YET IMPLEMENTED"); + } + + self.invoke = function(name) { + scb.Utils.initialize_field(self['_event_map'], name, []); + var array = self['_event_map'][name]; + for (var i in array) { + var fn = array[i]; + fn(); } + } - self.fire = self.invoke; + self.fire = self.invoke; } diff --git a/html_app/ug2/parse_wiki.js b/html_app/ug2/parse_wiki.js index fce42573..c37203c0 100644 --- a/html_app/ug2/parse_wiki.js +++ b/html_app/ug2/parse_wiki.js @@ -1,200 +1,206 @@ -function getUG(){ -$.get( "user_guide.html", function(data) { - var htmlObject = document.createElement('div'); - htmlObject.innerHTML = data; - document.body.innerHTML = data; - - document.body.innerHTML= document.body.innerHTML.replace(//g, ""); - $('.header-small').remove(); - $('.related').remove(); - $('.footer').remove(); - $('.sphinxsidebar').remove(); - $('.SCB-Heading1Allcaps:contains("")').each(function() { - if(this.textContent== "") - $(this).remove(); - }); - var main_headers = $('.SCB-Heading1Allcaps'); - $(main_headers).wrap('
'); - var subheaders = $('.SCB-Heading1'); - var lists = $('ul'); - $(subheaders).wrap('
'); - - - main_headers = $('.heading'); - subheaders = $('.subheading'); - - - //first attach everything to headings - var counter = 1; - for (var y=0; y .subheading').attr('class', 'subtitle'); - $('.subtitle > a').each(function(){ $(this).html($(this).text());}); - $('.title > .SCB-Normal').remove(); - $('.body').prepend('Table of Contents

'); - - $('.title > a').each(function(){ - $(this).attr('href', '#' +$(this).attr('name')); - $(this).attr('name', ''); - }); - - $('.subtitle > a').each(function(){ - $(this).attr('href', '#'+$(this).attr('name')); - $(this).attr('name', ''); - }); - - - - var back_to_top= document.createElement('a'); - back_to_top.href = "#"; - back_to_top.className = "back_to_top"; - back_to_top.style.color = 'blue'; - back_to_top.innerHTML='Back to Top

'; - $('.heading').append(back_to_top); - $('.subheading').append(back_to_top); - $('.heading >.subheading').parent().children('.back_to_top').remove(); - var divider = document.createElement('span') - divider.className = 'ug_dividing_line'; - $('.subheading').append(divider); - $('.heading').append(divider); - fixImages(); - $($('.title')[6]).after('

'); - - $('.body strong').append(' '); - $('.SCB-Heading1Allcaps strong').css('color','#316f94'); - $('.SCB-Heading1 span').css('color', '#316f94'); - $('.subheading').children().not('a').find('strong').prepend(' '); - $('.heading span>a').after(' '); - $('.body strong').css('color', 'black !important'); - $('.body').prepend('User Guide
'); - - $('a[href="#scb-s-help-sublink-23"]').next().remove(); - var x = window.location.hash; - window.location.hash = ''; - setTimeout( function() { window.location.hash = x ;} , 20); -}).done(function() { window.hash = window.location.hash}); +function getUG() { + $.get("user_guide.html", function(data) { + var htmlObject = document.createElement('div'); + htmlObject.innerHTML = data; + document.body.innerHTML = data; + + document.body.innerHTML = document.body.innerHTML.replace(//g, ""); + $('.header-small').remove(); + $('.related').remove(); + $('.footer').remove(); + $('.sphinxsidebar').remove(); + $('.SCB-Heading1Allcaps:contains("")').each(function() { + if (this.textContent == "") { + $(this).remove(); + } + }); + var main_headers = $('.SCB-Heading1Allcaps'); + $(main_headers).wrap('
'); + var subheaders = $('.SCB-Heading1'); + var lists = $('ul'); + $(subheaders).wrap('
'); + + + main_headers = $('.heading'); + subheaders = $('.subheading'); + + + //first attach everything to headings + var counter = 1; + for (var y = 0; y < main_headers.length; y++) { + var nextN = main_headers[y].nextElementSibling; + $(main_headers[y]).children('a').attr('name', 'scb-s-main-section-' + y); + //bindToggle($(main_headers[y]).children('span')); + while (nextN != null && nextN.className != 'heading') { + var next = nextN.nextElementSibling; + if (nextN.className == 'subheading') { + $(nextN).children('a').attr('name', 'scb-s-help-sublink-' + counter); + counter++; + nextN.style.textIndent = '50px'; + var nextL = nextN.nextElementSibling; + while (nextL != null && nextL.className != 'subheading' && nextL.className != 'heading') { + var temp = nextL.nextElementSibling; + $(nextN).append(nextL); + nextL = temp; + } + next = nextN.nextElementSibling; + $(nextN.previousElementSibling).append(nextN); + } else if ((nextN.tagName == 'P' && nextN.previousElementSibling.className == 'heading') || nextN.tagName == 'UL' || nextN.tagName == 'OL' || nextN.className == 'SCB-Normal') { + $(nextN.previousElementSibling).append(nextN); + } + nextN = next; + + } + } + + + + + $('.heading').clone().prependTo('.body').attr('class', 'title'); + $('.title').children('.subheading').children('ul').remove(); + $('.title').children('p').remove(); + $('.title').children('ol').remove(); + $('.title').children('.subheading').children('p').remove(); + $('.title').children('ul').remove() + $('.title > .subheading').attr('class', 'subtitle'); + $('.subtitle > a').each(function() { + $(this).html($(this).text()); + }); + $('.title > .SCB-Normal').remove(); + $('.body').prepend('Table of Contents

'); + + $('.title > a').each(function() { + $(this).attr('href', '#' + $(this).attr('name')); + $(this).attr('name', ''); + }); + + $('.subtitle > a').each(function() { + $(this).attr('href', '#' + $(this).attr('name')); + $(this).attr('name', ''); + }); + + + + var back_to_top = document.createElement('a'); + back_to_top.href = "#"; + back_to_top.className = "back_to_top"; + back_to_top.style.color = 'blue'; + back_to_top.innerHTML = 'Back to Top

'; + $('.heading').append(back_to_top); + $('.subheading').append(back_to_top); + $('.heading >.subheading').parent().children('.back_to_top').remove(); + var divider = document.createElement('span') + divider.className = 'ug_dividing_line'; + $('.subheading').append(divider); + $('.heading').append(divider); + fixImages(); + $($('.title')[6]).after('

'); + + $('.body strong').append(' '); + $('.SCB-Heading1Allcaps strong').css('color', '#316f94'); + $('.SCB-Heading1 span').css('color', '#316f94'); + $('.subheading').children().not('a').find('strong').prepend(' '); + $('.heading span>a').after(' '); + $('.body strong').css('color', 'black !important'); + $('.body').prepend('User Guide
'); + + $('a[href="#scb-s-help-sublink-23"]').next().remove(); + var x = window.location.hash; + window.location.hash = ''; + setTimeout(function() { + window.location.hash = x ; + }, 20); + }).done(function() { + window.hash = window.location.hash + }); } //toggle visibility of children, not used currently because toggle is made inactive -function bindToggle(item){ - $(item).click(function(){ - $(item).parent().children().toggle(); - }); +function bindToggle(item) { + $(item).click(function() { + $(item).parent().children().toggle(); + }); } -function fixImages(){ - $('img[src="../media/uploads/starcellbio/scb_icon_trash.png"]').addClass('resize_icon_popout'); - $('img[src="../media/uploads/starcellbio/scb_icon_trash.png"]').attr('src', '../../../images/user_guide/scb_ug_trash.png'); - - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0000_18-envelope.png"]').addClass('resize_icon_popout'); - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0000_18-envelope.png"]').attr('src', '../../../images/user_guide/scb_ug_envelope.png'); - - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0003_33-cabinet.png"]').addClass('resize_icon_popout'); - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0003_33-cabinet.png"]').attr('src', '../../../images/user_guide/scb_ug_cabinet.png'); - - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0006_96-book.png"]').addClass('resize_icon_popout'); - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0006_96-book.png"]').attr('src', '../../../images/user_guide/scb_ug_book.png'); - - $('img[src="../media/uploads/starcellbio/scb_icons_copy.png"]').addClass('resize_icon_popout'); - $('img[src="../media/uploads/starcellbio/scb_icons_copy.png"]').attr('src', '../../../images/user_guide/scb_ug_copy.png'); - - //screenshots - $('img[src="../media/uploads/starcellbio/scb_homepage_.png"]').attr('src', '../../../images/user_guide/SCB_Homepage.png'); - - $('img[src="../media/uploads/starcellbio/scb_sign_in_window_.png"]').attr('src', '../../../images/user_guide/SCB_Sign_In_Window.png'); - - $('img[src="../media/uploads/starcellbio/scb_sign_up_window_.png"]').attr('src', '../../../images/user_guide/SCB_Sign_Up_Window.png'); - - $('img[src="../media/uploads/starcellbio/scb_top_menu_bar_.png"]').attr('src', '../../../images/user_guide/SCB_Top_Menu_bar.png'); - - $('img[src="../media/uploads/starcellbio/scb_assignments_page_-_usability_test_.png"]').attr('src', '../../../images/user_guide/SCB_Assignments_Page_-_Usability_Test.png'); - - $('img[src="../media/uploads/starcellbio/scb_navigation_-_microscopy_active.png"]').attr('src', '../../../images/user_guide/SCB_Navigation_-_Microscopy_active.png'); - - $('img[src="../media/uploads/starcellbio/scb_experiments_design_page_.png"]').attr('src', '../../../images/user_guide/SCB_Experiments_Design_Page.png'); - - $('img[src="../media/uploads/starcellbio/scb_add_samples_window_-_samples_selected.png"]').attr('src', '../../../images/user_guide/SCB_Add_Samples_window_-_samples_selected.png'); - - $('img[src="../media/uploads/starcellbio/scb_setup_page.png"]').attr('src', '../../../images/user_guide/SCB_Setup_Page.png'); - - $('img[src="../media/uploads/starcellbio/scb_confirm_set-up_window.png"]').attr('src', '../../../images/user_guide/SCB_Confirm_Set-up_window.png'); - - $('img[src="../media/uploads/starcellbio/scb_select_techniques_page.png"]').attr('src', '../../../images/user_guide/SCB_Select_Techniques_page.png'); - - $('img[src="../media/uploads/starcellbio/scb_experiment_dropdown_menu_-_western_-_cropped__.png"]').attr('src', '../../../images/user_guide/SCB_Experiment_dropdown_menu_-_western_-_cropped.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_sample_prep.png"]').attr('src', '../../../images/user_guide/SCB_Western_Sample_prep.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_sample_prep_-_option_2.png"]').attr('src', '../../../images/user_guide/SCB_Western_Sample_Prep_-_Option_2.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_samples_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_Samples_window.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_samples_window_-_marker_added_and_re-ordered.png"]').attr('src', '../../../images/user_guide/SCB_Western_Samples_window_-_Marker_added_and_re-ordered.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_load.png"]').attr('src', '../../../images/user_guide/SCB_Western_load1.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_blot_cropped.png"]').attr('src', '../../../images/user_guide/SCB_Western_blot_cropped.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_develop.png"]').attr('src', '../../../images/user_guide/SCB_Western_Develop.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window.png'); - - $('img[src="../media/uploads/starcellbio/scb_western_reprobing_-_small_tabbed_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_reprobing_-_small_tabbed_window1.png'); - - $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_2.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Sample_Prep_-_2.png'); - - $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_samples_selected.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Sample_Prep_-_samples_selected.png'); - - $('img[src="../media/uploads/starcellbio/scb_flow_samples_window.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Samples_window.png'); - - $('img[src="../media/uploads/starcellbio/scb_flow_analyze_-_large_tabbed_window.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Analyze_-_large_tabbed_window.png'); - - $('img[src="../media/uploads/starcellbio/scb_flow_analysis_tool.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Analysis_Tool.png'); - - $('img[src="../media/uploads/starcellbio/scb_select_techniques_page_-_microscopy_available.png"]').attr('src', '../../../images/user_guide/SCB_Select_Techniques_Page_-_microscopy_available.png'); - - $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_large_tabbed_window.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Sample_Prep_page_-_large_tabbed_window.png'); - - $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_samples_selected_-_whole_page.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Sample_Prep_page_-_samples_selected_-_whole_page.png'); - - $('img[src="../media/uploads/starcellbio/scb_microscopy_analyze_-_with_note.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Analyze_-_with_note.png'); - - $('img[src="../media/uploads/starcellbio/scb_microscopy_small_tabbed_window_only.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_small_tabbed_window_only.png'); +function fixImages() { + $('img[src="../media/uploads/starcellbio/scb_icon_trash.png"]').addClass('resize_icon_popout'); + $('img[src="../media/uploads/starcellbio/scb_icon_trash.png"]').attr('src', '../../../images/user_guide/scb_ug_trash.png'); + + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0000_18-envelope.png"]').addClass('resize_icon_popout'); + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0000_18-envelope.png"]').attr('src', '../../../images/user_guide/scb_ug_envelope.png'); + + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0003_33-cabinet.png"]').addClass('resize_icon_popout'); + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0003_33-cabinet.png"]').attr('src', '../../../images/user_guide/scb_ug_cabinet.png'); + + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0006_96-book.png"]').addClass('resize_icon_popout'); + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0006_96-book.png"]').attr('src', '../../../images/user_guide/scb_ug_book.png'); + + $('img[src="../media/uploads/starcellbio/scb_icons_copy.png"]').addClass('resize_icon_popout'); + $('img[src="../media/uploads/starcellbio/scb_icons_copy.png"]').attr('src', '../../../images/user_guide/scb_ug_copy.png'); + + //screenshots + $('img[src="../media/uploads/starcellbio/scb_homepage_.png"]').attr('src', '../../../images/user_guide/SCB_Homepage.png'); + + $('img[src="../media/uploads/starcellbio/scb_sign_in_window_.png"]').attr('src', '../../../images/user_guide/SCB_Sign_In_Window.png'); + + $('img[src="../media/uploads/starcellbio/scb_sign_up_window_.png"]').attr('src', '../../../images/user_guide/SCB_Sign_Up_Window.png'); + + $('img[src="../media/uploads/starcellbio/scb_top_menu_bar_.png"]').attr('src', '../../../images/user_guide/SCB_Top_Menu_bar.png'); + + $('img[src="../media/uploads/starcellbio/scb_assignments_page_-_usability_test_.png"]').attr('src', '../../../images/user_guide/SCB_Assignments_Page_-_Usability_Test.png'); + + $('img[src="../media/uploads/starcellbio/scb_navigation_-_microscopy_active.png"]').attr('src', '../../../images/user_guide/SCB_Navigation_-_Microscopy_active.png'); + + $('img[src="../media/uploads/starcellbio/scb_experiments_design_page_.png"]').attr('src', '../../../images/user_guide/SCB_Experiments_Design_Page.png'); + + $('img[src="../media/uploads/starcellbio/scb_add_samples_window_-_samples_selected.png"]').attr('src', '../../../images/user_guide/SCB_Add_Samples_window_-_samples_selected.png'); + + $('img[src="../media/uploads/starcellbio/scb_setup_page.png"]').attr('src', '../../../images/user_guide/SCB_Setup_Page.png'); + + $('img[src="../media/uploads/starcellbio/scb_confirm_set-up_window.png"]').attr('src', '../../../images/user_guide/SCB_Confirm_Set-up_window.png'); + + $('img[src="../media/uploads/starcellbio/scb_select_techniques_page.png"]').attr('src', '../../../images/user_guide/SCB_Select_Techniques_page.png'); + + $('img[src="../media/uploads/starcellbio/scb_experiment_dropdown_menu_-_western_-_cropped__.png"]').attr('src', '../../../images/user_guide/SCB_Experiment_dropdown_menu_-_western_-_cropped.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_sample_prep.png"]').attr('src', '../../../images/user_guide/SCB_Western_Sample_prep.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_sample_prep_-_option_2.png"]').attr('src', '../../../images/user_guide/SCB_Western_Sample_Prep_-_Option_2.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_samples_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_Samples_window.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_samples_window_-_marker_added_and_re-ordered.png"]').attr('src', '../../../images/user_guide/SCB_Western_Samples_window_-_Marker_added_and_re-ordered.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_load.png"]').attr('src', '../../../images/user_guide/SCB_Western_load1.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_blot_cropped.png"]').attr('src', '../../../images/user_guide/SCB_Western_blot_cropped.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_develop.png"]').attr('src', '../../../images/user_guide/SCB_Western_Develop.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window.png'); + + $('img[src="../media/uploads/starcellbio/scb_western_reprobing_-_small_tabbed_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_reprobing_-_small_tabbed_window1.png'); + + $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_2.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Sample_Prep_-_2.png'); + + $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_samples_selected.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Sample_Prep_-_samples_selected.png'); + + $('img[src="../media/uploads/starcellbio/scb_flow_samples_window.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Samples_window.png'); + + $('img[src="../media/uploads/starcellbio/scb_flow_analyze_-_large_tabbed_window.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Analyze_-_large_tabbed_window.png'); + + $('img[src="../media/uploads/starcellbio/scb_flow_analysis_tool.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Analysis_Tool.png'); + + $('img[src="../media/uploads/starcellbio/scb_select_techniques_page_-_microscopy_available.png"]').attr('src', '../../../images/user_guide/SCB_Select_Techniques_Page_-_microscopy_available.png'); + + $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_large_tabbed_window.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Sample_Prep_page_-_large_tabbed_window.png'); + + $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_samples_selected_-_whole_page.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Sample_Prep_page_-_samples_selected_-_whole_page.png'); + + $('img[src="../media/uploads/starcellbio/scb_microscopy_analyze_-_with_note.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Analyze_-_with_note.png'); + + $('img[src="../media/uploads/starcellbio/scb_microscopy_small_tabbed_window_only.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_small_tabbed_window_only.png'); } \ No newline at end of file diff --git a/html_app/ug2/ug.js b/html_app/ug2/ug.js index 4d1bcb45..b1d543ac 100644 --- a/html_app/ug2/ug.js +++ b/html_app/ug2/ug.js @@ -1,323 +1,326 @@ //hide the native search bar $('.scb_f_help_search_bar').hide(); -var total=0; +var total = 0; $('.scb_s_ug_home').hide(); last_element_offset = 0; //function to redirect popout link to the new page, NOT USED, code redone in MainFrame for new handler -function popoutGuide(){ - var popout_string = ""; - var visible= $('.scb_s_section_inactive:visible'); - if(visible.length ==1) - { - if($(visible).attr('class') == 'scb_s_section_inactive') - popout_string = $('*:visible').closest('.scb_s_help_sublink').attr('class').split(' ')[1]; - else - popout_string = $(visible).attr('class'); - } - else{ - popout_string = $($('span:visible')[0]).attr('class'); - } - - popout_string = popout_string.replace(/_/g, '-'); - if($('.scb_s_section_inactive').length ==0) - popout_string ==""; - var popoutWindow =window.open("full_guide.html#"+popout_string); - //the timeout is needed, because the javascript has to load first, - //and then you can use the hash to the anchor - +function popoutGuide() { + var popout_string = ""; + var visible = $('.scb_s_section_inactive:visible'); + if (visible.length == 1) { + if ($(visible).attr('class') == 'scb_s_section_inactive') { + popout_string = $('*:visible').closest('.scb_s_help_sublink').attr('class').split(' ')[1]; + } else { + popout_string = $(visible).attr('class'); + } + } else { + popout_string = $($('span:visible')[0]).attr('class'); + } + + popout_string = popout_string.replace(/_/g, '-'); + if ($('.scb_s_section_inactive').length == 0) { + popout_string == ""; + } + var popoutWindow = window.open("full_guide.html#" + popout_string); + //the timeout is needed, because the javascript has to load first, + //and then you can use the hash to the anchor + } //This sets up the user guide -$.get( "/static/ug2/user_guide.html", function(data) { - var htmlObject = document.createElement('div'); - htmlObject.innerHTML = data; - var body = htmlObject.getElementsByClassName("body")[0]; - var links = body.getElementsByClassName('SCB-Heading1Allcaps'); - - var sublinks = []; - var number = 0; - //Go through all headings and begin parsing, sublinks and sections, and creating wrappers - for(var i=0; i     ' + next.innerHTML.trim()+'
';} - } - next = next.nextSibling; - - } - - var lnk = document.createElement('span'); - lnk.className = 'scb_s_main_help_link'; - lnk.style.textTransform = 'uppercase'; - lnk.innerHTML = '

'+$(links[i]).text()+"

" + "

"; - var div = document.createElement('div'); - div.className = 'scb_s_help_section scb_s_help_section_'+i; - if(i==6 || i==7){ - console.log(text); - } - div.innerHTML = text; - - - - var y = 0; - while(y < div.childNodes.length){ - if(div.childNodes[y].nodeName == '#text' ||(!div.childNodes[y].style && i!=6 && i!=7)){ - $(div.childNodes[y]).wrap(''); - } - - else if(div.childNodes[y].className=='scb_s_help_sublink'){ - number = number+1; - $(div.childNodes[y]).addClass('scb_s_help_sublink_' + number); - var nextC = div.childNodes[y].nextElementSibling; - while(nextC !=null && nextC.className !="scb_s_help_sublink"){ - $(nextC).addClass('scb_s_help_sub_section_'+number); - $(nextC).addClass('special'); - $(nextC).append('
'); - $(nextC).addClass('scb_s_help_link_' + i); - - if($(nextC).prop('tagName')=='SPAN') - $(nextC).addClass('span_tag'); - else - $(nextC).addClass('list_tag'); - nextC.style.display = 'none'; - $(div.childNodes[y]).append(nextC); - nextC = div.childNodes[y].nextElementSibling; - } - $(div.childNodes[y]).wrap(""); - } - else{ - $(div.childNodes[y]).addClass('scb_s_help_sub_section'); - if($(div.childNodes[y]).prop('tagName')=='SPAN') - $(div.childNodes[y]).addClass('span_tag'); - else - $(div.childNodes[y]).addClass('list_tag'); - $(div.childNodes[y]).addClass('special'); - $(div.childNodes[y]).addClass('scb_s_help_link_' + i); - div.childNodes[y].style.display = 'none'; - } - y++; - - - } - - $('a').not('.anchors').addClass('intextlink'); - //append the code to the display div - $('.scb_f_help_display').append(lnk); - $('.scb_f_help_display').append(div); - $(lnk).wrap(""); - - } - $('.scb_f_help_display > span:contains("")').each(function() { - if(this.className== "") - $(this).remove(); - }); - $('.scb_s_help_section > span:contains("")').each(function() { - if(this.className == "") - $(this).remove(); - }); - $('.scb_s_help_sublink').append('
') - $('.scb_s_help_sublink > li').css('margin-left', '35px'); - $('.scb_s_help_section').css('margin-left', '17px'); - - $('.scb_s_help_sublink').show(); - $('.special').append('
'); - $('.scb_s_help_link_2').append("
"); - - fixImages(); -}); +$.get("/static/ug2/user_guide.html", function(data) { + var htmlObject = document.createElement('div'); + htmlObject.innerHTML = data; + var body = htmlObject.getElementsByClassName("body")[0]; + var links = body.getElementsByClassName('SCB-Heading1Allcaps'); + + var sublinks = []; + var number = 0; + //Go through all headings and begin parsing, sublinks and sections, and creating wrappers + for (var i = 0; i < links.length; i++) { + var text = ""; + var next = links[i].nextSibling; + while (next != null && (next.nodeName == '#text' || next.className != "SCB-Heading1Allcaps")) { + if (next.nodeName == '#text') { + } else { + if (next.className != "SCB-Heading1") { + text = text + $(next).html(); + } else { + text = text + '

'; + } + } + next = next.nextSibling; + + } + + var lnk = document.createElement('span'); + lnk.className = 'scb_s_main_help_link'; + lnk.style.textTransform = 'uppercase'; + lnk.innerHTML = '

' + $(links[i]).text() + "

" + "

"; + var div = document.createElement('div'); + div.className = 'scb_s_help_section scb_s_help_section_' + i; + if (i == 6 || i == 7) { + console.log(text); + } + div.innerHTML = text; + + + + var y = 0; + while (y < div.childNodes.length) { + if (div.childNodes[y].nodeName == '#text' || (!div.childNodes[y].style && i != 6 && i != 7)) { + $(div.childNodes[y]).wrap(''); + } else if (div.childNodes[y].className == 'scb_s_help_sublink') { + number = number + 1; + $(div.childNodes[y]).addClass('scb_s_help_sublink_' + number); + var nextC = div.childNodes[y].nextElementSibling; + while (nextC != null && nextC.className != "scb_s_help_sublink") { + $(nextC).addClass('scb_s_help_sub_section_' + number); + $(nextC).addClass('special'); + $(nextC).append('
'); + $(nextC).addClass('scb_s_help_link_' + i); + + if ($(nextC).prop('tagName') == 'SPAN') { + $(nextC).addClass('span_tag'); + } else { + $(nextC).addClass('list_tag'); + } + nextC.style.display = 'none'; + $(div.childNodes[y]).append(nextC); + nextC = div.childNodes[y].nextElementSibling; + } + $(div.childNodes[y]).wrap(""); + } else { + $(div.childNodes[y]).addClass('scb_s_help_sub_section'); + if ($(div.childNodes[y]).prop('tagName') == 'SPAN') { + $(div.childNodes[y]).addClass('span_tag'); + } else { + $(div.childNodes[y]).addClass('list_tag'); + } + $(div.childNodes[y]).addClass('special'); + $(div.childNodes[y]).addClass('scb_s_help_link_' + i); + div.childNodes[y].style.display = 'none'; + } + y++; + + + } + + $('a').not('.anchors').addClass('intextlink'); + //append the code to the display div + $('.scb_f_help_display').append(lnk); + $('.scb_f_help_display').append(div); + $(lnk).wrap(""); + + } + $('.scb_f_help_display > span:contains("")').each(function() { + if (this.className == "") { + $(this).remove(); + } + }); + $('.scb_s_help_section > span:contains("")').each(function() { + if (this.className == "") { + $(this).remove(); + } + }); + $('.scb_s_help_sublink').append('
') + $('.scb_s_help_sublink > li').css('margin-left', '35px'); + $('.scb_s_help_section').css('margin-left', '17px'); + + $('.scb_s_help_sublink').show(); + $('.special').append('
'); + $('.scb_s_help_link_2').append("
"); + + fixImages(); +}); //Main function; clear the current state of the user guide and search for terms. -function searchUG(){ - mainUG(); - - total = 0; - var counter = 0; - var elements = []; - var search_string = "*" - if($(".help_search_input").val()=="") - alert('A phrase was not typed. Please type a value before searching.'); - else{ - var searchTerms = $(".help_search_input").val().trim().split(' '); - jQuery.expr[':'].contains = function(a, i, m) { - return jQuery(a).text().toUpperCase() - .indexOf(m[3].toUpperCase()) >= 0; - }; - for(var x =0; x < searchTerms.length ; x++){ - search_string = search_string+ ":contains('"+searchTerms[x]+"')"; - } - var list= $(search_string); - if(list.length == 0) - $('.scb_display_search_count').text('0 of 0'); - //alert("I\'m sorry we can\'t find that word"); - else{ - - var list= $(search_string); - list = $(list).filter('.special') - var search_sections = []; - for (var i = 0; i < list.length; i++) { - elements.push(list[i]); - var classnames = $(list[i]).attr('class').split(/\s+/); - for (index = 0; index < classnames.length; index++) { - if(classnames[index].indexOf('help_link') >0 ) - search_sections.push('scb_s_main_section_' +parseInt(classnames[index].match(/\d+$/))); - if(classnames[index].indexOf('help_sub_section') >0 ) - search_sections.push('scb_s_help_sublink_' +parseInt(classnames[index].match(/\d+$/))); - } - console.log(list[i]); - - } - search_sections = $.unique(search_sections); - $('.scb_s_main_help_link').css('display', 'none'); - $('.scb_s_help_sublink').hide(); - for(var i = 0; i < search_sections.length; i++){ - if($('.'+search_sections[i]).closest('.scb_s_main_help_link').length > 0 ) - $('.'+search_sections[i]).closest('.scb_s_main_help_link').css('display', 'inline'); - if($('.'+search_sections[i]).closest('.scb_s_help_sublink').length >0) - $('.'+search_sections[i]).closest('.scb_s_help_sublink').show(); - } - console.log(search_sections); - - } - } - +function searchUG() { + mainUG(); + + total = 0; + var counter = 0; + var elements = []; + var search_string = "*" + if ($(".help_search_input").val() == "") { + alert('A phrase was not typed. Please type a value before searching.'); + } else { + var searchTerms = $(".help_search_input").val().trim().split(' '); + jQuery.expr[':'].contains = function(a, i, m) { + return jQuery(a).text().toUpperCase() + .indexOf(m[3].toUpperCase()) >= 0; + }; + for (var x = 0; x < searchTerms.length; x++) { + search_string = search_string + ":contains('" + searchTerms[x] + "')"; + } + var list = $(search_string); + if (list.length == 0) { + $('.scb_display_search_count').text('0 of 0'); + } + //alert("I\'m sorry we can\'t find that word"); + else { + + var list = $(search_string); + list = $(list).filter('.special') + var search_sections = []; + for (var i = 0; i < list.length; i++) { + elements.push(list[i]); + var classnames = $(list[i]).attr('class').split(/\s+/); + for (index = 0; index < classnames.length; index++) { + if (classnames[index].indexOf('help_link') > 0) { + search_sections.push('scb_s_main_section_' + parseInt(classnames[index].match(/\d+$/))); + } + if (classnames[index].indexOf('help_sub_section') > 0) { + search_sections.push('scb_s_help_sublink_' + parseInt(classnames[index].match(/\d+$/))); + } + } + console.log(list[i]); + + } + search_sections = $.unique(search_sections); + $('.scb_s_main_help_link').css('display', 'none'); + $('.scb_s_help_sublink').hide(); + for (var i = 0; i < search_sections.length; i++) { + if ($('.' + search_sections[i]).closest('.scb_s_main_help_link').length > 0) { + $('.' + search_sections[i]).closest('.scb_s_main_help_link').css('display', 'inline'); + } + if ($('.' + search_sections[i]).closest('.scb_s_help_sublink').length > 0) { + $('.' + search_sections[i]).closest('.scb_s_help_sublink').show(); + } + } + console.log(search_sections); + + } + } + } -function hashchange_function(new_hash, anchor_element){ - if(new_hash.indexOf('scb_s_main_section') > -1){ - var txt = new_hash.replace("#", ""); - var ind = txt.match(/\d/g); - ind = ind.join(""); - var item = $('.'+txt, anchor_element).parents('.scb_s_main_help_link'); - var body = $(anchor_element).parents('body')[0]; - mainUG(body); - if( $('.scb_s_help_section_'+ind, body).children().children().children('li').css('display')=='none' - || $('.scb_s_help_section_'+ind, body).children().css('display')=='none' - || $('.scb_s_help_section_'+ind, body).children().children().css('display')=='none' - || $('.scb_s_help_section_'+ind, body).children('li').css('display')=='none'){ - $(item, body).children().attr('onclick', 'false'); - last_element_offset = $(body).scrollTop(); - if($('.scb_s_help_link_'+ ind, body).css('display') != 'none') - $('.scb_s_help_link_'+ ind, body).css('display', 'none'); - else{ - $('.scb_s_help_link_'+ ind+'.list_tag', body).css('display', 'list-item'); - $('.scb_s_help_link_'+ ind+'.span_tag', body).css('display', 'inline'); - } - - $('.scb_s_main_help_link', body).hide(); - $(item).css('display', 'inline'); - $(item).css('cursor', 'pointer'); - $('.scb_s_help_section', body).hide(); - $('.scb_s_help_section_'+ind, body).show(); - $('p', body).attr('class', 'scb_s_section_inactive'); - if($('.scb_f_help_footer', body).length >0) - $('.scb_f_help_footer', body).remove(); - else{ - var footer = document.createElement('div') - footer.className = 'scb_f_help_footer'; - footer.innerHTML = " "; - footer.style.height = '25px'; - $('.scb_f_help_display', body).append(footer); - $('.scb_f_help_footer', body).width($('.scb_f_help_search_bar').width() -15); - } - $(body).scrollTop(0); - $('.scb_s_help_section_'+ind +' .scb_s_section_active', body).css('margin-left', '-40px'); - - } - else{ - return; - } - - } - else if(new_hash.indexOf('scb_s_help_sublink')>-1){ - var txt = new_hash.replace("#", ""); - var ind = txt.match(/\d/g); - ind = ind.join(""); - var item = $('.'+txt, anchor_element); - var body = $(anchor_element).parents('body')[0]; - mainUG(body); - if($(item, body).children('span').length + $(item, body).children('li').length >1 && $(item, body).parent().children().prev().css('display')=='none'){ - return; - } - else{ - last_element_offset = $(body).scrollTop(); - $(item, body).first().children('span').first().attr('class', 'scb_s_section_inactive'); - $(item, body).first().children('span').first().css('margin-left' ,'-23px'); - - $('.scb_s_help_sub_section_'+ ind+'.list_tag', body).css('display', 'list-item'); - $('.scb_s_help_sub_section_'+ ind+'.span_tag', body).css('display', 'inline'); - $('.scb_s_main_help_link', body).hide(); - $('.scb_s_help_sublink', body).hide(); - if($(item, body).parent().prev().text().trim() == 'EXPERIMENTS'){ - $(item, body).parent().children('span').hide(); - $(item, body).parent().children('li').hide(); - } - $(item, body).css('display', 'inline'); - $(item, body).css('cursor', 'pointer'); - if($('.scb_f_help_footer', body).length >0) - $('.scb_f_help_footer', body).remove(); - else{ - var footer = document.createElement('div') - footer.className = 'scb_f_help_footer'; - footer.innerHTML = " "; - footer.style.height = '25px'; - $('.scb_f_help_display', body).append(footer); - $('.scb_f_help_footer', body).width($('.scb_f_help_search_bar', body).width() -15); - } - $(body).scrollTop(0); - } - } - else if(new_hash != '#' && new_hash != ''){ - var item = $('a[name="'+new_hash.substr(1)+'"]').closest('.scb_s_help_sublink'); - var ind = $(item).attr('class').match(/\d/g).join(""); - var body = $(anchor_element).parents('body')[0]; - mainUG(body); - console.log(new_hash); - last_element_offset = $(body).scrollTop(); - $(item, body).first().children('span').first().attr('class', 'scb_s_section_inactive'); - $(item, body).first().children('span').first().css('margin-left' ,'-23px'); - - $('.scb_s_help_sub_section_'+ ind+'.list_tag', body).css('display', 'list-item'); - $('.scb_s_help_sub_section_'+ ind+'.span_tag', body).css('display', 'inline'); - $('.scb_s_main_help_link', body).hide(); - $('.scb_s_help_sublink', body).hide(); - if($(item, body).parent().prev().text().trim() == 'EXPERIMENTS'){ - $(item, body).parent().children('span').hide(); - $(item, body).parent().children('li').hide(); - } - $(item, body).css('display', 'inline'); - $(item, body).css('cursor', 'pointer'); - if($('.scb_f_help_footer', body).length >0) - $('.scb_f_help_footer', body).remove(); - else{ - var footer = document.createElement('div') - footer.className = 'scb_f_help_footer'; - footer.innerHTML = " "; - footer.style.height = '25px'; - $('.scb_f_help_display', body).append(footer); - $('.scb_f_help_footer', body).width($('.scb_f_help_search_bar', body).width() -15); - } - $(body).scrollTop(0); - } - - else mainUG(); +function hashchange_function(new_hash, anchor_element) { + if (new_hash.indexOf('scb_s_main_section') > -1) { + var txt = new_hash.replace("#", ""); + var ind = txt.match(/\d/g); + ind = ind.join(""); + var item = $('.' + txt, anchor_element).parents('.scb_s_main_help_link'); + var body = $(anchor_element).parents('body')[0]; + mainUG(body); + if ($('.scb_s_help_section_' + ind, body).children().children().children('li').css('display') == 'none' + || $('.scb_s_help_section_' + ind, body).children().css('display') == 'none' + || $('.scb_s_help_section_' + ind, body).children().children().css('display') == 'none' + || $('.scb_s_help_section_' + ind, body).children('li').css('display') == 'none') { + $(item, body).children().attr('onclick', 'false'); + last_element_offset = $(body).scrollTop(); + if ($('.scb_s_help_link_' + ind, body).css('display') != 'none') { + $('.scb_s_help_link_' + ind, body).css('display', 'none'); + } else { + $('.scb_s_help_link_' + ind + '.list_tag', body).css('display', 'list-item'); + $('.scb_s_help_link_' + ind + '.span_tag', body).css('display', 'inline'); + } + + $('.scb_s_main_help_link', body).hide(); + $(item).css('display', 'inline'); + $(item).css('cursor', 'pointer'); + $('.scb_s_help_section', body).hide(); + $('.scb_s_help_section_' + ind, body).show(); + $('p', body).attr('class', 'scb_s_section_inactive'); + if ($('.scb_f_help_footer', body).length > 0) { + $('.scb_f_help_footer', body).remove(); + } else { + var footer = document.createElement('div') + footer.className = 'scb_f_help_footer'; + footer.innerHTML = " "; + footer.style.height = '25px'; + $('.scb_f_help_display', body).append(footer); + $('.scb_f_help_footer', body).width($('.scb_f_help_search_bar').width() - 15); + } + $(body).scrollTop(0); + $('.scb_s_help_section_' + ind + ' .scb_s_section_active', body).css('margin-left', '-40px'); + + } else { + return; + } + + } else if (new_hash.indexOf('scb_s_help_sublink') > -1) { + var txt = new_hash.replace("#", ""); + var ind = txt.match(/\d/g); + ind = ind.join(""); + var item = $('.' + txt, anchor_element); + var body = $(anchor_element).parents('body')[0]; + mainUG(body); + if ($(item, body).children('span').length + $(item, body).children('li').length > 1 && $(item, body).parent().children().prev().css('display') == 'none') { + return; + } else { + last_element_offset = $(body).scrollTop(); + $(item, body).first().children('span').first().attr('class', 'scb_s_section_inactive'); + $(item, body).first().children('span').first().css('margin-left', '-23px'); + + $('.scb_s_help_sub_section_' + ind + '.list_tag', body).css('display', 'list-item'); + $('.scb_s_help_sub_section_' + ind + '.span_tag', body).css('display', 'inline'); + $('.scb_s_main_help_link', body).hide(); + $('.scb_s_help_sublink', body).hide(); + if ($(item, body).parent().prev().text().trim() == 'EXPERIMENTS') { + $(item, body).parent().children('span').hide(); + $(item, body).parent().children('li').hide(); + } + $(item, body).css('display', 'inline'); + $(item, body).css('cursor', 'pointer'); + if ($('.scb_f_help_footer', body).length > 0) { + $('.scb_f_help_footer', body).remove(); + } else { + var footer = document.createElement('div') + footer.className = 'scb_f_help_footer'; + footer.innerHTML = " "; + footer.style.height = '25px'; + $('.scb_f_help_display', body).append(footer); + $('.scb_f_help_footer', body).width($('.scb_f_help_search_bar', body).width() - 15); + } + $(body).scrollTop(0); + } + } else if (new_hash != '#' && new_hash != '') { + var item = $('a[name="' + new_hash.substr(1) + '"]').closest('.scb_s_help_sublink'); + var ind = $(item).attr('class').match(/\d/g).join(""); + var body = $(anchor_element).parents('body')[0]; + mainUG(body); + console.log(new_hash); + last_element_offset = $(body).scrollTop(); + $(item, body).first().children('span').first().attr('class', 'scb_s_section_inactive'); + $(item, body).first().children('span').first().css('margin-left', '-23px'); + + $('.scb_s_help_sub_section_' + ind + '.list_tag', body).css('display', 'list-item'); + $('.scb_s_help_sub_section_' + ind + '.span_tag', body).css('display', 'inline'); + $('.scb_s_main_help_link', body).hide(); + $('.scb_s_help_sublink', body).hide(); + if ($(item, body).parent().prev().text().trim() == 'EXPERIMENTS') { + $(item, body).parent().children('span').hide(); + $(item, body).parent().children('li').hide(); + } + $(item, body).css('display', 'inline'); + $(item, body).css('cursor', 'pointer'); + if ($('.scb_f_help_footer', body).length > 0) { + $('.scb_f_help_footer', body).remove(); + } else { + var footer = document.createElement('div') + footer.className = 'scb_f_help_footer'; + footer.innerHTML = " "; + footer.style.height = '25px'; + $('.scb_f_help_display', body).append(footer); + $('.scb_f_help_footer', body).width($('.scb_f_help_search_bar', body).width() - 15); + } + $(body).scrollTop(0); + } else { + mainUG(); + } } $(window).on('hashchange', function(e) { - if(e.currentTarget.location.pathname.indexOf('help.html') >0) - hashchange_function(location.hash, $('a[href="'+location.hash+'"]')[0]); + if (e.currentTarget.location.pathname.indexOf('help.html') > 0) { + hashchange_function(location.hash, $('a[href="' + location.hash + '"]')[0]); + } }); @@ -327,28 +330,28 @@ $(window).on('hashchange', function(e) { //Clears the screen and returns the menu to default view -function mainUG(body){ - $('.help_search_input', body).focus(); - $('.scb_f_help font', body).each(function() { - $(this, body).replaceWith($(this, body).text()); - }); - - - $('.scb_s_section_inactive', body).addClass('scb_s_section_active'); - $('.scb_s_section_active', body).css('margin-left', '0px'); - $('.scb_s_section_inactive', body).removeClass('scb_s_section_inactive'); - $('.scb_s_main_help_link', body).css('display', 'inline'); - $('.scb_s_help_sublink >span', body).show(); - $('.special', body).hide(); - $('.scb_s_help_sublink', body).parent().parent().show(); - $('.scb_s_help_sublink', body).show(); - $('.scb_s_main_help_link', body).css('cursor', 'pointer'); - $('.scb_f_help_footer', body).remove(); - //$('.scb_f_help_search_bar').css('position', 'static'); - $('.scb_f_help', body).css('overflow-x', 'hidden'); - $(body).scrollTop(last_element_offset); - last_element_offset=0; - +function mainUG(body) { + $('.help_search_input', body).focus(); + $('.scb_f_help font', body).each(function() { + $(this, body).replaceWith($(this, body).text()); + }); + + + $('.scb_s_section_inactive', body).addClass('scb_s_section_active'); + $('.scb_s_section_active', body).css('margin-left', '0px'); + $('.scb_s_section_inactive', body).removeClass('scb_s_section_inactive'); + $('.scb_s_main_help_link', body).css('display', 'inline'); + $('.scb_s_help_sublink >span', body).show(); + $('.special', body).hide(); + $('.scb_s_help_sublink', body).parent().parent().show(); + $('.scb_s_help_sublink', body).show(); + $('.scb_s_main_help_link', body).css('cursor', 'pointer'); + $('.scb_f_help_footer', body).remove(); + //$('.scb_f_help_search_bar').css('position', 'static'); + $('.scb_f_help', body).css('overflow-x', 'hidden'); + $(body).scrollTop(last_element_offset); + last_element_offset = 0; + } @@ -356,85 +359,85 @@ function mainUG(body){ -function fixImages(){ - $('img[src="../media/uploads/starcellbio/scb_icon_trash.png"]').addClass('resize_icon'); - $('img[src="../media/uploads/starcellbio/scb_icon_trash.png"]').attr('src', '../../../images/user_guide/scb_ug_trash.png'); - - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0000_18-envelope.png"]').addClass('resize_contact'); - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0000_18-envelope.png"]').attr('src', '../../../images/user_guide/scb_ug_envelope.png'); - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0003_33-cabinet.png"]').addClass('resize_icon'); - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0003_33-cabinet.png"]').attr('src', '../../../images/user_guide/scb_ug_cabinet.png'); - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0006_96-book.png"]').addClass('resize_icon'); - $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0006_96-book.png"]').attr('src', '../../../images/user_guide/scb_ug_book.png'); - $('img[src="../media/uploads/starcellbio/scb_icons_copy.png"]').addClass('resize_copy'); - $('img[src="../media/uploads/starcellbio/scb_icons_copy.png"]').attr('src', '../../../images/user_guide/scb_ug_copy.png'); - - - //screenshots - $('img[src="../media/uploads/scb_homepage_-_try_an_experiment.png"]').addClass('resize_img'); - - $('img[src="../media/uploads/starcellbio/scb_homepage_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_homepage_.png"]').attr('src', '../../../images/user_guide/SCB_Homepage.png'); - $('img[src="../media/uploads/starcellbio/scb_sign_in_window_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_sign_in_window_.png"]').attr('src', '../../../images/user_guide/SCB_Sign_In_Window.png'); - $('img[src="../media/uploads/starcellbio/scb_sign_up_window_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_sign_up_window_.png"]').attr('src', '../../../images/user_guide/SCB_Sign_Up_Window.png'); - $('img[src="../media/uploads/starcellbio/scb_top_menu_bar_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_top_menu_bar_.png"]').attr('src', '../../../images/user_guide/SCB_Top_Menu_bar.png'); - $('img[src="../media/uploads/starcellbio/scb_assignments_page_-_usability_test_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_assignments_page_-_usability_test_.png"]').attr('src', '../../../images/user_guide/SCB_Assignments_Page_-_Usability_Test.png'); - $('img[src="../media/uploads/starcellbio/scb_navigation_-_microscopy_active.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_navigation_-_microscopy_active.png"]').attr('src', '../../../images/user_guide/SCB_Navigation_-_Microscopy_active.png'); - $('img[src="../media/uploads/starcellbio/scb_experiments_design_page_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_experiments_design_page_.png"]').attr('src', '../../../images/user_guide/SCB_Experiments_Design_Page.png'); - $('img[src="../media/uploads/starcellbio/scb_add_samples_window_-_samples_selected.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_add_samples_window_-_samples_selected.png"]').attr('src', '../../../images/user_guide/SCB_Add_Samples_window_-_samples_selected.png'); - $('img[src="../media/uploads/starcellbio/scb_setup_page.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_setup_page.png"]').attr('src', '../../../images/user_guide/SCB_Setup_Page.png'); - $('img[src="../media/uploads/starcellbio/scb_confirm_set-up_window.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_confirm_set-up_window.png"]').attr('src', '../../../images/user_guide/SCB_Confirm_Set-up_window.png'); - $('img[src="../media/uploads/starcellbio/scb_select_techniques_page.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_select_techniques_page.png"]').attr('src', '../../../images/user_guide/SCB_Select_Techniques_page.png'); - $('img[src="../media/uploads/starcellbio/scb_experiment_dropdown_menu_-_western_-_cropped__.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_experiment_dropdown_menu_-_western_-_cropped__.png"]').attr('src', '../../../images/user_guide/SCB_Experiment_dropdown_menu_-_western_-_cropped.png'); - $('img[src="../media/uploads/starcellbio/scb_western_sample_prep.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_sample_prep.png"]').attr('src', '../../../images/user_guide/SCB_Western_Sample_prep.png'); - $('img[src="../media/uploads/starcellbio/scb_western_sample_prep_-_option_2.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_sample_prep_-_option_2.png"]').attr('src', '../../../images/user_guide/SCB_Western_Sample_Prep_-_Option_2.png'); - $('img[src="../media/uploads/starcellbio/scb_western_samples_window_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_samples_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_Samples_window.png'); - $('img[src="../media/uploads/starcellbio/scb_western_samples_window_-_marker_added_and_re-ordered.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_samples_window_-_marker_added_and_re-ordered.png"]').attr('src', '../../../images/user_guide/SCB_Western_Samples_window_-_Marker_added_and_re-ordered.png'); - $('img[src="../media/uploads/starcellbio/scb_western_load.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_load.png"]').attr('src', '../../../images/user_guide/SCB_Western_load1.png'); - $('img[src="../media/uploads/starcellbio/scb_western_blot_cropped.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_blot_cropped.png"]').attr('src', '../../../images/user_guide/SCB_Western_blot_cropped.png'); - $('img[src="../media/uploads/starcellbio/scb_western_develop.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_develop.png"]').attr('src', '../../../images/user_guide/SCB_Western_Develop.png'); - $('img[src="../media/uploads/starcellbio/scb_western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window.png'); - $('img[src="../media/uploads/starcellbio/scb_western_reprobing_-_small_tabbed_window_.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_western_reprobing_-_small_tabbed_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_reprobing_-_small_tabbed_window1.png'); - $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_2.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_2.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Sample_Prep_-_2.png'); - $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_samples_selected.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_samples_selected.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Sample_Prep_-_samples_selected.png'); - $('img[src="../media/uploads/starcellbio/scb_flow_samples_window.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_flow_samples_window.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Samples_window.png'); - $('img[src="../media/uploads/starcellbio/scb_flow_analyze_-_large_tabbed_window.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_flow_analyze_-_large_tabbed_window.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Analyze_-_large_tabbed_window.png'); - $('img[src="../media/uploads/starcellbio/scb_flow_analysis_tool.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_flow_analysis_tool.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Analysis_Tool.png'); - $('img[src="../media/uploads/starcellbio/scb_select_techniques_page_-_microscopy_available.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_select_techniques_page_-_microscopy_available.png"]').attr('src', '../../../images/user_guide/SCB_Select_Techniques_Page_-_microscopy_available.png'); - $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_large_tabbed_window.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_large_tabbed_window.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Sample_Prep_page_-_large_tabbed_window.png'); - $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_samples_selected_-_whole_page.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_samples_selected_-_whole_page.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Sample_Prep_page_-_samples_selected_-_whole_page.png'); - $('img[src="../media/uploads/starcellbio/scb_microscopy_analyze_-_with_note.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_microscopy_analyze_-_with_note.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Analyze_-_with_note.png'); - $('img[src="../media/uploads/starcellbio/scb_microscopy_small_tabbed_window_only.png"]').addClass('resize_img'); - $('img[src="../media/uploads/starcellbio/scb_microscopy_small_tabbed_window_only.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_small_tabbed_window_only.png'); - +function fixImages() { + $('img[src="../media/uploads/starcellbio/scb_icon_trash.png"]').addClass('resize_icon'); + $('img[src="../media/uploads/starcellbio/scb_icon_trash.png"]').attr('src', '../../../images/user_guide/scb_ug_trash.png'); + + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0000_18-envelope.png"]').addClass('resize_contact'); + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0000_18-envelope.png"]').attr('src', '../../../images/user_guide/scb_ug_envelope.png'); + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0003_33-cabinet.png"]').addClass('resize_icon'); + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0003_33-cabinet.png"]').attr('src', '../../../images/user_guide/scb_ug_cabinet.png'); + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0006_96-book.png"]').addClass('resize_icon'); + $('img[src="../media/uploads/starcellbio/scb_all_homepage_f_test_0000s_0000s_0000s_0006_96-book.png"]').attr('src', '../../../images/user_guide/scb_ug_book.png'); + $('img[src="../media/uploads/starcellbio/scb_icons_copy.png"]').addClass('resize_copy'); + $('img[src="../media/uploads/starcellbio/scb_icons_copy.png"]').attr('src', '../../../images/user_guide/scb_ug_copy.png'); + + + //screenshots + $('img[src="../media/uploads/scb_homepage_-_try_an_experiment.png"]').addClass('resize_img'); + + $('img[src="../media/uploads/starcellbio/scb_homepage_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_homepage_.png"]').attr('src', '../../../images/user_guide/SCB_Homepage.png'); + $('img[src="../media/uploads/starcellbio/scb_sign_in_window_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_sign_in_window_.png"]').attr('src', '../../../images/user_guide/SCB_Sign_In_Window.png'); + $('img[src="../media/uploads/starcellbio/scb_sign_up_window_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_sign_up_window_.png"]').attr('src', '../../../images/user_guide/SCB_Sign_Up_Window.png'); + $('img[src="../media/uploads/starcellbio/scb_top_menu_bar_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_top_menu_bar_.png"]').attr('src', '../../../images/user_guide/SCB_Top_Menu_bar.png'); + $('img[src="../media/uploads/starcellbio/scb_assignments_page_-_usability_test_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_assignments_page_-_usability_test_.png"]').attr('src', '../../../images/user_guide/SCB_Assignments_Page_-_Usability_Test.png'); + $('img[src="../media/uploads/starcellbio/scb_navigation_-_microscopy_active.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_navigation_-_microscopy_active.png"]').attr('src', '../../../images/user_guide/SCB_Navigation_-_Microscopy_active.png'); + $('img[src="../media/uploads/starcellbio/scb_experiments_design_page_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_experiments_design_page_.png"]').attr('src', '../../../images/user_guide/SCB_Experiments_Design_Page.png'); + $('img[src="../media/uploads/starcellbio/scb_add_samples_window_-_samples_selected.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_add_samples_window_-_samples_selected.png"]').attr('src', '../../../images/user_guide/SCB_Add_Samples_window_-_samples_selected.png'); + $('img[src="../media/uploads/starcellbio/scb_setup_page.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_setup_page.png"]').attr('src', '../../../images/user_guide/SCB_Setup_Page.png'); + $('img[src="../media/uploads/starcellbio/scb_confirm_set-up_window.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_confirm_set-up_window.png"]').attr('src', '../../../images/user_guide/SCB_Confirm_Set-up_window.png'); + $('img[src="../media/uploads/starcellbio/scb_select_techniques_page.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_select_techniques_page.png"]').attr('src', '../../../images/user_guide/SCB_Select_Techniques_page.png'); + $('img[src="../media/uploads/starcellbio/scb_experiment_dropdown_menu_-_western_-_cropped__.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_experiment_dropdown_menu_-_western_-_cropped__.png"]').attr('src', '../../../images/user_guide/SCB_Experiment_dropdown_menu_-_western_-_cropped.png'); + $('img[src="../media/uploads/starcellbio/scb_western_sample_prep.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_sample_prep.png"]').attr('src', '../../../images/user_guide/SCB_Western_Sample_prep.png'); + $('img[src="../media/uploads/starcellbio/scb_western_sample_prep_-_option_2.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_sample_prep_-_option_2.png"]').attr('src', '../../../images/user_guide/SCB_Western_Sample_Prep_-_Option_2.png'); + $('img[src="../media/uploads/starcellbio/scb_western_samples_window_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_samples_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_Samples_window.png'); + $('img[src="../media/uploads/starcellbio/scb_western_samples_window_-_marker_added_and_re-ordered.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_samples_window_-_marker_added_and_re-ordered.png"]').attr('src', '../../../images/user_guide/SCB_Western_Samples_window_-_Marker_added_and_re-ordered.png'); + $('img[src="../media/uploads/starcellbio/scb_western_load.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_load.png"]').attr('src', '../../../images/user_guide/SCB_Western_load1.png'); + $('img[src="../media/uploads/starcellbio/scb_western_blot_cropped.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_blot_cropped.png"]').attr('src', '../../../images/user_guide/SCB_Western_blot_cropped.png'); + $('img[src="../media/uploads/starcellbio/scb_western_develop.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_develop.png"]').attr('src', '../../../images/user_guide/SCB_Western_Develop.png'); + $('img[src="../media/uploads/starcellbio/scb_western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_protein_measurement_tool_tip_-_cropped_-_small_tabbed_window.png'); + $('img[src="../media/uploads/starcellbio/scb_western_reprobing_-_small_tabbed_window_.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_western_reprobing_-_small_tabbed_window_.png"]').attr('src', '../../../images/user_guide/SCB_Western_reprobing_-_small_tabbed_window1.png'); + $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_2.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_2.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Sample_Prep_-_2.png'); + $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_samples_selected.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_flow_sample_prep_-_samples_selected.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Sample_Prep_-_samples_selected.png'); + $('img[src="../media/uploads/starcellbio/scb_flow_samples_window.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_flow_samples_window.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Samples_window.png'); + $('img[src="../media/uploads/starcellbio/scb_flow_analyze_-_large_tabbed_window.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_flow_analyze_-_large_tabbed_window.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Analyze_-_large_tabbed_window.png'); + $('img[src="../media/uploads/starcellbio/scb_flow_analysis_tool.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_flow_analysis_tool.png"]').attr('src', '../../../images/user_guide/SCB_Flow_Analysis_Tool.png'); + $('img[src="../media/uploads/starcellbio/scb_select_techniques_page_-_microscopy_available.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_select_techniques_page_-_microscopy_available.png"]').attr('src', '../../../images/user_guide/SCB_Select_Techniques_Page_-_microscopy_available.png'); + $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_large_tabbed_window.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_large_tabbed_window.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Sample_Prep_page_-_large_tabbed_window.png'); + $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_samples_selected_-_whole_page.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_microscopy_sample_prep_page_-_samples_selected_-_whole_page.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Sample_Prep_page_-_samples_selected_-_whole_page.png'); + $('img[src="../media/uploads/starcellbio/scb_microscopy_analyze_-_with_note.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_microscopy_analyze_-_with_note.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_Analyze_-_with_note.png'); + $('img[src="../media/uploads/starcellbio/scb_microscopy_small_tabbed_window_only.png"]').addClass('resize_img'); + $('img[src="../media/uploads/starcellbio/scb_microscopy_small_tabbed_window_only.png"]').attr('src', '../../../images/user_guide/SCB_Microscopy_small_tabbed_window_only.png'); + } diff --git a/html_app/ui/AssignmentsView.js b/html_app/ui/AssignmentsView.js index a6c9d998..8935df32 100644 --- a/html_app/ui/AssignmentsView.js +++ b/html_app/ui/AssignmentsView.js @@ -1,7 +1,7 @@ 'use strict'; -if (typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } @@ -9,252 +9,252 @@ scb.ui.static = scb.ui.static || {}; scb.ui.static.AssignmentsView = scb.ui.static.AssignmentsView || {}; -scb.ui.static.AssignmentsView.ARROW_OFFSET = 15; -scb.ui.static.AssignmentsView.ARROW_DIVISION = 2; +scb.ui.static.AssignmentsView.ARROW_OFFSET = 15; +scb.ui.static.AssignmentsView.ARROW_DIVISION = 2; scb.ui.static.AssignmentsView.HEADER_WIDTH = 579; scb.ui.static.AssignmentsView.HEADER_OFFSET = 34; -scb.ui.static.AssignmentsView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); +scb.ui.static.AssignmentsView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); - var state = { - assignment_id: assignment_id, - view: 'assignments', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); + var state = { + assignment_id: assignment_id, + view: 'assignments', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.AssignmentsView.scb_assignments_header_link_wrapper = function (element, workarea) { - var parsed = scb.ui.static.AssignmentsView.parse(element); - $('.scb_s_assignment_scroll','.scb_s_assignments_view').scrollTop(0); - var first_element = $('.scb_s_assignments_slider_header' ,'.scb_s_assignments_view').children().first().next().get(0); - var last_element = $('.scb_s_assignments_slider_header','.scb_s_assignments_view').children().last().prev().get(0); - - var section = $(element).attr('value'); - $('.scb_assignments_header_link_wrapper').removeClass('scb_assignments_header_link_selected'); - $('.arrow-down-blue').detach(); - $(element).append('

'); - $(element).addClass('scb_assignments_header_link_selected'); - $('.scb_s_display_section').hide() - $('.scb_s_display_section[value="'+section+'"]').show(); - $('.arrow-down-blue').css('left', - ($('.arrow-down-blue').parent().width()/scb.ui.static.AssignmentsView.ARROW_DIVISION)-scb.ui.static.AssignmentsView.ARROW_OFFSET+'px'); - - - if(element == first_element){ - $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); - $('.scb_s_assignment_header_img_left').addClass('scb_s_assignment_header_img_left_inactive'); - } - else if(element == last_element){ - $('.scb_s_assignment_header_img_right').addClass('scb_s_assignment_header_img_right_inactive'); - $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); - } - else{ - $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); - $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); - } - parsed.assignment.last_instruction = $('.scb_assignments_header_link_selected').index()-1; - console.log(parsed.assignment.last_instruction); - - var assignment_window = $('.scb_s_assignment_scroll','.scb_s_assignments_view').get(0); - if(assignment_window.scrollHeight == assignment_window.clientHeight) - $('.scb_s_assignments_bottom_scroll').addClass('scb_s_assignments_bottom_scroll_abs'); - else $('.scb_s_assignments_bottom_scroll').removeClass('scb_s_assignments_bottom_scroll_abs'); +scb.ui.static.AssignmentsView.scb_assignments_header_link_wrapper = function(element, workarea) { + var parsed = scb.ui.static.AssignmentsView.parse(element); + $('.scb_s_assignment_scroll', '.scb_s_assignments_view').scrollTop(0); + var first_element = $('.scb_s_assignments_slider_header', '.scb_s_assignments_view').children().first().next().get(0); + var last_element = $('.scb_s_assignments_slider_header', '.scb_s_assignments_view').children().last().prev().get(0); + + var section = $(element).attr('value'); + $('.scb_assignments_header_link_wrapper').removeClass('scb_assignments_header_link_selected'); + $('.arrow-down-blue').detach(); + $(element).append('
'); + $(element).addClass('scb_assignments_header_link_selected'); + $('.scb_s_display_section').hide() + $('.scb_s_display_section[value="' + section + '"]').show(); + $('.arrow-down-blue').css('left', + ($('.arrow-down-blue').parent().width() / scb.ui.static.AssignmentsView.ARROW_DIVISION) - scb.ui.static.AssignmentsView.ARROW_OFFSET + 'px'); + + + if (element == first_element) { + $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); + $('.scb_s_assignment_header_img_left').addClass('scb_s_assignment_header_img_left_inactive'); + } else if (element == last_element) { + $('.scb_s_assignment_header_img_right').addClass('scb_s_assignment_header_img_right_inactive'); + $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); + } else { + $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); + $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); + } + parsed.assignment.last_instruction = $('.scb_assignments_header_link_selected').index() - 1; + console.log(parsed.assignment.last_instruction); + + var assignment_window = $('.scb_s_assignment_scroll', '.scb_s_assignments_view').get(0); + if (assignment_window.scrollHeight == assignment_window.clientHeight) { + $('.scb_s_assignments_bottom_scroll').addClass('scb_s_assignments_bottom_scroll_abs'); + } else { + $('.scb_s_assignments_bottom_scroll').removeClass('scb_s_assignments_bottom_scroll_abs'); + } } -scb.ui.static.AssignmentsView.scb_s_assignment_header_img_left = function (element, workarea) { +scb.ui.static.AssignmentsView.scb_s_assignment_header_img_left = function(element, workarea) { - var parsed = scb.ui.static.AssignmentsView.parse(element); - $('.scb_s_assignment_scroll', '.scb_s_assignments_view').scrollTop(0); - var first_element = $('.scb_s_assignments_slider_header', '.scb_s_assignments_view').children().first().next().get(0); - var selected_element; - if ($('.scb_assignments_header_link_selected', '.scb_s_assignments_view').get(0) == first_element || $('.scb_assignments_header_link_selected', '.scb_s_assignments_view').get(0) == $(first_element, '.scb_s_assignments_view').next().get(0)) { - selected_element = first_element; + var parsed = scb.ui.static.AssignmentsView.parse(element); + $('.scb_s_assignment_scroll', '.scb_s_assignments_view').scrollTop(0); + var first_element = $('.scb_s_assignments_slider_header', '.scb_s_assignments_view').children().first().next().get(0); + var selected_element; + if ($('.scb_assignments_header_link_selected', '.scb_s_assignments_view').get(0) == first_element || $('.scb_assignments_header_link_selected', '.scb_s_assignments_view').get(0) == $(first_element, '.scb_s_assignments_view').next().get(0)) { + selected_element = first_element; - $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); - $('.scb_s_assignment_header_img_left').addClass('scb_s_assignment_header_img_left_inactive'); - } - else { - selected_element = $('.scb_assignments_header_link_wrapper')[$('.scb_assignments_header_link_selected').index() - 1 - 1]; - $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); - $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); - } + $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); + $('.scb_s_assignment_header_img_left').addClass('scb_s_assignment_header_img_left_inactive'); + } else { + selected_element = $('.scb_assignments_header_link_wrapper')[$('.scb_assignments_header_link_selected').index() - 1 - 1]; + $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); + $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); + } - $('.scb_assignments_header_link_wrapper').removeClass('scb_assignments_header_link_selected'); - $(selected_element).addClass('scb_assignments_header_link_selected'); + $('.scb_assignments_header_link_wrapper').removeClass('scb_assignments_header_link_selected'); + $(selected_element).addClass('scb_assignments_header_link_selected'); - $('.arrow-down-blue').detach(); - $(selected_element).append('
'); - var section = $(selected_element).attr('value'); - $('.arrow-down-blue').css('left', ($('.arrow-down-blue').parent().width() / scb.ui.static.AssignmentsView.ARROW_DIVISION) - scb.ui.static.AssignmentsView.ARROW_OFFSET + 'px'); + $('.arrow-down-blue').detach(); + $(selected_element).append('
'); + var section = $(selected_element).attr('value'); + $('.arrow-down-blue').css('left', ($('.arrow-down-blue').parent().width() / scb.ui.static.AssignmentsView.ARROW_DIVISION) - scb.ui.static.AssignmentsView.ARROW_OFFSET + 'px'); - $('.scb_s_display_section').hide() - $('.scb_s_display_section[value="' + section + '"]').show(); + $('.scb_s_display_section').hide() + $('.scb_s_display_section[value="' + section + '"]').show(); - parsed.assignment.last_instruction = $('.scb_assignments_header_link_selected').index() - 1 - 1; - console.log(parsed.assignment.last_instruction); + parsed.assignment.last_instruction = $('.scb_assignments_header_link_selected').index() - 1 - 1; + console.log(parsed.assignment.last_instruction); - var assignment_window = $('.scb_s_assignment_scroll', '.scb_s_assignments_view').get(0); - if (assignment_window.scrollHeight == assignment_window.clientHeight) - $('.scb_s_assignments_bottom_scroll').addClass('scb_s_assignments_bottom_scroll_abs'); - else $('.scb_s_assignments_bottom_scroll').removeClass('scb_s_assignments_bottom_scroll_abs'); + var assignment_window = $('.scb_s_assignment_scroll', '.scb_s_assignments_view').get(0); + if (assignment_window.scrollHeight == assignment_window.clientHeight) { + $('.scb_s_assignments_bottom_scroll').addClass('scb_s_assignments_bottom_scroll_abs'); + } else { + $('.scb_s_assignments_bottom_scroll').removeClass('scb_s_assignments_bottom_scroll_abs'); + } } -scb.ui.static.AssignmentsView.scb_s_assignment_header_img_right = function (element, workarea) { - var parsed = scb.ui.static.AssignmentsView.parse(element); - $('.scb_s_assignment_scroll', '.scb_s_assignments_view').scrollTop(0); - var last_element = $('.scb_s_assignments_slider_header', '.scb_s_assignments_view').children().last().prev().get(0); - var selected_element; - if ($('.scb_assignments_header_link_selected', '.scb_s_assignments_view').get(0) == last_element || $('.scb_assignments_header_link_selected', '.scb_s_assignments_view').get(0) == $(last_element, '.scb_s_assignments_view').prev().get(0)) { - selected_element = last_element; - $('.scb_s_assignment_header_img_right').addClass('scb_s_assignment_header_img_right_inactive'); - $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); - } - else { - selected_element = $('.scb_assignments_header_link_wrapper')[$('.scb_assignments_header_link_selected').index()]; +scb.ui.static.AssignmentsView.scb_s_assignment_header_img_right = function(element, workarea) { + var parsed = scb.ui.static.AssignmentsView.parse(element); + $('.scb_s_assignment_scroll', '.scb_s_assignments_view').scrollTop(0); + var last_element = $('.scb_s_assignments_slider_header', '.scb_s_assignments_view').children().last().prev().get(0); + var selected_element; + if ($('.scb_assignments_header_link_selected', '.scb_s_assignments_view').get(0) == last_element || $('.scb_assignments_header_link_selected', '.scb_s_assignments_view').get(0) == $(last_element, '.scb_s_assignments_view').prev().get(0)) { + selected_element = last_element; + $('.scb_s_assignment_header_img_right').addClass('scb_s_assignment_header_img_right_inactive'); + $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); + } else { + selected_element = $('.scb_assignments_header_link_wrapper')[$('.scb_assignments_header_link_selected').index()]; - $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); - $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); - } - $('.scb_assignments_header_link_wrapper').removeClass('scb_assignments_header_link_selected'); - $(selected_element).addClass('scb_assignments_header_link_selected'); + $('.scb_s_assignment_header_img_right').removeClass('scb_s_assignment_header_img_right_inactive'); + $('.scb_s_assignment_header_img_left').removeClass('scb_s_assignment_header_img_left_inactive'); + } + $('.scb_assignments_header_link_wrapper').removeClass('scb_assignments_header_link_selected'); + $(selected_element).addClass('scb_assignments_header_link_selected'); - $('.arrow-down-blue').detach(); - $(selected_element).append('
'); - var section = $(selected_element).attr('value'); - $('.arrow-down-blue').css('left', ($('.arrow-down-blue').parent().width() / scb.ui.static.AssignmentsView.ARROW_DIVISION) - scb.ui.static.AssignmentsView.ARROW_OFFSET + 'px'); + $('.arrow-down-blue').detach(); + $(selected_element).append('
'); + var section = $(selected_element).attr('value'); + $('.arrow-down-blue').css('left', ($('.arrow-down-blue').parent().width() / scb.ui.static.AssignmentsView.ARROW_DIVISION) - scb.ui.static.AssignmentsView.ARROW_OFFSET + 'px'); - $('.scb_s_display_section').hide() - $('.scb_s_display_section[value="' + section + '"]').show(); + $('.scb_s_display_section').hide() + $('.scb_s_display_section[value="' + section + '"]').show(); - parsed.assignment.last_instruction = $('.scb_assignments_header_link_selected').index() - 1; - console.log(parsed.assignment.last_instruction); - var assignment_window = $('.scb_s_assignment_scroll').get(0); - if (assignment_window.scrollHeight == assignment_window.clientHeight) - $('.scb_s_assignments_bottom_scroll').addClass('scb_s_assignments_bottom_scroll_abs'); - else $('.scb_s_assignments_bottom_scroll').removeClass('scb_s_assignments_bottom_scroll_abs'); + parsed.assignment.last_instruction = $('.scb_assignments_header_link_selected').index() - 1; + console.log(parsed.assignment.last_instruction); + var assignment_window = $('.scb_s_assignment_scroll').get(0); + if (assignment_window.scrollHeight == assignment_window.clientHeight) { + $('.scb_s_assignments_bottom_scroll').addClass('scb_s_assignments_bottom_scroll_abs'); + } else { + $('.scb_s_assignments_bottom_scroll').removeClass('scb_s_assignments_bottom_scroll_abs'); + } } scb.ui.static.AssignmentsView.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_assignments_header_link_wrapper', function (e) { - scb.ui.static.AssignmentsView.scb_assignments_header_link_wrapper(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_s_assignment_header_img_left', function (e) { - if(!$(this).hasClass('scb_s_assignment_header_img_left_inactive')) { - scb.ui.static.AssignmentsView.scb_s_assignment_header_img_left(this, e); - } + scb.utils.off_on(workarea, 'click', '.scb_assignments_header_link_wrapper', function(e) { + scb.ui.static.AssignmentsView.scb_assignments_header_link_wrapper(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_assignment_header_img_left', function(e) { + if (!$(this).hasClass('scb_s_assignment_header_img_left_inactive')) { + scb.ui.static.AssignmentsView.scb_s_assignment_header_img_left(this, e); + } + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_assignment_header_img_right', function(e) { + if (!$(this).hasClass('scb_s_assignment_header_img_right_inactive')) { + scb.ui.static.AssignmentsView.scb_s_assignment_header_img_right(this, e); + } + }); + scb.utils.off_on(workarea, 'click', '.scb_assignments_new_experiment', function(e) { + $('.scb_f_experiments_step_link').get(0).click(); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_assignments_print_assignment', function(e) { + console.log("assignment_id" + this.id); + var pdf_file; + if (this.id == "scb_ex1") { + pdf_file = "SCB Exercise 1_ver 7_questions.pdf"; + + } else if (this.id == "scb_ex2") { + pdf_file = "SCB Exercise 2_ver 10 questions.pdf"; + } else if (this.id == "scb_ex3") { + pdf_file = "SCB Exercise 3_ver17_questions.pdf"; + } else if (this.id == "decusability") { + pdf_file = "decusability_assignment.pdf"; + + } + var pdfwindow = window.open("../../pdf/" + pdf_file, '_blank', false); + $(pdfwindow.document).load(function() {}); + }); +}; + +scb.ui.AssignmentsView = function scb_ui_AssignmentsView(gstate) { + var self = this; + self.show = function(state) { + var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); + var courses = _.groupBy(assignments.list, function(assignment) { + return (assignment.course); }); - - scb.utils.off_on(workarea, 'click', '.scb_s_assignment_header_img_right', function (e) { - if(!$(this).hasClass('scb_s_assignment_header_img_right_inactive')) { - scb.ui.static.AssignmentsView.scb_s_assignment_header_img_right(this, e); - } + _.each(courses, function(v, k) { + try { + v.name = v[0].course_name + } catch ( e ) { + console.info(e); + }; }); - scb.utils.off_on(workarea, 'click', '.scb_assignments_new_experiment', function (e) { - $('.scb_f_experiments_step_link').get(0).click(); + window.courses = courses; + window.assignments = assignments; + var workarea = gstate.workarea; + var last_step = 1; + var prev_step; + if (assignments.selected.experiments.selected != null) { + prev_step = assignments.selected.experiments.selected.prev_step; + } else { + prev_step = null; + } + workarea.html(scb_assignments.main({ + global_template: gstate.context.master_model, + assignments: assignments, + last_step: last_step, + prev_step: prev_step, + context: gstate.context, + courses: courses, + })); + + scb.ui.static.HomepageView.select_list_item($('.scb_s_homepage_experimental_design_bullet_item', workarea).first(), gstate.workarea); + document.title = "Assignments - StarCellBio" + $('.scb_assignments_header_link_wrapper', '.scb_s_assignments_view').css('width', + (scb.ui.static.AssignmentsView.HEADER_WIDTH / assignments.selected.template.instructions.length) - scb.ui.static.AssignmentsView.HEADER_OFFSET + 'px'); + $('.arrow-down-blue', '.scb_s_assignments_view').css('left', ($('.arrow-down-blue', '.scb_s_assignments_view').parent().width() / scb.ui.static.AssignmentsView.ARROW_DIVISION) - scb.ui.static.AssignmentsView.ARROW_OFFSET + 'px'); + + $('.scb_s_ref_info_link').click(function() { + $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); }); - scb.utils.off_on(workarea, 'click', '.scb_s_assignments_print_assignment', function (e) { - console.log("assignment_id"+ this.id); - var pdf_file; - if(this.id=="scb_ex1"){ - pdf_file="SCB Exercise 1_ver 7_questions.pdf"; - - } - else if(this.id=="scb_ex2"){ - pdf_file="SCB Exercise 2_ver 10 questions.pdf"; - } - else if(this.id=="scb_ex3"){ - pdf_file="SCB Exercise 3_ver17_questions.pdf"; - } - else if(this.id=="decusability"){ - pdf_file="decusability_assignment.pdf"; - - } - var pdfwindow = window.open("../../pdf/"+pdf_file, '_blank', false); - $(pdfwindow.document).load(function(){ - - }); + var assignment_window = $('.scb_s_assignment_scroll', '.scb_s_assignments_view').get(0); + if (assignment_window.scrollHeight == assignment_window.clientHeight) { + $('.scb_s_assignments_bottom_scroll', '.scb_s_assignments_view').addClass('scb_s_assignments_bottom_scroll_abs'); + } else { + $('.scb_s_assignments_bottom_scroll', '.scb_s_assignments_view').removeClass('scb_s_assignments_bottom_scroll_abs'); + } + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 }); -}; + $(window).resize(function() { -scb.ui.AssignmentsView = function scb_ui_AssignmentsView(gstate) { - var self = this; - self.show = function (state) { - var assignments = new scb.AssignmentList(gstate.context.master_model.assignments, gstate.context); - var courses = _.groupBy(assignments.list, function (assignment) { - return (assignment.course); - }); - _.each( courses, function(v,k) { - try { - v.name = v[0].course_name - } catch(e) - { - console.info(e); - }; - }); - window.courses = courses; - window.assignments = assignments; - var workarea = gstate.workarea; - var last_step=1; - var prev_step; - if(assignments.selected.experiments.selected !=null) - prev_step=assignments.selected.experiments.selected.prev_step; - else prev_step = null; - workarea.html(scb_assignments.main({ - global_template: gstate.context.master_model, - assignments: assignments, - last_step: last_step, - prev_step: prev_step, - context: gstate.context, - courses: courses, - })); - - scb.ui.static.HomepageView.select_list_item($('.scb_s_homepage_experimental_design_bullet_item',workarea).first(), gstate.workarea); - document.title = "Assignments - StarCellBio" - $('.scb_assignments_header_link_wrapper','.scb_s_assignments_view').css('width' , - (scb.ui.static.AssignmentsView.HEADER_WIDTH/assignments.selected.template.instructions.length)-scb.ui.static.AssignmentsView.HEADER_OFFSET+ 'px'); - $('.arrow-down-blue','.scb_s_assignments_view').css('left', ($('.arrow-down-blue','.scb_s_assignments_view').parent().width()/scb.ui.static.AssignmentsView.ARROW_DIVISION)-scb.ui.static.AssignmentsView.ARROW_OFFSET+'px'); - - $('.scb_s_ref_info_link').click(function(){ - $('.scb_assignments_header_link_wrapper[value="Reference Material"]').click(); - }); - var assignment_window = $('.scb_s_assignment_scroll','.scb_s_assignments_view').get(0); - if(assignment_window.scrollHeight == assignment_window.clientHeight) - $('.scb_s_assignments_bottom_scroll','.scb_s_assignments_view').addClass('scb_s_assignments_bottom_scroll_abs'); - else $('.scb_s_assignments_bottom_scroll','.scb_s_assignments_view').removeClass('scb_s_assignments_bottom_scroll_abs'); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); - } + }); + + } } \ No newline at end of file diff --git a/html_app/ui/ExperimentDesignView.js b/html_app/ui/ExperimentDesignView.js index eed73e12..affa2aec 100644 --- a/html_app/ui/ExperimentDesignView.js +++ b/html_app/ui/ExperimentDesignView.js @@ -3,164 +3,151 @@ scb.ui = scb.ui || {}; scb.ui.static = scb.ui.static || {}; scb.ui.static.ExperimentDesignView = scb.ui.static.ExperimentDesignView || {}; -scb.ui.static.ExperimentDesignView.TOTAL_STEPS = 5; - -scb.ui.static.ExperimentDesignView.parsed = function(element) -{ - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view:'experiment_design', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - return parsed; +scb.ui.static.ExperimentDesignView.TOTAL_STEPS = 5; + +scb.ui.static.ExperimentDesignView.parsed = function(element) { + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_design', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + return parsed; } -scb.ui.static.ExperimentDesignView.update_experiment_design_hypothesis = function(element) - { - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view:'experiment_design', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - if( parsed.redisplay ) - { - alert( "INVALID ELEMENT!"); - } - if( parsed.experiment ) - { - parsed.experiment.hypothesis = $(element).attr('value'); - } - } - - -scb.ui.static.ExperimentDesignView.scb_s_experiment_design_objective = function(element) - { - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view:'experiment_design', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - if( parsed.redisplay ) - { - alert( "INVALID ELEMENT!"); - } - if( parsed.experiment ) - { - parsed.experiment.objective = $(element).attr('value'); - } - } - - - -scb.ui.static.ExperimentDesignView.scb_s_experiment_design_technique_answer = function(element) - { - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view:'experiment_design', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - if( parsed.redisplay ) - { - alert( "INVALID ELEMENT!"); - } - if( parsed.experiment ) - { - parsed.experiment.technique = $(element).attr('value'); - } - } - - -scb.ui.static.ExperimentDesignView.scb_s_experiment_name_edit = function(element) - { - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view:'experiment_design', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - if( parsed.redisplay ) - { - alert( "INVALID ELEMENT!"); - } - if( parsed.experiment ) - { - parsed.experiment.name = $(element).attr('value'); - } - } - - - -scb.ui.static.ExperimentDesignView.register = function(workarea) -{ - scb.utils.off_on(workarea, 'change', '.scb_s_experiment_design_hypothesis', function (e) { - scb.ui.static.ExperimentDesignView.update_experiment_design_hypothesis(this); - }); +scb.ui.static.ExperimentDesignView.update_experiment_design_hypothesis = function(element) { + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_design', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.experiment) { + parsed.experiment.hypothesis = $(element).attr('value'); + } +} - scb.utils.off_on(workarea, 'change', '.scb_s_experiment_design_objective', function (e) { - scb.ui.static.ExperimentDesignView.scb_s_experiment_design_objective(this); - }); - scb.utils.off_on(workarea, 'change', '.scb_s_experiment_design_technique_answer', function (e) { - scb.ui.static.ExperimentDesignView.scb_s_experiment_design_technique_answer(this); - }); - scb.utils.off_on(workarea, 'change', '.scb_s_experiment_name_edit', function (e) { - scb.ui.static.ExperimentDesignView.scb_s_experiment_name_edit(this); - }); + +scb.ui.static.ExperimentDesignView.scb_s_experiment_design_objective = function(element) { + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_design', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.experiment) { + parsed.experiment.objective = $(element).attr('value'); + } +} + + + +scb.ui.static.ExperimentDesignView.scb_s_experiment_design_technique_answer = function(element) { + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_design', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.experiment) { + parsed.experiment.technique = $(element).attr('value'); + } +} + + +scb.ui.static.ExperimentDesignView.scb_s_experiment_name_edit = function(element) { + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_design', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.experiment) { + parsed.experiment.name = $(element).attr('value'); + } +} + + + +scb.ui.static.ExperimentDesignView.register = function(workarea) { + scb.utils.off_on(workarea, 'change', '.scb_s_experiment_design_hypothesis', function(e) { + scb.ui.static.ExperimentDesignView.update_experiment_design_hypothesis(this); + }); + + scb.utils.off_on(workarea, 'change', '.scb_s_experiment_design_objective', function(e) { + scb.ui.static.ExperimentDesignView.scb_s_experiment_design_objective(this); + }); + scb.utils.off_on(workarea, 'change', '.scb_s_experiment_design_technique_answer', function(e) { + scb.ui.static.ExperimentDesignView.scb_s_experiment_design_technique_answer(this); + }); + scb.utils.off_on(workarea, 'change', '.scb_s_experiment_name_edit', function(e) { + scb.ui.static.ExperimentDesignView.scb_s_experiment_name_edit(this); + }); } scb.ui.ExperimentDesignView = function scb_ui_ExperimentDesignView(gstate) { - var self = this; - - self.show = function(state) { - var workarea = state.workarea; - workarea.html(scb_experiment_design.main({ - global_template : gstate.context.master_model, - context: gstate.context, - t : state.assignment.template, - prev_step: state.experiment.prev_step, - last_step: state.experiment.last_step, - assignment: state.assignment, - experiment: state.experiment - })); - state.experiment.prev_step = 1; - state.experiment.last_view = 'experiment_design'; - if(state.experiment.last_step < scb.ui.static.ExperimentDesignView.TOTAL_STEPS) - state.experiment.last_step = 3; - document.title = state.experiment.name + " - StarCellBio" ; - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); - } + var self = this; + + self.show = function(state) { + var workarea = state.workarea; + workarea.html(scb_experiment_design.main({ + global_template: gstate.context.master_model, + context: gstate.context, + t: state.assignment.template, + prev_step: state.experiment.prev_step, + last_step: state.experiment.last_step, + assignment: state.assignment, + experiment: state.experiment + })); + state.experiment.prev_step = 1; + state.experiment.last_view = 'experiment_design'; + if (state.experiment.last_step < scb.ui.static.ExperimentDesignView.TOTAL_STEPS) { + state.experiment.last_step = 3; + } + document.title = state.experiment.name + " - StarCellBio"; + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + } } \ No newline at end of file diff --git a/html_app/ui/ExperimentSetupView.js b/html_app/ui/ExperimentSetupView.js index 0ad1bc60..313260b6 100644 --- a/html_app/ui/ExperimentSetupView.js +++ b/html_app/ui/ExperimentSetupView.js @@ -4,974 +4,995 @@ scb.ui = scb.ui || {}; scb.ui.static = scb.ui.static || {}; scb.ui.static.ExperimentSetupView = scb.ui.static.ExperimentSetupView || {}; -scb.ui.static.ExperimentSetupView.TOTAL_STEPS = 5; +scb.ui.static.ExperimentSetupView.TOTAL_STEPS = 5; -scb.ui.static.ExperimentSetupView.parse = function (element) { - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - var cell_treatment_id = $(element).attr('cell_treatment_id'); - var treatment_id = $(element).attr('treatment_id'); +scb.ui.static.ExperimentSetupView.parse = function(element) { + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + var cell_treatment_id = $(element).attr('cell_treatment_id'); + var treatment_id = $(element).attr('treatment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - cell_treatment_id: cell_treatment_id, - treatment_id: treatment_id, - view: 'experiment_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + cell_treatment_id: cell_treatment_id, + treatment_id: treatment_id, + view: 'experiment_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); - return parsed; + return parsed; } -scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog = function (element, workarea) { - var parsed = scb.ui.static.ExperimentSetupView.parse(element); - var template = parsed.assignment.template; - var action = scb.utils.get(template, ['ui', 'experiment_setup', 'actions' , 0, 'open'], scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog_old); - if (typeof(action) == 'string' && typeof(eval(action)) == 'function') { - action = eval(action); - } - else { - action = scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog_old; - } - scb.Utils.call_back(action, { - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment, - template: template, - element: element, - close: scb.ui.static.MainFrame.refresh, - source_state: scb.utils.get(template, ['ui', 'experiment_setup', 'actions' , 0]) - }); +scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog = function(element, workarea) { + var parsed = scb.ui.static.ExperimentSetupView.parse(element); + var template = parsed.assignment.template; + var action = scb.utils.get(template, ['ui', 'experiment_setup', 'actions', 0, 'open'], scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog_old); + if (typeof (action) == 'string' && typeof (eval(action)) == 'function') { + action = eval(action); + } else { + action = scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog_old; + } + scb.Utils.call_back(action, { + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment, + template: template, + element: element, + close: scb.ui.static.MainFrame.refresh, + source_state: scb.utils.get(template, ['ui', 'experiment_setup', 'actions', 0]) + }); } -scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog_old = function (state) { - var element = state.element; - var dialog_selector = $('.scb_s_experiment_setup_table_add_samples_dialog'); - dialog_selector.dialog("open"); - scb.utils.off_on(dialog_selector, 'click', '.scb_f_experiment_setup_dialog_apply', function (e) { - //TODO: form new 'cell_treatment' using dialog box - var experiment_id = $('.scb_s_experiment_setup_table_add_samples_dialog').attr('experiment_id'); - var assignment_id = $('.scb_s_experiment_setup_table_add_samples_dialog').attr('assignment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'experiment_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var cell_treatment_list = parsed.experiment.cell_treatment_list; - var template = parsed.assignment.template; - var cell_lines = $('.scb_s_experiment_setup_dialog_cell_lines_select').val(); - var treatments = $('.scb_s_experiment_setup_dialog_treatments_select').val(); - var schedules = $('.scb_s_experiment_setup_dialog_collection_select').val(); - _.each(cell_lines, function (cell_line) { - var cell_line_template = scb.utils.find(template.experiment_setup_actions.cell_lines, cell_line); - _.each(treatments, function (treatment) { - var treatment_template = scb.utils.find(template.experiment_setup_actions.treatment_protocol_list, treatment); - _.each(schedules, function (schedule) { - var collection_template = scb.utils.find(template.experiment_setup_actions.collection_schedule_list, schedule); - var construct = {}; - _.each(cell_line_template, function (v, k) { - if (k != 'id' && k != 'title') { - construct[k] = v; - } - }); - _.each(treatment_template, function (v, k) { - if (k != 'id' && k != 'title') { - construct[k] = v; - } - }); - _.each(collection_template, function (v, k) { - if (k != 'id' && k != 'title') { - construct[k] = v; - } - }); - cell_treatment_list.start(construct); - console.info("NEXT"); - }); - }); +scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog_old = function(state) { + var element = state.element; + var dialog_selector = $('.scb_s_experiment_setup_table_add_samples_dialog'); + dialog_selector.dialog("open"); + scb.utils.off_on(dialog_selector, 'click', '.scb_f_experiment_setup_dialog_apply', function(e) { + //TODO: form new 'cell_treatment' using dialog box + var experiment_id = $('.scb_s_experiment_setup_table_add_samples_dialog').attr('experiment_id'); + var assignment_id = $('.scb_s_experiment_setup_table_add_samples_dialog').attr('assignment_id'); + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var cell_treatment_list = parsed.experiment.cell_treatment_list; + var template = parsed.assignment.template; + var cell_lines = $('.scb_s_experiment_setup_dialog_cell_lines_select').val(); + var treatments = $('.scb_s_experiment_setup_dialog_treatments_select').val(); + var schedules = $('.scb_s_experiment_setup_dialog_collection_select').val(); + _.each(cell_lines, function(cell_line) { + var cell_line_template = scb.utils.find(template.experiment_setup_actions.cell_lines, cell_line); + _.each(treatments, function(treatment) { + var treatment_template = scb.utils.find(template.experiment_setup_actions.treatment_protocol_list, treatment); + _.each(schedules, function(schedule) { + var collection_template = scb.utils.find(template.experiment_setup_actions.collection_schedule_list, schedule); + var construct = {}; + _.each(cell_line_template, function(v, k) { + if (k != 'id' && k != 'title') { + construct[k] = v; + } + }); + _.each(treatment_template, function(v, k) { + if (k != 'id' && k != 'title') { + construct[k] = v; + } + }); + _.each(collection_template, function(v, k) { + if (k != 'id' && k != 'title') { + construct[k] = v; + } + }); + cell_treatment_list.start(construct); + console.info("NEXT"); }); - console.info("DETACH HERE!") - scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_apply(this); - - }); - scb.utils.off_on(dialog_selector, 'click', '.scb_f_experiment_setup_dialog_cancel', function (e) { - scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_cancel(this); + }); }); + console.info("DETACH HERE!") + scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_apply(this); + + }); + scb.utils.off_on(dialog_selector, 'click', '.scb_f_experiment_setup_dialog_cancel', function(e) { + scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_cancel(this); + }); } -scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_apply = function (param) { - $('.scb_s_experiment_setup_table_add_samples_dialog').dialog("close"); - $('.scb_s_experiment_setup_table_add_samples_dialog').detach(); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_apply = function(param) { + $('.scb_s_experiment_setup_table_add_samples_dialog').dialog("close"); + $('.scb_s_experiment_setup_table_add_samples_dialog').detach(); + scb.ui.static.MainFrame.refresh(); }; -scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_cancel = function (param) { - $('.scb_s_experiment_setup_table_add_samples_dialog').dialog("close").detach(); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_cancel = function(param) { + $('.scb_s_experiment_setup_table_add_samples_dialog').dialog("close").detach(); + scb.ui.static.MainFrame.refresh(); }; -scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_remove_sample = function (param) { - var experiment_id = $(param).attr('experiment_id'); - var assignment_id = $(param).attr('assignment_id'); - var cell_treatment_id = $(param).attr('cell_treatment_id'); +scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_remove_sample = function(param) { + var experiment_id = $(param).attr('experiment_id'); + var assignment_id = $(param).attr('assignment_id'); + var cell_treatment_id = $(param).attr('cell_treatment_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + cell_treatment_id: cell_treatment_id, + view: 'experiment_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var cell_treatment_list = parsed.experiment.cell_treatment_list; + cell_treatment_list.remove(cell_treatment_id); + $('.scb_s_experiment_setup_table_add_samples_dialog').detach(); + scb.ui.static.MainFrame.refresh(); +}; - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - cell_treatment_id: cell_treatment_id, - view: 'experiment_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var cell_treatment_list = parsed.experiment.cell_treatment_list; - cell_treatment_list.remove(cell_treatment_id); - $('.scb_s_experiment_setup_table_add_samples_dialog').detach(); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_duplicate_sample = function(param) { + var experiment_id = $(param).attr('experiment_id'); + var assignment_id = $(param).attr('assignment_id'); + var cell_treatment_id = $(param).attr('cell_treatment_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + cell_treatment_id: cell_treatment_id, + view: 'experiment_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + scb.ui.static.ExperimentSetupView.save_row($(param).parent().parent()); + var cell_treatment_list = parsed.experiment.cell_treatment_list; + cell_treatment_list.duplicate(cell_treatment_id); + $('.scb_s_experiment_setup_table_add_samples_dialog').detach(); + scb.ui.static.MainFrame.refresh(); }; -scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_duplicate_sample = function (param) { - var experiment_id = $(param).attr('experiment_id'); - var assignment_id = $(param).attr('assignment_id'); - var cell_treatment_id = $(param).attr('cell_treatment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - cell_treatment_id: cell_treatment_id, - view: 'experiment_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - scb.ui.static.ExperimentSetupView.save_row($(param).parent().parent()); - var cell_treatment_list = parsed.experiment.cell_treatment_list; - cell_treatment_list.duplicate(cell_treatment_id); - $('.scb_s_experiment_setup_table_add_samples_dialog').detach(); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.ExperimentSetupView.scb_f_open_select_technique = function(param) { + var experiment_id = $(param).attr('experiment_id'); + var assignment_id = $(param).attr('assignment_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.experiment.setup_finished = true; + scb.ui.static.MainFrame.refresh(); }; -scb.ui.static.ExperimentSetupView.scb_f_open_select_technique = function (param) { - var experiment_id = $(param).attr('experiment_id'); - var assignment_id = $(param).attr('assignment_id'); - +scb.ui.static.ExperimentSetupView.register = function(workarea) { + scb.utils.off_on(workarea, 'click', '.scb_f_open_experiment_setup_readonly', function(e) { + scb.ui.static.ExperimentSetupView.scb_f_open_experiment_setup_readonly(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_action_open_add_samples_dialog', function(e) { + $(workarea).prepend(scb_common.contact_overlay()); + scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog(this, workarea); + e.preventDefault(); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_remove_sample', function(e) { + scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_remove_sample(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_duplicate_sample', function(e) { + scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_duplicate_sample(this); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_open_select_technique', function(e) { + if ($('.scb_s_warning_dialog').length > 0) { + $('.scb_s_warning_dialog').remove(); + } + scb.ui.static.ExperimentSetupView.scb_f_open_select_technique(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_experiment_setup_create_new_set_up', function(e) { + var experiment_id = $('.scb_s_experiment_setup_create_new_set_up').attr('experiment_id'); + var assignment_id = $('.scb_s_experiment_setup_create_new_set_up').attr('assignment_id'); var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'experiment_setup', - skip_hash_update: true + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_setup', + skip_hash_update: true }; var parsed = scb.ui.static.MainFrame.validate_state(state); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.experiment.setup_finished = true; + $('.scb_f_experiment_setup_new_set_up').attr('checked', 'checked'); + $('.scb_s_experiment_setup_new_set_up').css('visibility', 'visible'); + parsed.experiment.setup_visible = true; scb.ui.static.MainFrame.refresh(); -}; - - -scb.ui.static.ExperimentSetupView.register = function (workarea) { - scb.utils.off_on(workarea, 'click', '.scb_f_open_experiment_setup_readonly', function (e) { - scb.ui.static.ExperimentSetupView.scb_f_open_experiment_setup_readonly(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_action_open_add_samples_dialog', function (e) { - $(workarea).prepend(scb_common.contact_overlay()); - scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_action_open_add_samples_dialog(this, workarea); - e.preventDefault(); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_remove_sample', function (e) { - scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_remove_sample(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_experiment_setup_duplicate_sample', function (e) { - scb.ui.static.ExperimentSetupView.scb_f_experiment_setup_duplicate_sample(this); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_open_select_technique', function (e) { - if($('.scb_s_warning_dialog').length >0) - $('.scb_s_warning_dialog').remove(); - scb.ui.static.ExperimentSetupView.scb_f_open_select_technique(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_experiment_setup_create_new_set_up', function(e){ - var experiment_id = $('.scb_s_experiment_setup_create_new_set_up').attr('experiment_id'); - var assignment_id = $('.scb_s_experiment_setup_create_new_set_up').attr('assignment_id'); - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'experiment_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - $('.scb_f_experiment_setup_new_set_up').attr('checked', 'checked'); - $('.scb_s_experiment_setup_new_set_up').css('visibility', 'visible'); - parsed.experiment.setup_visible = true; - scb.ui.static.MainFrame.refresh(); - }); - - scb.utils.off_on(workarea, 'click', '.scb_s_experiment_setup_new_row', function (e) { - var mode = $('.scb_s_experiment_setup_details_view', workarea).attr('mode'); - if (mode != 'readonly') { - scb.ui.static.ExperimentSetupView.new_row_edit(this); - var row = scb.ui.static.ExperimentSetupView.save_new_row(this); - var edit_elements = $('.scb_s_experiment_setup_table_row[cell_treatment_id="' + row.id + '"]', workarea)[0]; - scb.ui.static.ExperimentSetupView.row_edit(edit_elements); - } - }); - scb.utils.off_on($(document), 'mouseup', $(document), function (e) { - if (true) { - if (e.target.tagName.toLowerCase() != 'option') { - var container = $(".scb_s_experiment_setup_table_row", $(document)); - - if (container.has(e.target).length === 0) { - $(container).each(function (c) { - var container = $(this); - if (container.attr('data-is_editing') == "true") { - container.removeAttr('data-is_editing'); - console.info("-- click outside -- edit row -- "); - scb.ui.static.ExperimentSetupView.save_row(container); - scb.ui.static.MainFrame.refresh(); - } - }); - } - } - } - if (true) { - if (e.target.tagName.toLowerCase() != 'option') { - var container = $(".scb_s_experiment_setup_new_row", $(document)); - - if (container.has(e.target).length === 0) { - $(container).each(function (c) { - var container = $(this); - if (container.attr('data-is_editing') == "true") { - container.removeAttr('data-is_editing'); - console.info("-- click outside --"); - scb.ui.static.ExperimentSetupView.save_new_row(container); - scb.ui.static.MainFrame.refresh(); - } - }); - } + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_experiment_setup_new_row', function(e) { + var mode = $('.scb_s_experiment_setup_details_view', workarea).attr('mode'); + if (mode != 'readonly') { + scb.ui.static.ExperimentSetupView.new_row_edit(this); + var row = scb.ui.static.ExperimentSetupView.save_new_row(this); + var edit_elements = $('.scb_s_experiment_setup_table_row[cell_treatment_id="' + row.id + '"]', workarea)[0]; + scb.ui.static.ExperimentSetupView.row_edit(edit_elements); + } + }); + scb.utils.off_on($(document), 'mouseup', $(document), function(e) { + if (true) { + if (e.target.tagName.toLowerCase() != 'option') { + var container = $(".scb_s_experiment_setup_table_row", $(document)); + + if (container.has(e.target).length === 0) { + $(container).each(function(c) { + var container = $(this); + if (container.attr('data-is_editing') == "true") { + container.removeAttr('data-is_editing'); + console.info("-- click outside -- edit row -- "); + scb.ui.static.ExperimentSetupView.save_row(container); + scb.ui.static.MainFrame.refresh(); } + }); } - }); - - scb.utils.off_on(workarea, 'click', '.scb_s_experiment_setup_table_row', function (e) { - var mode = $('.scb_s_experiment_setup_details_view', workarea).attr('mode'); - if (mode != 'readonly') { - if (!$(this).data('is_editing')) { - scb.ui.static.ExperimentSetupView.row_edit(this); + } + } + if (true) { + if (e.target.tagName.toLowerCase() != 'option') { + var container = $(".scb_s_experiment_setup_new_row", $(document)); + + if (container.has(e.target).length === 0) { + $(container).each(function(c) { + var container = $(this); + if (container.attr('data-is_editing') == "true") { + container.removeAttr('data-is_editing'); + console.info("-- click outside --"); + scb.ui.static.ExperimentSetupView.save_new_row(container); + scb.ui.static.MainFrame.refresh(); } + }); } - }); - -} + } + } + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_experiment_setup_table_row', function(e) { + var mode = $('.scb_s_experiment_setup_details_view', workarea).attr('mode'); + if (mode != 'readonly') { + if (!$(this).data('is_editing')) { + scb.ui.static.ExperimentSetupView.row_edit(this); + } + } + }); -scb.ui.static.ExperimentSetupView.scb_f_open_experiment_setup_readonly = function (element, event) { - var parsed = scb.ui.static.ExperimentSetupView.parse(element); - if (parsed.experiment) { - $('.jqDialog_header').remove(); - if (parsed.experiment.cell_treatment_list.length == 0) { - $('html').css('overflow', 'hidden'); - - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - - $.jqDialog.alert("Please set up at least one sample.", - function() { $('html').css('overflow', 'visible'); - $('.error_overlay').remove();/* callback function for 'OK' button*/ }); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - event.preventDefault(); - } - else{ - $('body').prepend(scb_experiment_setup.experiment_setup_overlay()); - $(element).attr('href', 'javascript:void(0)'); - $('#jqDialog_box').css('width', '570px'); - $.jqDialog.content(scb_experiment_setup.experiment_setup_dialog({assignment: parsed.assignment, experiment: parsed.experiment})); - $('#jqDialog_box').attr('role', 'alertdialog'); - //$('#jqDialog_box').prepend(scb_experiment_setup.experiment_confirm()); - $('.scb_f_open_experiment_setup').click( function () { - if($('.scb_s_warning_dialog').length >0){ - $('.scb_s_warning_dialog').remove(); - $('.overlay').remove(); - $('#jqDialog_box').hide(); - } - }); - $('.scb_f_open_select_technique').click(function(){ - if($('.scb_s_warning_dialog').length >0){ - $('.scb_s_warning_dialog').remove(); - $('.overlay').remove(); - $('#jqDialog_box').hide(); - } - scb.ui.static.ExperimentSetupView.scb_f_open_select_technique(this); - }); - - } - - } } -scb.ui.static.ExperimentSetupView.headings = function (table_map) { - var headings = []; - _.each(table_map, function (part) { - if (part.kind == 'cell_plate') { - headings.push(part); - } - if (part.kind == 'cell_line') { - headings.push(part); - } - if (part.kind == 'treatments') { - for (var subpart_index in part.children) { - var subpart = part.children[subpart_index]; - headings.push(subpart); - } - } - if (part.kind == 'temperature') { - headings.push(part); - } - if (part.kind == 'custom') { - headings.push(part); +scb.ui.static.ExperimentSetupView.scb_f_open_experiment_setup_readonly = function(element, event) { + var parsed = scb.ui.static.ExperimentSetupView.parse(element); + if (parsed.experiment) { + $('.jqDialog_header').remove(); + if (parsed.experiment.cell_treatment_list.length == 0) { + $('html').css('overflow', 'hidden'); + + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + + $.jqDialog.alert("Please set up at least one sample.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); /* callback function for 'OK' button*/ + }); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + event.preventDefault(); + } else { + $('body').prepend(scb_experiment_setup.experiment_setup_overlay()); + $(element).attr('href', 'javascript:void(0)'); + $('#jqDialog_box').css('width', '570px'); + $.jqDialog.content(scb_experiment_setup.experiment_setup_dialog({ + assignment: parsed.assignment, + experiment: parsed.experiment + })); + $('#jqDialog_box').attr('role', 'alertdialog'); + //$('#jqDialog_box').prepend(scb_experiment_setup.experiment_confirm()); + $('.scb_f_open_experiment_setup').click(function() { + if ($('.scb_s_warning_dialog').length > 0) { + $('.scb_s_warning_dialog').remove(); + $('.overlay').remove(); + $('#jqDialog_box').hide(); } - if (part.kind == 'actions') { - headings.push(part); + }); + $('.scb_f_open_select_technique').click(function() { + if ($('.scb_s_warning_dialog').length > 0) { + $('.scb_s_warning_dialog').remove(); + $('.overlay').remove(); + $('#jqDialog_box').hide(); } + scb.ui.static.ExperimentSetupView.scb_f_open_select_technique(this); + }); + } - }); - return headings; + } } -scb.ui.static.ExperimentSetupView.row = function (sample, headings, template, rows) { +scb.ui.static.ExperimentSetupView.headings = function(table_map) { + var headings = []; + _.each(table_map, function(part) { + if (part.kind == 'cell_plate') { + headings.push(part); + } + if (part.kind == 'cell_line') { + headings.push(part); + } + if (part.kind == 'treatments') { + for (var subpart_index in part.children) { + var subpart = part.children[subpart_index]; + headings.push(subpart); + } + } + if (part.kind == 'temperature') { + headings.push(part); + } + if (part.kind == 'custom') { + headings.push(part); + } + if (part.kind == 'actions') { + headings.push(part); + } + - var treatment_list = sample.treatment_list.list; - var size = treatment_list.length; - var total_height = 0; - _.each(treatment_list, function (treatment) { - total_height += treatment.drug_list.length; - }); - _.each(treatment_list, function (treatment, treatment_index) { - var drug_list = treatment.drug_list.list; - _.each(drug_list, function (drug, drug_index) { - var row = []; - _.each(headings, function (part) { - if (drug_index == 0 && treatment_index == 0 && part.kind == 'cell_line') { - console.log(sample.cell_line); - console.log(template.cell_lines); - console.log(template.cell_lines[sample.cell_line]); - - row.push({ - kind: 'cell_line', - title: template.cell_lines[sample.cell_line].name, - rows: total_height, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }); - } - else if (part.kind == 'drug') { - row.push({ - kind: 'drug', - title: drug.drug_name, - rows: 1, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }); - } - else if (part.kind == 'concentration') { - row.push({ - kind: 'concentration', - title: drug.drug_concentration, - rows: 1, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }); - } - else if (drug_index == 0 && part.kind == 'start') { - row.push({ - kind: 'start', - title: treatment.start_time, - rows: drug_list.length, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }); - } - else if (drug_index == 0 && part.kind == 'duration') { - row.push({ - kind: 'duration', - title: treatment.duration, - rows: drug_list.length, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }) - } - else if (drug_index == 0 && part.kind == 'collection') { - row.push({ - kind: 'collection', - title: treatment.collection_time, - rows: drug_list.length, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }) - } - else if (drug_index == 0 && part.kind == 'temperature') { - row.push({ - kind: 'temperature', - title: template.experiment_temperatures[treatment.temperature].name, - rows: drug_list.length, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }) - } - else if (drug_index == 0 && treatment_index == 0 && part.kind == 'custom') { - row.push({ - kind: part.kind, - title: sample[part.key], - rows: total_height, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }) - } - else if (drug_index == 0 && treatment_index == 0 && part.kind == 'cell_plate') { - row.push({ - kind: part.kind, - title: '', - rows: total_height, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }) - } - else if (drug_index == 0 && treatment_index == 0 && part.kind == 'actions') { - row.push({ - kind: part.kind, - rows: total_height, - first_row: drug_index == 0 && treatment_index == 0, - treatment: treatment.id - }); - } - }); - rows.push({ - id: sample.id, - columns: row, - treatment: treatment - }); - }); - }); + }); + return headings; } -scb.ui.static.ExperimentSetupView.rows = function (cell_treatment_list, headings, template) { - var rows = []; - _.each(cell_treatment_list, function (sample) { - scb.ui.static.ExperimentSetupView.row(sample, headings, template, rows); +scb.ui.static.ExperimentSetupView.row = function(sample, headings, template, rows) { + + var treatment_list = sample.treatment_list.list; + var size = treatment_list.length; + var total_height = 0; + _.each(treatment_list, function(treatment) { + total_height += treatment.drug_list.length; + }); + _.each(treatment_list, function(treatment, treatment_index) { + var drug_list = treatment.drug_list.list; + _.each(drug_list, function(drug, drug_index) { + var row = []; + _.each(headings, function(part) { + if (drug_index == 0 && treatment_index == 0 && part.kind == 'cell_line') { + console.log(sample.cell_line); + console.log(template.cell_lines); + console.log(template.cell_lines[sample.cell_line]); + + row.push({ + kind: 'cell_line', + title: template.cell_lines[sample.cell_line].name, + rows: total_height, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }); + } else if (part.kind == 'drug') { + row.push({ + kind: 'drug', + title: drug.drug_name, + rows: 1, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }); + } else if (part.kind == 'concentration') { + row.push({ + kind: 'concentration', + title: drug.drug_concentration, + rows: 1, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }); + } else if (drug_index == 0 && part.kind == 'start') { + row.push({ + kind: 'start', + title: treatment.start_time, + rows: drug_list.length, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }); + } else if (drug_index == 0 && part.kind == 'duration') { + row.push({ + kind: 'duration', + title: treatment.duration, + rows: drug_list.length, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }) + } else if (drug_index == 0 && part.kind == 'collection') { + row.push({ + kind: 'collection', + title: treatment.collection_time, + rows: drug_list.length, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }) + } else if (drug_index == 0 && part.kind == 'temperature') { + row.push({ + kind: 'temperature', + title: template.experiment_temperatures[treatment.temperature].name, + rows: drug_list.length, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }) + } else if (drug_index == 0 && treatment_index == 0 && part.kind == 'custom') { + row.push({ + kind: part.kind, + title: sample[part.key], + rows: total_height, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }) + } else if (drug_index == 0 && treatment_index == 0 && part.kind == 'cell_plate') { + row.push({ + kind: part.kind, + title: '', + rows: total_height, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }) + } else if (drug_index == 0 && treatment_index == 0 && part.kind == 'actions') { + row.push({ + kind: part.kind, + rows: total_height, + first_row: drug_index == 0 && treatment_index == 0, + treatment: treatment.id + }); + } + }); + rows.push({ + id: sample.id, + columns: row, + treatment: treatment + }); }); - return rows; + }); } -scb.ui.static.ExperimentSetupView.new_rows = function (new_row, context, headings, template) { - var rows = []; - if (scb.utils.isDefined(new_row)) { - var ct = new scb.CellTreatment(new_row, context); - scb.ui.static.ExperimentSetupView.row(ct, headings, template, rows); - } - return rows; +scb.ui.static.ExperimentSetupView.rows = function(cell_treatment_list, headings, template) { + var rows = []; + _.each(cell_treatment_list, function(sample) { + scb.ui.static.ExperimentSetupView.row(sample, headings, template, rows); + }); + return rows; } - -scb.ui.static.ExperimentSetupView.ensure_save = function () { - var container = $(".scb_s_experiment_setup_table_row", $(document)); - $(container).each( - function (e) { - if ($(this).attr('data-is_editing') == 'true') { - scb.ui.static.ExperimentSetupView.save_row(this); - } - } - ) - container = $(".scb_s_experiment_setup_new_row", $(document)); - $(container).each( - function (e) { - if ($(this).attr('data-is_editing') == 'true') { - scb.ui.static.ExperimentSetupView.save_new_row(this); - } - } - ) - +scb.ui.static.ExperimentSetupView.new_rows = function(new_row, context, headings, template) { + var rows = []; + if (scb.utils.isDefined(new_row)) { + var ct = new scb.CellTreatment(new_row, context); + scb.ui.static.ExperimentSetupView.row(ct, headings, template, rows); + } + return rows; } -scb.ui.static.ExperimentSetupView.save_row = function (element) { - var parsed = scb.ui.static.ExperimentSetupView.parse(element); - $(element).attr('data-is_editing', true); - var template = parsed.context.template; - var cell_line_id = parsed.experiment.new_row.cell_line; - var drug_id = parsed.experiment.new_row.drug_id; - var concentration_id = parsed.experiment.new_row.concentration_id; - var collection_id = parsed.experiment.new_row.collection_id; - var treatment_line = parsed.treatment.drug_list.list[0]; - var temperature = parsed.experiment.new_row.temperature; - var refresh = false; - if (drug_id && concentration_id) { - var valid = _.find(template.drugs[drug_id].concentrations, function (a) { - return a == concentration_id - }); - if (!_.isUndefined(valid)) { - treatment_line.drug_id = drug_id; - treatment_line.concentration_id = concentration_id; - refresh = true; - } else { - refresh = true; - } - } - if (cell_line_id) { - parsed.cell_treatment.cell_line_id = cell_line_id; - parsed.cell_treatment.cell_line = cell_line_id; - refresh = true; +scb.ui.static.ExperimentSetupView.ensure_save = function() { + var container = $(".scb_s_experiment_setup_table_row", $(document)); + $(container).each(function(e) { + if ($(this).attr('data-is_editing') == 'true') { + scb.ui.static.ExperimentSetupView.save_row(this); } - if (collection_id) { - parsed.treatment.collection_id = collection_id; - refresh = true; + } + ) + container = $(".scb_s_experiment_setup_new_row", $(document)); + $(container).each(function(e) { + if ($(this).attr('data-is_editing') == 'true') { + scb.ui.static.ExperimentSetupView.save_new_row(this); } - if (temperature) { - parsed.treatment.temperature = temperature; - refresh = true; - } - if (refresh) { - parsed.experiment.new_row = {}; - scb.ui.static.MainFrame.refresh(); - } -} - -scb.ui.static.ExperimentSetupView.save_new_row = function (element) { - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'experiment_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); + } + ) - $(element).attr('data-is_editing', false); - $(element).addClass('scb_s_experiment_setup_new_row_gray'); - - var template = parsed.context.template; - var cell_line_id = parsed.experiment.new_row.cell_line; - var drug_id = parsed.experiment.new_row.drug_id; - var concentration_id = parsed.experiment.new_row.concentration_id; - var schedule_value = parsed.experiment.new_row.schedule_value; - var duration_value = parsed.experiment.new_row.duration_value; - var temperature = parsed.experiment.new_row.temperature; - if (parsed.experiment.new_row.collection_id) - var collection_id = parsed.experiment.new_row.collection_id; - if (drug_id && concentration_id) { - var valid = _.find(template.drugs[drug_id].concentrations, function (a) { - return a == concentration_id - }); - if (!_.isUndefined(valid)) { - var cell_treatment_list = parsed.experiment.cell_treatment_list; - var ret = cell_treatment_list.start({ - title: 'New row', - cell_line: cell_line_id, - treatment_list: {list: [ - {collection_id: collection_id || 0, schedule_value: schedule_value, duration_value: duration_value, drug_list: {list: [ - {drug_id: drug_id, concentration_id: concentration_id} - ]}, temperature: temperature - } - ]}, - collection_schedule_list: {list: [ - {schedule: "18h", schedule_value: 18 * 3600, id: '3'} - ]} - }); - parsed.experiment.new_row = {}; - scb.ui.static.MainFrame.refresh(); - return ret; - } - else { - parsed.experiment.new_row = {}; - scb.ui.static.MainFrame.refresh(); - return null; - } - } } - -scb.ui.static.ExperimentSetupView.row_edit_is_editable = function (element, template) { - var kind = $(element).attr('kind'); - var cell = _.find(template.ui.experiment_setup.table, function (e) { - return e.kind == kind +scb.ui.static.ExperimentSetupView.save_row = function(element) { + var parsed = scb.ui.static.ExperimentSetupView.parse(element); + + $(element).attr('data-is_editing', true); + + var template = parsed.context.template; + var cell_line_id = parsed.experiment.new_row.cell_line; + var drug_id = parsed.experiment.new_row.drug_id; + var concentration_id = parsed.experiment.new_row.concentration_id; + var collection_id = parsed.experiment.new_row.collection_id; + var treatment_line = parsed.treatment.drug_list.list[0]; + var temperature = parsed.experiment.new_row.temperature; + var refresh = false; + if (drug_id && concentration_id) { + var valid = _.find(template.drugs[drug_id].concentrations, function(a) { + return a == concentration_id }); - if (!scb.utils.isDefined(cell)) { - var treatments = _.find(template.ui.experiment_setup.table, function (e) { - return e.kind == 'treatments' - }); - cell = _.find(treatments.children, function (e) { - return e.kind == kind - }); + if (!_.isUndefined(valid)) { + treatment_line.drug_id = drug_id; + treatment_line.concentration_id = concentration_id; + refresh = true; + } else { + refresh = true; } - console.info("editable " + kind + " " + cell + " " + (cell && cell.editable)); - return (cell && cell.editable) || false; + } + if (cell_line_id) { + parsed.cell_treatment.cell_line_id = cell_line_id; + parsed.cell_treatment.cell_line = cell_line_id; + refresh = true; + } + if (collection_id) { + parsed.treatment.collection_id = collection_id; + refresh = true; + } + if (temperature) { + parsed.treatment.temperature = temperature; + refresh = true; + } + if (refresh) { + parsed.experiment.new_row = {}; + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.ExperimentSetupView.row_edit = function (element) { - if ($(element).attr('data-is_editing') != 'true') { - scb.ui.static.ExperimentSetupView.ensure_save(); - } - var row_element = element; - - var parsed = scb.ui.static.ExperimentSetupView.parse(element); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - - var template = parsed.context.template; - var cell_line = parsed.cell_treatment.cell_line; - var treatment_line = parsed.treatment.drug_list.list[0]; - var drug_id = treatment_line.drug_id; - var concentration_id = treatment_line.concentration_id; - //var collection_id = parsed.cell_treatment.collection_id; - var collection_id = parsed.cell_treatment.treatment_list.list[0].collection_id; - var temperature = parsed.treatment.temperature; - - - if ($(element).attr('data-is_editing') != 'true') { - parsed.experiment.new_row.cell_line = cell_line; - parsed.experiment.new_row.drug_id = drug_id; - parsed.experiment.new_row.concentration_id = concentration_id; - parsed.experiment.new_row.collection_id = collection_id; - parsed.experiment.new_row.temperature = temperature; - $(element).attr('data-is_editing', true); - } - - //TODO: RETHINK THIS - IT NEEDS TO GO TO TEMPORARY STATE AND ONLY CHANGE IFF STATE IS VALID - $('.scb_s_experiment_setup_table_element', element).each(function (index) { - var element = this; - var kind = $(element).attr('kind'); - if (kind == 'cell_line' && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { - if (_.keys(template.cell_lines).length > 1) { - $(element).html(scb_experiment_setup.cell_lines_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - cell_line_id: parsed.experiment.new_row.cell_line - })); - scb.utils.off_on(element, "change", "select", function (e) { - console.info($(this).val()); - parsed.experiment.new_row.cell_line = $(this).val(); - scb.ui.static.ExperimentSetupView.row_edit(row_element); - }); - } - } - if (kind == 'drug') { - if (_.keys(template.drugs).length > 1 && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { - $(element).html(scb_experiment_setup.drug_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - drug_id: parsed.experiment.new_row.drug_id - })); - scb.utils.off_on(element, "change", "select", function (e) { - console.info($(this).val()); - parsed.experiment.new_row.drug_id = $(this).val(); - scb.ui.static.ExperimentSetupView.row_edit(row_element); - }); - } - else { - delete parsed.experiment.new_row.drug_id; - } - } - if (kind == 'collection') { - if (_.keys(template.collections).length > 1 && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { - $(element).html(scb_experiment_setup.collection_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - collection_id: parsed.experiment.new_row.collection_id - })); - scb.utils.off_on(element, "change", "select", function (e) { - console.info($(this).val()); - parsed.experiment.new_row.collection_id = $(this).val(); - scb.ui.static.ExperimentSetupView.row_edit(row_element); - }); - } - else { - delete parsed.experiment.new_row.collection_id; - } - } - if (kind == 'concentration') { - if (_.keys(template.concentrations).length > 1 && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { - var drug_id = parsed.experiment.new_row.drug_id; - if (drug_id && template.drugs[drug_id].concentrations) { - $(element).html(scb_experiment_setup.concentration_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - drug_id: parsed.experiment.new_row.drug_id, - concentrations: template.drugs[drug_id].concentrations, - concentration_id: parsed.experiment.new_row.concentration_id - })); - scb.utils.off_on(element, "change", "select", function (e) { - console.info($(this).val()); - parsed.experiment.new_row.concentration_id = $(this).val(); - scb.ui.static.ExperimentSetupView.row_edit(row_element); - }); - } - else { - $(element).html("Select drug first"); - } - } else if (_.keys(template.concentrations).length == 1 && !scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) +scb.ui.static.ExperimentSetupView.save_new_row = function(element) { + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + + $(element).attr('data-is_editing', false); + $(element).addClass('scb_s_experiment_setup_new_row_gray'); + + var template = parsed.context.template; + var cell_line_id = parsed.experiment.new_row.cell_line; + var drug_id = parsed.experiment.new_row.drug_id; + var concentration_id = parsed.experiment.new_row.concentration_id; + var schedule_value = parsed.experiment.new_row.schedule_value; + var duration_value = parsed.experiment.new_row.duration_value; + var temperature = parsed.experiment.new_row.temperature; + if (parsed.experiment.new_row.collection_id) { + var collection_id = parsed.experiment.new_row.collection_id; + } + if (drug_id && concentration_id) { + var valid = _.find(template.drugs[drug_id].concentrations, function(a) { + return a == concentration_id + }); + if (!_.isUndefined(valid)) { + var cell_treatment_list = parsed.experiment.cell_treatment_list; + var ret = cell_treatment_list.start({ + title: 'New row', + cell_line: cell_line_id, + treatment_list: { + list: [ { - - } - else { - delete parsed.experiment.new_row.concentration_id; + collection_id: collection_id || 0, + schedule_value: schedule_value, + duration_value: duration_value, + drug_list: { + list: [ + { + drug_id: drug_id, + concentration_id: concentration_id + } + ] + }, + temperature: temperature } - } - if (kind == 'temperature') { - if (_.keys(template.experiment_temperatures).length > 1 && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { - var temperature = parsed.experiment.new_row.temperature; - $(element).html(scb_experiment_setup.temperature_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - temperature: temperature - })); - scb.utils.off_on(element, "change", "select", function (e) { - parsed.experiment.new_row.temperature = $(this).val(); - scb.ui.static.ExperimentSetupView.row_edit(row_element); - }); - + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h", + schedule_value: 18 * 3600, + id: '3' } + ] } + }); + parsed.experiment.new_row = {}; + scb.ui.static.MainFrame.refresh(); + return ret; + } else { + parsed.experiment.new_row = {}; + scb.ui.static.MainFrame.refresh(); + return null; + } + } +} +scb.ui.static.ExperimentSetupView.row_edit_is_editable = function(element, template) { + var kind = $(element).attr('kind'); + var cell = _.find(template.ui.experiment_setup.table, function(e) { + return e.kind == kind + }); + if (!scb.utils.isDefined(cell)) { + var treatments = _.find(template.ui.experiment_setup.table, function(e) { + return e.kind == 'treatments' + }); + cell = _.find(treatments.children, function(e) { + return e.kind == kind }); + } + console.info("editable " + kind + " " + cell + " " + (cell && cell.editable)); + return (cell && cell.editable) || false; +} +scb.ui.static.ExperimentSetupView.row_edit = function(element) { + if ($(element).attr('data-is_editing') != 'true') { + scb.ui.static.ExperimentSetupView.ensure_save(); + } + var row_element = element; + + var parsed = scb.ui.static.ExperimentSetupView.parse(element); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + + var template = parsed.context.template; + var cell_line = parsed.cell_treatment.cell_line; + var treatment_line = parsed.treatment.drug_list.list[0]; + var drug_id = treatment_line.drug_id; + var concentration_id = treatment_line.concentration_id; + //var collection_id = parsed.cell_treatment.collection_id; + var collection_id = parsed.cell_treatment.treatment_list.list[0].collection_id; + var temperature = parsed.treatment.temperature; + + + if ($(element).attr('data-is_editing') != 'true') { + parsed.experiment.new_row.cell_line = cell_line; + parsed.experiment.new_row.drug_id = drug_id; + parsed.experiment.new_row.concentration_id = concentration_id; + parsed.experiment.new_row.collection_id = collection_id; + parsed.experiment.new_row.temperature = temperature; + $(element).attr('data-is_editing', true); + } -}; + //TODO: RETHINK THIS - IT NEEDS TO GO TO TEMPORARY STATE AND ONLY CHANGE IFF STATE IS VALID + $('.scb_s_experiment_setup_table_element', element).each(function(index) { + var element = this; + var kind = $(element).attr('kind'); + if (kind == 'cell_line' && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { + if (_.keys(template.cell_lines).length > 1) { + $(element).html(scb_experiment_setup.cell_lines_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + cell_line_id: parsed.experiment.new_row.cell_line + })); + scb.utils.off_on(element, "change", "select", function(e) { + console.info($(this).val()); + parsed.experiment.new_row.cell_line = $(this).val(); + scb.ui.static.ExperimentSetupView.row_edit(row_element); + }); + } + } + if (kind == 'drug') { + if (_.keys(template.drugs).length > 1 && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { + $(element).html(scb_experiment_setup.drug_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + drug_id: parsed.experiment.new_row.drug_id + })); + scb.utils.off_on(element, "change", "select", function(e) { + console.info($(this).val()); + parsed.experiment.new_row.drug_id = $(this).val(); + scb.ui.static.ExperimentSetupView.row_edit(row_element); + }); + } else { + delete parsed.experiment.new_row.drug_id; + } + } + if (kind == 'collection') { + if (_.keys(template.collections).length > 1 && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { + $(element).html(scb_experiment_setup.collection_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + collection_id: parsed.experiment.new_row.collection_id + })); + scb.utils.off_on(element, "change", "select", function(e) { + console.info($(this).val()); + parsed.experiment.new_row.collection_id = $(this).val(); + scb.ui.static.ExperimentSetupView.row_edit(row_element); + }); + } else { + delete parsed.experiment.new_row.collection_id; + } + } + if (kind == 'concentration') { + if (_.keys(template.concentrations).length > 1 && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { + var drug_id = parsed.experiment.new_row.drug_id; + if (drug_id && template.drugs[drug_id].concentrations) { + $(element).html(scb_experiment_setup.concentration_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + drug_id: parsed.experiment.new_row.drug_id, + concentrations: template.drugs[drug_id].concentrations, + concentration_id: parsed.experiment.new_row.concentration_id + })); + scb.utils.off_on(element, "change", "select", function(e) { + console.info($(this).val()); + parsed.experiment.new_row.concentration_id = $(this).val(); + scb.ui.static.ExperimentSetupView.row_edit(row_element); + }); + } else { + $(element).html("Select drug first"); + } + } else if (_.keys(template.concentrations).length == 1 && !scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { -scb.ui.static.ExperimentSetupView.new_row_edit = function (element) { - if ($(element).attr('data-is_editing') != 'true') { - scb.ui.static.ExperimentSetupView.ensure_save(); + } else { + delete parsed.experiment.new_row.concentration_id; + } } - var row_element = element; + if (kind == 'temperature') { + if (_.keys(template.experiment_temperatures).length > 1 && scb.ui.static.ExperimentSetupView.row_edit_is_editable(element, template)) { + var temperature = parsed.experiment.new_row.temperature; + $(element).html(scb_experiment_setup.temperature_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + temperature: temperature + })); + scb.utils.off_on(element, "change", "select", function(e) { + parsed.experiment.new_row.temperature = $(this).val(); + scb.ui.static.ExperimentSetupView.row_edit(row_element); + }); - var experiment_id = $(element).attr('experiment_id'); - var assignment_id = $(element).attr('assignment_id'); + } + } - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - view: 'experiment_setup', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); + }); - $(element).attr('data-is_editing', true); - $(element).removeClass('scb_s_experiment_setup_new_row_gray'); - var template = parsed.context.template; +}; - if (_.keys(parsed.experiment.new_row).length == 0) { +scb.ui.static.ExperimentSetupView.new_row_edit = function(element) { + if ($(element).attr('data-is_editing') != 'true') { + scb.ui.static.ExperimentSetupView.ensure_save(); + } + var row_element = element; + + var experiment_id = $(element).attr('experiment_id'); + var assignment_id = $(element).attr('assignment_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + view: 'experiment_setup', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + + $(element).attr('data-is_editing', true); + $(element).removeClass('scb_s_experiment_setup_new_row_gray'); + + var template = parsed.context.template; + + if (_.keys(parsed.experiment.new_row).length == 0) { + parsed.experiment.new_row.cell_line = template.ui.experiment_setup.new_row.cell_line || _.keys(template.cell_lines)[0]; + parsed.experiment.new_row.drug_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].drug_id || _.keys(template.drugs)[0]; + parsed.experiment.new_row.concentration_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].concentration_id || _.keys(template.concentrations)[0]; + parsed.experiment.new_row.schedule_value = template.ui.experiment_setup.new_row.treatment_list.list[0].schedule_value || 0; + parsed.experiment.new_row.collection_id = template.ui.experiment_setup.new_row.treatment_list.list[0].collection_id || 0; + parsed.experiment.new_row.duration_value = template.ui.experiment_setup.new_row.treatment_list.list[0].duration_value || 0; + parsed.experiment.new_row.temperature = template.ui.experiment_setup.new_row.treatment_list.list[0].temperature || 0; + + } + $('.scb_s_experiment_setup_td', element).each(function(index) { + var element = this; + var kind = $(element).attr('kind'); + if (kind == 'cell_line') { + if (_.keys(template.cell_lines).length > 1) { + // this is editable + $(element).html(scb_experiment_setup.cell_lines_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + cell_line_id: parsed.experiment.new_row.cell_line + })); + } else { parsed.experiment.new_row.cell_line = template.ui.experiment_setup.new_row.cell_line || _.keys(template.cell_lines)[0]; + $(element).html(template.cell_lines[parsed.experiment.new_row.cell_line].name); + } + } + if (kind == 'drug') { + if (_.keys(template.drugs).length > 1) { + $(element).html(scb_experiment_setup.drug_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + drug_id: parsed.experiment.new_row.drug_id + })); + scb.utils.off_on(element, "change", "select", function(e) { + console.info($(this).val()); + parsed.experiment.new_row.drug_id = $(this).val(); + scb.ui.static.ExperimentSetupView.new_row_edit(row_element); + }); + } else { parsed.experiment.new_row.drug_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].drug_id || _.keys(template.drugs)[0]; - parsed.experiment.new_row.concentration_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].concentration_id || _.keys(template.concentrations)[0]; - parsed.experiment.new_row.schedule_value = template.ui.experiment_setup.new_row.treatment_list.list[0].schedule_value || 0; - parsed.experiment.new_row.collection_id = template.ui.experiment_setup.new_row.treatment_list.list[0].collection_id || 0; - parsed.experiment.new_row.duration_value = template.ui.experiment_setup.new_row.treatment_list.list[0].duration_value || 0; - parsed.experiment.new_row.temperature = template.ui.experiment_setup.new_row.treatment_list.list[0].temperature || 0; - - } - $('.scb_s_experiment_setup_td', element).each(function (index) { - var element = this; - var kind = $(element).attr('kind'); - if (kind == 'cell_line') { - if (_.keys(template.cell_lines).length > 1) { - // this is editable - $(element).html(scb_experiment_setup.cell_lines_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - cell_line_id: parsed.experiment.new_row.cell_line - })); - } - else { - parsed.experiment.new_row.cell_line = template.ui.experiment_setup.new_row.cell_line || _.keys(template.cell_lines)[0]; - $(element).html(template.cell_lines[parsed.experiment.new_row.cell_line].name); - } - } - if (kind == 'drug') { - if (_.keys(template.drugs).length > 1) { - $(element).html(scb_experiment_setup.drug_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - drug_id: parsed.experiment.new_row.drug_id - })); - scb.utils.off_on(element, "change", "select", function (e) { - console.info($(this).val()); - parsed.experiment.new_row.drug_id = $(this).val(); - scb.ui.static.ExperimentSetupView.new_row_edit(row_element); - }); - } - else { - parsed.experiment.new_row.drug_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].drug_id || _.keys(template.drugs)[0]; - } - } - if (kind == 'collection') { - if (_.keys(template.collections).length > 1) { - $(element).html(scb_experiment_setup.collection_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - collection_id: parsed.experiment.new_row.collection_id - })); - scb.utils.off_on(element, "change", "select", function (e) { - console.info($(this).val()); - parsed.experiment.new_row.collection_id = $(this).val(); - scb.ui.static.ExperimentSetupView.new_row_edit(row_element); - }); - } - else { - parsed.experiment.new_row.collection_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].collection_id || _.keys(template.collections)[0]; - } - } - if (kind == 'concentration') { - if (_.keys(template.concentrations).length > 1) { - var drug_id = parsed.experiment.new_row.drug_id; - if (drug_id && template.drugs[drug_id].concentrations) { - $(element).html(scb_experiment_setup.concentration_edit({ - global_template: parsed.context.master_model, - template: template, - assignment: parsed.assignment, - experiment: parsed.experiment, - drug_id: parsed.experiment.new_row.drug_id, - concentrations: template.drugs[drug_id].concentrations, - concentration_id: parsed.experiment.new_row.concentration_id - })); - scb.utils.off_on(element, "change", "select", function (e) { - console.info($(this).val()); - parsed.experiment.new_row.concentration_id = $(this).val(); - scb.ui.static.ExperimentSetupView.new_row_edit(row_element); - }); - } - else { - $(element).html("Select drug first"); - } - } else { - parsed.experiment.new_row.concentration_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].concentration_id || _.keys(template.concentrations)[0]; - } + } + } + if (kind == 'collection') { + if (_.keys(template.collections).length > 1) { + $(element).html(scb_experiment_setup.collection_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + collection_id: parsed.experiment.new_row.collection_id + })); + scb.utils.off_on(element, "change", "select", function(e) { + console.info($(this).val()); + parsed.experiment.new_row.collection_id = $(this).val(); + scb.ui.static.ExperimentSetupView.new_row_edit(row_element); + }); + } else { + parsed.experiment.new_row.collection_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].collection_id || _.keys(template.collections)[0]; + } + } + if (kind == 'concentration') { + if (_.keys(template.concentrations).length > 1) { + var drug_id = parsed.experiment.new_row.drug_id; + if (drug_id && template.drugs[drug_id].concentrations) { + $(element).html(scb_experiment_setup.concentration_edit({ + global_template: parsed.context.master_model, + template: template, + assignment: parsed.assignment, + experiment: parsed.experiment, + drug_id: parsed.experiment.new_row.drug_id, + concentrations: template.drugs[drug_id].concentrations, + concentration_id: parsed.experiment.new_row.concentration_id + })); + scb.utils.off_on(element, "change", "select", function(e) { + console.info($(this).val()); + parsed.experiment.new_row.concentration_id = $(this).val(); + scb.ui.static.ExperimentSetupView.new_row_edit(row_element); + }); + } else { + $(element).html("Select drug first"); } - if (kind == 'actions') { - var cell_line_id = parsed.experiment.new_row.cell_line; - var drug_id = parsed.experiment.new_row.drug_id; - if (parsed.experiment.new_row.collection_id) - var collection_id = parsed.experiment.new_row.collection_id; - var concentration_id = parsed.experiment.new_row.concentration_id; - if (drug_id && concentration_id) { - var valid = _.find(template.drugs[drug_id].concentrations, function (a) { - return a == concentration_id - }); - if (!_.isUndefined(valid)) { - $('button', element).removeAttr('disabled'); - $('button', element).click(function () { - var cell_treatment_list = parsed.experiment.cell_treatment_list; - cell_treatment_list.start({ - title: 'New row', - cell_line: cell_line_id, - treatment_list: {list: [ - { collection_id: collection_id || 0,schedule_value: 0, duration_value: 0, drug_list: {list: [ - {drug_id: drug_id, concentration_id: concentration_id} - ]} - } - ]}, - collection_schedule_list: {list: [ - {schedule: "18h", schedule_value: 18 * 3600, id: '3'} - ]} - }); - scb.ui.static.MainFrame.refresh(); - }); - } - } + } else { + parsed.experiment.new_row.concentration_id = template.ui.experiment_setup.new_row.treatment_list.list[0].drug_list.list[0].concentration_id || _.keys(template.concentrations)[0]; + } + } + if (kind == 'actions') { + var cell_line_id = parsed.experiment.new_row.cell_line; + var drug_id = parsed.experiment.new_row.drug_id; + if (parsed.experiment.new_row.collection_id) { + var collection_id = parsed.experiment.new_row.collection_id; + } + var concentration_id = parsed.experiment.new_row.concentration_id; + if (drug_id && concentration_id) { + var valid = _.find(template.drugs[drug_id].concentrations, function(a) { + return a == concentration_id + }); + if (!_.isUndefined(valid)) { + $('button', element).removeAttr('disabled'); + $('button', element).click(function() { + var cell_treatment_list = parsed.experiment.cell_treatment_list; + cell_treatment_list.start({ + title: 'New row', + cell_line: cell_line_id, + treatment_list: { + list: [ + { + collection_id: collection_id || 0, + schedule_value: 0, + duration_value: 0, + drug_list: { + list: [ + { + drug_id: drug_id, + concentration_id: concentration_id + } + ] + } + } + ] + }, + collection_schedule_list: { + list: [ + { + schedule: "18h", + schedule_value: 18 * 3600, + id: '3' + } + ] + } + }); + scb.ui.static.MainFrame.refresh(); + }); } + } + } - }); + }); }; scb.ui.ExperimentSetupView = function scb_ui_ExperimentSetupView(gstate) { - var self = this; - self.show = function (state) { - var workarea = state.workarea; - var experiment = state.experiment; - var template = state.assignment.template; - var headings = scb.ui.static.ExperimentSetupView.headings(template.ui.experiment_setup.table); - var rows = scb.ui.static.ExperimentSetupView.rows(experiment.cell_treatment_list.list, headings, template); - var new_rows = scb.ui.static.ExperimentSetupView.new_rows(template.ui.experiment_setup.new_row, gstate.context, headings, template); - if (experiment.setup_finished) { - state.mode = 'readonly'; - state.last_view = 'experiment_run'; - } - $('.scb_s_experiment_setup_table_add_samples_dialog').detach(); - workarea.html(scb_experiment_setup.main({ - global_template: gstate.context.master_model, - t: template, - context: gstate.context, - assignment: state.assignment, - experiment: state.experiment, - headings: headings, - rows: rows, - prev_step: state.experiment.prev_step, - last_step: state.experiment.last_step, - new_rows: new_rows, - kind: state.mode - })); - state.experiment.prev_step=2; - if(state.last_view == 'experiment_run'){ - $('.scb_s_experiment_setup_instructions').hide(); - } - if(state.experiment.last_step < scb.ui.static.ExperimentSetupView.TOTAL_STEPS ) - state.experiment.last_step = 4; - if (rows.length > 0 || state.experiment.setup_visible){ - $('.scb_s_experiment_setup_new_set_up').css('visibility', 'visible'); - $('.scb_f_experiment_setup_new_set_up').prop('checked','checked'); - } - state.experiment.last_view = state.last_view; + var self = this; + self.show = function(state) { + var workarea = state.workarea; + var experiment = state.experiment; + var template = state.assignment.template; + var headings = scb.ui.static.ExperimentSetupView.headings(template.ui.experiment_setup.table); + var rows = scb.ui.static.ExperimentSetupView.rows(experiment.cell_treatment_list.list, headings, template); + var new_rows = scb.ui.static.ExperimentSetupView.new_rows(template.ui.experiment_setup.new_row, gstate.context, headings, template); + if (experiment.setup_finished) { + state.mode = 'readonly'; + state.last_view = 'experiment_run'; + } + $('.scb_s_experiment_setup_table_add_samples_dialog').detach(); + workarea.html(scb_experiment_setup.main({ + global_template: gstate.context.master_model, + t: template, + context: gstate.context, + assignment: state.assignment, + experiment: state.experiment, + headings: headings, + rows: rows, + prev_step: state.experiment.prev_step, + last_step: state.experiment.last_step, + new_rows: new_rows, + kind: state.mode + })); + state.experiment.prev_step = 2; + if (state.last_view == 'experiment_run') { + $('.scb_s_experiment_setup_instructions').hide(); + } + if (state.experiment.last_step < scb.ui.static.ExperimentSetupView.TOTAL_STEPS) { + state.experiment.last_step = 4; + } + if (rows.length > 0 || state.experiment.setup_visible) { + $('.scb_s_experiment_setup_new_set_up').css('visibility', 'visible'); + $('.scb_f_experiment_setup_new_set_up').prop('checked', 'checked'); + } + state.experiment.last_view = state.last_view; - if (state.mode == 'readonly') { - $('.scb_s_experiment_setup_table_add_samples_dialog').hide(); - } - else { - $('.scb_s_experiment_setup_table_add_samples_dialog').dialog({autoOpen: false}) + if (state.mode == 'readonly') { + $('.scb_s_experiment_setup_table_add_samples_dialog').hide(); + } else { + $('.scb_s_experiment_setup_table_add_samples_dialog').dialog({ + autoOpen: false + }) - } - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); - }; + } + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + }; }; \ No newline at end of file diff --git a/html_app/ui/FacsView.js b/html_app/ui/FacsView.js index 53b70a8f..84e85777 100644 --- a/html_app/ui/FacsView.js +++ b/html_app/ui/FacsView.js @@ -9,1612 +9,1672 @@ scb.ui.static.FacsView.TOTAL_SCROLL = 5; scb.ui.static.FacsView.MAX_GATE = 150; -scb.ui.static.FacsView.parse = function (element) { - - var assignment_id = $(element).attr('assignment_id'); - var experiment_id = $(element).attr('experiment_id'); - var facs_id = $(element).attr('facs_id'); - var facs_lane_id = $(element).attr('facs_lane_id'); - - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - facs_id: facs_id, - facs_lane_id: facs_lane_id, - view: 'facs', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - parsed.state = state; - return parsed; +scb.ui.static.FacsView.parse = function(element) { + + var assignment_id = $(element).attr('assignment_id'); + var experiment_id = $(element).attr('experiment_id'); + var facs_id = $(element).attr('facs_id'); + var facs_lane_id = $(element).attr('facs_lane_id'); + + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + facs_id: facs_id, + facs_lane_id: facs_lane_id, + view: 'facs', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + parsed.state = state; + return parsed; } -scb.ui.static.FacsView.scb_f_facs_sample_active = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - - var val = $(element).attr('checked'); - var cell_treatment_id = $(element).attr('cell_treatment_id'); - parsed.facs.is_cell_treatment_enabled[cell_treatment_id] = val; - if(val === 'checked') { - $('.scb_f_facs_select_lysate_type', $(element).parent().parent()).each(function (e) { - scb.ui.static.FacsView.scb_f_facs_select_lysate_type(this); - }); - }else{ - /*want to remove the FacsLane*/ - var lanes = _.filter(parsed.facs.lanes_list.list, function (lane) { - return cell_treatment_id == lane.cell_treatment_id - }); - _.each(lanes,function(lane){ - parsed.facs.lanes_list.remove(lane.id); - }); - } - parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); - scb.ui.static.MainFrame.refresh(); -} - -scb.ui.static.FacsView.scb_f_facs_cell_treatment_radio = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - /* val is 'fixed' or 'live' */ - var val = $(element).val(); - var cell_treatment_id = $(element).attr('cell_treatment_id'); - /* map_key is "cell_treatment.id_[lane.id]" */ - var map_key = $(element).attr('map_key'); - parsed.facs.is_cell_treatment_live[map_key] = val; - - $('.scb_f_facs_select_lysate_type', $(element).parent().parent()).each(function (e) { - scb.ui.static.FacsView.scb_f_facs_select_lysate_type(this); +scb.ui.static.FacsView.scb_f_facs_sample_active = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + + var val = $(element).attr('checked'); + var cell_treatment_id = $(element).attr('cell_treatment_id'); + parsed.facs.is_cell_treatment_enabled[cell_treatment_id] = val; + if (val === 'checked') { + $('.scb_f_facs_select_lysate_type', $(element).parent().parent()).each(function(e) { + scb.ui.static.FacsView.scb_f_facs_select_lysate_type(this); }); - parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); - event = true; - if (event) { - scb.ui.static.MainFrame.refresh(); - } -} - -scb.ui.static.FacsView.scb_f_facs_select_lysate_type = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - - var slide_type = $(element).attr('value'); - if (slide_type == '') { - return; - } - var avail_conditions = []; - var lane_id = $(element).attr('lane_id'); - /* cell_treatment_id identifies the sample (analysis, conditions are not involved) */ - var cell_treatment_id = $(element).attr('cell_treatment_id'); + } else { + /*want to remove the FacsLane*/ var lanes = _.filter(parsed.facs.lanes_list.list, function(lane) { - return lane.kind == slide_type && cell_treatment_id == lane.cell_treatment_id + return cell_treatment_id == lane.cell_treatment_id + }); + _.each(lanes, function(lane) { + parsed.facs.lanes_list.remove(lane.id); }); + } + parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); + scb.ui.static.MainFrame.refresh(); +} - var cell_treatment_list = parsed.experiment.cell_treatment_list; - /* Want to find the number of conditions available for this cell_treatment */ - var facs_kinds = _.filter(cell_treatment_list.list , function(lane){ - return lane.id == cell_treatment_id; })[0].treatment_list.first.facs; +scb.ui.static.FacsView.scb_f_facs_cell_treatment_radio = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + /* val is 'fixed' or 'live' */ + var val = $(element).val(); + var cell_treatment_id = $(element).attr('cell_treatment_id'); + /* map_key is "cell_treatment.id_[lane.id]" */ + var map_key = $(element).attr('map_key'); + parsed.facs.is_cell_treatment_live[map_key] = val; + + $('.scb_f_facs_select_lysate_type', $(element).parent().parent()).each(function(e) { + scb.ui.static.FacsView.scb_f_facs_select_lysate_type(this); + }); + parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); + event = true; + if (event) { + scb.ui.static.MainFrame.refresh(); + } +} - /* Find a list of available conditions for this slide type */ - if (_.isEmpty(facs_kinds)) { - avail_conditions = _.keys(parsed.assignment.template.facs_kinds[slide_type].conditions); +scb.ui.static.FacsView.scb_f_facs_select_lysate_type = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + + var slide_type = $(element).attr('value'); + if (slide_type == '') { + return; + } + var avail_conditions = []; + var lane_id = $(element).attr('lane_id'); + /* cell_treatment_id identifies the sample (analysis, conditions are not involved) */ + var cell_treatment_id = $(element).attr('cell_treatment_id'); + var lanes = _.filter(parsed.facs.lanes_list.list, function(lane) { + return lane.kind == slide_type && cell_treatment_id == lane.cell_treatment_id + }); + + var cell_treatment_list = parsed.experiment.cell_treatment_list; + /* Want to find the number of conditions available for this cell_treatment */ + var facs_kinds = _.filter(cell_treatment_list.list, function(lane) { + return lane.id == cell_treatment_id; + })[0].treatment_list.first.facs; + + /* Find a list of available conditions for this slide type */ + if (_.isEmpty(facs_kinds)) { + avail_conditions = _.keys(parsed.assignment.template.facs_kinds[slide_type].conditions); + } else { + avail_conditions = facs_kinds[slide_type]; + + } + + /* Want to check if there are more (than already chosen) conditions available for this sample) */ + if (lanes.length >= avail_conditions.length) { + + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("You've already selected this option.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + scb.ui.static.MainFrame.refresh(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; + } + + + if (lane_id == '') { /*This means that the Lane does not 'exist' yet*/ + var line; + if (_.size(avail_conditions) == 1) { + var slide_conditions_val = avail_conditions[0]; + line = parsed.facs.lanes_list.start({ + kind: slide_type, + conditions: slide_conditions_val, + cell_treatment_id: cell_treatment_id, + experiment_id: parsed.experiment.id, + live: parsed.facs.is_cell_treatment_live[cell_treatment_id + '_'] + }); } else { - avail_conditions = facs_kinds[slide_type]; - - } - - /* Want to check if there are more (than already chosen) conditions available for this sample) */ - if (lanes.length >= avail_conditions.length) { - - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("You've already selected this option.", - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - scb.ui.static.MainFrame.refresh(); - /* callback function for 'OK' button*/ - }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; + line = parsed.facs.lanes_list.start({ + kind: slide_type, + cell_treatment_id: cell_treatment_id, + experiment_id: parsed.experiment.id, + live: parsed.facs.is_cell_treatment_live[cell_treatment_id + '_'] + }); } + var cell_treatment_id = $(element).attr('cell_treatment_id'); + var map_key = cell_treatment_id + '_' + line.id; + parsed.facs.is_cell_treatment_live[map_key] = parsed.facs.is_cell_treatment_live[cell_treatment_id + '_']; - if (lane_id == '') {/*This means that the Lane does not 'exist' yet*/ - var line; - if (_.size(avail_conditions) == 1) { - var slide_conditions_val = avail_conditions[0]; - line = parsed.facs.lanes_list.start({ - kind: slide_type, - conditions: slide_conditions_val, - cell_treatment_id: cell_treatment_id, - experiment_id: parsed.experiment.id, - live: parsed.facs.is_cell_treatment_live[cell_treatment_id+'_'] - }); - } - else { - line = parsed.facs.lanes_list.start({ - kind: slide_type, - cell_treatment_id: cell_treatment_id, - experiment_id: parsed.experiment.id, - live: parsed.facs.is_cell_treatment_live[cell_treatment_id + '_'] - }); - } - var cell_treatment_id = $(element).attr('cell_treatment_id'); - var map_key = cell_treatment_id + '_' + line.id; - parsed.facs.is_cell_treatment_live[map_key] = parsed.facs.is_cell_treatment_live[cell_treatment_id + '_']; - - - } - else { - parsed.facs.lanes_list.get(lane_id).kind = slide_type; - } - if (event) { - scb.ui.static.MainFrame.refresh(); - } + } else { + parsed.facs.lanes_list.get(lane_id).kind = slide_type; + } + if (event) { + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.FacsView.scb_f_facs_add_all_conditions = function (element, event) { - /* Select all conditions for all types/kinds */ - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); - - var cell_treatment_id = $(element).attr('cell_treatment_id'); - var lanes = _.filter(parsed.facs.lanes_list.list, function(lane) { - return cell_treatment_id == lane.cell_treatment_id - }); - var facs_kinds = parsed.assignment.template.facs_kinds; - _.each(_.keys(facs_kinds), function(kind){ - var conditions = _.keys(facs_kinds[kind].conditions); - - _.each(conditions, function(condition){ - /* find if a lane exists with this condition */ - var lane = _.find(lanes, function(lane){ - return lane.conditions === condition - }); - if (typeof lane === 'undefined'){ - parsed.facs.lanes_list.start({ - kind: kind, - conditions: condition, - cell_treatment_id: cell_treatment_id, - experiment_id: parsed.experiment.id - }); - } - }); - /* want to remove any lanes that did not have condition selected */ - var lanes_no_cond = _.filter(lanes, function(lane){ - return lane.conditions == null - }); - _.each(lanes_no_cond, function(lane){ - parsed.facs.lanes_list.remove(lane.id); +scb.ui.static.FacsView.scb_f_facs_add_all_conditions = function(element, event) { + /* Select all conditions for all types/kinds */ + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); + + var cell_treatment_id = $(element).attr('cell_treatment_id'); + var lanes = _.filter(parsed.facs.lanes_list.list, function(lane) { + return cell_treatment_id == lane.cell_treatment_id + }); + var facs_kinds = parsed.assignment.template.facs_kinds; + _.each(_.keys(facs_kinds), function(kind) { + var conditions = _.keys(facs_kinds[kind].conditions); + + _.each(conditions, function(condition) { + /* find if a lane exists with this condition */ + var lane = _.find(lanes, function(lane) { + return lane.conditions === condition + }); + if (typeof lane === 'undefined') { + parsed.facs.lanes_list.start({ + kind: kind, + conditions: condition, + cell_treatment_id: cell_treatment_id, + experiment_id: parsed.experiment.id }); + } }); - if (event) { - scb.ui.static.MainFrame.refresh(); - } + /* want to remove any lanes that did not have condition selected */ + var lanes_no_cond = _.filter(lanes, function(lane) { + return lane.conditions == null + }); + _.each(lanes_no_cond, function(lane) { + parsed.facs.lanes_list.remove(lane.id); + }); + }); + if (event) { + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.FacsView.scb_f_facs_select_conditions = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - parsed.facs.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); +scb.ui.static.FacsView.scb_f_facs_select_conditions = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + parsed.facs.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var lane_conditions = $(element).attr('value'); + + if (lane_conditions == '') { + return; + } + var lane_id = $(element).attr('lane_id'); + var current_lane = parsed.facs.lanes_list.get(lane_id); + var cell_treatment_id = $(element).attr('cell_treatment_id'); + + var lanes_list = _.filter(parsed.facs.lanes_list.list, function(lane) { + return lane.kind == current_lane.kind && cell_treatment_id == lane.cell_treatment_id; + }); + + for (var index = 0; index < lanes_list.length; index++) { + if (lanes_list[index].conditions == lane_conditions) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("You've already selected this condition option.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + scb.ui.static.MainFrame.refresh(); + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); } - var lane_conditions = $(element).attr('value'); - if (lane_conditions == '') { - return; - } - var lane_id = $(element).attr('lane_id'); - var current_lane = parsed.facs.lanes_list.get(lane_id); - var cell_treatment_id = $(element).attr('cell_treatment_id'); + } + current_lane.conditions = lane_conditions; - var lanes_list= _.filter(parsed.facs.lanes_list.list, function(lane){ - return lane.kind == current_lane.kind && cell_treatment_id == lane.cell_treatment_id; - }); - - for (var index = 0; index < lanes_list.length; index++) { - if (lanes_list[index].conditions == lane_conditions) { - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("You've already selected this condition option.", - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ - scb.ui.static.MainFrame.refresh(); - }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; - - } + /* When condition selected for this Lane, want to enable conditions for the placeholder below*/ + var placeholder = $('span.scb_f_facs_select_lysate_type[cell_treatment_id="' + cell_treatment_id + '"][lane_kind="placeholder"]'); + /* Want to check if there is a placeholder*/ + if (placeholder.length > 0) { + scb.ui.static.FacsView.scb_f_facs_select_lysate_type(placeholder); + } - } - current_lane.conditions = lane_conditions; - - /* When condition selected for this Lane, want to enable conditions for the placeholder below*/ - var placeholder=$('span.scb_f_facs_select_lysate_type[cell_treatment_id="' + cell_treatment_id + '"][lane_kind="placeholder"]'); - /* Want to check if there is a placeholder*/ - if(placeholder.length>0) { - scb.ui.static.FacsView.scb_f_facs_select_lysate_type(placeholder); - } - - if (event) { - scb.ui.static.MainFrame.refresh(); - } + if (event) { + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.FacsView.scb_f_facs_prepare_lysates = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var rows_state = parsed.facs.rows_state(); - if (rows_state && rows_state.valid < 1) { - $('html').css('overflow', 'hidden'); +scb.ui.static.FacsView.scb_f_facs_prepare_lysates = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var rows_state = parsed.facs.rows_state(); + if (rows_state && rows_state.valid < 1) { + $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); + $('body').prepend(scb_experiment_setup.general_error_overlay()); - $.jqDialog.alert("Please select at least 1 sample to prepare.", function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ - }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - } - else { - /* want to find the first lane in the list that is valid - and select it */ - var valid_lane = _.find(rows_state.rows, function(r){ - return r.is_valid ; - }); - parsed.facs.lane_selected = valid_lane.lane.id; - parsed.facs.sample_prepared = true; - scb.ui.static.MainFrame.refresh(); - } + $.jqDialog.alert("Please select at least 1 sample to prepare.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + } else { + /* want to find the first lane in the list that is valid + and select it */ + var valid_lane = _.find(rows_state.rows, function(r) { + return r.is_valid; + }); + parsed.facs.lane_selected = valid_lane.lane.id; + parsed.facs.sample_prepared = true; + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.FacsView.scb_f_facs_sample_active_all = function (element, event) { - $('.scb_f_facs_sample_active').each(function (e) { - var element = this; - $(element).attr('checked', 'checked'); - scb.ui.static.FacsView.scb_f_facs_sample_active(element); - }); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.FacsView.scb_f_facs_sample_active_all = function(element, event) { + $('.scb_f_facs_sample_active').each(function(e) { + var element = this; + $(element).attr('checked', 'checked'); + scb.ui.static.FacsView.scb_f_facs_sample_active(element); + }); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.FacsView.scb_f_facs_sample_inactive_all = function (element) { - $('.scb_f_facs_sample_active').each(function (e) { - var element = this; - $(element).attr('checked', false); - scb.ui.static.FacsView.scb_f_facs_sample_active(element); - }); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.FacsView.scb_f_facs_sample_inactive_all = function(element) { + $('.scb_f_facs_sample_active').each(function(e) { + var element = this; + $(element).attr('checked', false); + scb.ui.static.FacsView.scb_f_facs_sample_active(element); + }); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.FacsView.scb_f_facs_run_samples = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.FacsView.scb_f_facs_run_samples = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.facs.samples_finished = true; - scb.ui.static.MainFrame.refresh(); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.facs.samples_finished = true; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.FacsView.scb_s_facs_choose_samples_order_list_select = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if (parsed.facs.samples_finished) { - parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); - $('li', $(element).parent()).removeClass('scb_s_facs_sample_selected'); - $(element).addClass('scb_s_facs_sample_selected'); - parsed.facs.lane_selected = parsed.facs_lane.id; - scb.ui.static.MainFrame.refresh(); - } +scb.ui.static.FacsView.scb_s_facs_choose_samples_order_list_select = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.facs.samples_finished) { + parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); + $('li', $(element).parent()).removeClass('scb_s_facs_sample_selected'); + $(element).addClass('scb_s_facs_sample_selected'); + parsed.facs.lane_selected = parsed.facs_lane.id; + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.FacsView.scb_s_facs_selected = function (element) { +scb.ui.static.FacsView.scb_s_facs_selected = function(element) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if ($(element).text().length <= 1) { - scb.ui.static.MainFrame.refresh(); - } - else { - parsed.facs.name = $(element).val(); - } + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if ($(element).text().length <= 1) { + scb.ui.static.MainFrame.refresh(); + } else { + parsed.facs.name = $(element).val(); + } } -scb.ui.static.FacsView.scb_s_western_blot_gel_tab = function (element) { +scb.ui.static.FacsView.scb_s_western_blot_gel_tab = function(element) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } - parsed.facs.lane_selected = parsed.facs_lane.id; - parsed.facs.is_tab_selected[parsed.facs.selected_lane.cell_treatment_id] = parsed.facs.lane_selected; - scb.ui.static.MainFrame.refresh(); + parsed.facs.lane_selected = parsed.facs_lane.id; + parsed.facs.is_tab_selected[parsed.facs.selected_lane.cell_treatment_id] = parsed.facs.lane_selected; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.FacsView.scb_f_facs_tools_start_analysis = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); +scb.ui.static.FacsView.scb_f_facs_tools_start_analysis = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); - parsed.facs.show_analysis = true; - scb.ui.static.MainFrame.refresh(); + parsed.facs.show_analysis = true; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.FacsView.scb_s_facs_single_range_button = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); - parsed.facs.sample_analysis = !parsed.facs.sample_analysis; - parsed.facs.double_analysis = false; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.FacsView.scb_s_facs_single_range_button = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); + parsed.facs.sample_analysis = !parsed.facs.sample_analysis; + parsed.facs.double_analysis = false; + scb.ui.static.MainFrame.refresh(); }; -scb.ui.static.FacsView.scb_s_facs_double_range_button = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); - parsed.facs.double_analysis = !parsed.facs.double_analysis; - parsed.facs.sample_analysis = false; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.FacsView.scb_s_facs_double_range_button = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); + parsed.facs.double_analysis = !parsed.facs.double_analysis; + parsed.facs.sample_analysis = false; + scb.ui.static.MainFrame.refresh(); }; -scb.ui.static.FacsView.scb_f_facs_note_close_button= function (element) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); - var note = $(element).attr('note'); - note = '.' + note; - $(note).slideUp('400', function () { - parsed.facs.instructions_show_state = $('.scb_s_facs_tools_instructions_followup').is(":visible"); - parsed.facs.samples_show_state = $('.scb_s_facs_tools_samples_followup').is(":visible"); - scb.ui.static.MainFrame.refresh(); - }); - +scb.ui.static.FacsView.scb_f_facs_note_close_button = function(element) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); + var note = $(element).attr('note'); + note = '.' + note; + $(note).slideUp('400', function() { + parsed.facs.instructions_show_state = $('.scb_s_facs_tools_instructions_followup').is(":visible"); + parsed.facs.samples_show_state = $('.scb_s_facs_tools_samples_followup').is(":visible"); + scb.ui.static.MainFrame.refresh(); + }); + } -scb.ui.static.FacsView.scb_f_facs_sample_remove = function (element) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); +scb.ui.static.FacsView.scb_f_facs_sample_remove = function(element) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + parsed.facs.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var cell_treatment_id = ''; - var lysate_id = $(element).attr('lane_id'); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var cell_treatment_id = ''; + var lysate_id = $(element).attr('lane_id'); - /* Find cell_treatment_id for this sample*/ - _.each(parsed.facs.lanes_list.list, function (lane) { - if (lysate_id == lane.id) { - cell_treatment_id = lane.cell_treatment_id; - } - }); - /* Delete this Lane from the lanes_list*/ - parsed.facs.lanes_list.remove(lysate_id); - - /* - * If this is the only Lane for this CellTreatment, - * then remove it from the list of enabled samples - */ - var lanes = _.filter(parsed.facs.lanes_list.list, function (lane) { - return cell_treatment_id == lane.cell_treatment_id - }); - if (lanes.length < 1) { - parsed.facs.is_cell_treatment_enabled[cell_treatment_id] = false; + /* Find cell_treatment_id for this sample*/ + _.each(parsed.facs.lanes_list.list, function(lane) { + if (lysate_id == lane.id) { + cell_treatment_id = lane.cell_treatment_id; } - scb.ui.static.MainFrame.refresh(); + }); + /* Delete this Lane from the lanes_list*/ + parsed.facs.lanes_list.remove(lysate_id); + + /* + * If this is the only Lane for this CellTreatment, + * then remove it from the list of enabled samples + */ + var lanes = _.filter(parsed.facs.lanes_list.list, function(lane) { + return cell_treatment_id == lane.cell_treatment_id + }); + if (lanes.length < 1) { + parsed.facs.is_cell_treatment_enabled[cell_treatment_id] = false; + } + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.FacsView.scb_f_facs_tools_toggle = function (element) { - var parsed = scb.ui.static.FacsView.parse(element); - var note = $(element).attr('note'); - note = '.' + note; - parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); +scb.ui.static.FacsView.scb_f_facs_tools_toggle = function(element) { + var parsed = scb.ui.static.FacsView.parse(element); + var note = $(element).attr('note'); + note = '.' + note; + parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); - $(note).slideDown('400', function () { - parsed.facs.instructions_show_state = $('.scb_s_facs_tools_instructions_followup').is(":visible"); - parsed.facs.samples_show_state = $('.scb_s_facs_tools_samples_followup').is(":visible"); - scb.ui.static.MainFrame.refresh(); - }); + $(note).slideDown('400', function() { + parsed.facs.instructions_show_state = $('.scb_s_facs_tools_instructions_followup').is(":visible"); + parsed.facs.samples_show_state = $('.scb_s_facs_tools_samples_followup').is(":visible"); + scb.ui.static.MainFrame.refresh(); + }); } -scb.ui.static.FacsView.scb_f_facs_analyze_remove_point = function (element) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); +scb.ui.static.FacsView.scb_f_facs_analyze_remove_point = function(element) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + parsed.facs.samples_scroll = $(".scb_s_facs_choose_samples_order_list").scrollTop(); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var from = parseFloat($(element).attr('from')); + var to = parseFloat($(element).attr('to')); + parsed.facs_lane.canvas_metadata_analysis.points = parsed.facs_lane.canvas_metadata_analysis.points ? parsed.facs_lane.canvas_metadata_analysis.points : []; + var element = _.find(parsed.facs_lane.canvas_metadata_analysis.points, function(e) { + return e.from == from && e.to == to; + }); + var elements = _.filter(parsed.facs_lane.canvas_metadata_analysis.points, function(e) { + return e.display_id == element.display_id; + }) + if (elements.length > 1) { + parsed.facs_lane.bisector_gate_created = false; + parsed.facs_lane.canvas_metadata_analysis.points = _.without( + parsed.facs_lane.canvas_metadata_analysis.points, elements[0] + ); + parsed.facs_lane.canvas_metadata_analysis.points = _.without( + parsed.facs_lane.canvas_metadata_analysis.points, elements[1] + ); + } + //delete two gates for bisector + else { + parsed.facs_lane.canvas_metadata_analysis.points = _.without(parsed.facs_lane.canvas_metadata_analysis.points, element); + } + scb.ui.static.FacsView.reevaluate_metadata(parsed); + parsed.facs.apply_dna_analysis_to_all = false; + scb.ui.static.MainFrame.refresh(); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var from = parseFloat($(element).attr('from')); - var to = parseFloat($(element).attr('to')); - parsed.facs_lane.canvas_metadata_analysis.points = parsed.facs_lane.canvas_metadata_analysis.points ? parsed.facs_lane.canvas_metadata_analysis.points : []; - var element = _.find(parsed.facs_lane.canvas_metadata_analysis.points, function (e) { - return e.from == from && e.to == to; +} + +scb.ui.static.FacsView.scb_f_facs_apply_to_all = function(element) { + //ADD APPLY ALL BISECTOR_GATE_CREATED GATE CREATED + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.facs.apply_dna_analysis_to_all = $(element).attr('checked') == 'checked'; + if (parsed.facs.apply_dna_analysis_to_all) { + _.each(parsed.facs.lanes_list.list, function(facs_lane) { + facs_lane.canvas_metadata_analysis.points = JSON.parse(JSON.stringify(parsed.facs_lane.canvas_metadata_analysis.points)); + facs_lane.exp_id = parsed.facs_lane.exp_id; + facs_lane.bisector_gate_created = parsed.facs_lane.bisector_gate_created; + scb.ui.static.FacsView.evaluate_chart({ + assignment: parsed.assignment, + facs: parsed.facs, + facs_lane: facs_lane, + context: parsed.context + }); }); - var elements = _.filter(parsed.facs_lane.canvas_metadata_analysis.points, function (e) { - return e.display_id == element.display_id; - }) - if (elements.length > 1) { - parsed.facs_lane.bisector_gate_created = false; - parsed.facs_lane.canvas_metadata_analysis.points = _.without( - parsed.facs_lane.canvas_metadata_analysis.points, elements[0] - ); - parsed.facs_lane.canvas_metadata_analysis.points = _.without( - parsed.facs_lane.canvas_metadata_analysis.points, elements[1] - ); - } - //delete two gates for bisector - else - parsed.facs_lane.canvas_metadata_analysis.points = _.without(parsed.facs_lane.canvas_metadata_analysis.points, element); - scb.ui.static.FacsView.reevaluate_metadata(parsed); - parsed.facs.apply_dna_analysis_to_all = false; scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.FacsView.scb_f_facs_apply_to_all = function (element) { - //ADD APPLY ALL BISECTOR_GATE_CREATED GATE CREATED - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.facs.apply_dna_analysis_to_all = $(element).attr('checked') == 'checked'; - if (parsed.facs.apply_dna_analysis_to_all) { - _.each(parsed.facs.lanes_list.list, function (facs_lane) { - facs_lane.canvas_metadata_analysis.points = JSON.parse(JSON.stringify(parsed.facs_lane.canvas_metadata_analysis.points)); - facs_lane.exp_id = parsed.facs_lane.exp_id; - facs_lane.bisector_gate_created = parsed.facs_lane.bisector_gate_created; - scb.ui.static.FacsView.evaluate_chart({ - assignment: parsed.assignment, - facs: parsed.facs, - facs_lane: facs_lane, - context: parsed.context - }); - }); - scb.ui.static.MainFrame.refresh(); - } - +scb.ui.static.FacsView.scb_s_facs_left_facs = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + parsed.facs.parent.start_tabs_index = parsed.facs.parent.start_tabs_index - 1; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.FacsView.scb_s_facs_left_facs = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - parsed.facs.parent.start_tabs_index = parsed.facs.parent.start_tabs_index - 1; - scb.ui.static.MainFrame.refresh(parsed.state); +scb.ui.static.FacsView.scb_s_facs_right_facs = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + parsed.facs.parent.start_tabs_index = parsed.facs.parent.start_tabs_index + 1; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.FacsView.scb_s_facs_right_facs = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - parsed.facs.parent.start_tabs_index = parsed.facs.parent.start_tabs_index + 1; - scb.ui.static.MainFrame.refresh(parsed.state); +scb.ui.static.FacsView.scb_s_facs_add_facs = function(element, event) { + var parsed = scb.ui.static.FacsView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.facs.parent.list.length == scb.ui.static.FacsView.TOTAL_TABS) { + parsed.facs.parent.start_tabs_index = 1; + } else if (parsed.facs.parent.list.length > scb.ui.static.FacsView.TOTAL_TABS) { + parsed.facs.parent.start_tabs_index = parsed.facs.parent.length - (scb.ui.static.FacsView.TOTAL_TABS - 1); + } + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.FacsView.scb_s_facs_add_facs = function (element, event) { - var parsed = scb.ui.static.FacsView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.facs.parent.list.length == scb.ui.static.FacsView.TOTAL_TABS) { - parsed.facs.parent.start_tabs_index = 1; - } - else if (parsed.facs.parent.list.length > scb.ui.static.FacsView.TOTAL_TABS) - parsed.facs.parent.start_tabs_index = parsed.facs.parent.length - (scb.ui.static.FacsView.TOTAL_TABS - 1); - scb.ui.static.MainFrame.refresh(parsed.state); -} +scb.ui.static.FacsView.scb_f_facs_remove = function(element) { + var parsed = scb.ui.static.FacsView.parse(element); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } -scb.ui.static.FacsView.scb_f_facs_remove = function (element) { - var parsed = scb.ui.static.FacsView.parse(element); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } + var id_list = []; + for (var x = 0; x < parsed.experiment.facs_list.list.length; x++) { + id_list.push(parsed.experiment.facs_list.list[x].id); + } + parsed.state.index = id_list.indexOf(parsed.facs.id); - var id_list = []; - for (var x = 0; x < parsed.experiment.facs_list.list.length; x++) { - id_list.push(parsed.experiment.facs_list.list[x].id); - } - parsed.state.index = id_list.indexOf(parsed.facs.id); + parsed.experiment.facs_list.remove(parsed.facs.id); - parsed.experiment.facs_list.remove(parsed.facs.id); + if (parsed.state.index == parsed.experiment.facs_list.list.length) { + parsed.state.index = parsed.state.index - 1; + } + //fix tab indexing for display + if (parsed.state.index > parsed.experiment.facs_list.list.length - scb.ui.static.FacsView.TOTAL_TABS) { - if (parsed.state.index == parsed.experiment.facs_list.list.length) { - parsed.state.index = parsed.state.index - 1; - } - //fix tab indexing for display - if (parsed.state.index > parsed.experiment.facs_list.list.length - scb.ui.static.FacsView.TOTAL_TABS) { - - if ( - ( - parsed.experiment.facs_list.list.length == scb.ui.static.FacsView.TOTAL_TABS + 1 || - parsed.experiment.facs_list.list.length == scb.ui.static.FacsView.TOTAL_TABS + 2 - ) && - parsed.experiment.facs_list.start_tabs_index <= 1 - ) - parsed.experiment.facs_list.start_tabs_index = parsed.experiment.facs_list.start_tabs_index + 1; - else parsed.experiment.facs_list.start_tabs_index = parsed.experiment.facs_list.start_tabs_index - 1; + if ( + ( + parsed.experiment.facs_list.list.length == scb.ui.static.FacsView.TOTAL_TABS + 1 || + parsed.experiment.facs_list.list.length == scb.ui.static.FacsView.TOTAL_TABS + 2 + ) && + parsed.experiment.facs_list.start_tabs_index <= 1 + ) { + parsed.experiment.facs_list.start_tabs_index = parsed.experiment.facs_list.start_tabs_index + 1; + } else { + parsed.experiment.facs_list.start_tabs_index = parsed.experiment.facs_list.start_tabs_index - 1; } - delete parsed.state.skip_hash_update; - scb.ui.static.MainFrame.refresh(parsed.state); + } + delete parsed.state.skip_hash_update; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.FacsView.register = function (workarea) { - scb.utils.off_on(workarea, 'change', '.scb_f_facs_sample_active', function (e) { - scb.ui.static.FacsView.scb_f_facs_sample_active(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_sample_active_all', function (e) { - scb.ui.static.FacsView.scb_f_facs_sample_active_all(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_sample_inactive_all', function (e) { - scb.ui.static.FacsView.scb_f_facs_sample_inactive_all(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_prepare_lysates', function (e) { - scb.ui.static.FacsView.scb_f_facs_prepare_lysates(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_facs_single_range_button', function (e) { - scb.ui.static.FacsView.scb_s_facs_single_range_button(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_facs_double_range_button', function (e) { - scb.ui.static.FacsView.scb_s_facs_double_range_button(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_facs_select_lysate_type', function (e) { - scb.ui.static.FacsView.scb_f_facs_select_lysate_type(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_facs_select_conditions', function (e) { - scb.ui.static.FacsView.scb_f_facs_select_conditions(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_add_all_conditions', function (e) { - scb.ui.static.FacsView.scb_f_facs_add_all_conditions(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_run_samples', function (e) { - scb.ui.static.FacsView.scb_f_facs_run_samples(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_gel_tab', function (e) { - scb.ui.static.FacsView.scb_s_western_blot_gel_tab(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_sample_remove', function (e) { - scb.ui.static.FacsView.scb_f_facs_sample_remove(this); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_facs_run_samples_short', function (e) { - scb.ui.static.FacsView.scb_f_facs_run_samples(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_remove', function (e) { - scb.ui.static.FacsView.scb_f_facs_remove(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_facs_choose_samples_order_list>li', function (e) { - scb.ui.static.FacsView.scb_s_facs_choose_samples_order_list_select(this, e); - }); - scb.utils.off_on(workarea, 'blur', '.scb_s_facs_selected', function (e) { - $('.scb_s_facs_selected').text($('.scb_s_facs_selected').attr('value')); - scb.ui.static.FacsView.scb_s_facs_selected(this); - }); - scb.utils.off_on(workarea, 'keydown', '.scb_s_facs_selected', function (e) { - if ($('.scb_s_facs_selected').text().length <= 10) { - } - else { - $('.scb_s_facs_selected').text(); - e.preventDefault(); - this.textContent = this.textContent.substring(0, this.textContent.length - 1) - return false; - } - }); - scb.utils.off_on(workarea, 'click', '.scb_s_facs_left_facs', function (e) { - scb.ui.static.FacsView.scb_s_facs_left_facs(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_facs_right_facs', function (e) { - scb.ui.static.FacsView.scb_s_facs_right_facs(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_facs_add_facs', function (e, ui) { - scb.ui.static.FacsView.scb_s_facs_add_facs(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_tools_start_analysis', function (e) { - scb.ui.static.FacsView.scb_f_facs_tools_start_analysis(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_tools_toggle', function (e) { - scb.ui.static.FacsView.scb_f_facs_tools_toggle(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_note_close_button', function (e) { - scb.ui.static.FacsView.scb_f_facs_note_close_button(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_analyze_remove_point', function (e) { - scb.ui.static.FacsView.scb_f_facs_analyze_remove_point(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_apply_to_all', function (e) { - scb.ui.static.FacsView.scb_f_facs_apply_to_all(this); - }); - scb.utils.off_on(workarea, 'mouseup', document, function (e, ui) { - var container = $(".scb_f_controls_note"); - container.slideUp(); // hide - }); - scb.utils.off_on(workarea, 'click', '.scb_f_controls_note', function (e, ui) { - e.stopPropagation(); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_info_icon', function (e, ui) { - e.stopPropagation(); - var note = $(this).attr('note'); - note = '.' + note; - if ($(note).is(":visible")) - $(note).slideUp(); - else $(note).slideDown(); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_facs_cell_treatment_radio', function (e) { - scb.ui.static.FacsView.scb_f_facs_cell_treatment_radio(this); - }); +scb.ui.static.FacsView.register = function(workarea) { + scb.utils.off_on(workarea, 'change', '.scb_f_facs_sample_active', function(e) { + scb.ui.static.FacsView.scb_f_facs_sample_active(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_sample_active_all', function(e) { + scb.ui.static.FacsView.scb_f_facs_sample_active_all(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_sample_inactive_all', function(e) { + scb.ui.static.FacsView.scb_f_facs_sample_inactive_all(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_prepare_lysates', function(e) { + scb.ui.static.FacsView.scb_f_facs_prepare_lysates(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_facs_single_range_button', function(e) { + scb.ui.static.FacsView.scb_s_facs_single_range_button(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_facs_double_range_button', function(e) { + scb.ui.static.FacsView.scb_s_facs_double_range_button(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_facs_select_lysate_type', function(e) { + scb.ui.static.FacsView.scb_f_facs_select_lysate_type(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_facs_select_conditions', function(e) { + scb.ui.static.FacsView.scb_f_facs_select_conditions(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_add_all_conditions', function(e) { + scb.ui.static.FacsView.scb_f_facs_add_all_conditions(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_run_samples', function(e) { + scb.ui.static.FacsView.scb_f_facs_run_samples(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_gel_tab', function(e) { + scb.ui.static.FacsView.scb_s_western_blot_gel_tab(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_sample_remove', function(e) { + scb.ui.static.FacsView.scb_f_facs_sample_remove(this); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_facs_run_samples_short', function(e) { + scb.ui.static.FacsView.scb_f_facs_run_samples(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_remove', function(e) { + scb.ui.static.FacsView.scb_f_facs_remove(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_facs_choose_samples_order_list>li', function(e) { + scb.ui.static.FacsView.scb_s_facs_choose_samples_order_list_select(this, e); + }); + scb.utils.off_on(workarea, 'blur', '.scb_s_facs_selected', function(e) { + $('.scb_s_facs_selected').text($('.scb_s_facs_selected').attr('value')); + scb.ui.static.FacsView.scb_s_facs_selected(this); + }); + scb.utils.off_on(workarea, 'keydown', '.scb_s_facs_selected', function(e) { + if ($('.scb_s_facs_selected').text().length <= 10) { + } else { + $('.scb_s_facs_selected').text(); + e.preventDefault(); + this.textContent = this.textContent.substring(0, this.textContent.length - 1) + return false; + } + }); + scb.utils.off_on(workarea, 'click', '.scb_s_facs_left_facs', function(e) { + scb.ui.static.FacsView.scb_s_facs_left_facs(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_facs_right_facs', function(e) { + scb.ui.static.FacsView.scb_s_facs_right_facs(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_facs_add_facs', function(e, ui) { + scb.ui.static.FacsView.scb_s_facs_add_facs(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_tools_start_analysis', function(e) { + scb.ui.static.FacsView.scb_f_facs_tools_start_analysis(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_tools_toggle', function(e) { + scb.ui.static.FacsView.scb_f_facs_tools_toggle(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_note_close_button', function(e) { + scb.ui.static.FacsView.scb_f_facs_note_close_button(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_analyze_remove_point', function(e) { + scb.ui.static.FacsView.scb_f_facs_analyze_remove_point(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_apply_to_all', function(e) { + scb.ui.static.FacsView.scb_f_facs_apply_to_all(this); + }); + scb.utils.off_on(workarea, 'mouseup', document, function(e, ui) { + var container = $(".scb_f_controls_note"); + container.slideUp(); // hide + }); + scb.utils.off_on(workarea, 'click', '.scb_f_controls_note', function(e, ui) { + e.stopPropagation(); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_info_icon', function(e, ui) { + e.stopPropagation(); + var note = $(this).attr('note'); + note = '.' + note; + if ($(note).is(":visible")) { + $(note).slideUp(); + } else { + $(note).slideDown(); + } + }); + scb.utils.off_on(workarea, 'click', '.scb_f_facs_cell_treatment_radio', function(e) { + scb.ui.static.FacsView.scb_f_facs_cell_treatment_radio(this); + }); } -scb.ui.static.FacsView.reevaluate_metadata = function (state) { - var facs_lane = state.facs_lane; - facs_lane.canvas_metadata_analysis.points = facs_lane.canvas_metadata_analysis.points ? facs_lane.canvas_metadata_analysis.points : []; - facs_lane.canvas_metadata_analysis.ranges = []; - var ranges = facs_lane.canvas_metadata_analysis.ranges; - var points = facs_lane.canvas_metadata_analysis.points; - var raw_data = scb.utils.get(facs_lane, ['canvas_metadata_analysis', 'raw_data', 0], []); - var data = []; - var template=state.assignment.template; - points = points.sort(function (a, b) { - return a.from > b.from; - }); +scb.ui.static.FacsView.reevaluate_metadata = function(state) { + var facs_lane = state.facs_lane; + facs_lane.canvas_metadata_analysis.points = facs_lane.canvas_metadata_analysis.points ? facs_lane.canvas_metadata_analysis.points : []; + facs_lane.canvas_metadata_analysis.ranges = []; + var ranges = facs_lane.canvas_metadata_analysis.ranges; + var points = facs_lane.canvas_metadata_analysis.points; + var raw_data = scb.utils.get(facs_lane, ['canvas_metadata_analysis', 'raw_data', 0], []); + var data = []; + var template = state.assignment.template; + points = points.sort(function(a, b) { + return a.from > b.from; + }); + + colors = ['#000000'] + + var total = 0; + _.each(raw_data.data, function(e) { + total += e[1]; + }); + + function range(pts) { + var carray = _.difference(colors, _.pluck(points, 'c')); + var c = carray.length > 0 ? carray[0] : colors[0]; + // if(_.size(state.facs.midpoint) != 0){ + // c = state.facs.midpoint.color; + // } + + var from = pts.from; + var to = pts.to; + var horizontal = pts.y; + var new_id = 0; + var bisector_id = ''; + if (_.size(state.facs.midpoint) != 0) { + new_id = state.facs.midpoint.display_id; + bisector_id = 'b'; + } else { + if (!pts.display_id) { + + //new_id = Math.floor(Math.random()*1000000000).toString(27); + state.facs_lane.exp_id = state.facs_lane.exp_id + 1; + new_id = state.facs_lane.exp_id; + state.facs_lane.gates_id = new_id; + bisector_id = 'a'; + } + } + pts.c = pts.c || c; + pts.display_id = pts.display_id || new_id; + pts.bisector_id = pts.bisector_id || bisector_id; + pts.unique_id = pts.unique_id || Math.floor(Math.random() * 1000000000).toString(27); + + var scaled_from = pts.from; + var scaled_to = pts.to; + if (template.model.facs.scale && (template.model.facs.scale.indexOf("pseudo") > -1)) { + scaled_from = Math.round(Math.pow(10, pts.from / 50.0)); //50 is a step size + scaled_to = Math.round(Math.pow(10, pts.to / 50.0)); + } - colors = ['#000000'] + /*display_from and display_to represent the value of the gate that will be displayed in the template. + * For pseudo-logarithmic scale their values are modified to replicate logarithmic scale values */ + var range = { + from: pts.from, + to: pts.to, + display_from: scaled_from, + display_to: scaled_to, + color: pts.c, + display_id: pts.display_id, + bisector_id: pts.bisector_id, + percentage: 0 + }; + var series = []; + var percentage = 0; + _.each(raw_data.data, function(element) { + var x = element[0]; + if (x >= from && x <= to) { + series.push(element); + percentage += element[1]; + } + }); - var total = 0; - _.each(raw_data.data, function (e) { - total += e[1]; + var bisector_points = _.filter(points, function(x) { + return x.display_id == pts.display_id && state.facs_lane.bisector_gate_created; }); - function range(pts) { - var carray = _.difference(colors, _.pluck(points, 'c')); - var c = carray.length > 0 ? carray[0] : colors[0]; -// if(_.size(state.facs.midpoint) != 0){ -// c = state.facs.midpoint.color; -// } - - var from = pts.from; - var to = pts.to; - var horizontal = pts.y; - var new_id = 0; - var bisector_id = ''; - if (_.size(state.facs.midpoint) != 0) { - new_id = state.facs.midpoint.display_id; - bisector_id = 'b'; - } - else { - if (!pts.display_id) { - - //new_id = Math.floor(Math.random()*1000000000).toString(27); - state.facs_lane.exp_id = state.facs_lane.exp_id + 1; - new_id = state.facs_lane.exp_id; - state.facs_lane.gates_id = new_id; - bisector_id = 'a'; - } - } - pts.c = pts.c || c; - pts.display_id = pts.display_id || new_id; - pts.bisector_id = pts.bisector_id || bisector_id; - pts.unique_id = pts.unique_id || Math.floor(Math.random()*1000000000).toString(27); - - var scaled_from=pts.from; - var scaled_to=pts.to; - if(template.model.facs.scale && (template.model.facs.scale.indexOf("pseudo") > -1)){ - scaled_from = Math.round(Math.pow(10, pts.from/50.0));//50 is a step size - scaled_to = Math.round(Math.pow(10, pts.to/50.0)); + _.each(points, function(p) { + if (bisector_points.length == 2) { + if (p != bisector_points[0] && p != bisector_points[1]) { + p.bisector_id = ''; } - - /*display_from and display_to represent the value of the gate that will be displayed in the template. - * For pseudo-logarithmic scale their values are modified to replicate logarithmic scale values */ - var range = { - from: pts.from, - to: pts.to, - display_from: scaled_from, - display_to: scaled_to, - color: pts.c, - display_id: pts.display_id, - bisector_id: pts.bisector_id, - percentage: 0 - }; - var series = []; - var percentage = 0; - _.each(raw_data.data, function (element) { - var x = element[0]; - if (x >= from && x <= to) { - series.push(element); - percentage += element[1]; - } - }); - - var bisector_points = _.filter(points, function (x) { - return x.display_id == pts.display_id && state.facs_lane.bisector_gate_created; - }); - - _.each(points, function (p) { - if (bisector_points.length == 2) { - if (p != bisector_points[0] && p != bisector_points[1]) - p.bisector_id = ''; - } - else if (!state.facs_lane.bisector_gate_created) { - p.bisector_id = ''; - } - - }); + } else if (!state.facs_lane.bisector_gate_created) { + p.bisector_id = ''; + } + }); - if (range.bisector_id == 'b') { - range.percentage = 100 - _.find(ranges, function (x) { - return x.bisector_id == 'a' - }).percentage; - } - else - range.percentage = Math.round(percentage / total * 100); - //data.push({data: series, color: pts.c }); - data.push({ - label: pts.display_id + ' ' + pts.bisector_id, - data: [ - [from, horizontal], - [from, horizontal + 5], - [from, horizontal + 2.5], - [to, horizontal + 2.5], - [to, horizontal + 5], - [to, horizontal] - ], grid: {show: false}, - xaxis: {tickSize: 5}, - color: pts.c, - lines: {show: true, fill: false, steps: true, lineWidth: 1} - }); - ranges.push(range); - } - for (var i in points) { - var pts = points[i]; - if (pts.from > pts.to) { - var tmp = pts.from; - pts.from = pts.to; - pts.to = tmp; - } - range(pts); + if (range.bisector_id == 'b') { + range.percentage = 100 - _.find(ranges, function(x) { + return x.bisector_id == 'a' + }).percentage; + } else { + range.percentage = Math.round(percentage / total * 100); } - ranges = _.sortBy(ranges, function (obj) { - return obj.display_id; - }); - state.facs_lane.canvas_metadata_analysis.ranges = _.sortBy(state.facs_lane.canvas_metadata_analysis.ranges, function (obj) { - return obj.display_id; + //data.push({data: series, color: pts.c }); + data.push({ + label: pts.display_id + ' ' + pts.bisector_id, + data: [ + [from, horizontal], + [from, horizontal + 5], + [from, horizontal + 2.5], + [to, horizontal + 2.5], + [to, horizontal + 5], + [to, horizontal] + ], + grid: { + show: false + }, + xaxis: { + tickSize: 5 + }, + color: pts.c, + lines: { + show: true, + fill: false, + steps: true, + lineWidth: 1 + } }); - - var count_of_gates_per_id = _.countBy(state.facs_lane.canvas_metadata_analysis.ranges, function (obj) { - return obj.display_id; - }); - data.push({data: raw_data.data, grid: {show: false}, xaxis: {tickSize: 5}, lines: {show: true, fill: false}}); - if (facs_lane.canvas_metadata) { - facs_lane.canvas_metadata.data = data; + ranges.push(range); + } + + for (var i in points) { + var pts = points[i]; + if (pts.from > pts.to) { + var tmp = pts.from; + pts.from = pts.to; + pts.to = tmp; + } + range(pts); + } + ranges = _.sortBy(ranges, function(obj) { + return obj.display_id; + }); + state.facs_lane.canvas_metadata_analysis.ranges = _.sortBy(state.facs_lane.canvas_metadata_analysis.ranges, function(obj) { + return obj.display_id; + }); + + var count_of_gates_per_id = _.countBy(state.facs_lane.canvas_metadata_analysis.ranges, function(obj) { + return obj.display_id; + }); + data.push({ + data: raw_data.data, + grid: { + show: false + }, + xaxis: { + tickSize: 5 + }, + lines: { + show: true, + fill: false } + }); + if (facs_lane.canvas_metadata) { + facs_lane.canvas_metadata.data = data; + } } -scb.ui.static.FacsView.evaluate_chart = function (state) { - if (!state.facs_lane.canvas_metadata) { - var canvas_metadata = { - data: [ - { label: "Foo", data: [ - [10, Math.random() * 1], - [17, Math.random() * -14], - [30, Math.random() * 5] - ] }, - { label: "Bar", data: [ - [11, Math.random() * 13], - [19, Math.random() * 11], - [30, Math.random() * -7] - ] } - ], - grid: {show: false}, - xaxis: {tickSize: 5}, - options: { - - series: { - lines: { show: true }, - points: { show: true } - } - } +scb.ui.static.FacsView.evaluate_chart = function(state) { + if (!state.facs_lane.canvas_metadata) { + var canvas_metadata = { + data: [ + { + label: "Foo", + data: [ + [10, Math.random() * 1], + [17, Math.random() * -14], + [30, Math.random() * 5] + ] + }, + { + label: "Bar", + data: [ + [11, Math.random() * 13], + [19, Math.random() * 11], + [30, Math.random() * -7] + ] } - var model = new scb.components.ModelFactory(state.context.template); - model.facs.compute(state); - - state.facs_lane.canvas_metadata = state.data ? state.data : canvas_metadata; - state.facs_lane.canvas_metadata_analysis.raw_data = state.facs_lane.canvas_metadata.data; + ], + grid: { + show: false + }, + xaxis: { + tickSize: 5 + }, + options: { + + series: { + lines: { + show: true + }, + points: { + show: true + } + } + } } - state.facs_lane.canvas_metadata.options.hooks = { bindEvents: [ function (plot, eventHolder) { - var xaxes = plot.getXAxes()[0]; - var yaxes = plot.getYAxes()[0]; - var sensitivity = 4; - /* Old assignments do not have max value given, they were using the value of a constant MAX_VALUE=150*/ - var max_x = state.assignment.template.model.facs.max; - max_x = max_x ? max_x : 150; - - if (state.facs.samples_finished && state.facs_lane.selected_gate) { - var selected_gate = state.facs.selected_lane.selected_gate; - var number_of_gates = _.filter(state.facs_lane.canvas_metadata_analysis.points, function (e) { - return e.display_id == selected_gate.display_id - }); + var model = new scb.components.ModelFactory(state.context.template); + model.facs.compute(state); + + state.facs_lane.canvas_metadata = state.data ? state.data : canvas_metadata; + state.facs_lane.canvas_metadata_analysis.raw_data = state.facs_lane.canvas_metadata.data; + } + state.facs_lane.canvas_metadata.options.hooks = { + bindEvents: [function(plot, eventHolder) { + var xaxes = plot.getXAxes()[0]; + var yaxes = plot.getYAxes()[0]; + var sensitivity = 4; + /* Old assignments do not have max value given, they were using the value of a constant MAX_VALUE=150*/ + var max_x = state.assignment.template.model.facs.max; + max_x = max_x ? max_x : 150; + + if (state.facs.samples_finished && state.facs_lane.selected_gate) { + var selected_gate = state.facs.selected_lane.selected_gate; + var number_of_gates = _.filter(state.facs_lane.canvas_metadata_analysis.points, function(e) { + return e.display_id == selected_gate.display_id + }); - var isdoublegate = number_of_gates.length == 2; + var isdoublegate = number_of_gates.length == 2; - if (isdoublegate) { + if (isdoublegate) { + var selected_gate = null; + if (number_of_gates[0].from < number_of_gates[1].from) { + selected_gate = number_of_gates[0]; + } else { + selected_gate = number_of_gates[1]; + } + + var from_val = Math.round(xaxes.p2c(selected_gate.from)); + var to_val = Math.round(xaxes.p2c(selected_gate.to)); + var height_val = Math.round(yaxes.p2c(selected_gate.y)); + var styles_guider = { + position: 'absolute', + top: height_val + 24 + 'px', + left: to_val + 53 + "px", + height: '6px', //'5px', + color: 'black', + background: 'black', + width: "5px", + 'border-left': 'none', + 'border-right': 'none', + 'vertical-align': 'center' + } + $('.scb_s_facs_chart_guider').css(styles_guider); + } else { + if (selected_gate.from) { + + var from_val = Math.round(xaxes.p2c(selected_gate.from)); + var to_val = Math.round(xaxes.p2c(selected_gate.to)); + var height_val = Math.round(yaxes.p2c(selected_gate.y)); + var styles_guider = { + position: 'absolute', + top: height_val + 16 + 'px', + left: from_val + 53 + "px", + height: '6px', //'5px', + color: 'black', + background: 'transparent', + width: Math.abs(to_val - from_val) - 6 + "px", + 'border-left': '5px solid ' + 'black', + 'border-right': '5px solid ' + 'black', + 'vertical-align': 'center', + } + + $('.scb_s_facs_chart_guider').css(styles_guider); + } + } + } + + var click = function(e) { + var srcElement = e.srcElement || e.target; + var px = xaxes.c2p(e.clientX - srcElement.getBoundingClientRect().left - plot.pointOffset({ + x: 0, + y: 0 + }).left); + var py = yaxes.c2p(e.offsetY); + var fromy = py > 16 ? py : 16; + fromy = fromy > 90 ? 90 : fromy; + px = Math.round(px); + if (!state.facs.double_analysis) { + console.info("Click on: " + px + " " + py); + if (!isNaN(from)) { + var to = px; + + if (to < 0) { + to = 0; + } else if (to > max_x) { + to = max_x; + } + /* point to edit is defined only an existing gate bound is dragged */ + /* Last point to hover over */ + if (point_to_edit) { + _.each(state.facs_lane.canvas_metadata_analysis.points, function(x) { + if ( + point_to_edit.from == x.to && + Math.abs(point_to_edit.y - x.y) == 5 && + Math.abs(from - x.to) < sensitivity + ) { + x.to = to; + } else if ( + point_to_edit.to == x.from && + Math.abs(point_to_edit.y - x.y) < 16 && + Math.abs(from - x.from) < sensitivity + ) { + x.from = to; + } + }); + if (Math.abs(point_to_edit.from - from) < sensitivity) { + point_to_edit.from = to; + } else { + point_to_edit.to = to; + } + /* number of gates for this gate_id, can be 1 or 2 */ + var number_of_gates = _.filter(state.facs_lane.canvas_metadata_analysis.points, function(e) { + return e.display_id == point_to_edit.display_id + }); + + if (number_of_gates.length == 2) { /* this gate is a double gate */ var selected_gate = null; if (number_of_gates[0].from < number_of_gates[1].from) { - selected_gate = number_of_gates[0]; - } - else { - selected_gate = number_of_gates[1]; + selected_gate = number_of_gates[0]; + } else { + selected_gate = number_of_gates[1]; } var from_val = Math.round(xaxes.p2c(selected_gate.from)); var to_val = Math.round(xaxes.p2c(selected_gate.to)); var height_val = Math.round(yaxes.p2c(selected_gate.y)); var styles_guider = { + position: 'absolute', + top: height_val + 24 + 'px', + left: to_val + 53 + "px", + height: '6px', //'5px', + color: 'black', + background: 'black', + width: "5px", + 'border-left': 'none', + 'border-right': 'none', + 'vertical-align': 'center' + } + $('.scb_s_facs_chart_guider').css(styles_guider); + } else { + if (point_to_edit.from) { + + var from_val = Math.round(xaxes.p2c(point_to_edit.from)); + var to_val = Math.round(xaxes.p2c(point_to_edit.to)); + var height_val = Math.round(yaxes.p2c(point_to_edit.y)); + var styles_guider = { position: 'absolute', - top: height_val + 24 + 'px', - left: to_val + 53 + "px", + top: height_val + 16 + 'px', + left: from_val + 53 + "px", height: '6px', //'5px', color: 'black', - background: 'black', - width: "5px", - 'border-left': 'none', - 'border-right': 'none', + background: 'transparent', + width: Math.abs(to_val - from_val) - 6 + "px", + 'border-left': '5px solid ' + 'black', + 'border-right': '5px solid ' + 'black', 'vertical-align': 'center' + } + state.facs_lane.gate_selected = point_to_edit.unique_id; + $('.scb_s_facs_chart_guider').css(styles_guider); } - $('.scb_s_facs_chart_guider').css(styles_guider); + } + + } else { + /* sample_analysis is set to true when (only) single gate is selected */ + /* after the single gate was placed want to set sample_analysis back to false */ + state.facs.sample_analysis = false; + /* need from and 'to' to go from left to right*/ + if (from > to) { + var swap = to; + to = from; + from = swap; + } + state.facs_lane.canvas_metadata_analysis.points.push({ + from: Math.round(from), + to: Math.round(to), + y: Math.round(fromy) + }); } - else { - if (selected_gate.from) { - - var from_val = Math.round(xaxes.p2c(selected_gate.from)); - var to_val = Math.round(xaxes.p2c(selected_gate.to)); - var height_val = Math.round(yaxes.p2c(selected_gate.y)); - var styles_guider = { - position: 'absolute', - top: height_val + 16 + 'px', - left: from_val + 53 + "px", - height: '6px', //'5px', - color: 'black', - background: 'transparent', - width: Math.abs(to_val - from_val) - 6 + "px", - 'border-left': '5px solid ' + 'black', - 'border-right': '5px solid ' + 'black', - 'vertical-align': 'center', - } - - $('.scb_s_facs_chart_guider').css(styles_guider); - } + var unique_id = null; + + if (point_to_edit) { + unique_id = point_to_edit.unique_id; } - } + point_to_edit = null; + scb.ui.static.FacsView.reevaluate_metadata(state); + var gate_selected = _.find(state.facs_lane.canvas_metadata_analysis.points, function(e) { + return (e.from == from && e.to == to) || (unique_id && unique_id == e.unique_id) + }); + state.facs_lane.gate_selected = gate_selected.unique_id; + state.facs.apply_dna_analysis_to_all = false; + from = NaN; + $('.scb_s_facs_chart_helper').text(''); + + scb.ui.static.MainFrame.refresh(); + + } else { + /* from was not set, user just clicked on the plot or clicked and dragged but gate + * button was not selected */ + var selected_gate = _.filter(state.facs_lane.canvas_metadata_analysis.points, function(e) { + return px <= e.to && px >= e.from && Math.abs(e.y - py) <= sensitivity + }); + if (selected_gate.length >= 1) { + selected_gate = selected_gate[0]; + state.facs_lane.gate_selected = selected_gate.unique_id; + } + var number_of_gates = _.filter(state.facs_lane.canvas_metadata_analysis.points, function(e) { + return e.display_id == selected_gate.display_id + }); - var click = function (e) { - var srcElement = e.srcElement || e.target; - var px = xaxes.c2p(e.clientX - srcElement.getBoundingClientRect().left - plot.pointOffset({x: 0, y: 0}).left); - var py = yaxes.c2p(e.offsetY); - var fromy = py > 16 ? py : 16; - fromy = fromy > 90 ? 90 : fromy; - px = Math.round(px); - if (!state.facs.double_analysis) { - console.info("Click on: " + px + " " + py); - if (!isNaN(from)) { - var to = px; - - if(to < 0){ - to = 0; - }else if(to > max_x){ - to = max_x; - } - /* point to edit is defined only an existing gate bound is dragged */ - /* Last point to hover over */ - if (point_to_edit) { - _.each(state.facs_lane.canvas_metadata_analysis.points, function (x) { - if ( - point_to_edit.from == x.to && - Math.abs(point_to_edit.y - x.y) == 5 && - Math.abs(from - x.to) < sensitivity - ) - { - x.to = to; - } else if ( - point_to_edit.to == x.from && - Math.abs(point_to_edit.y - x.y) < 16 && - Math.abs(from - x.from) < sensitivity - ) - { - x.from = to; - } - }); - if (Math.abs(point_to_edit.from - from) < sensitivity) { - point_to_edit.from = to; - } else { - point_to_edit.to = to; - } - /* number of gates for this gate_id, can be 1 or 2 */ - var number_of_gates = _.filter(state.facs_lane.canvas_metadata_analysis.points, function (e) { - return e.display_id == point_to_edit.display_id - }); - - if (number_of_gates.length == 2) { /* this gate is a double gate */ - var selected_gate = null; - if (number_of_gates[0].from < number_of_gates[1].from) { - selected_gate = number_of_gates[0]; - } - else { - selected_gate = number_of_gates[1]; - } - - var from_val = Math.round(xaxes.p2c(selected_gate.from)); - var to_val = Math.round(xaxes.p2c(selected_gate.to)); - var height_val = Math.round(yaxes.p2c(selected_gate.y)); - var styles_guider = { - position: 'absolute', - top: height_val + 24 + 'px', - left: to_val + 53 + "px", - height: '6px', //'5px', - color: 'black', - background: 'black', - width: "5px", - 'border-left': 'none', - 'border-right': 'none', - 'vertical-align': 'center' - } - $('.scb_s_facs_chart_guider').css(styles_guider); - } else { - if (point_to_edit.from) { - - var from_val = Math.round(xaxes.p2c(point_to_edit.from)); - var to_val = Math.round(xaxes.p2c(point_to_edit.to)); - var height_val = Math.round(yaxes.p2c(point_to_edit.y)); - var styles_guider = { - position: 'absolute', - top: height_val + 16 + 'px', - left: from_val + 53 + "px", - height: '6px', //'5px', - color: 'black', - background: 'transparent', - width: Math.abs(to_val - from_val) - 6 + "px", - 'border-left': '5px solid ' + 'black', - 'border-right': '5px solid ' + 'black', - 'vertical-align': 'center' - } - state.facs_lane.gate_selected = point_to_edit.unique_id; - $('.scb_s_facs_chart_guider').css(styles_guider); - } - } - - } - else { - /* sample_analysis is set to true when (only) single gate is selected */ - /* after the single gate was placed want to set sample_analysis back to false */ - state.facs.sample_analysis = false; - /* need from and 'to' to go from left to right*/ - if (from > to){ - var swap = to; - to = from; - from = swap; - } - state.facs_lane.canvas_metadata_analysis.points.push({from: Math.round(from), to: Math.round(to), y: Math.round(fromy)}); - } - var unique_id = null; - - if (point_to_edit) { - unique_id = point_to_edit.unique_id; - } - point_to_edit = null; - scb.ui.static.FacsView.reevaluate_metadata(state); - var gate_selected=_.find(state.facs_lane.canvas_metadata_analysis.points, function (e) { - return (e.from == from && e.to == to) || (unique_id && unique_id == e.unique_id) - }); - state.facs_lane.gate_selected = gate_selected.unique_id; - state.facs.apply_dna_analysis_to_all = false; - from = NaN; - $('.scb_s_facs_chart_helper').text(''); - - scb.ui.static.MainFrame.refresh(); + if (number_of_gates.length == 2) { /* double gate */ + if (number_of_gates[0].from < number_of_gates[1].from) { + selected_gate = number_of_gates[0]; + } else { + selected_gate = number_of_gates[1]; + } + + var from_val = Math.round(xaxes.p2c(selected_gate.from)); + var to_val = Math.round(xaxes.p2c(selected_gate.to)); + var height_val = Math.round(yaxes.p2c(selected_gate.y)); + var styles_guider = { + position: 'absolute', + top: height_val + 24 + 'px', + left: to_val + 53 + "px", + height: '6px', //'5px', + color: 'black', + background: 'black', + width: "5px", + 'border-left': 'none', + 'border-right': 'none', + 'vertical-align': 'center', + } + $('.scb_s_facs_chart_guider').css(styles_guider); + + } else { + if (selected_gate.from) { + var from_val = Math.round(xaxes.p2c(selected_gate.from)); + var to_val = Math.round(xaxes.p2c(selected_gate.to)); + var height_val = Math.round(yaxes.p2c(selected_gate.y)); + var styles_guider = { + position: 'absolute', + top: height_val + 16 + 'px', + left: from_val + 53 + "px", + height: '6px', //'5px', + color: 'black', + background: 'transparent', + width: Math.abs(to_val - from_val) - 6 + "px", + 'border-left': '5px solid ' + 'black', + 'border-right': '5px solid ' + 'black', + 'vertical-align': 'center', } - else { - /* from was not set, user just clicked on the plot or clicked and dragged but gate - * button was not selected */ - var selected_gate = _.filter(state.facs_lane.canvas_metadata_analysis.points, function (e) { - return px <= e.to && px >= e.from && Math.abs(e.y - py) <= sensitivity - }); - if (selected_gate.length >= 1) { - selected_gate = selected_gate[0]; - state.facs_lane.gate_selected = selected_gate.unique_id; - } - var number_of_gates = _.filter(state.facs_lane.canvas_metadata_analysis.points, function (e) { - return e.display_id == selected_gate.display_id - }); - - if (number_of_gates.length == 2) { /* double gate */ - if (number_of_gates[0].from < number_of_gates[1].from) { - selected_gate = number_of_gates[0]; - } - else { - selected_gate = number_of_gates[1]; - } - - var from_val = Math.round(xaxes.p2c(selected_gate.from)); - var to_val = Math.round(xaxes.p2c(selected_gate.to)); - var height_val = Math.round(yaxes.p2c(selected_gate.y)); - var styles_guider = { - position: 'absolute', - top: height_val + 24 + 'px', - left: to_val + 53 + "px", - height: '6px', //'5px', - color: 'black', - background: 'black', - width: "5px", - 'border-left': 'none', - 'border-right': 'none', - 'vertical-align': 'center', - } - $('.scb_s_facs_chart_guider').css(styles_guider); - - } - else { - if (selected_gate.from) { - - var from_val = Math.round(xaxes.p2c(selected_gate.from)); - var to_val = Math.round(xaxes.p2c(selected_gate.to)); - var height_val = Math.round(yaxes.p2c(selected_gate.y)); - var styles_guider = { - position: 'absolute', - top: height_val + 16 + 'px', - left: from_val + 53 + "px", - height: '6px', //'5px', - color: 'black', - background: 'transparent', - width: Math.abs(to_val - from_val) - 6 + "px", - 'border-left': '5px solid ' + 'black', - 'border-right': '5px solid ' + 'black', - 'vertical-align': 'center', - } - $('.scb_s_facs_chart_guider').css(styles_guider); - } - - } - + $('.scb_s_facs_chart_guider').css(styles_guider); + } - } } - if (state.facs.double_analysis) { - console.log('click double analysis') - if(state.facs.gate_count == 0){ - from = 0; - fromy= py > 16 ? py: 16; - fromy = fromy > 90 ? 90: fromy; - from_point = {top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), - left: ($('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) }; - - var point = match(px, py); - point_to_edit = point; - if (!isNaN(from)) { - var to = px; - if(to < 0){ - to = 0; - }else if(to > max_x){ - to = max_x; - } - if (point_to_edit) { - if (Math.abs(point_to_edit.from - from) < sensitivity) { - point_to_edit.from = to; - } else { - point_to_edit.to = to; - } - }else { - state.facs_lane.canvas_metadata_analysis.points.push({from: Math.round(from), to: Math.round(to), y: Math.round(fromy)}); - } - point_to_edit = null; - state.facs_lane.bisector_gate_created = true; - scb.ui.static.FacsView.reevaluate_metadata(state); - - state.facs.apply_dna_analysis_to_all = false; - $('.scb_s_facs_chart_helper').text(''); - state.facs.midpoint.from = px; - state.facs.midpoint.from = state.facs.midpoint.from > 0 ? state.facs.midpoint.from : 0; - state.facs.midpoint.fromy= (py > 16 ? py: 16); - state.facs.midpoint.fromy = (state.facs.midpoint.fromy > 90 ? 90: state.facs.midpoint.fromy) -5 ; - state.facs.midpoint.from_point = {top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), - left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) }; - state.facs.midpoint.display_id = state.facs_lane.gates_id; - - - //second gate starts - console.info("SET FROM " + px); - from = px; - if(from < 0){ - from = 0; - }else if(from > max_x){ - from = max_x; - } - fromy= (py > 16 ? py: 16); - fromy = (fromy > 90 ? 90: fromy)-5; - from_point = {top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), - left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) }; - - var point = match(px, py-5); - point_to_edit = point; - - var to = max_x ; - if(to < 0){ - to = 0; - }else if(to > max_x){ - to = max_x; - } - if (point_to_edit) { - if (Math.abs(point_to_edit.from - from) < sensitivity) { - point_to_edit.from = to; - } else { - point_to_edit.to = to; - } - }else { - state.facs_lane.canvas_metadata_analysis.points.push({from: Math.round(from), to: Math.round(to), y: Math.round(fromy)}); - } - var unique_id = null; - if(point_to_edit){ - unique_id = point_to_edit.unique_id; - } - point_to_edit = null; - - scb.ui.static.FacsView.reevaluate_metadata(state); - state.facs_lane.gate_selected = _.find(state.facs_lane.canvas_metadata_analysis.points, function(e){ return (e.from == from && e.to == to) || (unique_id && unique_id == e.unique_id) }).unique_id; - - state.facs.gate_count=0; - state.facs.midpoint = {}; - state.facs.apply_dna_analysis_to_all = false; - from = NaN; - $('.scb_s_facs_chart_helper').text(''); - state.facs.double_analysis = false; - $('.scb_s_facs_double_range_button').button('disable'); - scb.ui.static.MainFrame.refresh(); - - } - } - } - }; - var match = function (px, py) { - var point = _.find(state.facs_lane.canvas_metadata_analysis.points, function (e) { - var overlap = (Math.abs(px - e.from) < 4 || Math.abs(px - e.to) < sensitivity) && (Math.abs(py - e.y) < 3) && e == state.facs_lane.selected_gate; - return overlap; - }); - return point; - } - var from = NaN; - var fromy = NaN; - var from_point = null; - var point_to_edit = null; - var move = function (e) { - var srcElement = e.srcElement || e.target; - var px = xaxes.c2p(e.clientX - srcElement.getBoundingClientRect().left - plot.pointOffset({x: 0, y: 0}).left); - var py = yaxes.c2p(e.offsetY); - px = Math.round(px); - var button = scb.utils.isDefined(e.buttons) ? e.buttons : e.which; - console.info(px + " " + from + " " + point_to_edit + " cb=" + button + " b=" + e.button + " bs=" + e.buttons); - - - if (!state.facs.double_analysis) { - window._dump_event = e; - var point = match(px, py); - /* button is one if mouse is clicked and dragged */ - if (button == 1 && isNaN(from) && (state.facs.sample_analysis || point)) { - console.info("SET FROM " + px); - /* from is set here after mouse down */ - from = px; - if(from < 0){ - from=0; - }else if(from> max_x){ - from=max_x; - } - fromy = py > 16 ? py : 16; - fromy = fromy > 90 ? 90 : fromy; - from_point = {top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), - left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) }; - - point = match(px, py); - point_to_edit = point; - } - /* Hovering over the canvas */ - if (button == 0 && isNaN(from)) { - point = match(px, py); - if (point) { /* hover over gate endpoint */ - $(plot.getPlaceholder()).css('cursor', 'ew-resize'); - } - else { - $(plot.getPlaceholder()).css('cursor', 'pointer'); - } - } - /* Changing width of already existing gate*/ - if (button == 1 && !isNaN(from)) { - var to_point = { - top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), - left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) - }; - var left = from_point.left > to_point.left; - var styles = { - position: 'absolute', - top: from_point.top + 'px', - left: Math.min(from_point.left, to_point.left) + "px", - height: (310 - from_point.top) + 'px', //'5px', - color: point_to_edit ? point_to_edit.c : 'black', - background: (point_to_edit ? ( left ? 'white' : 'white' ) : 'transparent'), - width: Math.abs(from_point.left - to_point.left) + "px", - 'vertical-align': 'center', - } - - var styles_guider = { - position: 'absolute', - top: '0px', - left: Math.min(from_point.left, to_point.left) + "px", - height: 310 + 'px', //'5px', - color: point_to_edit ? point_to_edit.c : 'black', - background: (point_to_edit ? ( left ? 'white' : 'white' ) : 'transparent'), - width: Math.abs(from_point.left - to_point.left) + "px", - 'border-left': (point_to_edit ? ( left ? '2px solid ' + 'black' : '1px solid black' ) : '2px dashed black'), - 'border-right': (point_to_edit ? ( !left ? '2px solid ' + 'black' : '1px solid black' ) : '2px dashed black'), - 'vertical-align': 'center', - } - console.info(styles); - $('.scb_s_facs_chart_helper').css(styles); - $('.scb_s_facs_chart_guider').css(styles_guider); - if (point_to_edit) { - console.info("ew" + px); - $(plot.getPlaceholder()).css('cursor', 'ew-resize'); - } - else { - console.info("pt" + px); - $(plot.getPlaceholder()).css('cursor', 'pointer'); - } - } - if (button == 0 && !isNaN(from)) { - /* if the user drew the gate beyond the bounds of the canvas - * still create a gate */ - var to = px; - if(to < 0){ - to = 0; - }else if(to > max_x){ - to = max_x; - } - state.facs_lane.canvas_metadata_analysis.points.push({from: Math.round(from), to: Math.round(to), y: Math.round(fromy)}); - scb.ui.static.FacsView.reevaluate_metadata(state); - state.facs.apply_dna_analysis_to_all = false; - from = NaN; - scb.ui.static.MainFrame.refresh(); - } - } - else if (state.facs.double_analysis) { - console.log('double.analysis for move'); - window._dump_event = e; - console.log(state.facs.gate_count); - console.log(from); - console.info('stats:' + button + ' ' + isNaN(from)); - if (button == 0 && !isNaN(from) && (state.facs.gate_count == 1 || state.facs.gate_count == 2)) { - var to_point = { - top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), - left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) - }; - var left = from_point.left > to_point.left; - var styles = { - position: 'absolute', - top: from_point.top + 'px', - left: Math.min(from_point.left, to_point.left) + "px", - height: (310 - from_point.top) + 'px', //'5px', - color: point_to_edit ? point_to_edit.c : 'black', - background: (point_to_edit ? ( left ? 'white' : 'white' ) : '#808080'), - width: Math.abs(from_point.left - to_point.left) + "px", - 'border-left': (point_to_edit ? ( left ? '2px solid ' + 'black' : '1px solid black' ) : '2px solid black'), - 'border-right': (point_to_edit ? ( !left ? '2px solid ' + 'black' : '1px solid black' ) : '2px solid black'), - 'vertical-align': 'center', - } - console.info(styles); - $('.scb_s_facs_chart_helper').css(styles); - if (point_to_edit) { - console.info("ew" + px); - $(plot.getPlaceholder()).css('cursor', 'ew-resize'); - } - else { - console.info("pt" + px); - $(plot.getPlaceholder()).css('cursor', 'pointer'); - } - } - //if buttons is released and there is not a starting point, just browsing the screen - if (button == 0 && isNaN(from)) { - var styles = { - position: 'absolute', - top: '0px', - left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + "px", - height: (310) + 'px', //'5px', - background: 'black', - width: "2px", - 'vertical-align': 'center', - }; - - $('.scb_s_facs_chart_helper').css(styles); - // is it over line? - var point = match(px, py); - if (point) { - console.info("ew" + px); - $(plot.getPlaceholder()).css('cursor', 'ew-resize'); - } - else { - console.info("pt" + px); - $(plot.getPlaceholder()).css('cursor', 'pointer'); - } - console.info(point); + } + } + if (state.facs.double_analysis) { + console.log('click double analysis') + if (state.facs.gate_count == 0) { + from = 0; + fromy = py > 16 ? py : 16; + fromy = fromy > 90 ? 90 : fromy; + from_point = { + top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), + left: ($('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + }; + + var point = match(px, py); + point_to_edit = point; + if (!isNaN(from)) { + var to = px; + if (to < 0) { + to = 0; + } else if (to > max_x) { + to = max_x; + } + if (point_to_edit) { + if (Math.abs(point_to_edit.from - from) < sensitivity) { + point_to_edit.from = to; + } else { + point_to_edit.to = to; } - //if button depressed and there is a starting point - if (button == 1 && isNaN(from) && (state.facs.gate_count == 0)) { - -// console.info("SET FROM " + px); -// from = px; -// from = from > 0 ? from : 0; -// from = from > scb.ui.static.FacsView.MAX_GATE ? scb.ui.static.FacsView.MAX_GATE : from; -// from = from < 0 ? 0 : from; -// fromy= py > 16 ? py: 16; -// fromy = fromy > 90 ? 90: fromy; -// from_point = {top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), -// left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) }; -// -// var point = match(px, py); -// point_to_edit = point; - + } else { + state.facs_lane.canvas_metadata_analysis.points.push({ + from: Math.round(from), + to: Math.round(to), + y: Math.round(fromy) + }); + } + point_to_edit = null; + state.facs_lane.bisector_gate_created = true; + scb.ui.static.FacsView.reevaluate_metadata(state); + + state.facs.apply_dna_analysis_to_all = false; + $('.scb_s_facs_chart_helper').text(''); + state.facs.midpoint.from = px; + state.facs.midpoint.from = state.facs.midpoint.from > 0 ? state.facs.midpoint.from : 0; + state.facs.midpoint.fromy = (py > 16 ? py : 16); + state.facs.midpoint.fromy = (state.facs.midpoint.fromy > 90 ? 90 : state.facs.midpoint.fromy) - 5; + state.facs.midpoint.from_point = { + top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), + left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + }; + state.facs.midpoint.display_id = state.facs_lane.gates_id; + + + //second gate starts + console.info("SET FROM " + px); + from = px; + if (from < 0) { + from = 0; + } else if (from > max_x) { + from = max_x; + } + fromy = (py > 16 ? py : 16); + fromy = (fromy > 90 ? 90 : fromy) - 5; + from_point = { + top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), + left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + }; + + var point = match(px, py - 5); + point_to_edit = point; + + var to = max_x; + if (to < 0) { + to = 0; + } else if (to > max_x) { + to = max_x; + } + if (point_to_edit) { + if (Math.abs(point_to_edit.from - from) < sensitivity) { + point_to_edit.from = to; + } else { + point_to_edit.to = to; } - if (button == 1 && !isNaN(from) && (state.facs.gate_count == 0)) { - + } else { + state.facs_lane.canvas_metadata_analysis.points.push({ + from: Math.round(from), + to: Math.round(to), + y: Math.round(fromy) + }); + } + var unique_id = null; + if (point_to_edit) { + unique_id = point_to_edit.unique_id; + } + point_to_edit = null; + + scb.ui.static.FacsView.reevaluate_metadata(state); + state.facs_lane.gate_selected = _.find(state.facs_lane.canvas_metadata_analysis.points, function(e) { + return (e.from == from && e.to == to) || (unique_id && unique_id == e.unique_id) + }).unique_id; + + state.facs.gate_count = 0; + state.facs.midpoint = {}; + state.facs.apply_dna_analysis_to_all = false; + from = NaN; + $('.scb_s_facs_chart_helper').text(''); + state.facs.double_analysis = false; + $('.scb_s_facs_double_range_button').button('disable'); + scb.ui.static.MainFrame.refresh(); -// state.facs.gate_count= scb.ui.static.FacsView.MAX_GATE ; -// var to_point = { -// top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), -// left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) -// }; -// var left = from_point.left > to_point.left; -// if (point_to_edit) { -// console.info("ew" + px); -// $(plot.getPlaceholder()).css('cursor', 'ew-resize'); -// } -// else { -// console.info("pt" + px); -// $(plot.getPlaceholder()).css('cursor', 'pointer'); -// } + } + } + } + }; + var match = function(px, py) { + var point = _.find(state.facs_lane.canvas_metadata_analysis.points, function(e) { + var overlap = (Math.abs(px - e.from) < 4 || Math.abs(px - e.to) < sensitivity) && (Math.abs(py - e.y) < 3) && e == state.facs_lane.selected_gate; + return overlap; + }); + return point; + } + var from = NaN; + var fromy = NaN; + var from_point = null; + var point_to_edit = null; + var move = function(e) { + var srcElement = e.srcElement || e.target; + var px = xaxes.c2p(e.clientX - srcElement.getBoundingClientRect().left - plot.pointOffset({ + x: 0, + y: 0 + }).left); + var py = yaxes.c2p(e.offsetY); + px = Math.round(px); + var button = scb.utils.isDefined(e.buttons) ? e.buttons : e.which; + console.info(px + " " + from + " " + point_to_edit + " cb=" + button + " b=" + e.button + " bs=" + e.buttons); + + + if (!state.facs.double_analysis) { + window._dump_event = e; + var point = match(px, py); + /* button is one if mouse is clicked and dragged */ + if (button == 1 && isNaN(from) && (state.facs.sample_analysis || point)) { + console.info("SET FROM " + px); + /* from is set here after mouse down */ + from = px; + if (from < 0) { + from = 0; + } else if (from > max_x) { + from = max_x; + } + fromy = py > 16 ? py : 16; + fromy = fromy > 90 ? 90 : fromy; + from_point = { + top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), + left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + }; + + point = match(px, py); + point_to_edit = point; + } + /* Hovering over the canvas */ + if (button == 0 && isNaN(from)) { + point = match(px, py); + if (point) { /* hover over gate endpoint */ + $(plot.getPlaceholder()).css('cursor', 'ew-resize'); + } else { + $(plot.getPlaceholder()).css('cursor', 'pointer'); + } + } + /* Changing width of already existing gate*/ + if (button == 1 && !isNaN(from)) { + var to_point = { + top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), + left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + }; + var left = from_point.left > to_point.left; + var styles = { + position: 'absolute', + top: from_point.top + 'px', + left: Math.min(from_point.left, to_point.left) + "px", + height: (310 - from_point.top) + 'px', //'5px', + color: point_to_edit ? point_to_edit.c : 'black', + background: (point_to_edit ? (left ? 'white' : 'white') : 'transparent'), + width: Math.abs(from_point.left - to_point.left) + "px", + 'vertical-align': 'center', + } - } + var styles_guider = { + position: 'absolute', + top: '0px', + left: Math.min(from_point.left, to_point.left) + "px", + height: 310 + 'px', //'5px', + color: point_to_edit ? point_to_edit.c : 'black', + background: (point_to_edit ? (left ? 'white' : 'white') : 'transparent'), + width: Math.abs(from_point.left - to_point.left) + "px", + 'border-left': (point_to_edit ? (left ? '2px solid ' + 'black' : '1px solid black') : '2px dashed black'), + 'border-right': (point_to_edit ? (!left ? '2px solid ' + 'black' : '1px solid black') : '2px dashed black'), + 'vertical-align': 'center', + } + console.info(styles); + $('.scb_s_facs_chart_helper').css(styles); + $('.scb_s_facs_chart_guider').css(styles_guider); + if (point_to_edit) { + console.info("ew" + px); + $(plot.getPlaceholder()).css('cursor', 'ew-resize'); + } else { + console.info("pt" + px); + $(plot.getPlaceholder()).css('cursor', 'pointer'); + } + } + + if (button == 0 && !isNaN(from)) { + /* if the user drew the gate beyond the bounds of the canvas + * still create a gate */ + var to = px; + if (to < 0) { + to = 0; + } else if (to > max_x) { + to = max_x; } + state.facs_lane.canvas_metadata_analysis.points.push({ + from: Math.round(from), + to: Math.round(to), + y: Math.round(fromy) + }); + scb.ui.static.FacsView.reevaluate_metadata(state); + state.facs.apply_dna_analysis_to_all = false; + from = NaN; + scb.ui.static.MainFrame.refresh(); + } + } else if (state.facs.double_analysis) { + console.log('double.analysis for move'); + window._dump_event = e; + console.log(state.facs.gate_count); + console.log(from); + console.info('stats:' + button + ' ' + isNaN(from)); + if (button == 0 && !isNaN(from) && (state.facs.gate_count == 1 || state.facs.gate_count == 2)) { + var to_point = { + top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), + left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + }; + var left = from_point.left > to_point.left; + var styles = { + position: 'absolute', + top: from_point.top + 'px', + left: Math.min(from_point.left, to_point.left) + "px", + height: (310 - from_point.top) + 'px', //'5px', + color: point_to_edit ? point_to_edit.c : 'black', + background: (point_to_edit ? (left ? 'white' : 'white') : '#808080'), + width: Math.abs(from_point.left - to_point.left) + "px", + 'border-left': (point_to_edit ? (left ? '2px solid ' + 'black' : '1px solid black') : '2px solid black'), + 'border-right': (point_to_edit ? (!left ? '2px solid ' + 'black' : '1px solid black') : '2px solid black'), + 'vertical-align': 'center', + } + console.info(styles); + $('.scb_s_facs_chart_helper').css(styles); + if (point_to_edit) { + console.info("ew" + px); + $(plot.getPlaceholder()).css('cursor', 'ew-resize'); + } else { + console.info("pt" + px); + $(plot.getPlaceholder()).css('cursor', 'pointer'); + } + } + //if buttons is released and there is not a starting point, just browsing the screen + if (button == 0 && isNaN(from)) { + var styles = { + position: 'absolute', + top: '0px', + left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + "px", + height: (310) + 'px', //'5px', + background: 'black', + width: "2px", + 'vertical-align': 'center', + }; + + $('.scb_s_facs_chart_helper').css(styles); + // is it over line? + var point = match(px, py); + if (point) { + console.info("ew" + px); + $(plot.getPlaceholder()).css('cursor', 'ew-resize'); + } else { + console.info("pt" + px); + $(plot.getPlaceholder()).css('cursor', 'pointer'); + } + console.info(point); + } + //if button depressed and there is a starting point + if (button == 1 && isNaN(from) && (state.facs.gate_count == 0)) { + + // console.info("SET FROM " + px); + // from = px; + // from = from > 0 ? from : 0; + // from = from > scb.ui.static.FacsView.MAX_GATE ? scb.ui.static.FacsView.MAX_GATE : from; + // from = from < 0 ? 0 : from; + // fromy= py > 16 ? py: 16; + // fromy = fromy > 90 ? 90: fromy; + // from_point = {top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), + // left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) }; + // + // var point = match(px, py); + // point_to_edit = point; + + } + if (button == 1 && !isNaN(from) && (state.facs.gate_count == 0)) { + + + // state.facs.gate_count= scb.ui.static.FacsView.MAX_GATE ; + // var to_point = { + // top: (e.clientY - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().top), + // left: (e.clientX - $('.scb_s_facs_chart_wrapper', '.scb_s_facs_view').get(0).getBoundingClientRect().left) + // }; + // var left = from_point.left > to_point.left; + // if (point_to_edit) { + // console.info("ew" + px); + // $(plot.getPlaceholder()).css('cursor', 'ew-resize'); + // } + // else { + // console.info("pt" + px); + // $(plot.getPlaceholder()).css('cursor', 'pointer'); + // } + + + } } - eventHolder.click(click); - eventHolder.mousemove(move); + } + eventHolder.click(click); + eventHolder.mousemove(move); } ], - draw: [ function (plot, canvascontext) { - var xaxes = plot.getXAxes()[0]; - var yaxes = plot.getYAxes()[0]; + draw: [function(plot, canvascontext) { + var xaxes = plot.getXAxes()[0]; + var yaxes = plot.getYAxes()[0]; - var points = state.facs_lane.canvas_metadata_analysis.points.length > 0 ? state.facs_lane.canvas_metadata_analysis.points : []; - _.each(points, function (p) { - var y_coord = yaxes.p2c(p.y); - var x_coord = xaxes.p2c((p.to - p.from) / 2 + p.from); - canvascontext.fillText(p.display_id + ' ' + p.bisector_id, x_coord + 20, y_coord - 2); - }); - console.log('draw_overlay'); + var points = state.facs_lane.canvas_metadata_analysis.points.length > 0 ? state.facs_lane.canvas_metadata_analysis.points : []; + _.each(points, function(p) { + var y_coord = yaxes.p2c(p.y); + var x_coord = xaxes.p2c((p.to - p.from) / 2 + p.from); + canvascontext.fillText(p.display_id + ' ' + p.bisector_id, x_coord + 20, y_coord - 2); + }); + console.log('draw_overlay'); - } - ] - }; - scb.ui.static.FacsView.reevaluate_metadata(state); - if (state.chart) { - //Canvas is drawn here - $.plot(state.chart, state.facs_lane.canvas_metadata.data, state.facs_lane.canvas_metadata.options); } + ] + }; + scb.ui.static.FacsView.reevaluate_metadata(state); + if (state.chart) { + //Canvas is drawn here + $.plot(state.chart, state.facs_lane.canvas_metadata.data, state.facs_lane.canvas_metadata.options); + } }; -scb.ui.static.FacsView.charts = function (workarea) { - $('.scb_s_facs_chart').each(function () { +scb.ui.static.FacsView.charts = function(workarea) { + $('.scb_s_facs_chart').each(function() { - var chart = $(this); - var parsed = scb.ui.static.FacsView.parse(this); - parsed = resetScrollValue(parsed); + var chart = $(this); + var parsed = scb.ui.static.FacsView.parse(this); + parsed = resetScrollValue(parsed); - parsed.chart = chart; - scb.ui.static.FacsView.evaluate_chart(parsed); - }) + parsed.chart = chart; + scb.ui.static.FacsView.evaluate_chart(parsed); + }) } scb.ui.FacsView = function scb_ui_FacsView(gstate) { - var self = this; - - self.show = function (state) { - - var workarea = gstate.workarea; - var template = state.assignment.template; - var rows_state = state.facs.rows_state(); - - var can_prepare_lysate = rows_state.valid > 0; - var kind = 'sample_prep'; - if (state.facs.sample_prepared) { - kind = 'analyze'; - if (state.facs && state.facs.selected_lane) { - scb.ui.static.FacsView.reevaluate_metadata({ - facs: state.facs, - facs_lane: state.facs.selected_lane, - assignment: state.assignment - }); - } - } + var self = this; + + self.show = function(state) { + + var workarea = gstate.workarea; + var template = state.assignment.template; + var rows_state = state.facs.rows_state(); + + var can_prepare_lysate = rows_state.valid > 0; + var kind = 'sample_prep'; + if (state.facs.sample_prepared) { + kind = 'analyze'; + if (state.facs && state.facs.selected_lane) { + scb.ui.static.FacsView.reevaluate_metadata({ + facs: state.facs, + facs_lane: state.facs.selected_lane, + assignment: state.assignment + }); + } + } - state.experiment.last_technique_view = 'facs'; - var scroll_num = 0; - if ($('.scb_s_facs_samples_table').length == 0) - scroll_num = scb.ui.static.FacsView.TOTAL_SCROLL; - else - scroll_num = $('.scb_s_facs_samples_table', '.scb_s_facs_view').get(0).scrollTop; - - - workarea.html(scb_facs.main({ - global_template: gstate.context.master_model, - assignment: state.assignment, - experiment: state.experiment, - context: gstate.context, - facs: state.facs, - t: template, - rows: rows_state.rows, - rows_valid: rows_state.valid, - kind: kind, - last_step: state.experiment.last_step, - prev_step: state.experiment.prev_step, - kinds: template.facs_kinds, - can_prepare_lysate: can_prepare_lysate - })); - - - if (kind == 'sample_prep'){ - $('.scb_s_facs_samples_table', '.scb_s_facs_view').scrollTop(state.facs.prep_scroll); - }else{ - $('.scb_s_facs_choose_samples_order_list', '.scb_s_facs_view').scrollTop(state.facs.samples_scroll); - } - state.experiment.prev_step = scb.ui.static.FacsView.TOTAL_STEPS; - if (state.experiment.last_step >= scb.ui.static.FacsView.TOTAL_STEPS) - state.experiment.last_step = 6; - state.experiment.last_technique = 'FLOW CYTOMETRY'; - state.experiment.last_id = state.facs.id; - state.experiment.last_param = 'facs_id'; - - - document.title = "FACS - StarCellBio"; - - state.facs.parent.selected_id = state.facs.id; - state.experiment.last_view = 'facs'; - state.experiment.last_technique_view = state.experiment.last_view; - if(state.facs.parent.start_tabs_index <= 0){ - state.facs.parent.start_tabs_index = 0; - $('.scb_s_facs_left_facs').prop('disabled', true); - $('.scb_s_facs_right_facs').prop('disabled', false); - } - else $('.scb_s_facs_left_facs').prop('disabled', false); - - if(state.facs.parent.start_tabs_index + scb.ui.static.FacsView.TOTAL_TABS-1 ==state.facs.parent.list.length-1){ - $('.scb_s_facs_right_facs').prop('disabled', true); - $('.scb_s_facs_left_facs').prop('disabled', false); - } - else $('.scb_s_facs_right_facs').prop('disabled', false); - if (state.facs.samples_finished) { - scb.ui.static.FacsView.charts(workarea); - } - else { - $('.scb_s_facs_samples_graph_area').css('opacity', '.25'); - $('.scb_s_facs_samples_graph_area button').prop('disabled', true); - } + state.experiment.last_technique_view = 'facs'; + var scroll_num = 0; + if ($('.scb_s_facs_samples_table').length == 0) { + scroll_num = scb.ui.static.FacsView.TOTAL_SCROLL; + } else { + scroll_num = $('.scb_s_facs_samples_table', '.scb_s_facs_view').get(0).scrollTop; + } - $("label[for='scb_facs_check']", '.scb_s_facs_view').attr('title', 'Single gate'); - $("label[for='scb_facs_check2']", '.scb_s_facs_view').attr('title', 'Bisector gate'); - $("label[class='scb_s_facs_label']", '.scb_s_facs_view').tooltip(); + workarea.html(scb_facs.main({ + global_template: gstate.context.master_model, + assignment: state.assignment, + experiment: state.experiment, + context: gstate.context, + facs: state.facs, + t: template, + rows: rows_state.rows, + rows_valid: rows_state.valid, + kind: kind, + last_step: state.experiment.last_step, + prev_step: state.experiment.prev_step, + kinds: template.facs_kinds, + can_prepare_lysate: can_prepare_lysate + })); + + + if (kind == 'sample_prep') { + $('.scb_s_facs_samples_table', '.scb_s_facs_view').scrollTop(state.facs.prep_scroll); + } else { + $('.scb_s_facs_choose_samples_order_list', '.scb_s_facs_view').scrollTop(state.facs.samples_scroll); + } + state.experiment.prev_step = scb.ui.static.FacsView.TOTAL_STEPS; + if (state.experiment.last_step >= scb.ui.static.FacsView.TOTAL_STEPS) { + state.experiment.last_step = 6; + } + state.experiment.last_technique = 'FLOW CYTOMETRY'; + state.experiment.last_id = state.facs.id; + state.experiment.last_param = 'facs_id'; - _.each($(".scb_s_experiment_step_button"), function (e) { - if (!$(e).hasClass('scb_s_experiment_step_visited')) - $(e).attr('title', 'To use this button, start a new ' + $(e).text() + ' Experiment.'); - else $(e).removeAttr('title'); - }); - $(".scb_s_facs_selected").keypress(function (e) { - return e.which != 13; - }); - if (kind == 'analyze') { - $('.scb_s_facs_single_range_button').button(); - $('.scb_s_facs_double_range_button').button(); - if (state.facs.samples_finished && state.facs.selected_lane.bisector_gate_created) - $('.scb_s_facs_double_range_button').button('disable'); + document.title = "FACS - StarCellBio"; - } + state.facs.parent.selected_id = state.facs.id; + state.experiment.last_view = 'facs'; + state.experiment.last_technique_view = state.experiment.last_view; + if (state.facs.parent.start_tabs_index <= 0) { + state.facs.parent.start_tabs_index = 0; + $('.scb_s_facs_left_facs').prop('disabled', true); + $('.scb_s_facs_right_facs').prop('disabled', false); + } else { + $('.scb_s_facs_left_facs').prop('disabled', false); + } - var elem = document.getElementById('slider'); - window.mySwipe = Swipe(elem, { - continuous: false, - disableScroll: true, - transitionEnd: function(index, element) { - $('.slider_dots li').attr('class',''); - $($('.slider_dots li')[index]).attr('class','on');} - }); - document.body.scrollTop = state.experiment.last_scroll; + if (state.facs.parent.start_tabs_index + scb.ui.static.FacsView.TOTAL_TABS - 1 == state.facs.parent.list.length - 1) { + $('.scb_s_facs_right_facs').prop('disabled', true); + $('.scb_s_facs_left_facs').prop('disabled', false); + } else { + $('.scb_s_facs_right_facs').prop('disabled', false); + } + if (state.facs.samples_finished) { + scb.ui.static.FacsView.charts(workarea); + } else { + $('.scb_s_facs_samples_graph_area').css('opacity', '.25'); + $('.scb_s_facs_samples_graph_area button').prop('disabled', true); + } - $('#main').css({ - position: 'absolute', - left: ($(window).width() - $('#main').outerWidth()) / 2, - top: 0 - }); - $(window).resize(function () { + $("label[for='scb_facs_check']", '.scb_s_facs_view').attr('title', 'Single gate'); + $("label[for='scb_facs_check2']", '.scb_s_facs_view').attr('title', 'Bisector gate'); - $('#main').css({ - position: 'absolute', - left: ($(window).width() - $('#main').outerWidth()) / 2, - top: ($(window).height() - $('#main').outerHeight()) / 2 - }); + $("label[class='scb_s_facs_label']", '.scb_s_facs_view').tooltip(); + + _.each($(".scb_s_experiment_step_button"), function(e) { + if (!$(e).hasClass('scb_s_experiment_step_visited')) { + $(e).attr('title', 'To use this button, start a new ' + $(e).text() + ' Experiment.'); + } else { + $(e).removeAttr('title'); + } + }); + $(".scb_s_facs_selected").keypress(function(e) { + return e.which != 13; + }); + + if (kind == 'analyze') { + $('.scb_s_facs_single_range_button').button(); + $('.scb_s_facs_double_range_button').button(); + if (state.facs.samples_finished && state.facs.selected_lane.bisector_gate_created) { + $('.scb_s_facs_double_range_button').button('disable'); + } - }); } + + var elem = document.getElementById('slider'); + window.mySwipe = Swipe(elem, { + continuous: false, + disableScroll: true, + transitionEnd: function(index, element) { + $('.slider_dots li').attr('class', ''); + $($('.slider_dots li')[index]).attr('class', 'on'); + } + }); + document.body.scrollTop = state.experiment.last_scroll; + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + } } diff --git a/html_app/ui/HomepageView.js b/html_app/ui/HomepageView.js index 5cd84b2f..bb0e4100 100644 --- a/html_app/ui/HomepageView.js +++ b/html_app/ui/HomepageView.js @@ -1,226 +1,234 @@ 'use strict'; -if( typeof (scb.ui ) == 'undefined') { - scb.ui = {}; +if (typeof (scb.ui) == 'undefined') { + scb.ui = {}; } scb.ui.static = scb.ui.static || {}; scb.ui.static.HomepageView = scb.ui.static.HomepageView || {} ; -scb.ui.static.HomepageView.select_list_item = function(element,workarea,aria) -{ - $('.learn_more_dynamic').attr('value', $(element).attr('value')); - $('.scb_s_homepage_experimental_design_bullet_item').attr('aria-selected', false); - $(element).attr('aria-selected', true); - var name = 'experimental_design_'+$(element).attr('data-id'); - var template = scb_homepage[name]; - if( template ) - { - $('.scb_s_homepage_experimental_design_list_info',workarea).html(template({})).attr('aria-live',aria?'polite':'off'); - $('.scb_s_homepage_experimental_design_bullet_item').removeClass('scb_s_homepage_experimental_design_bullet_item_selected'); - $(element).addClass('scb_s_homepage_experimental_design_bullet_item_selected'); - - } - else - { - $('.scb_s_homepage_experimental_design_list_info',workarea).html(" can not found " + name ); - - } +scb.ui.static.HomepageView.select_list_item = function(element, workarea, aria) { + $('.learn_more_dynamic').attr('value', $(element).attr('value')); + $('.scb_s_homepage_experimental_design_bullet_item').attr('aria-selected', false); + $(element).attr('aria-selected', true); + var name = 'experimental_design_' + $(element).attr('data-id'); + var template = scb_homepage[name]; + if (template) { + $('.scb_s_homepage_experimental_design_list_info', workarea).html(template({})).attr('aria-live', aria ? 'polite' : 'off'); + $('.scb_s_homepage_experimental_design_bullet_item').removeClass('scb_s_homepage_experimental_design_bullet_item_selected'); + $(element).addClass('scb_s_homepage_experimental_design_bullet_item_selected'); + + } else { + $('.scb_s_homepage_experimental_design_list_info', workarea).html(" can not found " + name); + + } } scb.ui.static.HomepageView.register = function(workarea) { - scb.utils.off_on(workarea, 'click', '.scb_s_homepage_experimental_design_bullet_item', function (e) { - scb.ui.static.HomepageView.select_list_item(this,workarea,true); - }); - - - scb.utils.off_on(workarea, 'click', '.learn_more_dynamic', function (e) { - var pop_string = $(this).attr('value'); - var url = "static/ref_lib/full_library.html#"+pop_string; - var popoutWindow =window.open("static/ref_lib/full_library.html#"+pop_string); + scb.utils.off_on(workarea, 'click', '.scb_s_homepage_experimental_design_bullet_item', function(e) { + scb.ui.static.HomepageView.select_list_item(this, workarea, true); + }); + + + scb.utils.off_on(workarea, 'click', '.learn_more_dynamic', function(e) { + var pop_string = $(this).attr('value'); + var url = "static/ref_lib/full_library.html#" + pop_string; + var popoutWindow = window.open("static/ref_lib/full_library.html#" + pop_string); + + }); + scb.utils.off_on(workarea, 'click', '.scb_f_create_student_account', function(e) { + + $(workarea).append(scb_auth.signup({})); + scb.utils.off_on(workarea, 'click', '.scb_f_signup_close_button', function() { + $('.scb_s_signup_dialog').detach(); }); - - scb.utils.off_on(workarea, 'click', '.scb_f_create_student_account', function (e) { - - $(workarea).append(scb_auth.signup({})); - scb.utils.off_on(workarea, 'click', '.scb_f_signup_close_button', function () { - $('.scb_s_signup_dialog').detach(); - }); - $('.scb_f_signup_iframe').load(function(){ - var iframe = $('.scb_f_signup_iframe').get(0); - var content = (iframe.contentDocument || iframe.contentWindow); - content.body.style.fontSize = '90%'; - content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; - var inputs = content.getElementsByTagName('button'); - $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); - var fieldset = content.querySelectorAll('fieldset'); - $(fieldset).children().wrap('

'); - var texts = content.querySelectorAll('input'); - $(texts).attr('placeholder', ''); - $(texts).css('font-family', 'Trebuchet MS, sans-serif'); - - var iframe = $('.scb_f_signup_iframe').contents(); - iframe.find('input[type="checkbox"]').css('height', '12px'); - iframe.find('input[type="radio"][value="student"]').attr('checked', 'checked'); - iframe.find('#toggle_message').html( - 'Your instructor should have provided you with a code that you need ' + - 'to enter below to register and use this StarCellBio tool. Please contact ' + - 'your instructor if you have not received this code. You will receive an ' + - 'email to confirm your account.

Your work will be saved in this account.' - ); - iframe.find(".auth_submit_button").click(function(){ - var mask = document.createElement('div'); - mask.className='overlay'; - $(mask).css({'width': '100%','height': '100%','position': 'fixed', 'z-index': '993', 'background': 'rgba(125,125,125,0.7)', 'visibility': 'visible'}); - $('body').prepend(mask); - var progress_icon = document.createElement('img'); - progress_icon.src = '../../../images/homepage/ajax_loader.gif'; - progress_icon.style.marginLeft = '50%'; - progress_icon.style.marginTop= '50%'; - - $('.overlay').append(progress_icon); - - $('.scb_f_signup_iframe').hide(); - $('.scb_f_signup_iframe').load(function(){ - var profile = $('.scb_f_signup_iframe').contents().get(0); - if(profile.body.textContent.indexOf('confirmed') >0){ - parent.document.location.reload(); - - } - - else{ - $(mask).remove(); - $('.scb_f_signup_iframe').show(); - if($('.scb_f_signup_iframe').contents().find('.login_submit').length >0) - $('.scb_f_signup_iframe').contents().find('#errorMsg').html('Incorrect username or password. Try again'); - - } - }); - }); - }); - + $('.scb_f_signup_iframe').load(function() { + var iframe = $('.scb_f_signup_iframe').get(0); + var content = (iframe.contentDocument || iframe.contentWindow); + content.body.style.fontSize = '90%'; + content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; + var inputs = content.getElementsByTagName('button'); + $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); + var fieldset = content.querySelectorAll('fieldset'); + $(fieldset).children().wrap('

'); + var texts = content.querySelectorAll('input'); + $(texts).attr('placeholder', ''); + $(texts).css('font-family', 'Trebuchet MS, sans-serif'); + + var iframe = $('.scb_f_signup_iframe').contents(); + iframe.find('input[type="checkbox"]').css('height', '12px'); + iframe.find('input[type="radio"][value="student"]').attr('checked', 'checked'); + iframe.find('#toggle_message').html( + 'Your instructor should have provided you with a code that you need ' + + 'to enter below to register and use this StarCellBio tool. Please contact ' + + 'your instructor if you have not received this code. You will receive an ' + + 'email to confirm your account.

Your work will be saved in this account.' + ); + iframe.find(".auth_submit_button").click(function() { + var mask = document.createElement('div'); + mask.className = 'overlay'; + $(mask).css({ + 'width': '100%', + 'height': '100%', + 'position': 'fixed', + 'z-index': '993', + 'background': 'rgba(125,125,125,0.7)', + 'visibility': 'visible' + }); + $('body').prepend(mask); + var progress_icon = document.createElement('img'); + progress_icon.src = '../../../images/homepage/ajax_loader.gif'; + progress_icon.style.marginLeft = '50%'; + progress_icon.style.marginTop = '50%'; + + $('.overlay').append(progress_icon); + + $('.scb_f_signup_iframe').hide(); + $('.scb_f_signup_iframe').load(function() { + var profile = $('.scb_f_signup_iframe').contents().get(0); + if (profile.body.textContent.indexOf('confirmed') > 0) { + parent.document.location.reload(); + + } else { + $(mask).remove(); + $('.scb_f_signup_iframe').show(); + if ($('.scb_f_signup_iframe').contents().find('.login_submit').length > 0) { + $('.scb_f_signup_iframe').contents().find('#errorMsg').html('Incorrect username or password. Try again'); + } + + } + }); + }); }); + }); + + + + scb.utils.off_on(workarea, 'click', '.scb_s_homepage_see_more_button', function(e) { + alert("under construction!"); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_create_instructors_account', function(e) { - scb.utils.off_on(workarea, 'click', '.scb_s_homepage_see_more_button', function (e) { - alert( "under construction!"); + $(workarea).append(scb_auth.signup({})); + scb.utils.off_on(workarea, 'click', '.scb_f_signup_close_button', function() { + $('.scb_s_signup_dialog').detach(); }); - scb.utils.off_on(workarea, 'click', '.scb_f_create_instructors_account', function (e) { - - - $(workarea).append(scb_auth.signup({})); - scb.utils.off_on(workarea, 'click', '.scb_f_signup_close_button', function () { - $('.scb_s_signup_dialog').detach(); - }); - $('.scb_f_signup_iframe').load(function(){ - - var iframe = $('.scb_f_signup_iframe').get(0); - var content = (iframe.contentDocument || iframe.contentWindow); - content.body.style.fontSize = '90%'; - content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; - var inputs = content.getElementsByTagName('button'); - $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); - var fieldset = content.querySelectorAll('fieldset'); - $(fieldset).children().wrap('

'); - var texts = content.querySelectorAll('input'); - $(texts).attr('placeholder', ''); - $(texts).css('font-family', 'Trebuchet MS, sans-serif'); - - var iframe = $('.scb_f_signup_iframe').contents(); - iframe.find('input[type="checkbox"]').css('height', '12px'); - iframe.find('input[type="radio"][value="instructor"]').attr('checked', 'checked'); - iframe.find('#div_id_course_code').css('display', 'none'); - iframe.find('#toggle_message').text( - "In the instructor account, instructors set up and customize " + - "their own StarCellBio assignments and experiments. The email address " + - "for the instructor account must be different from those used to set " + - "up other StarCellBio accounts. To set up an instructor account, enter " + - "your email and password below and then click Create Account." - ); - iframe.find(".auth_submit_button").click(function(){ - var mask = document.createElement('div'); - mask.className='overlay'; - $(mask).css({'width': '100%','height': '100%','position': 'fixed', 'z-index': '993', 'background': 'rgba(125,125,125,0.7)', 'visibility': 'visible'}); - $('body').prepend(mask); - var progress_icon = document.createElement('img'); - progress_icon.src = '../../../images/homepage/ajax_loader.gif'; - progress_icon.style.marginLeft = '50%'; - progress_icon.style.marginTop= '50%'; - - $('.overlay').append(progress_icon); - - $('.scb_f_signup_iframe').hide(); - $('.scb_f_signup_iframe').load(function(){ - var profile = $('.scb_f_signup_iframe').contents().get(0); - if(profile.body.textContent.indexOf('confirmed') >0){ - parent.document.location.reload(); - - } - - else{ - $(mask).remove(); - $('.scb_f_signup_iframe').show(); - if($('.scb_f_signup_iframe').contents().find('.login_submit').length >0) - $('.scb_f_signup_iframe').contents().find('#errorMsg').html('Incorrect username or password. Try again'); - - } - }); - }); - }); - - + $('.scb_f_signup_iframe').load(function() { + + var iframe = $('.scb_f_signup_iframe').get(0); + var content = (iframe.contentDocument || iframe.contentWindow); + content.body.style.fontSize = '90%'; + content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; + var inputs = content.getElementsByTagName('button'); + $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); + var fieldset = content.querySelectorAll('fieldset'); + $(fieldset).children().wrap('

'); + var texts = content.querySelectorAll('input'); + $(texts).attr('placeholder', ''); + $(texts).css('font-family', 'Trebuchet MS, sans-serif'); + + var iframe = $('.scb_f_signup_iframe').contents(); + iframe.find('input[type="checkbox"]').css('height', '12px'); + iframe.find('input[type="radio"][value="instructor"]').attr('checked', 'checked'); + iframe.find('#div_id_course_code').css('display', 'none'); + iframe.find('#toggle_message').text( + "In the instructor account, instructors set up and customize " + + "their own StarCellBio assignments and experiments. The email address " + + "for the instructor account must be different from those used to set " + + "up other StarCellBio accounts. To set up an instructor account, enter " + + "your email and password below and then click Create Account." + ); + iframe.find(".auth_submit_button").click(function() { + var mask = document.createElement('div'); + mask.className = 'overlay'; + $(mask).css({ + 'width': '100%', + 'height': '100%', + 'position': 'fixed', + 'z-index': '993', + 'background': 'rgba(125,125,125,0.7)', + 'visibility': 'visible' + }); + $('body').prepend(mask); + var progress_icon = document.createElement('img'); + progress_icon.src = '../../../images/homepage/ajax_loader.gif'; + progress_icon.style.marginLeft = '50%'; + progress_icon.style.marginTop = '50%'; + + $('.overlay').append(progress_icon); + + $('.scb_f_signup_iframe').hide(); + $('.scb_f_signup_iframe').load(function() { + var profile = $('.scb_f_signup_iframe').contents().get(0); + if (profile.body.textContent.indexOf('confirmed') > 0) { + parent.document.location.reload(); + + } else { + $(mask).remove(); + $('.scb_f_signup_iframe').show(); + if ($('.scb_f_signup_iframe').contents().find('.login_submit').length > 0) { + $('.scb_f_signup_iframe').contents().find('#errorMsg').html('Incorrect username or password. Try again'); + } + + } + }); + }); }); - - scb.utils.off_on(workarea, 'click', '.scb_f_instructor_resources', function (e) { - alert( "under construction!"); - }); + + }); + + + scb.utils.off_on(workarea, 'click', '.scb_f_instructor_resources', function(e) { + alert("under construction!"); + }); }; scb.ui.HomepageView = function scb_ui_HomepageView(gstate) { - var self = this; - self.show = function(state) { - var workarea = gstate.workarea; - workarea.html(scb_homepage.main({ - global_template : gstate.context.master_model, - context: gstate.context - })); - scb.ui.static.HomepageView.select_list_item($('.scb_s_homepage_experimental_design_bullet_item').first(),gstate.workarea,false); - document.title = "Home - StarCellBio"; - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); - } + var self = this; + self.show = function(state) { + var workarea = gstate.workarea; + workarea.html(scb_homepage.main({ + global_template: gstate.context.master_model, + context: gstate.context + })); + scb.ui.static.HomepageView.select_list_item($('.scb_s_homepage_experimental_design_bullet_item').first(), gstate.workarea, false); + document.title = "Home - StarCellBio"; + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + } } -function inConstructionError(){ - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("In Construction", - function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - scb.ui.static.MainFrame.refresh(); - /* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; +function inConstructionError() { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("In Construction", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + scb.ui.static.MainFrame.refresh(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; } \ No newline at end of file diff --git a/html_app/ui/MainFrame.js b/html_app/ui/MainFrame.js index b2aa9116..2d643626 100644 --- a/html_app/ui/MainFrame.js +++ b/html_app/ui/MainFrame.js @@ -6,1116 +6,1124 @@ scb.ui.static = scb.ui.static || {}; scb.ui.static.MainFrame = scb.ui.static.MainFrame || {}; scb.ui.static.MainFrame.LOGOUT_URL = '/scb/logout/'; -scb.ui.static.MainFrame.update_hash = function (state) { - - // only send a google page event if the hash changed - if (state.onhashchange) { - // construct a url path to use with google analytics - ga_path = ''; - if (state.assignment_id) { - ga_path += '/' + state.assignment_id; - } - ga_path += '/' + state.view; - // send it - ga('send', { - 'hitType': 'pageview', - 'page': ga_path, - }); - // other state fields that we aren't currently tracking: - // experiment_id: appears to be a unique identifier - // facs_id: appears to be a unique identifier - } - - if (!state.onhashchange) { - delete state.onhashchange; - var History = window.History; - if (!History.enabled) { - return; - } - History.discardedState(); - History.discardedState(); - if (get_user_result && get_user_result.account_type == 'preview') { - // skip - } - else { - History.pushState(state, 2, "/#" + $.param(state)); - } +scb.ui.static.MainFrame.update_hash = function(state) { + + // only send a google page event if the hash changed + if (state.onhashchange) { + // construct a url path to use with google analytics + ga_path = ''; + if (state.assignment_id) { + ga_path += '/' + state.assignment_id; } + ga_path += '/' + state.view; + // send it + ga('send', { + 'hitType': 'pageview', + 'page': ga_path, + }); + // other state fields that we aren't currently tracking: + // experiment_id: appears to be a unique identifier + // facs_id: appears to be a unique identifier + } + + if (!state.onhashchange) { + delete state.onhashchange; + var History = window.History; + if (!History.enabled) { + return; + } + History.discardedState(); + History.discardedState(); + if (get_user_result && get_user_result.account_type == 'preview') { + // skip + } else { + History.pushState(state, 2, "/#" + $.param(state)); + } + } } scb.ui.MainFrame = function scb_ui_MainFrame(master_model, context) { - var self = this; - var pending_save = false; - context.main_frame = self; - self.sections = {}; - var assignment = null; - assignments = new scb.AssignmentList(master_model.assignments, context); + var self = this; + var pending_save = false; + context.main_frame = self; + self.sections = {}; + var assignment = null; + assignments = new scb.AssignmentList(master_model.assignments, context); - user_is_auth = typeof get_student_courses_result != "undefined" ? get_student_courses_result.is_auth : get_instructor_assignments_result.is_auth; + user_is_auth = typeof get_student_courses_result != "undefined" ? get_student_courses_result.is_auth : get_instructor_assignments_result.is_auth; - user_token = typeof get_student_courses_result != "undefined" ? get_student_courses_result.token : get_instructor_assignments_result.token; + user_token = typeof get_student_courses_result != "undefined" ? get_student_courses_result.token : get_instructor_assignments_result.token; - scb.ui.static.MainFrame.ensure_auth_context = function () { - context = context || {}; - context.auth = context.auth || {}; - } - scb.ui.static.MainFrame.validate_state = function (state) { - var ret = { - redisplay: false - }; - - if (state.assignment_id) { - var assignment = assignments.get(state.assignment_id); - if (assignment) { - assignments.selected_id = assignment.id; - ret.assignment = assignment; - if (state.notebook_id) { - var notebook = assignment.notebook; - if (notebook) { - ret.notebook = notebook; - if (state.section_id) { - var section = notebook.sections.get(state.section_id); - if (section) { - assignment.notebook.sections.selected_id = section.id - ret.section = section; - } - } - } - } - if (state.experiment_id) { - var experiment = assignment.experiments.get(state.experiment_id); - if (experiment) { - assignment.experiments.selected_id = experiment.id; - ret.experiment = experiment; - if (state.western_blot_id) { - var western_blot = experiment.western_blot_list.get(state.western_blot_id); - if (western_blot) { - ret.western_blot = western_blot; - if (state.western_blot_gel_id && western_blot) { - var western_blot_gel = western_blot.gel_list.get(state.western_blot_gel_id); - ret.western_blot_gel = western_blot_gel; - } - } - } - if (state.cell_treatment_id) { - var cell_treatment = experiment.cell_treatment_list.get(state.cell_treatment_id); - if (cell_treatment) { - ret.cell_treatment = cell_treatment; - if (state.treatment_id && cell_treatment) { - var treatment = cell_treatment.treatment_list.get(state.treatment_id); - ret.treatment = treatment; - } - } - } - if (state.facs_id) { - var facs = experiment.facs_list.get(state.facs_id); - if (facs) { - ret.facs = facs; - if (state.facs_lane_id && facs) { - var facs_lane = facs.lanes_list.get(state.facs_lane_id) - ret.facs_lane = facs_lane; - } - } - } - if (state.microscopy_id) { - var microscopy = experiment.microscopy_list.get(state.microscopy_id); - if (microscopy) { - ret.microscopy = microscopy; - } - if (state.microscopy_lane_id && microscopy) { - var microscopy_lane = microscopy.lanes_list.get(state.microscopy_lane_id) - ret.microscopy_lane = microscopy_lane; - } - } - - } - else { - // if experiment_id is invalid go to assignment -// $('html').css('overflow', 'hidden'); -// $('body').prepend(scb_experiment_setup.general_error_overlay()); -// $.jqDialog.alert('Experiment ' + state.experiment_id + ' does not exist.', function() { -// $('html').css('overflow', 'visible'); -// $('.error_overlay').remove();/* callback function for 'OK' button*/ }); -// $('.jqDialog_header').remove(); -// $('#jqDialog_box').prepend("

Error

"); - - state.onhashchange = false; - state.view = 'assignments'; - delete state.experiment_id; - scb.ui.static.MainFrame.update_hash(state); - ret.redisplay = true; - ret.redisplay_state = state; - } - } - } - else { - // if assignment_id is invalid go to assignments -// $('html').css('overflow', 'hidden'); -// $('body').prepend(scb_experiment_setup.general_error_overlay()); -// $.jqDialog.alert('Assignment ' + state.assignment_id + ' does not exist.', function() { -// $('html').css('overflow', 'visible'); -// $('.error_overlay').remove();/* callback function for 'OK' button*/ }); -// $('.jqDialog_header').remove(); -// $('#jqDialog_box').prepend("

Error

"); - - state.onhashchange = false; - state.view = 'assignments'; - delete state.assignment_id; - scb.ui.static.MainFrame.update_hash(state); - ret.redisplay = true; - ret.redisplay_state = state; - } - } - if (ret.redisplay == false && state.skip_hash_update != true) { - scb.ui.static.MainFrame.update_hash(state); - } - ret.context = context; - return ret; - } - - //TODO: DEBUG REMOVE - window._assigments = assignments; - - self.current_tab = { - hide: scb.Utils.noop, - show: scb.Utils.noop + scb.ui.static.MainFrame.ensure_auth_context = function() { + context = context || {}; + context.auth = context.auth || {}; + } + scb.ui.static.MainFrame.validate_state = function(state) { + var ret = { + redisplay: false }; - var workarea = context.ui; - workarea.css({ - 'height': '100%' - }); - - scb.ui.static.HomepageView.register(workarea); - scb.ui.static.AssignmentsView.register(workarea); - scb.ui.static.ExperimentDesignView.register(workarea); - scb.ui.static.ExperimentSetupView.register(workarea); - scb.ui.static.WesternBlotView.register(workarea); - scb.ui.static.MicroscopyView.register(workarea); - scb.ui.static.NotebookView.register(workarea); - scb.ui.static.WesternBlotGelView.register(workarea); - scb.ui.static.SelectTechniqueView.register(workarea); - scb.ui.static.FacsView.register(workarea); - - scb.ui.static.MainFrame.in_ajax = false; - scb.ui.static.MainFrame.show_in_ajax = false; - scb.ui.static.MainFrame.show_in_ajax_message = ''; - - scb.ui.static.MainFrame.in_ajax_display = function () { - var saving = $('#saving'); - if (scb.ui.static.MainFrame.show_in_ajax) { - saving.show(); - $('#saving_message', saving).html(scb.ui.static.MainFrame.show_in_ajax_message); - } - else { - saving.hide(); - } - } - scb.ui.static.MainFrame.save = function () { - var tmp; - try { - tmp = assignments.selected.experiments.selected_id; - } catch (ex) { - } - try { - assignment.selected.experiments.selected_id = null; - } catch (ex) { + if (state.assignment_id) { + var assignment = assignments.get(state.assignment_id); + if (assignment) { + assignments.selected_id = assignment.id; + ret.assignment = assignment; + if (state.notebook_id) { + var notebook = assignment.notebook; + if (notebook) { + ret.notebook = notebook; + if (state.section_id) { + var section = notebook.sections.get(state.section_id); + if (section) { + assignment.notebook.sections.selected_id = section.id + ret.section = section; + } + } + } } - var model_string = JSON.stringify(master_model); - if (localStorage.getItem("scb_master_model") != model_string) { - master_model.timestamp = (new Date()).getTime(); - model_string = JSON.stringify(master_model); - try { - localStorage.setItem("scb_master_model", model_string); - if (!scb.ui.static.MainFrame.in_ajax) { - scb.ui.static.MainFrame.in_ajax = true; - scb.ui.static.MainFrame.show_in_ajax = true; - scb.ui.static.MainFrame.show_in_ajax_message = ''; - scb.ui.static.MainFrame.in_ajax_display(); - scb.utils.server.call(model_string, function (state) { - scb.ui.static.MainFrame.in_ajax = false; - scb.ui.static.MainFrame.show_in_ajax = !state.success; - scb.ui.static.MainFrame.show_in_ajax_message = !state.success ? 'Failed, will retry in 30 seconds.' : ''; - scb.ui.static.MainFrame.in_ajax_display(); - }); + if (state.experiment_id) { + var experiment = assignment.experiments.get(state.experiment_id); + if (experiment) { + assignment.experiments.selected_id = experiment.id; + ret.experiment = experiment; + if (state.western_blot_id) { + var western_blot = experiment.western_blot_list.get(state.western_blot_id); + if (western_blot) { + ret.western_blot = western_blot; + if (state.western_blot_gel_id && western_blot) { + var western_blot_gel = western_blot.gel_list.get(state.western_blot_gel_id); + ret.western_blot_gel = western_blot_gel; + } + } + } + if (state.cell_treatment_id) { + var cell_treatment = experiment.cell_treatment_list.get(state.cell_treatment_id); + if (cell_treatment) { + ret.cell_treatment = cell_treatment; + if (state.treatment_id && cell_treatment) { + var treatment = cell_treatment.treatment_list.get(state.treatment_id); + ret.treatment = treatment; } + } } - catch (e) { + if (state.facs_id) { + var facs = experiment.facs_list.get(state.facs_id); + if (facs) { + ret.facs = facs; + if (state.facs_lane_id && facs) { + var facs_lane = facs.lanes_list.get(state.facs_lane_id) + ret.facs_lane = facs_lane; + } + } } + if (state.microscopy_id) { + var microscopy = experiment.microscopy_list.get(state.microscopy_id); + if (microscopy) { + ret.microscopy = microscopy; + } + if (state.microscopy_lane_id && microscopy) { + var microscopy_lane = microscopy.lanes_list.get(state.microscopy_lane_id) + ret.microscopy_lane = microscopy_lane; + } + } + + } else { + // if experiment_id is invalid go to assignment + // $('html').css('overflow', 'hidden'); + // $('body').prepend(scb_experiment_setup.general_error_overlay()); + // $.jqDialog.alert('Experiment ' + state.experiment_id + ' does not exist.', function() { + // $('html').css('overflow', 'visible'); + // $('.error_overlay').remove();/* callback function for 'OK' button*/ }); + // $('.jqDialog_header').remove(); + // $('#jqDialog_box').prepend("

Error

"); + + state.onhashchange = false; + state.view = 'assignments'; + delete state.experiment_id; + scb.ui.static.MainFrame.update_hash(state); + ret.redisplay = true; + ret.redisplay_state = state; + } } - try { - assignment.experiments.selected_id = tmp; - } catch (ex) { - } - }; + } else { + // if assignment_id is invalid go to assignments + // $('html').css('overflow', 'hidden'); + // $('body').prepend(scb_experiment_setup.general_error_overlay()); + // $.jqDialog.alert('Assignment ' + state.assignment_id + ' does not exist.', function() { + // $('html').css('overflow', 'visible'); + // $('.error_overlay').remove();/* callback function for 'OK' button*/ }); + // $('.jqDialog_header').remove(); + // $('#jqDialog_box').prepend("

Error

"); - scb.ui.static.MainFrame.load = function () { - var master_model = JSON.parse(localStorage.getItem("scb_master_model")); - starcellbio(context.ui, master_model); + state.onhashchange = false; + state.view = 'assignments'; + delete state.assignment_id; + scb.ui.static.MainFrame.update_hash(state); + ret.redisplay = true; + ret.redisplay_state = state; + } } - - scb.ui.static.MainFrame.clear_NO_PROMPT = function () { - $.ajax({url: scb.ui.static.MainFrame.LOGOUT_URL, async: false, timeout: 5 }); - self.show({view: 'assignments'}); - master_model = master_model_data; - scb.ui.static.MainFrame.save(); - starcellbio(context.ui, master_model); + if (ret.redisplay == false && state.skip_hash_update != true) { + scb.ui.static.MainFrame.update_hash(state); } - - scb.ui.static.MainFrame.clear = function () { - var r = prompt("This will restart whole assignment. Your saved data will be lost. Type: 'YES' to proceed."); - if (r == 'YES') { - self.show({view: 'assignments'}); - master_model = master_model_data; - scb.ui.static.MainFrame.save(); - starcellbio(context.ui, master_model); - } - else { - $('html').css('overflow', 'hidden'); - - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("Operation canceled!\n If you wanted to clear everything type YES in previous dialog.", - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ - }); - ; - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Error:

"); - $('#jqDialog_box').attr('role', 'alertdialog'); - + ret.context = context; + return ret; + } + + //TODO: DEBUG REMOVE + window._assigments = assignments; + + self.current_tab = { + hide: scb.Utils.noop, + show: scb.Utils.noop + }; + + var workarea = context.ui; + workarea.css({ + 'height': '100%' + }); + + scb.ui.static.HomepageView.register(workarea); + scb.ui.static.AssignmentsView.register(workarea); + scb.ui.static.ExperimentDesignView.register(workarea); + scb.ui.static.ExperimentSetupView.register(workarea); + scb.ui.static.WesternBlotView.register(workarea); + scb.ui.static.MicroscopyView.register(workarea); + scb.ui.static.NotebookView.register(workarea); + scb.ui.static.WesternBlotGelView.register(workarea); + scb.ui.static.SelectTechniqueView.register(workarea); + scb.ui.static.FacsView.register(workarea); + + scb.ui.static.MainFrame.in_ajax = false; + scb.ui.static.MainFrame.show_in_ajax = false; + scb.ui.static.MainFrame.show_in_ajax_message = ''; + + scb.ui.static.MainFrame.in_ajax_display = function() { + var saving = $('#saving'); + if (scb.ui.static.MainFrame.show_in_ajax) { + saving.show(); + $('#saving_message', saving).html(scb.ui.static.MainFrame.show_in_ajax_message); + } else { + saving.hide(); + } + } + scb.ui.static.MainFrame.save = function() { + var tmp; + try { + tmp = assignments.selected.experiments.selected_id; + } catch ( ex ) {} + try { + assignment.selected.experiments.selected_id = null; + } catch ( ex ) {} + var model_string = JSON.stringify(master_model); + if (localStorage.getItem("scb_master_model") != model_string) { + master_model.timestamp = (new Date()).getTime(); + model_string = JSON.stringify(master_model); + try { + localStorage.setItem("scb_master_model", model_string); + if (!scb.ui.static.MainFrame.in_ajax) { + scb.ui.static.MainFrame.in_ajax = true; + scb.ui.static.MainFrame.show_in_ajax = true; + scb.ui.static.MainFrame.show_in_ajax_message = ''; + scb.ui.static.MainFrame.in_ajax_display(); + scb.utils.server.call(model_string, function(state) { + scb.ui.static.MainFrame.in_ajax = false; + scb.ui.static.MainFrame.show_in_ajax = !state.success; + scb.ui.static.MainFrame.show_in_ajax_message = !state.success ? 'Failed, will retry in 30 seconds.' : ''; + scb.ui.static.MainFrame.in_ajax_display(); + }); } + } catch ( e ) {} } - - - scb.utils.off_on(workarea, 'click', '.save_master_model', function () { - scb.ui.static.MainFrame.save(); - alert("Save"); - }); - - scb.utils.off_on(workarea, 'click', '.load_master_model', function () { - scb.ui.static.MainFrame.load(); - }); - - scb.utils.off_on(workarea, 'click', '.clear_master_model', function () { - scb.ui.static.MainFrame.clear(); + try { + assignment.experiments.selected_id = tmp; + } catch ( ex ) {} + }; + + scb.ui.static.MainFrame.load = function() { + var master_model = JSON.parse(localStorage.getItem("scb_master_model")); + starcellbio(context.ui, master_model); + } + + scb.ui.static.MainFrame.clear_NO_PROMPT = function() { + $.ajax({ + url: scb.ui.static.MainFrame.LOGOUT_URL, + async: false, + timeout: 5 }); - - - scb.utils.off_on(workarea.parent(), 'click', '.remove_experiment', function () { - $('html').css('overflow', 'hidden'); - - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.confirm("Delete experiment?", - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - var model_id = scb.Utils.get_attribute($(this), 'experiment_id'); - assignments.selected.experiments.remove(model_id); - assignments.selected.experiments.selected_id = null; - self.show({}); - },// callback function for 'YES' button - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - return; - } // callback function for 'NO' button - ); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Delete experiment?

"); - $('#jqDialog_box').attr('role', 'alertdialog'); - - }); - - - //HANDLER FOR CONTACT BUTTON AND IFRAME - scb.utils.off_on(workarea.parent(), 'click', '.scb_f_contact', function (evt) { - $(workarea).append(scb_contact.contact({})); - - $(workarea).prepend(scb_common.contact_overlay()); - - scb.utils.off_on(workarea, 'click', '.scb_f_contact_close_button', function () { - $('.scb_s_contact_dialog').detach(); - - $('.contact_overlay').remove(); - }); - $('.scb_s_contact_iframe', workarea).load(function () { - $('.scb_s_contact_dialog').draggable({ handle: '.scb_s_feedback_form'}); - var iframe = $('.scb_s_contact_iframe').get(0); - var content = (iframe.contentDocument || iframe.contentWindow); - content.body.style.fontSize = '90%'; - content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; - var inputs = content.getElementsByTagName('button'); - $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); - var fieldset = content.querySelectorAll('fieldset'); - var texts = content.querySelectorAll('input'); - $(texts).attr('placeholder', ''); - $(texts).css('font-family', 'Trebuchet MS, sans-serif'); - - var iframe = $('.scb_s_contact_iframe').contents(); - iframe.find('input[type="checkbox"]').css('height', '12px'); - - var fieldset = content.querySelectorAll('fieldset'); - $(fieldset).css('border', '0'); - $('.scb_s_contact_iframe', workarea).contents().find(".scb_f_contact_submit_button").click(function (e) { - $('.scb_s_contact_iframe', workarea).load(function () { - var profile = $('.scb_s_contact_iframe', workarea).contents().get(0); - if (profile.body.textContent.indexOf('you for your feedback.') > 0) { - parent.document.location.reload(); - } - }); - }); - }); + self.show({ + view: 'assignments' }); + master_model = master_model_data; + scb.ui.static.MainFrame.save(); + starcellbio(context.ui, master_model); + } + + scb.ui.static.MainFrame.clear = function() { + var r = prompt("This will restart whole assignment. Your saved data will be lost. Type: 'YES' to proceed."); + if (r == 'YES') { + self.show({ + view: 'assignments' + }); + master_model = master_model_data; + scb.ui.static.MainFrame.save(); + starcellbio(context.ui, master_model); + } else { + $('html').css('overflow', 'hidden'); + + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("Operation canceled!\n If you wanted to clear everything type YES in previous dialog.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + }); + ; + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Error:

"); + $('#jqDialog_box').attr('role', 'alertdialog'); + } + } - //HANDLER FOR USER_GUIDE BUTTON AND IFRAME - scb.utils.off_on(workarea.parent(), 'click', '.scb_f_user_guide', function (evt) { - var iframe_history = ['#']; - var currentPush = false; - $('body').append(scb_userguide.userguide({})); - $("#closesearch").hide(); - $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); - $('.scb_s_ug_home').attr('disabled', 'disabled'); - scb.utils.off_on('body', 'click', '.scb_f_ug_close_button', function () { - $('.scb_f_ug_help_search_bar').detach(); - }); - $(function () { - $(".scb_f_ug_help_search_bar").mousemove(function (e) { - var myPos = $(this).offset(); - myPos.bottom = $(this).offset().top + $(this).outerHeight(); - myPos.right = $(this).offset().left + $(this).outerWidth(); - - if (myPos.bottom > e.pageY && e.pageY > myPos.bottom - 20 && myPos.right > e.pageX && e.pageX > myPos.right - 20) { - $(this).css({ cursor: "nwse-resize" }); - } - else { - $(this).css({ cursor: "" }); - } - }); - }); - $('iframe.scb_s_ug_dialog').load(function () { - $('.scb_f_ug_help_search_bar').width($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help_display').width() + 20); - $('iframe.scb_s_ug_dialog').width($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help').width() + 20); - $('iframe.scb_s_ug_dialog').height($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help').height() + 20); - $('.scb_f_ug_help_search_bar').draggable({ handle: '.user_guide_title'}); - $('iframe.scb_s_ug_dialog').contents().find('body').css('font-family', "Trebuchet MS, Helvetica, Arial, Verdana, sans-serif"); - $('iframe.scb_s_ug_dialog').contents().find("#popout").hide(); - $('iframe.scb_s_ug_dialog').contents().click(function (event) { - if (event.target.className != 'scb_s_ug_home' && event.target.id != 'search') { - if (iframe_history.length == 0) { - iframe_history = ['#']; - } - $(".scb_s_ug_home").removeClass('scb_s_ug_home_disabled'); - $('.scb_s_ug_home').removeAttr('disabled'); - if ($('iframe.scb_s_ug_dialog').contents().find("#popout").length > 0) { - $('iframe.scb_s_ug_dialog').contents().find("#popout").hide(); - } - var anchor_element = $(event.target).closest('.anchors') - if (event.target.className == 'intextlink') - anchor_element = $(event.target).get(0); - var anchor_hash = $(anchor_element).attr('href'); - var window_location = window.location.toString() + '/static/ug2/help.html' + anchor_hash; - hashchange_function(anchor_hash, anchor_element); - iframe_history.push(anchor_hash); - currentPush = true; - $(".scb_s_ug_back").removeClass('scb_s_ug_back_disabled'); - $('.scb_s_ug_back').removeAttr('disabled'); - event.preventDefault(); - } - }); - - $('#search').click(function () { - $('iframe.scb_s_ug_dialog').ready(function () { - $("#closesearch").show(); - $('iframe.scb_s_ug_dialog').contents().find(".help_search_input").val($(".help_search_input").val()); - $('iframe.scb_s_ug_dialog').contents().find("#search").click(); - }); - }); - - $('.help_search_input').keypress(function (e) { - var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; - if (key == 13) { - e.preventDefault(); - $('#search').click(); - } - }); - - - $(".scb_s_ug_home").click(function () { - iframe_history.push('#'); - currentPush = true; - $('iframe.scb_s_ug_dialog').contents().find(".scb_s_ug_home").click(); - $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); - $('.scb_s_ug_home').attr('disabled', 'disabled'); - $(".scb_s_ug_back").removeClass('scb_s_ug_back_disabled'); - $('.scb_s_ug_back').removeAttr('disabled'); - $("#closesearch").hide(); - $(".help_search_input").val(""); - }); - - - $(".scb_s_ug_back").click(function () { - var back_url = iframe_history.pop(); - if (currentPush) { - back_url = iframe_history.pop(); - } - currentPush = false; + scb.utils.off_on(workarea, 'click', '.save_master_model', function() { + scb.ui.static.MainFrame.save(); + alert("Save"); + }); - if (back_url) { - if (back_url == "#") - $('iframe.scb_s_ug_dialog').contents().find(".scb_s_ug_home").click(); - else - $('iframe.scb_s_ug_dialog').contents().find('a[href="' + back_url + '"]').click(); - } - else { - $(".scb_s_ug_back").addClass('scb_s_ug_back_disabled'); - $('.scb_s_ug_back').attr('disabled', 'disabled'); + scb.utils.off_on(workarea, 'click', '.load_master_model', function() { + scb.ui.static.MainFrame.load(); + }); - $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); - $('.scb_s_ug_home').attr('disabled', 'disabled'); - } - }); + scb.utils.off_on(workarea, 'click', '.clear_master_model', function() { + scb.ui.static.MainFrame.clear(); + }); - $(".main_popout").click(function () { - var popout_string = ""; - var visible = $('iframe.scb_s_ug_dialog').contents().find('.scb_s_section_inactive:visible'); - if (visible.length == 1) { - if ($(visible).attr('class') == 'scb_s_section_inactive') - popout_string = $('iframe.scb_s_ug_dialog').contents().find('*:visible ').closest('.scb_s_help_sublink').attr('class').split(' ')[1]; - else - popout_string = $(visible).attr('class'); - } - else { - popout_string = $($('iframe.scb_s_ug_dialog').contents().find('span:visible').get(0)).attr('class'); - } + scb.utils.off_on(workarea.parent(), 'click', '.remove_experiment', function() { + $('html').css('overflow', 'hidden'); - popout_string = popout_string.replace(/_/g, '-'); - if ($('iframe.scb_s_ug_dialog').contents().find('.scb_s_section_inactive').length == 0) - popout_string = ""; - try { - var popoutWindow = window.open("static/ug2/full_guide.html#" + popout_string); - } - catch (err) { - var popoutWindow = window.open("ug2/full_guide.html#" + popout_string); - } - - }); - - $("#closesearch").click(function () { - $('.help_search_input').val(''); - $("#closesearch").hide(); - $(".scb_s_ug_home").click(); - }); - - }); + $('body').prepend(scb_experiment_setup.general_error_overlay()); - }); + $.jqDialog.confirm("Delete experiment?", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + var model_id = scb.Utils.get_attribute($(this), 'experiment_id'); + assignments.selected.experiments.remove(model_id); + assignments.selected.experiments.selected_id = null; + self.show({}); + }, // callback function for 'YES' button + function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + return; + } // callback function for 'NO' button + ); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Delete experiment?

"); + $('#jqDialog_box').attr('role', 'alertdialog'); - //HANDLER FOR LOGIN BUTTON AND IFRAME - scb.utils.off_on(workarea.parent(), 'click', '.scb_f_login', function (evt) { - scb.ui.static.MainFrame.ensure_auth_context(); - if (assignments.selected && !user_is_auth) { - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - - $.jqDialog.confirm("If you sign in to your account, you will lose your current work as a guest. Would you like to continue?", - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - if (user_is_auth) { - - window.location = scb.ui.static.MainFrame.LOGOUT_URL; - } - else { - add_login_script(workarea); - } - evt.preventDefault(); - }, // callback function for 'YES' button - function () { - $('.error_overlay').remove(); - $('html').css('overflow', 'visible'); - return; - } // callback function for 'NO' button - ); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - evt.preventDefault(); - } - else { - if (user_is_auth) { + }); - window.location = scb.ui.static.MainFrame.LOGOUT_URL; - } - else { - add_login_script(workarea); - } - evt.preventDefault(); - } - }); + //HANDLER FOR CONTACT BUTTON AND IFRAME + scb.utils.off_on(workarea.parent(), 'click', '.scb_f_contact', function(evt) { + $(workarea).append(scb_contact.contact({})); - self.sections.homepage = new scb.ui.HomepageView({ - workarea: workarea, - context: context - }); - self.sections.assignments = new scb.ui.AssignmentsView({ - workarea: workarea, - context: context - }); + $(workarea).prepend(scb_common.contact_overlay()); + scb.utils.off_on(workarea, 'click', '.scb_f_contact_close_button', function() { + $('.scb_s_contact_dialog').detach(); - self.sections.experiment_design = new scb.ui.ExperimentDesignView({ - workarea: workarea, - context: context + $('.contact_overlay').remove(); }); - - self.sections.experiment_setup = new scb.ui.ExperimentSetupView({ - workarea: workarea, - context: context - }); - - self.sections.facs = new scb.ui.FacsView({ - workarea: workarea, - context: context - }); - - self.sections.select_technique = new scb.ui.SelectTechniqueView({ - workarea: workarea, - context: context + $('.scb_s_contact_iframe', workarea).load(function() { + $('.scb_s_contact_dialog').draggable({ + handle: '.scb_s_feedback_form' + }); + var iframe = $('.scb_s_contact_iframe').get(0); + var content = (iframe.contentDocument || iframe.contentWindow); + content.body.style.fontSize = '90%'; + content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; + var inputs = content.getElementsByTagName('button'); + $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); + var fieldset = content.querySelectorAll('fieldset'); + var texts = content.querySelectorAll('input'); + $(texts).attr('placeholder', ''); + $(texts).css('font-family', 'Trebuchet MS, sans-serif'); + + var iframe = $('.scb_s_contact_iframe').contents(); + iframe.find('input[type="checkbox"]').css('height', '12px'); + + var fieldset = content.querySelectorAll('fieldset'); + $(fieldset).css('border', '0'); + $('.scb_s_contact_iframe', workarea).contents().find(".scb_f_contact_submit_button").click(function(e) { + $('.scb_s_contact_iframe', workarea).load(function() { + var profile = $('.scb_s_contact_iframe', workarea).contents().get(0); + if (profile.body.textContent.indexOf('you for your feedback.') > 0) { + parent.document.location.reload(); + } + }); + }); }); - - self.sections.western_blot = new scb.ui.WesternBlotView({ - workarea: workarea, - context: context - }) - - self.sections.microscopy = new scb.ui.MicroscopyView({ - workarea: workarea, - context: context + }); + + + //HANDLER FOR USER_GUIDE BUTTON AND IFRAME + scb.utils.off_on(workarea.parent(), 'click', '.scb_f_user_guide', function(evt) { + var iframe_history = ['#']; + var currentPush = false; + $('body').append(scb_userguide.userguide({})); + $("#closesearch").hide(); + $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); + $('.scb_s_ug_home').attr('disabled', 'disabled'); + scb.utils.off_on('body', 'click', '.scb_f_ug_close_button', function() { + $('.scb_f_ug_help_search_bar').detach(); }); - - self.sections.notebook = new scb.ui.NotebookView({ - workarea: workarea, - context: context + $(function() { + $(".scb_f_ug_help_search_bar").mousemove(function(e) { + var myPos = $(this).offset(); + myPos.bottom = $(this).offset().top + $(this).outerHeight(); + myPos.right = $(this).offset().left + $(this).outerWidth(); + + if (myPos.bottom > e.pageY && e.pageY > myPos.bottom - 20 && myPos.right > e.pageX && e.pageX > myPos.right - 20) { + $(this).css({ + cursor: "nwse-resize" + }); + } else { + $(this).css({ + cursor: "" + }); + } + }); }); - self.sections.western_blot_gel = new scb.ui.WesternBlotGelView({ - workarea: workarea, - context: context - }) - - - - self.show = function (state) { - scb.ui.static.MainFrame.ensure_auth_context(); - context.auth.logged_in = user_is_auth; - state = state || { - view: 'homepage' - } - if (state.onhashchange) { - window.scrollTo(0, 0); - } - scb.ui.static.MainFrame.save(); - console.info(JSON.stringify(state)); - var parsed = scb.ui.static.MainFrame.validate_state(state); - if (parsed.redisplay) { - self.show(parsed.redisplay_state); - return; - } - if (state.view == 'homepage') { - self.sections.homepage.show({ - workarea: x - }); + $('iframe.scb_s_ug_dialog').load(function() { + $('.scb_f_ug_help_search_bar').width($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help_display').width() + 20); + $('iframe.scb_s_ug_dialog').width($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help').width() + 20); + $('iframe.scb_s_ug_dialog').height($('iframe.scb_s_ug_dialog').contents().find('.scb_f_help').height() + 20); + $('.scb_f_ug_help_search_bar').draggable({ + handle: '.user_guide_title' + }); + $('iframe.scb_s_ug_dialog').contents().find('body').css('font-family', "Trebuchet MS, Helvetica, Arial, Verdana, sans-serif"); + $('iframe.scb_s_ug_dialog').contents().find("#popout").hide(); + $('iframe.scb_s_ug_dialog').contents().click(function(event) { + if (event.target.className != 'scb_s_ug_home' && event.target.id != 'search') { + if (iframe_history.length == 0) { + iframe_history = ['#']; + } + $(".scb_s_ug_home").removeClass('scb_s_ug_home_disabled'); + $('.scb_s_ug_home').removeAttr('disabled'); + if ($('iframe.scb_s_ug_dialog').contents().find("#popout").length > 0) { + $('iframe.scb_s_ug_dialog').contents().find("#popout").hide(); + } + var anchor_element = $(event.target).closest('.anchors') + if (event.target.className == 'intextlink') { + anchor_element = $(event.target).get(0); + } + var anchor_hash = $(anchor_element).attr('href'); + var window_location = window.location.toString() + '/static/ug2/help.html' + anchor_hash; + hashchange_function(anchor_hash, anchor_element); + iframe_history.push(anchor_hash); + currentPush = true; + $(".scb_s_ug_back").removeClass('scb_s_ug_back_disabled'); + $('.scb_s_ug_back').removeAttr('disabled'); + event.preventDefault(); } - if (state.view == 'assignments') { - if (!parsed.assignment) { - state.assignment_id = assignments.selected_id ? assignments.selected_id : get_student_courses_result.is_selected; - if (state.assignment_id == null || state.assignment_id == 'null') { - state.assignment_id = assignments.list[0].id; - } - state.onhashchange = false; - self.show(state); - return; - } + }); - assignments.selected_id = state.assignment_id ? state.assignment_id : null; - scb.ui.static.MainFrame.update_hash(state); - self.sections.assignments.show({ - workarea: workarea, - assignments: assignments - }); - } - if (state.view == 'notebook') { - if (!parsed.notebook) { - delete state.onhashchange; - var experiment = ''; - if (!parsed.assignment.experiments.selected) { - experiment = parsed.assignment.experiments.start({}); - } - else { - experiment = parsed.assignment.experiments.selected; - } + $('#search').click(function() { + $('iframe.scb_s_ug_dialog').ready(function() { + $("#closesearch").show(); + $('iframe.scb_s_ug_dialog').contents().find(".help_search_input").val($(".help_search_input").val()); + $('iframe.scb_s_ug_dialog').contents().find("#search").click(); + }); + }); - state.experiment_id = experiment.id; - var notebook = assignments.get(state.assignment_id).notebook; + $('.help_search_input').keypress(function(e) { + var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; + if (key == 13) { + e.preventDefault(); + $('#search').click(); + } + }); - var section = ''; - if (!notebook.sections.selected) { - section = notebook.sections.start({}); - var History = window.History; - if (History.enabled) { - History.replaceState("New Notebook Section", "New Notebook Section", '#' + $.param(state)); - } - } - else { - section = notebook.sections.selected; - } + $(".scb_s_ug_home").click(function() { + iframe_history.push('#'); + currentPush = true; + $('iframe.scb_s_ug_dialog').contents().find(".scb_s_ug_home").click(); + $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); + $('.scb_s_ug_home').attr('disabled', 'disabled'); + $(".scb_s_ug_back").removeClass('scb_s_ug_back_disabled'); + $('.scb_s_ug_back').removeAttr('disabled'); + $("#closesearch").hide(); + $(".help_search_input").val(""); + }); - state.notebook_id = notebook.id; - state.section_id = section.id; - state.onhashchange = true; - self.show(state); - return; - } - scb.ui.static.MainFrame.update_hash(state); - self.sections.notebook.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment, - notebook: parsed.notebook, - section: parsed.section - }); - } - if (state.view == 'experiment_design') { - if (!parsed.experiment) { - delete state.onhashchange; - var experiment = parsed.assignment.experiments.start({}); - state.experiment_id = experiment.id; - var History = window.History; - if (History.enabled) { - History.replaceState("New Experiment", "New Experiment", '#' + $.param(state)); - } - state.onhashchange = true; - self.show(state); - return; - } - self.sections.experiment_design.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment - }); + $(".scb_s_ug_back").click(function() { + var back_url = iframe_history.pop(); + if (currentPush) { + back_url = iframe_history.pop(); } - if (state.view == 'experiment_setup') { - self.sections.experiment_setup.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment, - mode: 'readwrite', - last_view: 'experiment_setup', - }); + currentPush = false; + + if (back_url) { + if (back_url == "#") { + $('iframe.scb_s_ug_dialog').contents().find(".scb_s_ug_home").click(); + } else { + $('iframe.scb_s_ug_dialog').contents().find('a[href="' + back_url + '"]').click(); + } + } else { + $(".scb_s_ug_back").addClass('scb_s_ug_back_disabled'); + $('.scb_s_ug_back').attr('disabled', 'disabled'); + + $(".scb_s_ug_home").addClass('scb_s_ug_home_disabled'); + $('.scb_s_ug_home').attr('disabled', 'disabled'); } - if (state.view == 'experiment_run') { - - self.sections.experiment_setup.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment, - mode: 'readonly', - last_view: 'experiment_run', - }); + }); + + + $(".main_popout").click(function() { + var popout_string = ""; + var visible = $('iframe.scb_s_ug_dialog').contents().find('.scb_s_section_inactive:visible'); + if (visible.length == 1) { + if ($(visible).attr('class') == 'scb_s_section_inactive') { + popout_string = $('iframe.scb_s_ug_dialog').contents().find('*:visible ').closest('.scb_s_help_sublink').attr('class').split(' ')[1]; + } else { + popout_string = $(visible).attr('class'); + } + } else { + popout_string = $($('iframe.scb_s_ug_dialog').contents().find('span:visible').get(0)).attr('class'); } - if (state.view == 'facs') { - var id_list = []; - for (var x = 0; x < parsed.experiment.facs_list.list.length; x++) { - id_list.push(parsed.experiment.facs_list.list[x].id); - } - if (!parsed.facs) { - if (state.facs_id && id_list.indexOf(state.facs_id) < 0 && parsed.experiment.facs_list.list.length > 0) { - parsed.facs = parsed.experiment.facs_list.list[state.index]; - - } - else { - delete state.onhashchange; - var facs = parsed.experiment.facs_list.start({}); - state.facs_id = facs.id; - var History = window.History; - if (History.enabled) { - History.replaceState("New FACS", "New FACS", '#' + $.param(state)); - } - state.onhashchange = true; - self.show(state); - return; - } - } - self.sections.facs.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment, - facs: parsed.facs - }); + popout_string = popout_string.replace(/_/g, '-'); + if ($('iframe.scb_s_ug_dialog').contents().find('.scb_s_section_inactive').length == 0) { + popout_string = ""; + } + try { + var popoutWindow = window.open("static/ug2/full_guide.html#" + popout_string); + } catch ( err ) { + var popoutWindow = window.open("ug2/full_guide.html#" + popout_string); } - if (state.view == 'select_technique') { - self.sections.select_technique.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment - }); + }); - } - if (state.view == 'western_blot') { + $("#closesearch").click(function() { + $('.help_search_input').val(''); + $("#closesearch").hide(); + $(".scb_s_ug_home").click(); + }); - var id_list = []; - for (var x = 0; x < parsed.experiment.western_blot_list.list.length; x++) { - id_list.push(parsed.experiment.western_blot_list.list[x].id); - } + }); - if (!parsed.western_blot) { - if (state.western_blot_id && id_list.indexOf(state.western_blot_id) < 0 && parsed.experiment.western_blot_list.list.length > 0) { - parsed.western_blot = parsed.experiment.western_blot_list.list[state.index]; + }); - } - else { - var western_blot = parsed.experiment.western_blot_list.start({}); - state.western_blot_id = western_blot.id; - var History = window.History; - if (History.enabled) { - History.replaceState("New WB", "New WB", '#' + $.param(state)); - } - - state.onhashchange = true; - self.show(state); - return; - } - } + //HANDLER FOR LOGIN BUTTON AND IFRAME + scb.utils.off_on(workarea.parent(), 'click', '.scb_f_login', function(evt) { + scb.ui.static.MainFrame.ensure_auth_context(); + if (assignments.selected && !user_is_auth) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); - if (parsed.western_blot.is_transfered) { - state.view = 'western_blot_gel'; - state.onhashchange = false; - self.show(state); - return; - } + $.jqDialog.confirm("If you sign in to your account, you will lose your current work as a guest. Would you like to continue?", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + if (user_is_auth) { - self.sections.western_blot.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment, - western_blot: parsed.western_blot - }); + window.location = scb.ui.static.MainFrame.LOGOUT_URL; + } else { + add_login_script(workarea); + } + evt.preventDefault(); + }, // callback function for 'YES' button + function() { + $('.error_overlay').remove(); + $('html').css('overflow', 'visible'); + return; + } // callback function for 'NO' button + ); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + evt.preventDefault(); + } else { + if (user_is_auth) { + + window.location = scb.ui.static.MainFrame.LOGOUT_URL; + } else { + add_login_script(workarea); + } + evt.preventDefault(); + } + }); + + + self.sections.homepage = new scb.ui.HomepageView({ + workarea: workarea, + context: context + }); + self.sections.assignments = new scb.ui.AssignmentsView({ + workarea: workarea, + context: context + }); + + + self.sections.experiment_design = new scb.ui.ExperimentDesignView({ + workarea: workarea, + context: context + }); + + self.sections.experiment_setup = new scb.ui.ExperimentSetupView({ + workarea: workarea, + context: context + }); + + self.sections.facs = new scb.ui.FacsView({ + workarea: workarea, + context: context + }); + + self.sections.select_technique = new scb.ui.SelectTechniqueView({ + workarea: workarea, + context: context + }); + + self.sections.western_blot = new scb.ui.WesternBlotView({ + workarea: workarea, + context: context + }) + + self.sections.microscopy = new scb.ui.MicroscopyView({ + workarea: workarea, + context: context + }); + + self.sections.notebook = new scb.ui.NotebookView({ + workarea: workarea, + context: context + }); + + self.sections.western_blot_gel = new scb.ui.WesternBlotGelView({ + workarea: workarea, + context: context + }) + + + + self.show = function(state) { + scb.ui.static.MainFrame.ensure_auth_context(); + context.auth.logged_in = user_is_auth; + state = state || { + view: 'homepage' + } + if (state.onhashchange) { + window.scrollTo(0, 0); + } + scb.ui.static.MainFrame.save(); + console.info(JSON.stringify(state)); + var parsed = scb.ui.static.MainFrame.validate_state(state); + if (parsed.redisplay) { + self.show(parsed.redisplay_state); + return; + } + if (state.view == 'homepage') { + self.sections.homepage.show({ + workarea: x + }); + } + if (state.view == 'assignments') { + if (!parsed.assignment) { + state.assignment_id = assignments.selected_id ? assignments.selected_id : get_student_courses_result.is_selected; + if (state.assignment_id == null || state.assignment_id == 'null') { + state.assignment_id = assignments.list[0].id; } - if (state.view == 'microscopy') { + state.onhashchange = false; + self.show(state); + return; + } + assignments.selected_id = state.assignment_id ? state.assignment_id : null; + scb.ui.static.MainFrame.update_hash(state); + self.sections.assignments.show({ + workarea: workarea, + assignments: assignments + }); + } + if (state.view == 'notebook') { + if (!parsed.notebook) { + delete state.onhashchange; + var experiment = ''; + if (!parsed.assignment.experiments.selected) { + experiment = parsed.assignment.experiments.start({}); + } else { + experiment = parsed.assignment.experiments.selected; + } - var id_list = []; - for (var x = 0; x < parsed.experiment.microscopy_list.list.length; x++) { - id_list.push(parsed.experiment.microscopy_list.list[x].id); - } + state.experiment_id = experiment.id; + var notebook = assignments.get(state.assignment_id).notebook; - if (!parsed.microscopy) { - if (state.microscopy_id && id_list.indexOf(state.microscopy_id) < 0 && parsed.experiment.microscopy_list.list.length > 0) { - parsed.microscopy = parsed.experiment.microscopy_list.list[state.index]; + var section = ''; - } - else { - delete state.onhashchange; - var microscopy = parsed.experiment.microscopy_list.start({}); - state.microscopy_id = microscopy.id; - var History = window.History; - if (History.enabled) { - History.replaceState("New Microscopy", "New Microscopy", '#' + $.param(state)); - } - state.onhashchange = true; - self.show(state); - return; - } - } - self.sections.microscopy.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment, - microscopy: parsed.microscopy - }); + if (!notebook.sections.selected) { + section = notebook.sections.start({}); + var History = window.History; + if (History.enabled) { + History.replaceState("New Notebook Section", "New Notebook Section", '#' + $.param(state)); + } + } else { + section = notebook.sections.selected; } - if (state.view == 'western_blot_gel') { - if (parsed.western_blot.last_gel && parsed.western_blot.gel_list.list.length == 1) - parsed.western_blot.last_gel = parsed.western_blot.gel_list.list[0].id; - if (!parsed.western_blot) { - state.onhashchange = false; - state.view = 'select_technique'; - self.show(state); - return; - } - if (!parsed.western_blot.is_transfered) { - state.view = 'western_blot'; - state.onhashchange = false; - self.show(state); - return; - } - if (!parsed.western_blot_gel) { - var gel_id = parsed.western_blot.last_gel; - if (!gel_id) { - gel = parsed.western_blot.gel_list.start({}); - parsed.western_blot.last_gel = gel.id; - gel_id = gel.id; - } - state.western_blot_gel_id = gel_id; - state.onhashchange = false; - self.show(state); - return; - } - self.sections.western_blot_gel.show({ - workarea: workarea, - assignment: parsed.assignment, - experiment: parsed.experiment, - western_blot: parsed.western_blot, - western_blot_gel: parsed.western_blot_gel - }); - } - if (state.view == 'experiment_last') { + state.notebook_id = notebook.id; + state.section_id = section.id; + state.onhashchange = true; + self.show(state); + return; + } + scb.ui.static.MainFrame.update_hash(state); + self.sections.notebook.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment, + notebook: parsed.notebook, + section: parsed.section + }); + } - if (parsed.experiment) { - state.view = parsed.experiment.last_view ? parsed.experiment.last_view : 'experiment_design'; - self.show(state); - } - else { - $('html').css('overflow', 'hidden'); - - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("Experiment does not exist", function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ - }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Error

"); - $('#jqDialog_box').attr('role', 'alertdialog'); - if (parsed.assignment) { - self.show({ - view: 'assignments', - assignment: parsed.assignment - }); - } - else { - self.show({ - view: 'assignments' - }); - } - } - } - if (user_is_auth) { - $('.scb_s_login_status').text('SIGN OUT'); - $('.scb_f_try_an_experiment').click(); + if (state.view == 'experiment_design') { + if (!parsed.experiment) { + delete state.onhashchange; + var experiment = parsed.assignment.experiments.start({}); + state.experiment_id = experiment.id; + var History = window.History; + if (History.enabled) { + History.replaceState("New Experiment", "New Experiment", '#' + $.param(state)); } - scb.ui.static.MainFrame.pending_save(parsed); - scb.ui.static.MainFrame.in_ajax_display(); - + state.onhashchange = true; + self.show(state); + return; + } + self.sections.experiment_design.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment + }); } - - scb.ui.static.MainFrame.pending_save_queue = []; - scb.ui.static.MainFrame.pending_save_inajax = false; - scb.ui.static.MainFrame.pending_save = function (parsed) { - scb.ui.static.MainFrame.pending_save_queue.push((new Date()).getTime()); - setTimeout(function () { - scb.ui.static.MainFrame.pending_save_process(parsed); - }, 5000); + if (state.view == 'experiment_setup') { + self.sections.experiment_setup.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment, + mode: 'readwrite', + last_view: 'experiment_setup', + }); } + if (state.view == 'experiment_run') { - scb.ui.static.MainFrame.pending_save_process = function (parsed) { - if (scb.ui.static.MainFrame.pending_save_inajax) { - console.info("In ajax - skipping save"); - return; + self.sections.experiment_setup.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment, + mode: 'readonly', + last_view: 'experiment_run', + }); + } + if (state.view == 'facs') { + var id_list = []; + for (var x = 0; x < parsed.experiment.facs_list.list.length; x++) { + id_list.push(parsed.experiment.facs_list.list[x].id); + } + + if (!parsed.facs) { + if (state.facs_id && id_list.indexOf(state.facs_id) < 0 && parsed.experiment.facs_list.list.length > 0) { + parsed.facs = parsed.experiment.facs_list.list[state.index]; + + } else { + delete state.onhashchange; + var facs = parsed.experiment.facs_list.start({}); + state.facs_id = facs.id; + var History = window.History; + if (History.enabled) { + History.replaceState("New FACS", "New FACS", '#' + $.param(state)); + } + state.onhashchange = true; + self.show(state); + return; } - if (scb.ui.static.MainFrame.pending_save_queue.length > 0) { - console.info("Ajax save - clear Queue"); - scb.ui.static.MainFrame.pending_save_queue = []; - if (typeof post_state_result === 'undefined') - token = user_token; - else - token = post_state_result.token; - post_obj = {'token': token, 'model': parsed.context.master_model} - console.log(post_obj); - scb.ui.static.MainFrame.pending_save_inajax = true; - console.info("Ajax save - start request "); - if (get_user_result && get_user_result.account_type == 'preview') { - console.info("In ajax - preview - skipping save"); - } - else { - $.ajax({ - type: "POST", - url: 'scb/post_state.js', - data: JSON.stringify(post_obj), - success: function (data) { - console.info("Ajax save - request success "); - scb.ui.static.MainFrame.pending_save_inajax = false; - console.log(data); - setTimeout(function () { - scb.ui.static.MainFrame.pending_save_process(parsed); - }, 5000); - }, - error: function (data) { - console.info("Ajax save - request failed, retry... "); - scb.ui.static.MainFrame.pending_save_inajax = false; - scb.ui.static.MainFrame.pending_save(parsed); - } - }); + } + self.sections.facs.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment, + facs: parsed.facs + }); + } + if (state.view == 'select_technique') { + + self.sections.select_technique.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment + }); - } - } } + if (state.view == 'western_blot') { + + var id_list = []; + for (var x = 0; x < parsed.experiment.western_blot_list.list.length; x++) { + id_list.push(parsed.experiment.western_blot_list.list[x].id); + } + + if (!parsed.western_blot) { + if (state.western_blot_id && id_list.indexOf(state.western_blot_id) < 0 && parsed.experiment.western_blot_list.list.length > 0) { + parsed.western_blot = parsed.experiment.western_blot_list.list[state.index]; + + } else { + var western_blot = parsed.experiment.western_blot_list.start({}); + state.western_blot_id = western_blot.id; + var History = window.History; + if (History.enabled) { + History.replaceState("New WB", "New WB", '#' + $.param(state)); + } + + state.onhashchange = true; + self.show(state); + return; + } + } + + if (parsed.western_blot.is_transfered) { + state.view = 'western_blot_gel'; + state.onhashchange = false; + self.show(state); + return; + } - scb.ui.static.MainFrame.pending_save_orig = function (parsed) { - if (!pending_save) { - setTimeout(function () { - pending_save = false; - console.log('believe'); - var token = 0; - if (typeof post_state_result === 'undefined') - token = user_token; - else - token = post_state_result.token; - post_obj = {'token': token, 'model': parsed.context.master_model} - console.log(post_obj); - $.ajax({ - type: "POST", - url: 'scb/post_state.js', - data: JSON.stringify(post_obj), - success: function (data) { - console.log(data); - } - }); - }, 5000); - pending_save = true; + self.sections.western_blot.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment, + western_blot: parsed.western_blot + }); + } + if (state.view == 'microscopy') { + + + var id_list = []; + for (var x = 0; x < parsed.experiment.microscopy_list.list.length; x++) { + id_list.push(parsed.experiment.microscopy_list.list[x].id); + } + + if (!parsed.microscopy) { + if (state.microscopy_id && id_list.indexOf(state.microscopy_id) < 0 && parsed.experiment.microscopy_list.list.length > 0) { + parsed.microscopy = parsed.experiment.microscopy_list.list[state.index]; + + } else { + delete state.onhashchange; + var microscopy = parsed.experiment.microscopy_list.start({}); + state.microscopy_id = microscopy.id; + var History = window.History; + if (History.enabled) { + History.replaceState("New Microscopy", "New Microscopy", '#' + $.param(state)); + } + state.onhashchange = true; + self.show(state); + return; } + } + self.sections.microscopy.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment, + microscopy: parsed.microscopy + }); } - scb.ui.static.MainFrame.refresh = function (navigation_state) { - var state = navigation_state || $.deparam(location.hash.replace(/^#/, ''), true); + if (state.view == 'western_blot_gel') { + if (parsed.western_blot.last_gel && parsed.western_blot.gel_list.list.length == 1) { + parsed.western_blot.last_gel = parsed.western_blot.gel_list.list[0].id; + } + if (!parsed.western_blot) { state.onhashchange = false; - state.view = state.view || 'homepage'; + state.view = 'select_technique'; self.show(state); - } - - $(window).bind('hashchange', function (e) { - var state = $.deparam(location.hash.replace(/^#/, ''), true); - state.onhashchange = true; - state.view = state.view || 'homepage'; + return; + } + if (!parsed.western_blot.is_transfered) { + state.view = 'western_blot'; + state.onhashchange = false; self.show(state); - }); + return; + } + if (!parsed.western_blot_gel) { + var gel_id = parsed.western_blot.last_gel; + if (!gel_id) { + gel = parsed.western_blot.gel_list.start({}); + parsed.western_blot.last_gel = gel.id; + gel_id = gel.id; + } - (function () { - var state = $.deparam(location.hash.replace(/^#/, ''), true); - state.onhashchange = true; - state.view = state.view || 'homepage'; + state.western_blot_gel_id = gel_id; + state.onhashchange = false; self.show(state); - })(); - - /* register with context SHOW_EXPERIMENT event */ - context.register('show_experiment', function () { - self.current_tab.hide(function () { - self.sections.experiment.show(function () { - self.current_tab = self.sections.experiment; - }); - }) - }); - /* register with context SHOW_MAKING_LYSATES event */ - context.register('show_making_lysates', function () { - self.current_tab.hide(function () { - self.sections.making_lysates.show(function () { - self.current_tab = self.sections.making_lysates; - }); - }) - }); -}; + return; + } + self.sections.western_blot_gel.show({ + workarea: workarea, + assignment: parsed.assignment, + experiment: parsed.experiment, + western_blot: parsed.western_blot, + western_blot_gel: parsed.western_blot_gel + }); + } + if (state.view == 'experiment_last') { -function add_login_script(workarea) { + if (parsed.experiment) { + state.view = parsed.experiment.last_view ? parsed.experiment.last_view : 'experiment_design'; + self.show(state); + } else { + $('html').css('overflow', 'hidden'); - $(workarea).append(scb_auth.login({})); - scb.utils.off_on(workarea, 'click', '.scb_f_login_close_button', function () { - $('.scb_s_login_dialog').detach(); - }); - $('.scb_f_login_iframe').load(function () { - var iframe = $('.scb_f_login_iframe').get(0); - var content = (iframe.contentDocument || iframe.contentWindow); - content.body.style.fontSize = '90%'; - content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; - var inputs = content.getElementsByTagName('button'); - $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); - var fieldset = content.querySelectorAll('fieldset'); - $(fieldset).children().wrap('

'); - var texts = content.querySelectorAll('input'); - $(texts).attr('placeholder', ''); - $(texts).css('font-family', 'Trebuchet MS, sans-serif'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); - var iframe = $('.scb_f_login_iframe').contents(); - iframe.find('input[type="checkbox"]').css('height', '12px'); - iframe.find('input[type="radio"][value="student"]').attr('checked', 'checked'); - - iframe.find('a:contains("Member")').click(function () { - $('.scb_f_login_iframe').load(function () { - var iframe = $('.scb_f_login_iframe').contents(); - $('.scb_s_login_form > div').text('Sign Up'); - $('.scb_s_login_dialog').addClass('scb_s_signup_dialog'); - $('.scb_f_login_iframe').css('height', '560px'); - }); + $.jqDialog.alert("Experiment does not exist", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ }); - iframe.find('a:contains("Password")').click(function () { - $('.scb_f_login_iframe').load(function () { - - $('.scb_s_login_form > div').text('Reset Password'); - }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Error

"); + $('#jqDialog_box').attr('role', 'alertdialog'); + if (parsed.assignment) { + self.show({ + view: 'assignments', + assignment: parsed.assignment + }); + } else { + self.show({ + view: 'assignments' + }); + } + } + } + if (user_is_auth) { + $('.scb_s_login_status').text('SIGN OUT'); + $('.scb_f_try_an_experiment').click(); + } + scb.ui.static.MainFrame.pending_save(parsed); + scb.ui.static.MainFrame.in_ajax_display(); + + } + + scb.ui.static.MainFrame.pending_save_queue = []; + scb.ui.static.MainFrame.pending_save_inajax = false; + scb.ui.static.MainFrame.pending_save = function(parsed) { + scb.ui.static.MainFrame.pending_save_queue.push((new Date()).getTime()); + setTimeout(function() { + scb.ui.static.MainFrame.pending_save_process(parsed); + }, 5000); + } + + scb.ui.static.MainFrame.pending_save_process = function(parsed) { + if (scb.ui.static.MainFrame.pending_save_inajax) { + console.info("In ajax - skipping save"); + return; + } + if (scb.ui.static.MainFrame.pending_save_queue.length > 0) { + console.info("Ajax save - clear Queue"); + scb.ui.static.MainFrame.pending_save_queue = []; + if (typeof post_state_result === 'undefined') { + token = user_token; + } else { + token = post_state_result.token; + } + post_obj = { + 'token': token, + 'model': parsed.context.master_model + } + console.log(post_obj); + scb.ui.static.MainFrame.pending_save_inajax = true; + console.info("Ajax save - start request "); + if (get_user_result && get_user_result.account_type == 'preview') { + console.info("In ajax - preview - skipping save"); + } else { + $.ajax({ + type: "POST", + url: 'scb/post_state.js', + data: JSON.stringify(post_obj), + success: function(data) { + console.info("Ajax save - request success "); + scb.ui.static.MainFrame.pending_save_inajax = false; + console.log(data); + setTimeout(function() { + scb.ui.static.MainFrame.pending_save_process(parsed); + }, 5000); + }, + error: function(data) { + console.info("Ajax save - request failed, retry... "); + scb.ui.static.MainFrame.pending_save_inajax = false; + scb.ui.static.MainFrame.pending_save(parsed); + } }); - iframe.find('a:contains("Back")').click(function () { - $('.scb_f_login_iframe').load(function () { - - $('.scb_s_login_form > div').text('Sign In'); - }); + } + } + } + + + scb.ui.static.MainFrame.pending_save_orig = function(parsed) { + if (!pending_save) { + setTimeout(function() { + pending_save = false; + console.log('believe'); + var token = 0; + if (typeof post_state_result === 'undefined') { + token = user_token; + } else { + token = post_state_result.token; + } + post_obj = { + 'token': token, + 'model': parsed.context.master_model + } + console.log(post_obj); + $.ajax({ + type: "POST", + url: 'scb/post_state.js', + data: JSON.stringify(post_obj), + success: function(data) { + console.log(data); + } }); + }, 5000); + pending_save = true; + } + } + scb.ui.static.MainFrame.refresh = function(navigation_state) { + var state = navigation_state || $.deparam(location.hash.replace(/^#/, ''), true); + state.onhashchange = false; + state.view = state.view || 'homepage'; + self.show(state); + } + + $(window).bind('hashchange', function(e) { + var state = $.deparam(location.hash.replace(/^#/, ''), true); + state.onhashchange = true; + state.view = state.view || 'homepage'; + self.show(state); + }); + + (function() { + var state = $.deparam(location.hash.replace(/^#/, ''), true); + state.onhashchange = true; + state.view = state.view || 'homepage'; + self.show(state); + })(); + + /* register with context SHOW_EXPERIMENT event */ + context.register('show_experiment', function() { + self.current_tab.hide(function() { + self.sections.experiment.show(function() { + self.current_tab = self.sections.experiment; + }); + }) + }); + /* register with context SHOW_MAKING_LYSATES event */ + context.register('show_making_lysates', function() { + self.current_tab.hide(function() { + self.sections.making_lysates.show(function() { + self.current_tab = self.sections.making_lysates; + }); + }) + }); +}; - iframe.find(".auth_submit_button").click(function () { - var mask = document.createElement('div'); - mask.className = 'overlay'; - $(mask).css({'width': '100%', 'height': '100%', 'position': 'fixed', 'z-index': '993', 'background': 'rgba(125,125,125,0.7)', 'visibility': 'visible'}); - $('body').prepend(mask); - var progress_icon = document.createElement('img'); - progress_icon.src = '../../../images/homepage/ajax_loader.gif'; - progress_icon.style.marginLeft = '50%'; - progress_icon.style.marginTop = '50%'; +function add_login_script(workarea) { + + $(workarea).append(scb_auth.login({})); + scb.utils.off_on(workarea, 'click', '.scb_f_login_close_button', function() { + $('.scb_s_login_dialog').detach(); + }); + $('.scb_f_login_iframe').load(function() { + var iframe = $('.scb_f_login_iframe').get(0); + var content = (iframe.contentDocument || iframe.contentWindow); + content.body.style.fontSize = '90%'; + content.body.style.fontFamily = 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'; + var inputs = content.getElementsByTagName('button'); + $(inputs).css('font-family', 'Trebuchet MS, Helvetica, Arial, Verdana, sans-serif'); + var fieldset = content.querySelectorAll('fieldset'); + $(fieldset).children().wrap('

'); + var texts = content.querySelectorAll('input'); + $(texts).attr('placeholder', ''); + $(texts).css('font-family', 'Trebuchet MS, sans-serif'); + + var iframe = $('.scb_f_login_iframe').contents(); + iframe.find('input[type="checkbox"]').css('height', '12px'); + iframe.find('input[type="radio"][value="student"]').attr('checked', 'checked'); + + iframe.find('a:contains("Member")').click(function() { + $('.scb_f_login_iframe').load(function() { + var iframe = $('.scb_f_login_iframe').contents(); + $('.scb_s_login_form > div').text('Sign Up'); + $('.scb_s_login_dialog').addClass('scb_s_signup_dialog'); + $('.scb_f_login_iframe').css('height', '560px'); + }); + }); + iframe.find('a:contains("Password")').click(function() { + $('.scb_f_login_iframe').load(function() { - $('.overlay').append(progress_icon); + $('.scb_s_login_form > div').text('Reset Password'); + }); + }); - $('.scb_f_login_iframe').hide(); - $('.scb_f_login_iframe').load(function () { - var profile = $('.scb_f_login_iframe').contents().get(0); - if (profile.body.textContent.indexOf('confirmed') > 0) { - parent.document.location.reload(); + iframe.find('a:contains("Back")').click(function() { + $('.scb_f_login_iframe').load(function() { - } + $('.scb_s_login_form > div').text('Sign In'); + }); + }); - else { - $(mask).remove(); - $('.scb_f_login_iframe').show(); - if ($('.scb_f_login_iframe').contents().find('.login_submit').length > 0) - $('.scb_f_login_iframe').contents().find('#errorMsg').html('Incorrect username or password. Try again'); + iframe.find(".auth_submit_button").click(function() { + var mask = document.createElement('div'); + mask.className = 'overlay'; + $(mask).css({ + 'width': '100%', + 'height': '100%', + 'position': 'fixed', + 'z-index': '993', + 'background': 'rgba(125,125,125,0.7)', + 'visibility': 'visible' + }); + $('body').prepend(mask); + var progress_icon = document.createElement('img'); + progress_icon.src = '../../../images/homepage/ajax_loader.gif'; + progress_icon.style.marginLeft = '50%'; + progress_icon.style.marginTop = '50%'; + + $('.overlay').append(progress_icon); + + $('.scb_f_login_iframe').hide(); + $('.scb_f_login_iframe').load(function() { + var profile = $('.scb_f_login_iframe').contents().get(0); + if (profile.body.textContent.indexOf('confirmed') > 0) { + parent.document.location.reload(); + + } else { + $(mask).remove(); + $('.scb_f_login_iframe').show(); + if ($('.scb_f_login_iframe').contents().find('.login_submit').length > 0) { + $('.scb_f_login_iframe').contents().find('#errorMsg').html('Incorrect username or password. Try again'); + } - } - }); - }); + } + }); }); -}; + }); +} +; diff --git a/html_app/ui/MicroscopyView.js b/html_app/ui/MicroscopyView.js index ac85a8dc..d91b8c90 100644 --- a/html_app/ui/MicroscopyView.js +++ b/html_app/ui/MicroscopyView.js @@ -3,8 +3,8 @@ scb.ui = scb.ui || {}; scb.ui.static = scb.ui.static || {}; scb.ui.static.MicroscopyView = scb.ui.static.MicroscopyView || {}; -scb.ui.static.MicroscopyView.TOTAL_TABS = 4; -scb.ui.static.MicroscopyView.TOTAL_STEPS = 5; +scb.ui.static.MicroscopyView.TOTAL_TABS = 4; +scb.ui.static.MicroscopyView.TOTAL_STEPS = 5; scb.ui.static.MicroscopyView.MAX_CONDITION_CHARS = 11; @@ -15,18 +15,18 @@ var disableSlider = false; var caman; var img_width; var img_height; -scb.ui.static.MicroscopyView.ARC = 150; -scb.ui.static.MicroscopyView.UPPER_SCROLL_LIMIT = 350; -scb.ui.static.MicroscopyView.LENS = 300; -scb.ui.static.MicroscopyView.PICTURE_LIM = 400; -scb.ui.static.MicroscopyView.MAX_BLUR= 4; -scb.ui.static.MicroscopyView.MAX_BRIGHTNESS= 250; +scb.ui.static.MicroscopyView.ARC = 150; +scb.ui.static.MicroscopyView.UPPER_SCROLL_LIMIT = 350; +scb.ui.static.MicroscopyView.LENS = 300; +scb.ui.static.MicroscopyView.PICTURE_LIM = 400; +scb.ui.static.MicroscopyView.MAX_BLUR = 4; +scb.ui.static.MicroscopyView.MAX_BRIGHTNESS = 250; -scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS = 1; -scb.ui.static.MicroscopyView.WHITE_MAX_BRIGHTNESS = 10; +scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS = 1; +scb.ui.static.MicroscopyView.WHITE_MAX_BRIGHTNESS = 10; -scb.ui.static.MicroscopyView.NORMAL_MIN_BRIGHTNESS = 0; -scb.ui.static.MicroscopyView.NORMAL_MAX_BRIGHTNESS = 8.5; +scb.ui.static.MicroscopyView.NORMAL_MIN_BRIGHTNESS = 0; +scb.ui.static.MicroscopyView.NORMAL_MAX_BRIGHTNESS = 8.5; scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT = 10; @@ -62,729 +62,718 @@ var mouseStillDown_right = false; //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// -scb.ui.static.MicroscopyView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); - var experiment_id = $(element).attr('experiment_id'); - var microscopy_id = $(element).attr('microscopy_id'); - var microscopy_lane_id = $(element).attr('microscopy_lane_id'); - - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - microscopy_id: microscopy_id, - microscopy_lane_id: microscopy_lane_id, - view: 'microscopy', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - parsed.state = state; - return parsed; +scb.ui.static.MicroscopyView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); + var experiment_id = $(element).attr('experiment_id'); + var microscopy_id = $(element).attr('microscopy_id'); + var microscopy_lane_id = $(element).attr('microscopy_lane_id'); + + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + microscopy_id: microscopy_id, + microscopy_lane_id: microscopy_lane_id, + view: 'microscopy', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + parsed.state = state; + return parsed; } -scb.ui.static.MicroscopyView.scb_s_microscopy_lens_draw_slide = function(state){ - var model = new scb.components.ModelFactory(state.context.template); - model.microscopy.compute(state); - /* state.slides contains the computed image hash */ - var img_sample = state.slides[0].hash; - - $('.scb_s_microscopy_switch_disabled').removeClass('scb_s_microscopy_switch_disabled'); - var notebook_id = null; - if(state.i_want) - notebook_id = state.i_want; - var enableIFSlider = false; - /* If the slide already assigned, don't change it */ - /* Why is this done only after compute? */ - if(state.microscopy_lane.current_slides.length == 0){ - state.microscopy_lane.current_slides = state.slides; - } - var fluorescence = (state.slide_type == 'IF' || state.slide_type == 'FLUOR' || state.slide_type == 'DyeFluor'); - - if (fluorescence) { - if ((state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type ) || (!state.microscopy_lane.lens_map.action && state.slides.length > 1 )) { - if (state.microscopy_lane.current_slides.length != 1) { - $('.scb_s_microscopy_if').prop('disabled', false); - if ($('.scb_s_microscopy_if[checked="checked"]').length > 0) { - var selected_filter = $('.scb_s_microscopy_if[checked="checked"]').prop('title').toLowerCase(); - $('.scb_f_microscopy_' + selected_filter).prop('checked', 'checked'); - state.microscopy.red_enabled = false; - state.microscopy.blue_enabled = false; - state.microscopy.green_enabled = false; - state.microscopy.merge_enabled = false; - if (selected_filter == 'all') - selected_filter = 'merge'; - state.microscopy[selected_filter + '_enabled'] = true; - state.microscopy_lane.lens_map.if_type = selected_filter; - img_sample = $.grep(state.microscopy_lane.current_slides, function (e) { - return e.if_type == selected_filter; - })[0].hash; - } - else { - if ((state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type == 'red')) { - set_filters('red', state); - } - else if ((state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type == 'green')) { - set_filters('green', state); - } - else if ((state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type == 'blue')) { - set_filters('blue', state); - } - else if ((state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type == 'merge')) { - set_filters('all', state); - } - else if (state.slides[0].if_type == 'red') { - set_filters('red', state); - state.microscopy_lane.lens_map.if_type = 'red'; - } - else if (state.slides[0].if_type == 'green') { - set_filters('green', state); - state.microscopy_lane.lens_map.if_type = 'green'; - } - else if (state.slides[0].if_type == 'blue') { - set_filters('blue', state); - state.microscopy_lane.lens_map.if_type = 'blue'; - } - else if (state.slides[0].if_type == 'merge') { - set_filters('all', state); - state.microscopy_lane.lens_map.if_type = 'merge'; - } - else { - set_filters('red', state); - state.microscopy_lane.lens_map.if_type = 'red'; - } - } - } - else { - var color = state.microscopy_lane.current_slides[0].if_type; - if (color == 'merge') - color = 'all'; - set_filters(color, state); - } +scb.ui.static.MicroscopyView.scb_s_microscopy_lens_draw_slide = function(state) { + var model = new scb.components.ModelFactory(state.context.template); + model.microscopy.compute(state); + /* state.slides contains the computed image hash */ + var img_sample = state.slides[0].hash; + + $('.scb_s_microscopy_switch_disabled').removeClass('scb_s_microscopy_switch_disabled'); + var notebook_id = null; + if (state.i_want) { + notebook_id = state.i_want; + } + var enableIFSlider = false; + /* If the slide already assigned, don't change it */ + /* Why is this done only after compute? */ + if (state.microscopy_lane.current_slides.length == 0) { + state.microscopy_lane.current_slides = state.slides; + } + var fluorescence = (state.slide_type == 'IF' || state.slide_type == 'FLUOR' || state.slide_type == 'DyeFluor'); + + if (fluorescence) { + if ((state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type) || (!state.microscopy_lane.lens_map.action && state.slides.length > 1)) { + if (state.microscopy_lane.current_slides.length != 1) { + $('.scb_s_microscopy_if').prop('disabled', false); + if ($('.scb_s_microscopy_if[checked="checked"]').length > 0) { + var selected_filter = $('.scb_s_microscopy_if[checked="checked"]').prop('title').toLowerCase(); + $('.scb_f_microscopy_' + selected_filter).prop('checked', 'checked'); + state.microscopy.red_enabled = false; + state.microscopy.blue_enabled = false; + state.microscopy.green_enabled = false; + state.microscopy.merge_enabled = false; + if (selected_filter == 'all') { + selected_filter = 'merge'; + } + state.microscopy[selected_filter + '_enabled'] = true; + state.microscopy_lane.lens_map.if_type = selected_filter; + img_sample = $.grep(state.microscopy_lane.current_slides, function(e) { + return e.if_type == selected_filter; + })[0].hash; + } else { + if ( (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type == 'red') ) { + set_filters('red', state); + } else if ( (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type == 'green') ) { + set_filters('green', state); + } else if ( (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type == 'blue') ) { + set_filters('blue', state); + } else if ( (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.if_type == 'merge') ) { + set_filters('all', state); + } else if (state.slides[0].if_type == 'red') { + set_filters('red', state); + state.microscopy_lane.lens_map.if_type = 'red'; + } else if (state.slides[0].if_type == 'green') { + set_filters('green', state); + state.microscopy_lane.lens_map.if_type = 'green'; + } else if (state.slides[0].if_type == 'blue') { + set_filters('blue', state); + state.microscopy_lane.lens_map.if_type = 'blue'; + } else if (state.slides[0].if_type == 'merge') { + set_filters('all', state); + state.microscopy_lane.lens_map.if_type = 'merge'; + } else { + set_filters('red', state); + state.microscopy_lane.lens_map.if_type = 'red'; + } } - else { - - //how to categorize a single IF slide and initialize the filter state - if (state.slides[0].if_type == 'red') { - set_filters('red', state); - state.microscopy_lane.lens_map.if_type = 'red'; - $('.scb_s_microscopy_red').prop('disabled', false); - } - else if (state.slides[0].if_type == 'green') { - set_filters('green', state); - state.microscopy_lane.lens_map.if_type = 'green'; - $('.scb_s_microscopy_green').prop('disabled', false); - } - else if (state.slides[0].if_type == 'blue') { - set_filters('blue', state); - state.microscopy_lane.lens_map.if_type = 'blue'; - $('.scb_s_microscopy_blue').prop('disabled', false); - } - else if (state.slides[0].if_type == 'merge') { - set_filters('all', state); - state.microscopy_lane.lens_map.if_type = 'merge'; - $('.scb_s_microscopy_all').prop('disabled', false); - } + } else { + var color = state.microscopy_lane.current_slides[0].if_type; + if (color == 'merge') { + color = 'all'; } + set_filters(color, state); + } } else { - $('.scb_s_microscopy_if').prop('disabled', true); - $('.scb_s_microscopy_if').prop('checked', false); + + //how to categorize a single IF slide and initialize the filter state + if (state.slides[0].if_type == 'red') { + set_filters('red', state); + state.microscopy_lane.lens_map.if_type = 'red'; + $('.scb_s_microscopy_red').prop('disabled', false); + } else if (state.slides[0].if_type == 'green') { + set_filters('green', state); + state.microscopy_lane.lens_map.if_type = 'green'; + $('.scb_s_microscopy_green').prop('disabled', false); + } else if (state.slides[0].if_type == 'blue') { + set_filters('blue', state); + state.microscopy_lane.lens_map.if_type = 'blue'; + $('.scb_s_microscopy_blue').prop('disabled', false); + } else if (state.slides[0].if_type == 'merge') { + set_filters('all', state); + state.microscopy_lane.lens_map.if_type = 'merge'; + $('.scb_s_microscopy_all').prop('disabled', false); + } } - - if(state.microscopy.light_on){ - $('#brightup').prop('disabled', false); - $('#brightdown').prop('disabled', false); - } else{ - $('#brightup').prop('disabled', true); - $('#brightdown').prop('disabled', true); + } else { + $('.scb_s_microscopy_if').prop('disabled', true); + $('.scb_s_microscopy_if').prop('checked', false); + } + + if (state.microscopy.light_on) { + $('#brightup').prop('disabled', false); + $('#brightdown').prop('disabled', false); + } else { + $('#brightup').prop('disabled', true); + $('#brightdown').prop('disabled', true); + } + if (!fluorescence) { + if (state.microscopy.light_on) { + if (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.src) { + $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); + init(state.microscopy_lane.lens_map, false, false, draw, state.microscopy_lane.lens_map.src, notebook_id); + } else { + state.microscopy_lane.lens_map.mag = state.slides[0].mag; + $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); + init(state.microscopy_lane.lens_map, true, false, draw, state.assignment.template.slides[img_sample], notebook_id); + } + disableSlider = false; + if_light_on_and_laser_on = false; + } else { + init_wb('/images/microscopy/black.jpg'); + disableSlider = true; + if_light_on_and_laser_on = false; } - if (!fluorescence) { - if (state.microscopy.light_on) { - if (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.src) { - $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); - init(state.microscopy_lane.lens_map, false, false, draw, state.microscopy_lane.lens_map.src, notebook_id); - } else { - state.microscopy_lane.lens_map.mag = state.slides[0].mag; - $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); - init(state.microscopy_lane.lens_map, true, false, draw, state.assignment.template.slides[img_sample], notebook_id); - } - disableSlider = false; - if_light_on_and_laser_on = false; - } else { - init_wb('/images/microscopy/black.jpg'); - disableSlider = true; - if_light_on_and_laser_on = false; - } - } else { /* Fluorescent */ - /* Disable the light_on button for Fluorescent images */ - $('.scb_f_microscopy_light').addClass('scb_s_microscopy_switch_disabled'); - $('.scb_f_microscopy_light').prop('disabled', true); - $('#brightdown').prop('disabled', true); - $('#brightup').prop('disabled', true); - - if (!state.microscopy.light_on && !state.microscopy.laser_on) { - init_wb('/images/microscopy/black.jpg'); - disableSlider = true; - if_light_on_and_laser_on = true; - change_brightness_lines(state.microscopy_lane.lens_map.brightness, true); - } else if (state.microscopy.light_on && !state.microscopy.laser_on) { - - if (state.microscopy_lane.lens_map.brightness > 1) - init_wb_mod(state.microscopy_lane.lens_map, '/images/microscopy/white.jpg'); - else - init_wb_mod(state.microscopy_lane.lens_map, '/images/microscopy/black.jpg'); - disableSlider = false; - enableIFSlider = true; - min_brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; - max_brightness = scb.ui.static.MicroscopyView.WHITE_MAX_BRIGHTNESS; - if_light_on_and_laser_on = true; - change_brightness_lines(state.microscopy_lane.lens_map.brightness, false); - } else if (!state.microscopy.light_on && state.microscopy.laser_on) { - if (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.src) { - $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); - state.microscopy_lane.lens_map.cache_brightness = state.microscopy_lane.lens_map.brightness; - state.microscopy_lane.lens_map.brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; - init(state.microscopy_lane.lens_map, false, true, draw, state.microscopy_lane.current_slides.length != 1 ? state.assignment.template.slides[img_sample] : state.microscopy_lane.lens_map.src, notebook_id); - } else { - state.microscopy_lane.lens_map.mag = state.slides[0].mag; - $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); - state.microscopy_lane.lens_map.cache_brightness = state.microscopy_lane.lens_map.brightness; - state.microscopy_lane.lens_map.brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; - init(state.microscopy_lane.lens_map, true, true, draw, state.assignment.template.slides[img_sample], notebook_id); - } - disableSlider = true; - min_brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; - max_brightness = scb.ui.static.MicroscopyView.WHITE_MAX_BRIGHTNESS; - if_light_on_and_laser_on = true; - } else if (state.microscopy.light_on && state.microscopy.laser_on) { - disableSlider = false; - enableIFSlider = true; - - - if (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.src) { - $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); - init(state.microscopy_lane.lens_map, false, true, draw, state.microscopy_lane.current_slides.length != 1 ? state.assignment.template.slides[img_sample] : state.microscopy_lane.lens_map.src, notebook_id); - } - else { - state.microscopy_lane.lens_map.mag = state.slides[0].mag; - $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); - init(state.microscopy_lane.lens_map, true, true, draw, state.assignment.template.slides[img_sample], notebook_id); - } - min_brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; - max_brightness = scb.ui.static.MicroscopyView.WHITE_MAX_BRIGHTNESS; - if_light_on_and_laser_on = true; + } else { /* Fluorescent */ + /* Disable the light_on button for Fluorescent images */ + $('.scb_f_microscopy_light').addClass('scb_s_microscopy_switch_disabled'); + $('.scb_f_microscopy_light').prop('disabled', true); + $('#brightdown').prop('disabled', true); + $('#brightup').prop('disabled', true); + + if (!state.microscopy.light_on && !state.microscopy.laser_on) { + init_wb('/images/microscopy/black.jpg'); + disableSlider = true; + if_light_on_and_laser_on = true; + change_brightness_lines(state.microscopy_lane.lens_map.brightness, true); + } else if (state.microscopy.light_on && !state.microscopy.laser_on) { + + if (state.microscopy_lane.lens_map.brightness > 1) { + init_wb_mod(state.microscopy_lane.lens_map, '/images/microscopy/white.jpg'); + } else { + init_wb_mod(state.microscopy_lane.lens_map, '/images/microscopy/black.jpg'); + } + disableSlider = false; + enableIFSlider = true; + min_brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; + max_brightness = scb.ui.static.MicroscopyView.WHITE_MAX_BRIGHTNESS; + if_light_on_and_laser_on = true; + change_brightness_lines(state.microscopy_lane.lens_map.brightness, false); + } else if (!state.microscopy.light_on && state.microscopy.laser_on) { + if (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.src) { + $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); + state.microscopy_lane.lens_map.cache_brightness = state.microscopy_lane.lens_map.brightness; + state.microscopy_lane.lens_map.brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; + init(state.microscopy_lane.lens_map, false, true, draw, state.microscopy_lane.current_slides.length != 1 ? state.assignment.template.slides[img_sample] : state.microscopy_lane.lens_map.src, notebook_id); + } else { + state.microscopy_lane.lens_map.mag = state.slides[0].mag; + $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); + state.microscopy_lane.lens_map.cache_brightness = state.microscopy_lane.lens_map.brightness; + state.microscopy_lane.lens_map.brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; + init(state.microscopy_lane.lens_map, true, true, draw, state.assignment.template.slides[img_sample], notebook_id); + } + disableSlider = true; + min_brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; + max_brightness = scb.ui.static.MicroscopyView.WHITE_MAX_BRIGHTNESS; + if_light_on_and_laser_on = true; + } else if (state.microscopy.light_on && state.microscopy.laser_on) { + disableSlider = false; + enableIFSlider = true; + + + if (state.microscopy_lane.lens_map && state.microscopy_lane.lens_map.src) { + $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); + init(state.microscopy_lane.lens_map, false, true, draw, state.microscopy_lane.current_slides.length != 1 ? state.assignment.template.slides[img_sample] : state.microscopy_lane.lens_map.src, notebook_id); + } else { + state.microscopy_lane.lens_map.mag = state.slides[0].mag; + $('.scb_s_microscopy_mag').text(state.microscopy_lane.lens_map.mag); + init(state.microscopy_lane.lens_map, true, true, draw, state.assignment.template.slides[img_sample], notebook_id); + } + min_brightness = scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS; + max_brightness = scb.ui.static.MicroscopyView.WHITE_MAX_BRIGHTNESS; + if_light_on_and_laser_on = true; - } - } - if (!disableSlider && !enableIFSlider) { - min_brightness = scb.ui.static.MicroscopyView.NORMAL_MIN_BRIGHTNESS; - max_brightness = scb.ui.static.MicroscopyView.NORMAL_MAX_BRIGHTNESS; } - disableBlur = state.microscopy.disable_blur; - disableBrightness = state.microscopy.disable_brightness; - if (state.microscopy.disable_blur){ - $('#fblurup').prop('disabled', true); - $('#fblurdown').prop('disabled', true); - $('#blurup').prop('disabled', true); - $('#blurdown').prop('disabled', true); - } - if(state.microscopy.disable_brightness){ - $('#brightup').prop('disabled', true); - $('#brightdown').prop('disabled', true); - $('.scb_s_microscopy_brightness_focus_middle').children().attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - } + } + if (!disableSlider && !enableIFSlider) { + min_brightness = scb.ui.static.MicroscopyView.NORMAL_MIN_BRIGHTNESS; + max_brightness = scb.ui.static.MicroscopyView.NORMAL_MAX_BRIGHTNESS; + } + disableBlur = state.microscopy.disable_blur; + disableBrightness = state.microscopy.disable_brightness; + if (state.microscopy.disable_blur) { + $('#fblurup').prop('disabled', true); + $('#fblurdown').prop('disabled', true); + $('#blurup').prop('disabled', true); + $('#blurdown').prop('disabled', true); + } + if (state.microscopy.disable_brightness) { + $('#brightup').prop('disabled', true); + $('#brightdown').prop('disabled', true); + $('.scb_s_microscopy_brightness_focus_middle').children().attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } } -function set_filters(name, state){ - state.microscopy.red_enabled = false; - state.microscopy.blue_enabled = false; - state.microscopy.green_enabled = false; - state.microscopy.merge_enabled = false; - $('.scb_s_microscopy_filter').prop('src', 'images/microscopy/Filter_Slider_'+name.charAt(0).toUpperCase() + name.slice(1)+'.png'); - $('.scb_f_microscopy_'+name).prop('checked', 'checked'); - if(name == 'all') - name = 'merge'; - state.microscopy[name+'_enabled'] = true; +function set_filters(name, state) { + state.microscopy.red_enabled = false; + state.microscopy.blue_enabled = false; + state.microscopy.green_enabled = false; + state.microscopy.merge_enabled = false; + $('.scb_s_microscopy_filter').prop('src', 'images/microscopy/Filter_Slider_' + name.charAt(0).toUpperCase() + name.slice(1) + '.png'); + $('.scb_f_microscopy_' + name).prop('checked', 'checked'); + if (name == 'all') { + name = 'merge'; + } + state.microscopy[name + '_enabled'] = true; } -scb.ui.static.MicroscopyView.scb_f_microscopy_select_slide_type = function (element, event) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - parsed.microscopy.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var slide_type = $(element).attr('value'); - if (slide_type == '') { - return; - } - var slide_id = $(element).attr('lane_id'); - var cell_treatment_id = $(element).attr('cell_treatment_id'); - var lanes = _.filter(parsed.microscopy.lanes_list.list, function(lane) { - return lane.kind == slide_type && cell_treatment_id == lane.cell_treatment_id - }); - /* Want to check if there are more conditions available for this analysis type*/ - if(lanes.length > 0) { - /* Find conditions available for this analysis type*/ - var cond_avail = lanes[0].cell_treatment.treatment_list.first.conditions[slide_type]; - - /* If the number of existing lanes is equal to num of conditions available */ - if (lanes.length >= cond_avail.length) { - - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("You've already selected this slide option.", - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - scb.ui.static.MainFrame.refresh(); - /* callback function for 'OK' button*/ - }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; - } +scb.ui.static.MicroscopyView.scb_f_microscopy_select_slide_type = function(element, event) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + parsed.microscopy.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var slide_type = $(element).attr('value'); + if (slide_type == '') { + return; + } + var slide_id = $(element).attr('lane_id'); + var cell_treatment_id = $(element).attr('cell_treatment_id'); + var lanes = _.filter(parsed.microscopy.lanes_list.list, function(lane) { + return lane.kind == slide_type && cell_treatment_id == lane.cell_treatment_id + }); + /* Want to check if there are more conditions available for this analysis type*/ + if (lanes.length > 0) { + /* Find conditions available for this analysis type*/ + var cond_avail = lanes[0].cell_treatment.treatment_list.first.conditions[slide_type]; + + /* If the number of existing lanes is equal to num of conditions available */ + if (lanes.length >= cond_avail.length) { + + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("You've already selected this slide option.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + scb.ui.static.MainFrame.refresh(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; } - /* Since there are more conditions available, we can: - 1) create a new MicroscopyLane, or - 2) change the the 'kind' of this existing Lane - */ - if (slide_id == '') {/*This means that the Lane does not 'exist' yet*/ - var cell_treatment_list=parsed.experiment.cell_treatment_list; - /* Want to find the number of conditions available for this cell_treatment */ - var conditions = _.filter(cell_treatment_list.list , function(lane){ - return lane.id == cell_treatment_id; })[0].treatment_list.first.conditions; - - if ( _.size(conditions[slide_type]) == 1) { - var slide_conditions_val = conditions[slide_type][0]; - /* Create MicroscopyLane*/ - parsed.microscopy.lanes_list.start({ - kind: slide_type, - slide_conditions: slide_conditions_val, - cell_treatment_id: cell_treatment_id, - experiment_id: parsed.experiment.id - }); - }else { - /*If there many kinds or conditions slide_condition will be selected later*/ - parsed.microscopy.lanes_list.start({ - kind: slide_type, - cell_treatment_id: cell_treatment_id, - experiment_id: parsed.experiment.id - }); - } - }else { - parsed.microscopy.lanes_list.get(slide_id).kind = slide_type; + } + /* Since there are more conditions available, we can: + 1) create a new MicroscopyLane, or + 2) change the the 'kind' of this existing Lane + */ + if (slide_id == '') { /*This means that the Lane does not 'exist' yet*/ + var cell_treatment_list = parsed.experiment.cell_treatment_list; + /* Want to find the number of conditions available for this cell_treatment */ + var conditions = _.filter(cell_treatment_list.list, function(lane) { + return lane.id == cell_treatment_id; + })[0].treatment_list.first.conditions; + + if (_.size(conditions[slide_type]) == 1) { + var slide_conditions_val = conditions[slide_type][0]; + /* Create MicroscopyLane*/ + parsed.microscopy.lanes_list.start({ + kind: slide_type, + slide_conditions: slide_conditions_val, + cell_treatment_id: cell_treatment_id, + experiment_id: parsed.experiment.id + }); + } else { + /*If there many kinds or conditions slide_condition will be selected later*/ + parsed.microscopy.lanes_list.start({ + kind: slide_type, + cell_treatment_id: cell_treatment_id, + experiment_id: parsed.experiment.id + }); } + } else { + parsed.microscopy.lanes_list.get(slide_id).kind = slide_type; + } - if (event) { - scb.ui.static.MainFrame.refresh(); - } + if (event) { + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.MicroscopyView.scb_f_microscopy_add_all_conditions = function (element, event) { - /* Select all conditions for all types/kinds */ - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - parsed.microscopy.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); - - var cell_treatment_id = $(element).attr('cell_treatment_id'); - var lanes = _.filter(parsed.microscopy.lanes_list.list, function (lane) { - return cell_treatment_id == lane.cell_treatment_id - }); - /* Need to get available conditions for each cell_treatment*/ - var cell_treatment_list=parsed.experiment.cell_treatment_list; - /* Want to find a dict of kinds and conditions available for this cell_treatment */ - var micro_kinds = _.filter(cell_treatment_list.list , function(lane){ - return lane.id == cell_treatment_id; })[0].treatment_list.first.conditions; - _.each(_.keys(micro_kinds), function(type){ - _.each(micro_kinds[type], function(condition){ - /* find if a lane exists with this condition */ - var lane = _.find(lanes, function(lane){ - return lane.slide_conditions === condition - }); - /* if not, create a new MicroscopyLane */ - if (typeof lane === 'undefined'){ - parsed.microscopy.lanes_list.start({ - kind: type, - slide_conditions: condition, - cell_treatment_id: cell_treatment_id, - experiment_id: parsed.experiment.id - }); - } - }); - /* want to remove any lanes that did not have condition selected */ - var lanes_no_cond = _.filter(lanes, function(lane){ - return lane.slide_conditions === null +scb.ui.static.MicroscopyView.scb_f_microscopy_add_all_conditions = function(element, event) { + /* Select all conditions for all types/kinds */ + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + parsed.microscopy.prep_scroll = $('.scb_s_facs_samples_table').scrollTop(); + + var cell_treatment_id = $(element).attr('cell_treatment_id'); + var lanes = _.filter(parsed.microscopy.lanes_list.list, function(lane) { + return cell_treatment_id == lane.cell_treatment_id + }); + /* Need to get available conditions for each cell_treatment*/ + var cell_treatment_list = parsed.experiment.cell_treatment_list; + /* Want to find a dict of kinds and conditions available for this cell_treatment */ + var micro_kinds = _.filter(cell_treatment_list.list, function(lane) { + return lane.id == cell_treatment_id; + })[0].treatment_list.first.conditions; + _.each(_.keys(micro_kinds), function(type) { + _.each(micro_kinds[type], function(condition) { + /* find if a lane exists with this condition */ + var lane = _.find(lanes, function(lane) { + return lane.slide_conditions === condition + }); + /* if not, create a new MicroscopyLane */ + if (typeof lane === 'undefined') { + parsed.microscopy.lanes_list.start({ + kind: type, + slide_conditions: condition, + cell_treatment_id: cell_treatment_id, + experiment_id: parsed.experiment.id }); - _.each(lanes_no_cond, function(lane){ - parsed.microscopy.lanes_list.remove(lane.id); - }); - }) - if (event) { - scb.ui.static.MainFrame.refresh(); - } + } + }); + /* want to remove any lanes that did not have condition selected */ + var lanes_no_cond = _.filter(lanes, function(lane) { + return lane.slide_conditions === null + }); + _.each(lanes_no_cond, function(lane) { + parsed.microscopy.lanes_list.remove(lane.id); + }); + }) + if (event) { + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.MicroscopyView.scb_f_microscopy_select_conditions = function (element, event) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - parsed.microscopy.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); - - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var slide_conditions = $(element).attr('value'); - if (slide_conditions == '') { - return; +scb.ui.static.MicroscopyView.scb_f_microscopy_select_conditions = function(element, event) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + parsed.microscopy.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var slide_conditions = $(element).attr('value'); + if (slide_conditions == '') { + return; + } + var slide_id = $(element).attr('lane_id'); + var cell_treatment_id = $(element).attr('cell_treatment_id'); + + /* Want to uncheck all checked radio buttons for this lane */ + var cond_list = $('input.scb_f_microscopy_select_conditions[cell_treatment_id="' + cell_treatment_id + '"][lane_id="' + slide_id + '"]'); + for (var i = 0; i < cond_list.length; i++) { + if ($(cond_list[i]).attr('value') != slide_conditions && $(cond_list[i]).attr('checked') == 'checked') { + $(cond_list[i]).attr('checked', false); } - var slide_id = $(element).attr('lane_id'); - var cell_treatment_id = $(element).attr('cell_treatment_id'); - - /* Want to uncheck all checked radio buttons for this lane */ - var cond_list= $('input.scb_f_microscopy_select_conditions[cell_treatment_id="'+ cell_treatment_id+'"][lane_id="'+slide_id+'"]'); - for (var i=0; i < cond_list.length; i++){ - if($(cond_list[i]).attr('value') != slide_conditions && $(cond_list[i]).attr('checked')=='checked'){ - $(cond_list[i]).attr('checked', false); - } + } + + /* Iterating over all lanes and comparing it to the selected one*/ + /* Comparing based on condition, kind, cell_treatment_id*/ + for (var index = 0; index < parsed.microscopy.lanes_list.list.length; index++) { + var lane = parsed.microscopy.lanes_list.list[index]; + if ( + lane.slide_conditions == slide_conditions && + lane.kind == parsed.microscopy.lanes_list.get(slide_id).kind && + lane.cell_treatment_id == cell_treatment_id + ) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + + $.jqDialog.alert("You've already selected this condition option.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + scb.ui.static.MainFrame.refresh(); + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; + } - /* Iterating over all lanes and comparing it to the selected one*/ - /* Comparing based on condition, kind, cell_treatment_id*/ - for (var index = 0; index < parsed.microscopy.lanes_list.list.length; index++) { - var lane = parsed.microscopy.lanes_list.list[index]; - if ( - lane.slide_conditions == slide_conditions && - lane.kind == parsed.microscopy.lanes_list.get(slide_id).kind && - lane.cell_treatment_id == cell_treatment_id - ) { - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - - $.jqDialog.alert("You've already selected this condition option.", - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ - scb.ui.static.MainFrame.refresh(); - }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; + } + parsed.microscopy.lanes_list.get(slide_id).slide_conditions = slide_conditions; + /* When condition selected for this Lane, want to enable conditions for the placeholder below*/ + var placeholder = $('span.scb_f_microscopy_select_slide_type[cell_treatment_id="' + cell_treatment_id + '"][lane_kind="placeholder"]'); + /* Want to check if there is a placeholder*/ + if (placeholder.length > 0) { + scb.ui.static.MicroscopyView.scb_f_microscopy_select_slide_type(placeholder); + } - } + if (event) { + scb.ui.static.MainFrame.refresh(); + } +} +scb.ui.static.MicroscopyView.scb_f_microscopy_sample_remove = function(element) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + parsed.microscopy.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var cell_treatment_id = ''; + var lysate_id = $(element).attr('lane_id'); + + /* Find cell_treatment_id for this sample*/ + _.each(parsed.microscopy.lanes_list.list, function(lane) { + if (lysate_id == lane.id) { + cell_treatment_id = lane.cell_treatment_id; } - parsed.microscopy.lanes_list.get(slide_id).slide_conditions = slide_conditions; - /* When condition selected for this Lane, want to enable conditions for the placeholder below*/ - var placeholder=$('span.scb_f_microscopy_select_slide_type[cell_treatment_id="' + cell_treatment_id + '"][lane_kind="placeholder"]'); - /* Want to check if there is a placeholder*/ - if(placeholder.length>0) { - scb.ui.static.MicroscopyView.scb_f_microscopy_select_slide_type(placeholder); - } - - if (event) { - scb.ui.static.MainFrame.refresh(); - } + }); + + /* Delete this Lane from the lanes_list*/ + parsed.microscopy.lanes_list.remove(lysate_id); + + /* If this is the only Lane for this CellTreatment, + * then remove it from the list of enabled samples*/ + var lanes = _.filter(parsed.microscopy.lanes_list.list, function(lane) { + return cell_treatment_id == lane.cell_treatment_id + }); + if (lanes.length < 1) { + parsed.microscopy.is_cell_treatment_enabled[cell_treatment_id] = false; + } + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.MicroscopyView.scb_f_microscopy_sample_remove = function (element) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - parsed.microscopy.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); +scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active = function(element, event) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var cell_treatment_id = ''; - var lysate_id = $(element).attr('lane_id'); + var val = $(element).attr('checked'); + var cell_treatment_id = $(element).attr('cell_treatment_id'); - /* Find cell_treatment_id for this sample*/ - _.each(parsed.microscopy.lanes_list.list, function (lane) { - if (lysate_id == lane.id) { - cell_treatment_id = lane.cell_treatment_id; - } - }); + parsed.microscopy.is_cell_treatment_enabled[cell_treatment_id] = val; - /* Delete this Lane from the lanes_list*/ - parsed.microscopy.lanes_list.remove(lysate_id); - - /* If this is the only Lane for this CellTreatment, - * then remove it from the list of enabled samples*/ - var lanes = _.filter(parsed.microscopy.lanes_list.list, function (lane) { - return cell_treatment_id == lane.cell_treatment_id + if (val === 'checked') { + $('.scb_f_microscopy_select_slide_type', $(element).parent().parent()).each(function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_select_slide_type(this); + }); + } else { + /*want to remove the MicroscopyLane*/ + var lanes = _.filter(parsed.microscopy.lanes_list.list, function(lane) { + return cell_treatment_id == lane.cell_treatment_id }); - if (lanes.length < 1) { - parsed.microscopy.is_cell_treatment_enabled[cell_treatment_id] = false; + _.each(lanes, function(lane) { + parsed.microscopy.lanes_list.remove(lane.id); + }); + } + parsed.microscopy.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); + if (event) { + var rows_count = parsed.microscopy.rows_state(); + if (rows_count.valid > (scb.ui.static.MicroscopyView.MAX_ROWS - 1)) { + var element = $('.scb_f_microscopy_sample_active[cell_treatment_id="' + cell_treatment_id + '"]'); + var parent = $(element).parent(); + var note = $("" + rows_count.valid + ""); + note.appendTo(parent); + console.info(parent); + setTimeout(function() { + $(note).detach(); + }, 500); } scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active = function (element, event) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); +scb.ui.static.MicroscopyView.scb_f_microscopy_remove = function(element) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var id_list = []; + for (var x = 0; x < parsed.experiment.microscopy_list.list.length; x++) { + id_list.push(parsed.experiment.microscopy_list.list[x].id); + } + parsed.state.index = id_list.indexOf(parsed.microscopy.id); + parsed.experiment.microscopy_list.remove(parsed.microscopy.id); + if (parsed.state.index == parsed.experiment.microscopy_list.list.length) { + parsed.state.index = parsed.state.index - 1; + } + //fix tab indexing for display + if (parsed.state.index > parsed.experiment.microscopy_list.list.length - scb.ui.static.MicroscopyView.TOTAL_TABS) { + + if ((parsed.experiment.microscopy_list.list.length == scb.ui.static.MicroscopyView.TOTAL_TABS + 1 || parsed.experiment.microscopy_list.list.length == scb.ui.static.MicroscopyView.TOTAL_TABS + 2) && parsed.experiment.microscopy_list.start_tabs_index <= 1) { + parsed.experiment.microscopy_list.start_tabs_index = parsed.experiment.microscopy_list.start_tabs_index + 1; + } else { + parsed.experiment.microscopy_list.start_tabs_index = parsed.experiment.microscopy_list.start_tabs_index - 1; } + } - var val = $(element).attr('checked'); - var cell_treatment_id = $(element).attr('cell_treatment_id'); + delete parsed.state.skip_hash_update; + scb.ui.static.MainFrame.refresh(parsed.state); +} - parsed.microscopy.is_cell_treatment_enabled[cell_treatment_id] = val; +scb.ui.static.MicroscopyView.scb_s_microscopy_selected = function(element) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } - if(val === 'checked') { - $('.scb_f_microscopy_select_slide_type', $(element).parent().parent()).each(function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_select_slide_type(this); - }); - }else{ - /*want to remove the MicroscopyLane*/ - var lanes = _.filter(parsed.microscopy.lanes_list.list, function (lane) { - return cell_treatment_id == lane.cell_treatment_id - }); - _.each(lanes,function(lane){ - parsed.microscopy.lanes_list.remove(lane.id); - }); - } - parsed.microscopy.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); - if (event) { - var rows_count = parsed.microscopy.rows_state(); - if (rows_count.valid > (scb.ui.static.MicroscopyView.MAX_ROWS - 1)) { - var element = $('.scb_f_microscopy_sample_active[cell_treatment_id="' + cell_treatment_id + '"]'); - var parent = $(element).parent(); - var note = $("" + rows_count.valid + ""); - note.appendTo(parent); - console.info(parent); - setTimeout(function () { - $(note).detach(); - }, 500); - } - scb.ui.static.MainFrame.refresh(); - } + parsed.microscopy.name = $(element).text(); } -scb.ui.static.MicroscopyView.scb_f_microscopy_remove = function (element) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var id_list = []; - for( var x=0; x < parsed.experiment.microscopy_list.list.length; x++){id_list.push(parsed.experiment.microscopy_list.list[x].id);} - parsed.state.index= id_list.indexOf(parsed.microscopy.id); - parsed.experiment.microscopy_list.remove(parsed.microscopy.id); - if(parsed.state.index == parsed.experiment.microscopy_list.list.length){ - parsed.state.index = parsed.state.index -1 ; - } - //fix tab indexing for display - if(parsed.state.index > parsed.experiment.microscopy_list.list.length -scb.ui.static.MicroscopyView.TOTAL_TABS) { - - if((parsed.experiment.microscopy_list.list.length == scb.ui.static.MicroscopyView.TOTAL_TABS+1 || parsed.experiment.microscopy_list.list.length == scb.ui.static.MicroscopyView.TOTAL_TABS+2) && parsed.experiment.microscopy_list.start_tabs_index <=1) - parsed.experiment.microscopy_list.start_tabs_index = parsed.experiment.microscopy_list.start_tabs_index+1; - else parsed.experiment.microscopy_list.start_tabs_index = parsed.experiment.microscopy_list.start_tabs_index-1; - } - - delete parsed.state.skip_hash_update; - scb.ui.static.MainFrame.refresh(parsed.state); -} +scb.ui.static.MicroscopyView.scb_f_microscopy_prepare_slides = function(element) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + var rows_state = parsed.microscopy.rows_state(); + if (rows_state && rows_state.valid < 1) { + $('html').css('overflow', 'hidden'); -scb.ui.static.MicroscopyView.scb_s_microscopy_selected = function (element) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } + $('body').prepend(scb_experiment_setup.general_error_overlay()); + if ($('.scb_f_microscopy_sample_active:checked').length > 0) { - parsed.microscopy.name = $(element).text(); -} + $.jqDialog.alert("Please select microscopy analysis and/or conditions for at least one sample.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); /* callback function for 'OK' button*/ return; + }); -scb.ui.static.MicroscopyView.scb_f_microscopy_prepare_slides = function (element) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - var rows_state = parsed.microscopy.rows_state(); - if (rows_state && rows_state.valid < 1) { - $('html').css('overflow', 'hidden'); - - $('body').prepend(scb_experiment_setup.general_error_overlay()); - if($('.scb_f_microscopy_sample_active:checked').length > 0){ - - $.jqDialog.alert("Please select microscopy analysis and/or conditions for at least one sample.", function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove();/* callback function for 'OK' button*/ return;}); - - } - - else{ - - $.jqDialog.alert("No samples selected.", function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove();/* callback function for 'OK' button*/ return;}); - } - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - } - else{ - /* want to find the first lane in the list that valid - and select it */ - var valid_lane = _.find(rows_state.rows, function(r){ - return r.is_valid ; - }); - parsed.microscopy.lane_selected = valid_lane.lane.id; - parsed.microscopy.slide_prepared = true; - window.scrollTo(0, 0); - scb.ui.static.MainFrame.refresh(); - } -} + } else { -scb.ui.static.MicroscopyView.scb_s_microscopy_choose_gel_type_input = function (element) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); + $.jqDialog.alert("No samples selected.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); /* callback function for 'OK' button*/ return; + }); } - parsed.microscopy.gel_type = $(element).val(); - scb.ui.static.MainFrame.refresh(); -} - -scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active_all = function (element) { - $('.scb_f_microscopy_sample_active').each(function (e) { - var element = this; - $(element).attr('checked', true); - scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active(element); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + } else { + /* want to find the first lane in the list that valid + and select it */ + var valid_lane = _.find(rows_state.rows, function(r) { + return r.is_valid; }); + parsed.microscopy.lane_selected = valid_lane.lane.id; + parsed.microscopy.slide_prepared = true; + window.scrollTo(0, 0); scb.ui.static.MainFrame.refresh(); + } +} +scb.ui.static.MicroscopyView.scb_s_microscopy_choose_gel_type_input = function(element) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.microscopy.gel_type = $(element).val(); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.MicroscopyView.scb_f_microscopy_sample_inactive_all = function (element) { - $('.scb_f_microscopy_sample_active').each(function(e){ - var element = this; - $(element).attr('checked', false); - scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active(element); - }); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active_all = function(element) { + $('.scb_f_microscopy_sample_active').each(function(e) { + var element = this; + $(element).attr('checked', true); + scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active(element); + }); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.MicroscopyView.scb_f_microscopy_load_slides = function(element){ +scb.ui.static.MicroscopyView.scb_f_microscopy_sample_inactive_all = function(element) { + $('.scb_f_microscopy_sample_active').each(function(e) { + var element = this; + $(element).attr('checked', false); + scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active(element); + }); + scb.ui.static.MainFrame.refresh(); - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); +} - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.microscopy.samples_finished = true; - parsed.microscopy.enable_samples = true; - var lane_kind = parsed.microscopy.selected_lane.kind; - if(lane_kind=='IF' || lane_kind == 'FLUOR' ){ - parsed.microscopy.laser_on = true; - parsed.microscopy.light_on =false; - } - else{ - parsed.microscopy.laser_on = false; - parsed.microscopy.light_on = true; - } - $('#lens').remove(); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.MicroscopyView.scb_f_microscopy_load_slides = function(element) { + + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.microscopy.samples_finished = true; + parsed.microscopy.enable_samples = true; + var lane_kind = parsed.microscopy.selected_lane.kind; + if (lane_kind == 'IF' || lane_kind == 'FLUOR') { + parsed.microscopy.laser_on = true; + parsed.microscopy.light_on = false; + } else { + parsed.microscopy.laser_on = false; + parsed.microscopy.light_on = true; + } + $('#lens').remove(); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.MicroscopyView.scb_s_microscopy_slide_tab = function(element){ - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if(parsed.microscopy_lane.kind == 'IF' || parsed.microscopy_lane.kind == 'FLUOR'){ - parsed.microscopy.laser_on = true; - } - else{ - parsed.microscopy.laser_on = false; - } - parsed.microscopy.lane_selected = parsed.microscopy_lane.id; - parsed.microscopy.is_tab_selected[parsed.microscopy.selected_lane.cell_treatment_id] - = parsed.microscopy.lane_selected; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.MicroscopyView.scb_s_microscopy_slide_tab = function(element) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.microscopy_lane.kind == 'IF' || parsed.microscopy_lane.kind == 'FLUOR') { + parsed.microscopy.laser_on = true; + } else { + parsed.microscopy.laser_on = false; + } + parsed.microscopy.lane_selected = parsed.microscopy_lane.id; + parsed.microscopy.is_tab_selected[parsed.microscopy.selected_lane.cell_treatment_id] = parsed.microscopy.lane_selected; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.MicroscopyView.scb_s_microscopy_choose_samples_order_list_select = function (element, event) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - if(parsed.microscopy.enable_samples){ - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if (parsed.microscopy.samples_finished) { - if (parsed.microscopy_lane.kind == 'IF' || parsed.microscopy_lane.kind == 'FLUOR') { - parsed.microscopy.laser_on = true; - } - else { - parsed.microscopy.laser_on = false; - } - $('li', $(element).parent()).removeClass('scb_s_microscopy_sample_selected'); - $(element).addClass('scb_s_microscopy_sample_selected'); - parsed.microscopy.lane_selected = parsed.microscopy_lane.id; - parsed.microscopy.scroll = $('.scb_s_microscopy_choose_samples_order_list').scrollTop(); - scb.ui.static.MainFrame.refresh(); - } - } +scb.ui.static.MicroscopyView.scb_s_microscopy_choose_samples_order_list_select = function(element, event) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.microscopy.enable_samples) { + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.microscopy.samples_finished) { + if (parsed.microscopy_lane.kind == 'IF' || parsed.microscopy_lane.kind == 'FLUOR') { + parsed.microscopy.laser_on = true; + } else { + parsed.microscopy.laser_on = false; + } + $('li', $(element).parent()).removeClass('scb_s_microscopy_sample_selected'); + $(element).addClass('scb_s_microscopy_sample_selected'); + parsed.microscopy.lane_selected = parsed.microscopy_lane.id; + parsed.microscopy.scroll = $('.scb_s_microscopy_choose_samples_order_list').scrollTop(); + scb.ui.static.MainFrame.refresh(); + } + } } -scb.ui.static.MicroscopyView.scb_s_microscopy_left_microscopy = function(element, event){ - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.MicroscopyView.scb_s_microscopy_left_microscopy = function(element, event) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); - parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.start_tabs_index -1; - scb.ui.static.MainFrame.refresh(parsed.state); + parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.start_tabs_index - 1; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.MicroscopyView.scb_s_microscopy_right_microscopy = function(element, event){ - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.MicroscopyView.scb_s_microscopy_right_microscopy = function(element, event) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); - parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.start_tabs_index +1; - scb.ui.static.MainFrame.refresh(parsed.state); + parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.start_tabs_index + 1; + scb.ui.static.MainFrame.refresh(parsed.state); } scb.ui.static.MicroscopyView.scb_s_microscopy_lane_left = function(element, event) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - var cell_treatment_id = parsed.microscopy.selected_lane.cell_treatment_id; - if (parsed.microscopy.start_tabs_index[cell_treatment_id] > 0) { - parsed.microscopy.start_tabs_index[cell_treatment_id]--; - } - scb.ui.static.MainFrame.refresh(parsed.state); + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + var cell_treatment_id = parsed.microscopy.selected_lane.cell_treatment_id; + if (parsed.microscopy.start_tabs_index[cell_treatment_id] > 0) { + parsed.microscopy.start_tabs_index[cell_treatment_id]--; + } + scb.ui.static.MainFrame.refresh(parsed.state); } scb.ui.static.MicroscopyView.scb_s_microscopy_lane_right = function(element, event) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); - var cell_treatment_id = parsed.microscopy.selected_lane.cell_treatment_id; - var max_tab_index = parsed.microscopy.total_num_tabs - scb.ui.static.MicroscopyView.TOTAL_TABS; - if (parsed.microscopy.start_tabs_index[cell_treatment_id] < max_tab_index) { - parsed.microscopy.start_tabs_index[cell_treatment_id]++; - } - scb.ui.static.MainFrame.refresh(parsed.state); + var cell_treatment_id = parsed.microscopy.selected_lane.cell_treatment_id; + var max_tab_index = parsed.microscopy.total_num_tabs - scb.ui.static.MicroscopyView.TOTAL_TABS; + if (parsed.microscopy.start_tabs_index[cell_treatment_id] < max_tab_index) { + parsed.microscopy.start_tabs_index[cell_treatment_id]++; + } + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.MicroscopyView.scb_s_microscopy_add_microscopy= function(element, event){ - var parsed = scb.ui.static.MicroscopyView.parse(element); - parsed = resetScrollValue(parsed); - - console.log(parsed.microscopy.parent.start_tabs_index); - console.log(parsed.microscopy.parent.list.length); - if(parsed.microscopy.parent.list.length==scb.ui.static.MicroscopyView.TOTAL_TABS){ - parsed.microscopy.parent.start_tabs_index = 1; - } - else if (parsed.microscopy.parent.list.length >scb.ui.static.MicroscopyView.TOTAL_TABS) - parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.length-(scb.ui.static.MicroscopyView.TOTAL_TABS-1); - scb.ui.static.MainFrame.refresh(parsed.state); +scb.ui.static.MicroscopyView.scb_s_microscopy_add_microscopy = function(element, event) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + parsed = resetScrollValue(parsed); + + console.log(parsed.microscopy.parent.start_tabs_index); + console.log(parsed.microscopy.parent.list.length); + if (parsed.microscopy.parent.list.length == scb.ui.static.MicroscopyView.TOTAL_TABS) { + parsed.microscopy.parent.start_tabs_index = 1; + } else if (parsed.microscopy.parent.list.length > scb.ui.static.MicroscopyView.TOTAL_TABS) { + parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.length - (scb.ui.static.MicroscopyView.TOTAL_TABS - 1); + } + scb.ui.static.MainFrame.refresh(parsed.state); } @@ -825,768 +814,805 @@ you pass a callback function to the method so that it calls the draw method imme -function draw_lens(param, addition, state, canvas){ - console.log(state.xparam); - console.log(state.yparam); - if(state.xparam > scb.ui.static.MicroscopyView.UPPER_SCROLL_LIMIT){ - $('#left', '.scb_s_microscopy_view').prop('disabled', true); - mouseStillDown_left = false; - - } - else{ - $('#left', '.scb_s_microscopy_view').prop('disabled', false); - - } - if(state.xparam < -img_width){ - $('#right', '.scb_s_microscopy_view').prop('disabled', true); - mouseStillDown_right = false; - - } - else{ - $('#right', '.scb_s_microscopy_view').prop('disabled', false); - - } - if(state.yparam > scb.ui.static.MicroscopyView.UPPER_SCROLL_LIMIT){ - $('#up', '.scb_s_microscopy_view').prop('disabled', true); - mouseStillDown_up = false; - - } - else{ - $('#up', '.scb_s_microscopy_view').prop('disabled', false); - - } - if(state.yparam < -img_height){ - $('#down', '.scb_s_microscopy_view').prop('disabled', true); - mouseStillDown_down = false; - - } - else{ - $('#down', '.scb_s_microscopy_view').prop('disabled', false); - - } - if(true){ - switch(param) - { - case 'x': - state.xparam = state.xparam + addition; - break; - case 'y': - state.yparam = state.yparam + addition; - break; - default: - break; - } - - - - - var samples_area = $('.scb_s_microscopy_view').find(".scb_s_microscopy_slide_content[microscopy_lane_id='"+state.parent.id+"']", '#main').get(0); - - $('#scb_s_microscopy_slide_content_lens_outline_'+state.lane_id+' svg image', '#main').attr('transform',"matrix(1,0,0,1,"+state.xparam+","+state.yparam+")" ); - } - else{ - console.error( "ERROR IN DRAW! "); - debugger; - } +function draw_lens(param, addition, state, canvas) { + console.log(state.xparam); + console.log(state.yparam); + if (state.xparam > scb.ui.static.MicroscopyView.UPPER_SCROLL_LIMIT) { + $('#left', '.scb_s_microscopy_view').prop('disabled', true); + mouseStillDown_left = false; + + } else { + $('#left', '.scb_s_microscopy_view').prop('disabled', false); + + } + if (state.xparam < -img_width) { + $('#right', '.scb_s_microscopy_view').prop('disabled', true); + mouseStillDown_right = false; + + } else { + $('#right', '.scb_s_microscopy_view').prop('disabled', false); + + } + if (state.yparam > scb.ui.static.MicroscopyView.UPPER_SCROLL_LIMIT) { + $('#up', '.scb_s_microscopy_view').prop('disabled', true); + mouseStillDown_up = false; + + } else { + $('#up', '.scb_s_microscopy_view').prop('disabled', false); + + } + if (state.yparam < -img_height) { + $('#down', '.scb_s_microscopy_view').prop('disabled', true); + mouseStillDown_down = false; + + } else { + $('#down', '.scb_s_microscopy_view').prop('disabled', false); + + } + if (true) { + switch (param) { + case 'x': + state.xparam = state.xparam + addition; + break; + case 'y': + state.yparam = state.yparam + addition; + break; + default: + break; + } + + + + + var samples_area = $('.scb_s_microscopy_view').find(".scb_s_microscopy_slide_content[microscopy_lane_id='" + state.parent.id + "']", '#main').get(0); + + $('#scb_s_microscopy_slide_content_lens_outline_' + state.lane_id + ' svg image', '#main').attr('transform', "matrix(1,0,0,1," + state.xparam + "," + state.yparam + ")"); + } else { + console.error("ERROR IN DRAW! "); + debugger; + } } -function draw(state){ - var canvas=document.getElementById("lens"); - - - document.onkeydown=function (e) { - e = e || window.event; - if(caman_lock){ - console.log('nope'); - } - else{ - if (e.keyCode == '37' && $('#left', '.scb_s_microscopy_view').prop('disabled') == false) { - // l arrow - e.preventDefault(); - draw_lens('x', scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); - console.log('left') - } - else if (e.keyCode == '38' && $('#up', '.scb_s_microscopy_view').prop('disabled')== false) { - // u arrow - e.preventDefault(); - draw_lens('y', scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state,document.getElementById("lens")); - console.log('up'); - } - else if (e.keyCode == '39' && $('#right', '.scb_s_microscopy_view').prop('disabled')== false) { - // r arrow - e.preventDefault(); - draw_lens('x', -scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); - - console.log('right'); - } - else if (e.keyCode == '40' && $('#down', '.scb_s_microscopy_view').prop('disabled')== false) { - // d arrow - e.preventDefault(); - draw_lens('y', -scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); - - console.log('down'); - } - } - }; - - $('#up', '.scb_s_microscopy_view').mousedown(function(){ - if(caman_lock){ - } - else{ - mouseStillDown_up = true; - moveUp(); - } - - }); - $('#down', '.scb_s_microscopy_view').mousedown(function(){ - if(caman_lock){ - } - else{ - mouseStillDown_down = true; - moveDown(); - } - }); - $('#left', '.scb_s_microscopy_view').mousedown(function(){ - if(caman_lock){ - } - else{ - mouseStillDown_left = true; - moveLeft(); - } - }); - $('#right', '.scb_s_microscopy_view').mousedown(function(){ - if(caman_lock){ - } - else{ - mouseStillDown_right = true; - moveRight(); - } - }); - - - - - $(document).mouseup(function(event) { - mouseStillDown_up = false; - mouseStillDown_down = false; - mouseStillDown_left = false; - mouseStillDown_right = false; - }); - - - - function moveUp() { - if (!mouseStillDown_up) { return; } // we could have come back from - // SetInterval and the mouse is no longer down - - draw_lens('y', scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); - console.log('up'); - - if (mouseStillDown_up) { setTimeout(moveUp, 100); } - } - - function moveDown() { - if (!mouseStillDown_down) { return; } // we could have come back from - // SetInterval and the mouse is no longer down - - draw_lens('y', -scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); - console.log('down'); - - if (mouseStillDown_down) { setTimeout(moveDown, 100); } - } - - function moveLeft() { - if (!mouseStillDown_left) { return; } // we could have come back from - // SetInterval and the mouse is no longer down - - draw_lens('x', scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); - console.log('left'); - - if (mouseStillDown_left) { setTimeout(moveLeft, 100); } - } - - function moveRight() { - if (!mouseStillDown_right) { return; } // we could have come back from - // SetInterval and the mouse is no longer down - - draw_lens('x', -scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); - console.log('right'); - - if (mouseStillDown_right) { setTimeout(moveRight, 100); } - } - - - - - - - - - - - $('#brightup', '.scb_s_microscopy_view').click(function(){ - if(caman_lock){ - console.log('nope'); - } - else{ - if($('.scb_s_microscopy_slide_content_lens_outline_'+state.lane_id+' svg image', '.scb_s_microscopy_view').attr('xlink:href') == '/images/microscopy/black.jpg'){ - if(state.brightness >=scb.ui.static.MicroscopyView.MAX_BRIGHTNESS){ - $('#brightup', '.scb_s_microscopy_view').prop('disabled', true); - } - else{ - $('#brightup', '.scb_s_microscopy_view').prop('disabled', false); - $('#brightdown', '.scb_s_microscopy_view').prop('disabled', false); - - } - state.brightness = state.brightness +scb.ui.static.MicroscopyView.BRIGHTNESS_LARGE_INCREMENT; - } - else{ - if(state.brightness >=max_brightness){ - $('#brightup', '.scb_s_microscopy_view').prop('disabled', true); - } - else{ - $('#brightup', '.scb_s_microscopy_view').prop('disabled', false); - $('#brightdown', '.scb_s_microscopy_view').prop('disabled', false); - - } - - if(state.brightness >=scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS) - state.brightness = state.brightness + scb.ui.static.MicroscopyView.BRIGHTNESS_UP_INCREMENT; - else state.brightness = state.brightness + scb.ui.static.MicroscopyView.BRIGHTNESS_DOWN_INCREMENT; - - console.log(state.brightness); - console.log('brightup'); - var svg =document.getElementById("svg"); - - } - - $('#lensfilter #brightness #b_red', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - $('#lensfilter #brightness #b_green', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - $('#lensfilter #brightness #b_blue', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - - $('#filter1 #b_red', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - $('#filter1 #b_green', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - $('#filter1 #b_blue', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - change_brightness_lines(state.brightness, false); - } - }); - $('#brightdown', '.scb_s_microscopy_view').click(function(){ - if(caman_lock){ - console.log('nope'); - } - else{ - if($('#svg image', '.scb_s_microscopy_view').attr('xlink:href') == '/images/microscopy/black.jpg'){ - if(state.brightness <=scb.ui.static.MicroscopyView.MAX_BRIGHTNESS){ - $('#brightup', '.scb_s_microscopy_view').prop('disabled', true); - } - else{ - $('#brightup', '.scb_s_microscopy_view').prop('disabled', false); - $('#brightdown', '.scb_s_microscopy_view').prop('disabled', false); - - } - state.brightness = state.brightness -scb.ui.static.MicroscopyView.BRIGHTNESS_LARGE_INCREMENT; - } - else{ - if(state.brightness <=min_brightness){ - $('#brightdown', '.scb_s_microscopy_view').prop('disabled', true); - } - else{ - $('#brightup', '.scb_s_microscopy_view').prop('disabled', false); - $('#brightdown', '.scb_s_microscopy_view').prop('disabled', false); - - } - - if(state.brightness <=scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS) - state.brightness = state.brightness - scb.ui.static.MicroscopyView.BRIGHTNESS_DOWN_INCREMENT; - else state.brightness = state.brightness - scb.ui.static.MicroscopyView.BRIGHTNESS_UP_INCREMENT; - - console.log(state.brightness); - console.log('brightdown'); - var svg =document.getElementById("svg"); - } - - $('#lensfilter #brightness #b_red', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - $('#lensfilter #brightness #b_green', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - $('#lensfilter #brightness #b_blue', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - - $('#filter1 #b_red', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - $('#filter1 #b_green', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - $('#filter1 #b_blue', '.scb_s_microscopy_view').attr('slope', state.brightness+''); - change_brightness_lines(state.brightness, false); - } - }); - $('#blurup', '.scb_s_microscopy_view').click(function(){ - console.log(state.blur); - console.log(scb.ui.static.MicroscopyView.MAX_BLUR); - if(state.blur >=scb.ui.static.MicroscopyView.MAX_BLUR && !isLeft){ - $('#blurup', '.scb_s_microscopy_view').prop('disabled', true); - } - else { - $('#fblurup', '.scb_s_microscopy_view').prop('disabled', false); - $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', false); - $('#blurup', '.scb_s_microscopy_view').prop('disabled', false); - $('#blurdown', '.scb_s_microscopy_view').prop('disabled', false); - } - - modify_state_blur(scb.ui.static.MicroscopyView.BLUR_COARSE_INCREMENT, state, 'up'); - console.log(state.blur) - console.log('*'); - }); - $('#blurdown', '.scb_s_microscopy_view').click(function(){ - console.log(state.blur); - console.log(scb.ui.static.MicroscopyView.MAX_BLUR); - if(state.blur >=scb.ui.static.MicroscopyView.MAX_BLUR && isLeft){ - $('#blurdown', '.scb_s_microscopy_view').prop('disabled', true); - } - else { - $('#fblurup', '.scb_s_microscopy_view').prop('disabled', false); - $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', false); - $('#blurup', '.scb_s_microscopy_view').prop('disabled', false); - $('#blurdown', '.scb_s_microscopy_view').prop('disabled', false); - } - - modify_state_blur(-scb.ui.static.MicroscopyView.BLUR_COARSE_INCREMENT, state, 'down'); - console.log(state.blur) - console.log('*'); - }); - $('#fblurup', '.scb_s_microscopy_view').click(function(){ - console.log(state.blur); - console.log(scb.ui.static.MicroscopyView.MAX_BLUR); - if(state.blur >=scb.ui.static.MicroscopyView.MAX_BLUR && !isLeft){ - $('#fblurup', '.scb_s_microscopy_view').prop('disabled', true); - $('#blurup', '.scb_s_microscopy_view').prop('disabled', true); - } - else { - $('#fblurup', '.scb_s_microscopy_view').prop('disabled', false); - $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', false); - $('#blurup', '.scb_s_microscopy_view').prop('disabled', false); - $('#blurdown', '.scb_s_microscopy_view').prop('disabled', false); - } - - modify_state_blur(scb.ui.static.MicroscopyView.BLUR_FINE_INCREMENT, state, 'up'); - console.log(state.blur) - console.log('*'); - }); - $('#fblurdown', '.scb_s_microscopy_view').click(function(){ - console.log(state.blur); - console.log(scb.ui.static.MicroscopyView.MAX_BLUR); - if(state.blur >=scb.ui.static.MicroscopyView.MAX_BLUR && isLeft){ - $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', true); - $('#blurdown', '.scb_s_microscopy_view').prop('disabled', true); - } - else { - $('#fblurup', '.scb_s_microscopy_view').prop('disabled', false); - $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', false); - $('#blurup', '.scb_s_microscopy_view').prop('disabled', false); - $('#blurdown', '.scb_s_microscopy_view').prop('disabled', false); - } - - modify_state_blur(-scb.ui.static.MicroscopyView.BLUR_FINE_INCREMENT, state, 'down'); - console.log(state.blur) - console.log('*'); - }); - - console.log('draw'); +function draw(state) { + var canvas = document.getElementById("lens"); + + + document.onkeydown = function(e) { + e = e || window.event; + if (caman_lock) { + console.log('nope'); + } else { + if (e.keyCode == '37' && $('#left', '.scb_s_microscopy_view').prop('disabled') == false) { + // l arrow + e.preventDefault(); + draw_lens('x', scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); + console.log('left') + } else if (e.keyCode == '38' && $('#up', '.scb_s_microscopy_view').prop('disabled') == false) { + // u arrow + e.preventDefault(); + draw_lens('y', scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); + console.log('up'); + } else if (e.keyCode == '39' && $('#right', '.scb_s_microscopy_view').prop('disabled') == false) { + // r arrow + e.preventDefault(); + draw_lens('x', -scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); + + console.log('right'); + } else if (e.keyCode == '40' && $('#down', '.scb_s_microscopy_view').prop('disabled') == false) { + // d arrow + e.preventDefault(); + draw_lens('y', -scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); + + console.log('down'); + } + } + }; + + $('#up', '.scb_s_microscopy_view').mousedown(function() { + if (caman_lock) { + } else { + mouseStillDown_up = true; + moveUp(); + } + + }); + $('#down', '.scb_s_microscopy_view').mousedown(function() { + if (caman_lock) { + } else { + mouseStillDown_down = true; + moveDown(); + } + }); + $('#left', '.scb_s_microscopy_view').mousedown(function() { + if (caman_lock) { + } else { + mouseStillDown_left = true; + moveLeft(); + } + }); + $('#right', '.scb_s_microscopy_view').mousedown(function() { + if (caman_lock) { + } else { + mouseStillDown_right = true; + moveRight(); + } + }); + + + + + $(document).mouseup(function(event) { + mouseStillDown_up = false; + mouseStillDown_down = false; + mouseStillDown_left = false; + mouseStillDown_right = false; + }); + + + + function moveUp() { + if (!mouseStillDown_up) { + return; + } // we could have come back from + // SetInterval and the mouse is no longer down + + draw_lens('y', scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); + console.log('up'); + + if (mouseStillDown_up) { + setTimeout(moveUp, 100); + } + } + + function moveDown() { + if (!mouseStillDown_down) { + return; + } // we could have come back from + // SetInterval and the mouse is no longer down + + draw_lens('y', -scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); + console.log('down'); + + if (mouseStillDown_down) { + setTimeout(moveDown, 100); + } + } + + function moveLeft() { + if (!mouseStillDown_left) { + return; + } // we could have come back from + // SetInterval and the mouse is no longer down + + draw_lens('x', scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); + console.log('left'); + + if (mouseStillDown_left) { + setTimeout(moveLeft, 100); + } + } + + function moveRight() { + if (!mouseStillDown_right) { + return; + } // we could have come back from + // SetInterval and the mouse is no longer down + + draw_lens('x', -scb.ui.static.MicroscopyView.LENS_DRAW_INCREMENT, state, document.getElementById("lens")); + console.log('right'); + + if (mouseStillDown_right) { + setTimeout(moveRight, 100); + } + } + + + + + + + + + + + $('#brightup', '.scb_s_microscopy_view').click(function() { + if (caman_lock) { + console.log('nope'); + } else { + if ($('.scb_s_microscopy_slide_content_lens_outline_' + state.lane_id + ' svg image', '.scb_s_microscopy_view').attr('xlink:href') == '/images/microscopy/black.jpg') { + if (state.brightness >= scb.ui.static.MicroscopyView.MAX_BRIGHTNESS) { + $('#brightup', '.scb_s_microscopy_view').prop('disabled', true); + } else { + $('#brightup', '.scb_s_microscopy_view').prop('disabled', false); + $('#brightdown', '.scb_s_microscopy_view').prop('disabled', false); + + } + state.brightness = state.brightness + scb.ui.static.MicroscopyView.BRIGHTNESS_LARGE_INCREMENT; + } else { + if (state.brightness >= max_brightness) { + $('#brightup', '.scb_s_microscopy_view').prop('disabled', true); + } else { + $('#brightup', '.scb_s_microscopy_view').prop('disabled', false); + $('#brightdown', '.scb_s_microscopy_view').prop('disabled', false); + + } + + if (state.brightness >= scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS) { + state.brightness = state.brightness + scb.ui.static.MicroscopyView.BRIGHTNESS_UP_INCREMENT; + } else { + state.brightness = state.brightness + scb.ui.static.MicroscopyView.BRIGHTNESS_DOWN_INCREMENT; + } + + console.log(state.brightness); + console.log('brightup'); + var svg = document.getElementById("svg"); + + } + + $('#lensfilter #brightness #b_red', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + $('#lensfilter #brightness #b_green', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + $('#lensfilter #brightness #b_blue', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + + $('#filter1 #b_red', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + $('#filter1 #b_green', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + $('#filter1 #b_blue', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + change_brightness_lines(state.brightness, false); + } + }); + $('#brightdown', '.scb_s_microscopy_view').click(function() { + if (caman_lock) { + console.log('nope'); + } else { + if ($('#svg image', '.scb_s_microscopy_view').attr('xlink:href') == '/images/microscopy/black.jpg') { + if (state.brightness <= scb.ui.static.MicroscopyView.MAX_BRIGHTNESS) { + $('#brightup', '.scb_s_microscopy_view').prop('disabled', true); + } else { + $('#brightup', '.scb_s_microscopy_view').prop('disabled', false); + $('#brightdown', '.scb_s_microscopy_view').prop('disabled', false); + + } + state.brightness = state.brightness - scb.ui.static.MicroscopyView.BRIGHTNESS_LARGE_INCREMENT; + } else { + if (state.brightness <= min_brightness) { + $('#brightdown', '.scb_s_microscopy_view').prop('disabled', true); + } else { + $('#brightup', '.scb_s_microscopy_view').prop('disabled', false); + $('#brightdown', '.scb_s_microscopy_view').prop('disabled', false); + + } + + if (state.brightness <= scb.ui.static.MicroscopyView.WHITE_MIN_BRIGHTNESS) { + state.brightness = state.brightness - scb.ui.static.MicroscopyView.BRIGHTNESS_DOWN_INCREMENT; + } else { + state.brightness = state.brightness - scb.ui.static.MicroscopyView.BRIGHTNESS_UP_INCREMENT; + } + + console.log(state.brightness); + console.log('brightdown'); + var svg = document.getElementById("svg"); + } + + $('#lensfilter #brightness #b_red', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + $('#lensfilter #brightness #b_green', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + $('#lensfilter #brightness #b_blue', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + + $('#filter1 #b_red', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + $('#filter1 #b_green', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + $('#filter1 #b_blue', '.scb_s_microscopy_view').attr('slope', state.brightness + ''); + change_brightness_lines(state.brightness, false); + } + }); + $('#blurup', '.scb_s_microscopy_view').click(function() { + console.log(state.blur); + console.log(scb.ui.static.MicroscopyView.MAX_BLUR); + if (state.blur >= scb.ui.static.MicroscopyView.MAX_BLUR && !isLeft) { + $('#blurup', '.scb_s_microscopy_view').prop('disabled', true); + } else { + $('#fblurup', '.scb_s_microscopy_view').prop('disabled', false); + $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', false); + $('#blurup', '.scb_s_microscopy_view').prop('disabled', false); + $('#blurdown', '.scb_s_microscopy_view').prop('disabled', false); + } + + modify_state_blur(scb.ui.static.MicroscopyView.BLUR_COARSE_INCREMENT, state, 'up'); + console.log(state.blur) + console.log('*'); + }); + $('#blurdown', '.scb_s_microscopy_view').click(function() { + console.log(state.blur); + console.log(scb.ui.static.MicroscopyView.MAX_BLUR); + if (state.blur >= scb.ui.static.MicroscopyView.MAX_BLUR && isLeft) { + $('#blurdown', '.scb_s_microscopy_view').prop('disabled', true); + } else { + $('#fblurup', '.scb_s_microscopy_view').prop('disabled', false); + $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', false); + $('#blurup', '.scb_s_microscopy_view').prop('disabled', false); + $('#blurdown', '.scb_s_microscopy_view').prop('disabled', false); + } + + modify_state_blur(-scb.ui.static.MicroscopyView.BLUR_COARSE_INCREMENT, state, 'down'); + console.log(state.blur) + console.log('*'); + }); + $('#fblurup', '.scb_s_microscopy_view').click(function() { + console.log(state.blur); + console.log(scb.ui.static.MicroscopyView.MAX_BLUR); + if (state.blur >= scb.ui.static.MicroscopyView.MAX_BLUR && !isLeft) { + $('#fblurup', '.scb_s_microscopy_view').prop('disabled', true); + $('#blurup', '.scb_s_microscopy_view').prop('disabled', true); + } else { + $('#fblurup', '.scb_s_microscopy_view').prop('disabled', false); + $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', false); + $('#blurup', '.scb_s_microscopy_view').prop('disabled', false); + $('#blurdown', '.scb_s_microscopy_view').prop('disabled', false); + } + + modify_state_blur(scb.ui.static.MicroscopyView.BLUR_FINE_INCREMENT, state, 'up'); + console.log(state.blur) + console.log('*'); + }); + $('#fblurdown', '.scb_s_microscopy_view').click(function() { + console.log(state.blur); + console.log(scb.ui.static.MicroscopyView.MAX_BLUR); + if (state.blur >= scb.ui.static.MicroscopyView.MAX_BLUR && isLeft) { + $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', true); + $('#blurdown', '.scb_s_microscopy_view').prop('disabled', true); + } else { + $('#fblurup', '.scb_s_microscopy_view').prop('disabled', false); + $('#fblurdown', '.scb_s_microscopy_view').prop('disabled', false); + $('#blurup', '.scb_s_microscopy_view').prop('disabled', false); + $('#blurdown', '.scb_s_microscopy_view').prop('disabled', false); + } + + modify_state_blur(-scb.ui.static.MicroscopyView.BLUR_FINE_INCREMENT, state, 'down'); + console.log(state.blur) + console.log('*'); + }); + + console.log('draw'); } -function change_brightness_lines(brightness_value, brightness_disabled){ - if(brightness_disabled && disableSlider){ - $('.scb_s_microscopy_brightness_focus_middle', '.scb_s_microscopy_view').children().attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - } - else{ - if(if_light_on_and_laser_on){ - var list_of_lines = $('.scb_s_microscopy_brightness_focus_middle', '.scb_s_microscopy_view').children(); - if (brightness_value > 1) - $(list_of_lines[0]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[0]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value >1.5) - $(list_of_lines[1]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[1]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 2 ) - $(list_of_lines[2]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[2]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value >2.5 ) - $(list_of_lines[3]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[3]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 3 ) - $(list_of_lines[4]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[4]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 3.5 ) - $(list_of_lines[5]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[5]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value >4 ) - $(list_of_lines[6]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[6]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value >4.5) - $(list_of_lines[7]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[7]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 5) - $(list_of_lines[8]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[8]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - - - if (brightness_value >5.5) - $(list_of_lines[9]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[9]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 6 ) - $(list_of_lines[10]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[10]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value >6.5) - $(list_of_lines[11]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[11]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value >7 ) - $(list_of_lines[12]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[12]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 7.5 ) - $(list_of_lines[13]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[13]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 8 ) - $(list_of_lines[14]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[14]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 8.5) - $(list_of_lines[15]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[15]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 9 ) - $(list_of_lines[16]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[16]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 9.5 ) - $(list_of_lines[17]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[17]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - } - else{ - var list_of_lines = $('.scb_s_microscopy_brightness_focus_middle', '.scb_s_microscopy_view').children(); - if (brightness_value > 0) - $(list_of_lines[0]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[0]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 0.1 ) - $(list_of_lines[1]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[1]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 0.2 ) - $(list_of_lines[2]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[2]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 0.3 ) - $(list_of_lines[3]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[3]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 0.4 ) - $(list_of_lines[4]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[4]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 0.5 ) - $(list_of_lines[5]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[5]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 0.6 ) - $(list_of_lines[6]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[6]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 0.7 ) - $(list_of_lines[7]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[7]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 0.8 ) - $(list_of_lines[8]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[8]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - - - if (brightness_value > 0.9 ) - $(list_of_lines[9]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[9]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 1 ) - $(list_of_lines[10]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[10]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value >2) - $(list_of_lines[11]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[11]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value >3 ) - $(list_of_lines[12]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[12]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 4 ) - $(list_of_lines[13]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[13]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 5 ) - $(list_of_lines[14]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[14]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 6 ) - $(list_of_lines[15]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[15]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 7 ) - $(list_of_lines[16]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[16]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - if (brightness_value > 8 ) - $(list_of_lines[17]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); - else - $(list_of_lines[17]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); - } - } +function change_brightness_lines(brightness_value, brightness_disabled) { + if (brightness_disabled && disableSlider) { + $('.scb_s_microscopy_brightness_focus_middle', '.scb_s_microscopy_view').children().attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } else { + if (if_light_on_and_laser_on) { + var list_of_lines = $('.scb_s_microscopy_brightness_focus_middle', '.scb_s_microscopy_view').children(); + if (brightness_value > 1) { + $(list_of_lines[0]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[0]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 1.5) { + $(list_of_lines[1]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[1]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 2) { + $(list_of_lines[2]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[2]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 2.5) { + $(list_of_lines[3]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[3]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 3) { + $(list_of_lines[4]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[4]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 3.5) { + $(list_of_lines[5]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[5]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 4) { + $(list_of_lines[6]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[6]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 4.5) { + $(list_of_lines[7]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[7]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 5) { + $(list_of_lines[8]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[8]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + + + if (brightness_value > 5.5) { + $(list_of_lines[9]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[9]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 6) { + $(list_of_lines[10]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[10]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 6.5) { + $(list_of_lines[11]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[11]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 7) { + $(list_of_lines[12]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[12]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 7.5) { + $(list_of_lines[13]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[13]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 8) { + $(list_of_lines[14]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[14]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 8.5) { + $(list_of_lines[15]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[15]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 9) { + $(list_of_lines[16]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[16]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 9.5) { + $(list_of_lines[17]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[17]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + } else { + var list_of_lines = $('.scb_s_microscopy_brightness_focus_middle', '.scb_s_microscopy_view').children(); + if (brightness_value > 0) { + $(list_of_lines[0]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[0]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 0.1) { + $(list_of_lines[1]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[1]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 0.2) { + $(list_of_lines[2]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[2]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 0.3) { + $(list_of_lines[3]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[3]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 0.4) { + $(list_of_lines[4]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[4]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 0.5) { + $(list_of_lines[5]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[5]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 0.6) { + $(list_of_lines[6]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[6]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 0.7) { + $(list_of_lines[7]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[7]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 0.8) { + $(list_of_lines[8]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[8]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + + + if (brightness_value > 0.9) { + $(list_of_lines[9]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[9]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 1) { + $(list_of_lines[10]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[10]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 2) { + $(list_of_lines[11]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[11]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 3) { + $(list_of_lines[12]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[12]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 4) { + $(list_of_lines[13]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[13]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 5) { + $(list_of_lines[14]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[14]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 6) { + $(list_of_lines[15]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[15]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 7) { + $(list_of_lines[16]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[16]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + if (brightness_value > 8) { + $(list_of_lines[17]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Green.png'); + } else { + $(list_of_lines[17]).attr('src', 'images/microscopy/Brightness/Brightness_Line_Gray.png'); + } + } + } } /////////////////////////////////////////////////////////////////////////////////////////// - + /////////////////////////////////////////////////////////////////////////////////////////// function getNatural($mainImage) { - var mainImage = $mainImage[0], - d = {}; - - if (mainImage.naturalWidth === undefined) { - var i = new Image(); - i.src = mainImage.src; - d.oWidth = i.width; - d.oHeight = i.height; - } else { - d.oWidth = mainImage.naturalWidth; - d.oHeight = mainImage.naturalHeight; - } - return d; + var mainImage = $mainImage[0]; + var d = {}; + + if (mainImage.naturalWidth === undefined) { + var i = new Image(); + i.src = mainImage.src; + d.oWidth = i.width; + d.oHeight = i.height; + } else { + d.oWidth = mainImage.naturalWidth; + d.oHeight = mainImage.naturalHeight; + } + return d; } -function getDimensions(url){ -// if(isNew || !state.src){ -// $.jqDialog.notify("The slide is being loaded. Please wait while the image loads.", 2); -// $('.jqDialog_header').remove(); -// $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); -// $('#jqDialog_box').attr('role', 'alertdialog'); -// } - var img = new Image(); - img.src = url; - var int = setInterval(function() { - if (img.complete) { - clearInterval(int); - var obj={}; - obj.oWidth = this.width; obj.oHeight = this.height; - return obj; - } - }, 50); +function getDimensions(url) { + // if(isNew || !state.src){ + // $.jqDialog.notify("The slide is being loaded. Please wait while the image loads.", 2); + // $('.jqDialog_header').remove(); + // $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + // $('#jqDialog_box').attr('role', 'alertdialog'); + // } + var img = new Image(); + img.src = url; + var int = setInterval(function() { + if (img.complete) { + clearInterval(int); + var obj = {}; + obj.oWidth = this.width; + obj.oHeight = this.height; + return obj; + } + }, 50); } //This function will initialize the image and serialize the data of the //original unprocessed image to a string -function init(state, isNew, isIF, draw, image_source, notebook_id){ - - - if(isIF){ - $('#scb_s_microscopy_slide_content_lens_outline svg').remove(); - $( "#brightup" ).unbind( "click"); - $( "#brightdown" ).unbind( "click"); - $( "#blurup" ).unbind( "click"); - $( "#blurdown" ).unbind( "click"); - $( "#fblurup" ).unbind( "click"); - $( "#fblurdown" ).unbind( "click"); - } - - $('#spy').remove(); - if(isNew || !state.src || state.width == 0 || state.height == 0){ -// var image_dimensions = document.createElement('img'); -// image_dimensions.src = image_source; -// $('.scb_s_microscopy_view')[0].appendChild(image_dimensions); -// var img = $(image_dimensions); - -// var naturalDimension = null; -// // while(naturalDimension == null){ -// naturalDimension = getDimensions(image_source); -// // } - var img = new Image(); - img.src = image_source; - var int = setInterval(function() { - $.jqDialog.notify("The image is still loading because of a slow internet connection. Please wait while the image loads.", 1); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - if (img.complete) { - $('#jqDialog_box').hide() - clearInterval(int); - var naturalDimension={}; - naturalDimension.oWidth = img.width; naturalDimension.oHeight = img.height; - if(Math.ceil(naturalDimension.oWidth/scb.ui.static.MicroscopyView.PICTURE_LIM) <= 1 || Math.ceil(naturalDimension.oHeight/scb.ui.static.MicroscopyView.PICTURE_LIM) <= 1){ - img_width =naturalDimension.oWidth; - img_height =naturalDimension.oHeight; - state.width = naturalDimension.oWidth; - state.height = naturalDimension.oHeight; - } - else{ - img_width = scb.ui.static.MicroscopyView.PICTURE_LIM; - - var height_proportion = Math.ceil((scb.ui.static.MicroscopyView.PICTURE_LIM*naturalDimension.oHeight)/naturalDimension.oWidth); - - img_height = height_proportion; - - - naturalDimension.oHeight=img_height; - naturalDimension.oWidth =img_width; - state.width = naturalDimension.oWidth; - state.height = naturalDimension.oHeight; - } - initialize_state(state, isNew, isIF, draw, image_source, naturalDimension, notebook_id) - - } - }, 1000); - - } - else{ - initialize_state(state, isNew, isIF, draw, image_source, notebook_id) - } +function init(state, isNew, isIF, draw, image_source, notebook_id) { + + + if (isIF) { + $('#scb_s_microscopy_slide_content_lens_outline svg').remove(); + $("#brightup").unbind("click"); + $("#brightdown").unbind("click"); + $("#blurup").unbind("click"); + $("#blurdown").unbind("click"); + $("#fblurup").unbind("click"); + $("#fblurdown").unbind("click"); + } + + $('#spy').remove(); + if (isNew || !state.src || state.width == 0 || state.height == 0) { + // var image_dimensions = document.createElement('img'); + // image_dimensions.src = image_source; + // $('.scb_s_microscopy_view')[0].appendChild(image_dimensions); + // var img = $(image_dimensions); + + // var naturalDimension = null; + // // while(naturalDimension == null){ + // naturalDimension = getDimensions(image_source); + // // } + var img = new Image(); + img.src = image_source; + var int = setInterval(function() { + $.jqDialog.notify("The image is still loading because of a slow internet connection. Please wait while the image loads.", 1); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + if (img.complete) { + $('#jqDialog_box').hide() + clearInterval(int); + var naturalDimension = {}; + naturalDimension.oWidth = img.width; + naturalDimension.oHeight = img.height; + if (Math.ceil(naturalDimension.oWidth / scb.ui.static.MicroscopyView.PICTURE_LIM) <= 1 || Math.ceil(naturalDimension.oHeight / scb.ui.static.MicroscopyView.PICTURE_LIM) <= 1) { + img_width = naturalDimension.oWidth; + img_height = naturalDimension.oHeight; + state.width = naturalDimension.oWidth; + state.height = naturalDimension.oHeight; + } else { + img_width = scb.ui.static.MicroscopyView.PICTURE_LIM; + + var height_proportion = Math.ceil((scb.ui.static.MicroscopyView.PICTURE_LIM * naturalDimension.oHeight) / naturalDimension.oWidth); + + img_height = height_proportion; + + + naturalDimension.oHeight = img_height; + naturalDimension.oWidth = img_width; + state.width = naturalDimension.oWidth; + state.height = naturalDimension.oHeight; + } + initialize_state(state, isNew, isIF, draw, image_source, naturalDimension, notebook_id) + + } + }, 1000); + + } else { + initialize_state(state, isNew, isIF, draw, image_source, notebook_id) + } } -function initialize_state(state, isNew, isIF, draw, image_source, naturalDimension, notebook_id){ - var controls = document.getElementById('scb_s_microscopy_lens_controls', '.scb_s_microscopy_view'); - - var outline = $('body').find('.scb_s_microscopy_slide_content_lens_outline', '#main').get(0); - var samples_area = $('body').find(".scb_s_microscopy_slide_content[microscopy_lane_id='"+state.parent.id+"']", '#main').get(0); - - if(samples_area){ - - $(samples_area).append(controls); -// if(image_dimensions.src.indexOf('static') < 0 && image_dimensions.src.indexOf('127.0.0.1:8000') >=0) -// image_dimensions.src = [image_dimensions.src.slice(0, 22), 'static/', image_dimensions.src.slice(22)].join(''); - - if(isNew){ - state.brightness= 1; - state.action = 'start'; - if(!disableBlur){ - var randomblur = Math.round(Math.ceil(Math.random()*scb.ui.static.MicroscopyView.MAX_BLUR) / 1) * 1; - var randomside = Math.round(Math.ceil(Math.random()*2)); - if(randomside == 1){ - isLeft = false; - } - else{ - isLeft = true; - } - state.blur = randomblur; - } - var randomxparam = Math.ceil(Math.random() * (scb.ui.static.MicroscopyView.ARC - -(state.width-scb.ui.static.MicroscopyView.ARC)) + -(state.width-scb.ui.static.MicroscopyView.ARC)); - var randomyparam = Math.ceil(Math.random() * (scb.ui.static.MicroscopyView.ARC - -(state.height-scb.ui.static.MicroscopyView.ARC)) + -(state.height-scb.ui.static.MicroscopyView.ARC)); - state.xparam = randomxparam; - state.yparam = randomyparam; - state.src = image_source; - } - else{ - - state.src = image_source; - } - if($('.scb_s_notebook_view').length > 0 ){ - } - else{ - Raphael.st.draggable = function() { - var me = this, - lx = 0, - ly = 0, - ox = state.xparam, - oy = state.yparam, - moveFnc = function(dx, dy) { - lx = dx + ox; // add the new change in x to the drag origin - ly = dy + oy; // do the same for y - me.transform('t' + lx + ',' + ly); - }, - startFnc = function() { - if(state.isFirstDrag){ - state.isFirstDrag = false; - } - else{ - //if first time, then 0 otherwise make it state.xparam - ox = state.xparam; - oy = state.yparam; - } - }, - endFnc = function() { - ox = lx; - oy = ly; - state.xparam = lx; - state.yparam = ly; - }; - - this.drag(moveFnc, startFnc, endFnc); - }; - } - - var outline = null; - if(notebook_id ){ - - outline = document.getElementById(notebook_id); - } - else{ - outline = document.getElementById('scb_s_microscopy_slide_content_lens_outline_'+state.lane_id); - } - - var paper = Raphael(outline); - var mySet=paper.set(); - var filter1 = paper.filterCreate("filter1"); - var blur1 = Raphael.filterOps.feGaussianBlur({id: 'blur', stdDeviation: state.blur, "in": "SourceGraphic"}); - filter1.appendOperation(blur1); - var ct1 = Raphael.filterOps.feComponentTransfer({ - feFuncR: {type: "linear", slope: state.brightness, id: 'b_red'}, - feFuncG: {type: "linear", slope: state.brightness, id: 'b_green'}, - feFuncB: {type: "linear", slope:state.brightness, id: 'b_blue'} - }); - filter1.appendOperation(ct1); - var image = paper.image(image_source, 0, 0,state.width, state.height); - - image.filterInstall(filter1); - - mySet.push(image); - if($('.scb_s_notebook_view').length > 0 ){ - } - else{ - mySet.draggable(); - } - - - state.action = 'initialized'; - $('#scb_s_microscopy_slide_content_lens_outline_'+state.lane_id+' svg image').attr('transform',"matrix(1,0,0,1,"+state.xparam+","+state.yparam+")" ); - $('svg').css('position', 'static'); //or initial - if($('.scb_s_notebook_view').length > 0 ){ - } - else{ - change_brightness_lines(state.brightness, disableBrightness); - draw(state); - - } - } +function initialize_state(state, isNew, isIF, draw, image_source, naturalDimension, notebook_id) { + var controls = document.getElementById('scb_s_microscopy_lens_controls', '.scb_s_microscopy_view'); + + var outline = $('body').find('.scb_s_microscopy_slide_content_lens_outline', '#main').get(0); + var samples_area = $('body').find(".scb_s_microscopy_slide_content[microscopy_lane_id='" + state.parent.id + "']", '#main').get(0); + + if (samples_area) { + + $(samples_area).append(controls); + // if(image_dimensions.src.indexOf('static') < 0 && image_dimensions.src.indexOf('127.0.0.1:8000') >=0) + // image_dimensions.src = [image_dimensions.src.slice(0, 22), 'static/', image_dimensions.src.slice(22)].join(''); + + if (isNew) { + state.brightness = 1; + state.action = 'start'; + if (!disableBlur) { + var randomblur = Math.round(Math.ceil(Math.random() * scb.ui.static.MicroscopyView.MAX_BLUR) / 1) * 1; + var randomside = Math.round(Math.ceil(Math.random() * 2)); + if (randomside == 1) { + isLeft = false; + } else { + isLeft = true; + } + state.blur = randomblur; + } + var randomxparam = Math.ceil(Math.random() * (scb.ui.static.MicroscopyView.ARC - -(state.width - scb.ui.static.MicroscopyView.ARC)) + -(state.width - scb.ui.static.MicroscopyView.ARC)); + var randomyparam = Math.ceil(Math.random() * (scb.ui.static.MicroscopyView.ARC - -(state.height - scb.ui.static.MicroscopyView.ARC)) + -(state.height - scb.ui.static.MicroscopyView.ARC)); + state.xparam = randomxparam; + state.yparam = randomyparam; + state.src = image_source; + } else { + + state.src = image_source; + } + if ($('.scb_s_notebook_view').length > 0) { + } else { + Raphael.st.draggable = function() { + var me = this; + var lx = 0; + var ly = 0; + var ox = state.xparam; + var oy = state.yparam; + var moveFnc = function(dx, dy) { + lx = dx + ox; // add the new change in x to the drag origin + ly = dy + oy; // do the same for y + me.transform('t' + lx + ',' + ly); + }; + var startFnc = function() { + if (state.isFirstDrag) { + state.isFirstDrag = false; + } else { + //if first time, then 0 otherwise make it state.xparam + ox = state.xparam; + oy = state.yparam; + } + }; + var endFnc = function() { + ox = lx; + oy = ly; + state.xparam = lx; + state.yparam = ly; + }; + + this.drag(moveFnc, startFnc, endFnc); + }; + } + + var outline = null; + if (notebook_id) { + + outline = document.getElementById(notebook_id); + } else { + outline = document.getElementById('scb_s_microscopy_slide_content_lens_outline_' + state.lane_id); + } + + var paper = Raphael(outline); + var mySet = paper.set(); + var filter1 = paper.filterCreate("filter1"); + var blur1 = Raphael.filterOps.feGaussianBlur({ + id: 'blur', + stdDeviation: state.blur, + "in": "SourceGraphic" + }); + filter1.appendOperation(blur1); + var ct1 = Raphael.filterOps.feComponentTransfer({ + feFuncR: { + type: "linear", + slope: state.brightness, + id: 'b_red' + }, + feFuncG: { + type: "linear", + slope: state.brightness, + id: 'b_green' + }, + feFuncB: { + type: "linear", + slope: state.brightness, + id: 'b_blue' + } + }); + filter1.appendOperation(ct1); + var image = paper.image(image_source, 0, 0, state.width, state.height); + + image.filterInstall(filter1); + + mySet.push(image); + if ($('.scb_s_notebook_view').length > 0) { + } else { + mySet.draggable(); + } + + + state.action = 'initialized'; + $('#scb_s_microscopy_slide_content_lens_outline_' + state.lane_id + ' svg image').attr('transform', "matrix(1,0,0,1," + state.xparam + "," + state.yparam + ")"); + $('svg').css('position', 'static'); //or initial + if ($('.scb_s_notebook_view').length > 0) { + } else { + change_brightness_lines(state.brightness, disableBrightness); + draw(state); + + } + } } -function copy_state(current_state, new_state, new_state_source){ - new_state.brightness = current_state.brightness; - new_state.xparam = current_state.xparam; - new_state.yparam = current_state.yparam; - new_state.blur = current_state.blur; - new_state.action = 'start'; - new_state.src = new_state_source; - $('.scb_s_microscope_status', '.scb_s_microscopy_view').text(new_state.action); - return new_state; - +function copy_state(current_state, new_state, new_state_source) { + new_state.brightness = current_state.brightness; + new_state.xparam = current_state.xparam; + new_state.yparam = current_state.yparam; + new_state.blur = current_state.blur; + new_state.action = 'start'; + new_state.src = new_state_source; + $('.scb_s_microscope_status', '.scb_s_microscopy_view').text(new_state.action); + return new_state; + } @@ -1595,68 +1621,64 @@ function copy_state(current_state, new_state, new_state_source){ //////////////////ORIGINAL FUNCTIONS///////////////////////// -function modify_state_blur(addition, state, direction){ - caman_lock = true; - var svg =document.getElementById("svg"); - if(state.blur >scb.ui.static.MicroscopyView.MAX_BLUR){ - state.blur = scb.ui.static.MicroscopyView.MAX_BLUR; - } - else if (state.blur <-scb.ui.static.MicroscopyView.MAX_BLUR){ - state.blur = -scb.ui.static.MicroscopyView.MAX_BLUR; - } - if (state.blur == 0 && direction =='up'){ - isLeft = false; - var canvas = document.getElementById('lens'); - state.blur = state.blur + Math.abs(addition); - } - else if (state.blur == 0 && direction =='down'){ - isLeft = true; - var canvas = document.getElementById('lens'); - state.blur = state.blur + Math.abs(addition); - } - else if(isLeft){ - var canvas = document.getElementById('lens'); - state.blur = state.blur + -addition; - } - else { - var canvas = document.getElementById('lens'); - state.blur = state.blur + addition; - - } - - $(".scb_s_microscopy_slide_content[microscopy_lane_id='"+state.parent.id+"'] #filter1 *[in='SourceGraphic']", '#main').get(0).setAttribute('stdDeviation', state.blur); - caman_lock = false; +function modify_state_blur(addition, state, direction) { + caman_lock = true; + var svg = document.getElementById("svg"); + if (state.blur > scb.ui.static.MicroscopyView.MAX_BLUR) { + state.blur = scb.ui.static.MicroscopyView.MAX_BLUR; + } else if (state.blur < -scb.ui.static.MicroscopyView.MAX_BLUR) { + state.blur = -scb.ui.static.MicroscopyView.MAX_BLUR; + } + if (state.blur == 0 && direction == 'up') { + isLeft = false; + var canvas = document.getElementById('lens'); + state.blur = state.blur + Math.abs(addition); + } else if (state.blur == 0 && direction == 'down') { + isLeft = true; + var canvas = document.getElementById('lens'); + state.blur = state.blur + Math.abs(addition); + } else if (isLeft) { + var canvas = document.getElementById('lens'); + state.blur = state.blur + -addition; + } else { + var canvas = document.getElementById('lens'); + state.blur = state.blur + addition; + + } + + $(".scb_s_microscopy_slide_content[microscopy_lane_id='" + state.parent.id + "'] #filter1 *[in='SourceGraphic']", '#main').get(0).setAttribute('stdDeviation', state.blur); + caman_lock = false; } -function reset_image(img2string){ - var image = document.createElement('img'); - image.src = img2string; - return image; +function reset_image(img2string) { + var image = document.createElement('img'); + image.src = img2string; + return image; } -scb.ui.static.MicroscopyView.scb_f_microscopy_note_close_button= function (element) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - var note = $(element).attr('note'); - note = '.' +note; - $(note).slideUp('400', function(){ - parsed.microscopy.navigation_show_state = $('.scb_s_microscopy_tools_navigation_followup', '.scb_s_microscopy_view').is(":visible"); - parsed.microscopy.samples_show_state = $('.scb_s_microscopy_tools_samples_followup', '.scb_s_microscopy_view').is(":visible"); - //scb.ui.static.MainFrame.refresh(); - }); - +scb.ui.static.MicroscopyView.scb_f_microscopy_note_close_button = function(element) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + var note = $(element).attr('note'); + note = '.' + note; + $(note).slideUp('400', function() { + parsed.microscopy.navigation_show_state = $('.scb_s_microscopy_tools_navigation_followup', '.scb_s_microscopy_view').is(":visible"); + parsed.microscopy.samples_show_state = $('.scb_s_microscopy_tools_samples_followup', '.scb_s_microscopy_view').is(":visible"); + //scb.ui.static.MainFrame.refresh(); + }); + } -scb.ui.static.MicroscopyView.scb_f_microscopy_tools_toggle = function (element) { - var parsed = scb.ui.static.MicroscopyView.parse(element); - var note = $(element).attr('note'); - note = '.' +note; - $(note).slideDown('400', function(){ - parsed.microscopy.navigation_show_state = $('.scb_s_microscopy_tools_navigation_followup', '.scb_s_microscopy_view').is(":visible"); - parsed.microscopy.samples_show_state = $('.scb_s_microscopy_tools_samples_followup', '.scb_s_microscopy_view').is(":visible"); - //scb.ui.static.MainFrame.refresh(); - }); - +scb.ui.static.MicroscopyView.scb_f_microscopy_tools_toggle = function(element) { + var parsed = scb.ui.static.MicroscopyView.parse(element); + var note = $(element).attr('note'); + note = '.' + note; + $(note).slideDown('400', function() { + parsed.microscopy.navigation_show_state = $('.scb_s_microscopy_tools_navigation_followup', '.scb_s_microscopy_view').is(":visible"); + parsed.microscopy.samples_show_state = $('.scb_s_microscopy_tools_samples_followup', '.scb_s_microscopy_view').is(":visible"); + //scb.ui.static.MainFrame.refresh(); + }); + } //////////////////// @@ -1664,495 +1686,492 @@ scb.ui.static.MicroscopyView.scb_f_microscopy_tools_toggle = function (element) //////////////////// //////////////////// -scb.ui.static.MicroscopyView.register = function (workarea) { - scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_select_slide_type', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_select_slide_type(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_add_all_conditions', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_add_all_conditions(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_select_conditions', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_select_conditions(this, e); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_sample_active', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_remove', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_remove(this); - }); - scb.utils.off_on(workarea, 'blur', '.scb_s_microscopy_selected', function (e) { - scb.ui.static.MicroscopyView.scb_s_microscopy_selected(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_load_slides', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_load_slides(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_left_microscopy', function (e) { - scb.ui.static.MicroscopyView.scb_s_microscopy_left_microscopy(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_right_microscopy', function (e) { - scb.ui.static.MicroscopyView.scb_s_microscopy_right_microscopy(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_lane_left', function (e) { - scb.ui.static.MicroscopyView.scb_s_microscopy_lane_left(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_lane_right', function (e) { - scb.ui.static.MicroscopyView.scb_s_microscopy_lane_right(this); - }); +scb.ui.static.MicroscopyView.register = function(workarea) { + scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_select_slide_type', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_select_slide_type(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_add_all_conditions', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_add_all_conditions(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_select_conditions', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_select_conditions(this, e); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_sample_active', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_remove', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_remove(this); + }); + scb.utils.off_on(workarea, 'blur', '.scb_s_microscopy_selected', function(e) { + scb.ui.static.MicroscopyView.scb_s_microscopy_selected(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_load_slides', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_load_slides(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_left_microscopy', function(e) { + scb.ui.static.MicroscopyView.scb_s_microscopy_left_microscopy(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_right_microscopy', function(e) { + scb.ui.static.MicroscopyView.scb_s_microscopy_right_microscopy(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_lane_left', function(e) { + scb.ui.static.MicroscopyView.scb_s_microscopy_lane_left(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_lane_right', function(e) { + scb.ui.static.MicroscopyView.scb_s_microscopy_lane_right(this); + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_slide_tab', function(e) { + scb.ui.static.MicroscopyView.scb_s_microscopy_slide_tab(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_add_microscopy', function(e, ui) { + scb.ui.static.MicroscopyView.scb_s_microscopy_add_microscopy(this); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_laser', function(e) { + + var parsed = scb.ui.static.MicroscopyView.parse(this); + parsed = resetScrollValue(parsed); - scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_slide_tab', function (e) { - scb.ui.static.MicroscopyView.scb_s_microscopy_slide_tab(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_add_microscopy', function (e, ui) { - scb.ui.static.MicroscopyView.scb_s_microscopy_add_microscopy(this); - }); - scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_laser', function (e) { - - var parsed = scb.ui.static.MicroscopyView.parse(this); - parsed = resetScrollValue(parsed); - - if($(this).attr('checked') =='checked'){ - - parsed.microscopy.laser_on = true; - } - else{ - parsed.microscopy.laser_on = false; - } - scb.ui.static.MainFrame.refresh(); + if ($(this).attr('checked') == 'checked') { - }); - scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_light', function (e) { - - var parsed = scb.ui.static.MicroscopyView.parse(this); - parsed = resetScrollValue(parsed); - - if($(this).attr('checked') =='checked'){ - parsed.microscopy.light_on = true; - - } - else{ - parsed.microscopy.light_on = false; - - - } - if(!parsed.microscopy.light_on){ - $('#brightup').prop('disabled', true); - - $('#brightdown').prop('disabled', true); - } - else{ - $('#brightup').prop('disabled', false); - - $('#brightdown').prop('disabled', false); - } - scb.ui.static.MainFrame.refresh(); + parsed.microscopy.laser_on = true; + } else { + parsed.microscopy.laser_on = false; + } + scb.ui.static.MainFrame.refresh(); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_choose_samples_order_list>li', function (e) { - scb.ui.static.MicroscopyView.scb_s_microscopy_choose_samples_order_list_select(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_prepare_slides', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_prepare_slides(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_sample_active_all', function (e, ui) { - scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active_all(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_sample_inactive_all', function (e, ui){ - scb.ui.static.MicroscopyView.scb_f_microscopy_sample_inactive_all(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_sample_remove', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_sample_remove(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_red', function (e, ui){ - - var parsed = scb.ui.static.MicroscopyView.parse(this); - parsed = resetScrollValue(parsed); - if( parsed.microscopy_lane.kind != 'IF' ){ - parsed.microscopy.red_enabled = true; - parsed.microscopy.blue_enabled = false; - parsed.microscopy.green_enabled = false; - parsed.microscopy.merge_enabled = false; - $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Red.png'); - return; - } - else if(parsed.microscopy_lane.kind == 'IF' && !parsed.microscopy_lane.lens_map.if_type){ - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("No available image for this filter", - function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; - } - else{ - for(var x = 0; x < parsed.microscopy.selected_lane.current_slides.length; x ++){ - if(parsed.microscopy.selected_lane.current_slides[x].if_type == 'red'){ - parsed.microscopy.red_enabled = true; - parsed.microscopy.blue_enabled = false; - parsed.microscopy.green_enabled = false; - parsed.microscopy.merge_enabled = false; - parsed.microscopy.selected_lane.lens_map.if_type = 'red'; - draw_lens('x', 0,parsed.microscopy.selected_lane.lens_map, document.getElementById("lens")); - $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Red.png'); - var new_state = copy_state(parsed.microscopy_lane.lens_map, scb.LensMap, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash]) - init(parsed.microscopy_lane.lens_map, false, true, draw, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash], null); - break; - } - } - } - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_blue', function (e, ui){ - - var parsed = scb.ui.static.MicroscopyView.parse(this); - parsed = resetScrollValue(parsed); - if( parsed.microscopy_lane.kind != 'IF' ){ - parsed.microscopy.red_enabled = false; - parsed.microscopy.blue_enabled = true; - parsed.microscopy.green_enabled = false; - parsed.microscopy.merge_enabled = false; - $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Blue.png'); - return; - } - else if(parsed.microscopy_lane.kind == 'IF' && !parsed.microscopy_lane.lens_map.if_type){ - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("No available image for this filter", - function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; - } - else{ - for(var x = 0; x < parsed.microscopy.selected_lane.current_slides.length; x ++){ - if(parsed.microscopy.selected_lane.current_slides[x].if_type == 'blue'){ - parsed.microscopy.red_enabled = false; - parsed.microscopy.blue_enabled = true; - parsed.microscopy.green_enabled = false; - parsed.microscopy.merge_enabled = false; - parsed.microscopy.selected_lane.lens_map.if_type = 'blue'; - draw_lens('x', 0,parsed.microscopy.selected_lane.lens_map, document.getElementById("lens")); - $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Blue.png'); - var new_state = copy_state(parsed.microscopy_lane.lens_map, scb.LensMap, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash]) - init(parsed.microscopy_lane.lens_map, false, true, draw, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash], null); - break; - } - } - } - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_green', function (e, ui){ - - var parsed = scb.ui.static.MicroscopyView.parse(this); - parsed = resetScrollValue(parsed); - if( parsed.microscopy_lane.kind != 'IF' ){ - parsed.microscopy.red_enabled = false; - parsed.microscopy.blue_enabled = false; - parsed.microscopy.green_enabled = true; - parsed.microscopy.merge_enabled = false; - $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Green.png'); - return; - } - else if(parsed.microscopy_lane.kind == 'IF' && !parsed.microscopy_lane.lens_map.if_type){ - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("No available image for this filter", - function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; - } - else{ - for(var x = 0; x < parsed.microscopy.selected_lane.current_slides.length; x ++){ - if(parsed.microscopy.selected_lane.current_slides[x].if_type == 'green'){ - parsed.microscopy.red_enabled = false; - parsed.microscopy.blue_enabled = false; - parsed.microscopy.green_enabled = true; - parsed.microscopy.merge_enabled = false; - parsed.microscopy.selected_lane.lens_map.if_type = 'green'; - draw_lens('x', 0,parsed.microscopy.selected_lane.lens_map, document.getElementById("lens")); - $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Green.png'); - var new_state = copy_state(parsed.microscopy_lane.lens_map, scb.LensMap, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash]) - init(parsed.microscopy_lane.lens_map, false, true, draw, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash], null); - break; - } - } - } - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_all', function (e, ui){ - - var parsed = scb.ui.static.MicroscopyView.parse(this); - parsed = resetScrollValue(parsed); - if( parsed.microscopy_lane.kind != 'IF' ){ - parsed.microscopy.red_enabled = false; - parsed.microscopy.blue_enabled = false; - parsed.microscopy.green_enabled = false; - parsed.microscopy.merge_enabled = true; - $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_All.png'); - return; - } - else if(parsed.microscopy_lane.kind == 'IF' && !parsed.microscopy_lane.lens_map.if_type){ - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("No available image for this filter", - function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - return; - } - else{ - for(var x = 0; x < parsed.microscopy.selected_lane.current_slides.length; x ++){ - if(parsed.microscopy.selected_lane.current_slides[x].if_type == 'merge'){ - parsed.microscopy.red_enabled = false; - parsed.microscopy.blue_enabled = false; - parsed.microscopy.green_enabled = false; - parsed.microscopy.merge_enabled = true; - parsed.microscopy.selected_lane.lens_map.if_type = 'merge'; - draw_lens('x', 0,parsed.microscopy.selected_lane.lens_map, document.getElementById("lens")); - $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_All.png'); - var new_state = copy_state(parsed.microscopy_lane.lens_map, scb.LensMap, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash]) - init(parsed.microscopy_lane.lens_map, false, true, draw, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash], null); - break; - } - } - } - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_tools_toggle', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_tools_toggle(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_note_close_button', function (e) { - scb.ui.static.MicroscopyView.scb_f_microscopy_note_close_button(this); - }); - scb.utils.off_on(workarea, 'mouseup', document, function(e,ui){ - var container = $(".scb_f_controls_note"); - container.slideUp(); // hide - }); - scb.utils.off_on(workarea, 'click','.scb_f_controls_note', function(e,ui){ - e.stopPropagation(); - }); - scb.utils.off_on(workarea, 'click','.scb_f_info_icon', function(e,ui){ - e.stopPropagation(); - var note = $(this).attr('note'); - note = '.' +note; - if($(note).is(":visible")) - $(note).slideUp(); - else $(note).slideDown(); - }); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_microscopy_light', function(e) { + + var parsed = scb.ui.static.MicroscopyView.parse(this); + parsed = resetScrollValue(parsed); + + if ($(this).attr('checked') == 'checked') { + parsed.microscopy.light_on = true; + + } else { + parsed.microscopy.light_on = false; + + + } + if (!parsed.microscopy.light_on) { + $('#brightup').prop('disabled', true); + + $('#brightdown').prop('disabled', true); + } else { + $('#brightup').prop('disabled', false); + + $('#brightdown').prop('disabled', false); + } + scb.ui.static.MainFrame.refresh(); + + }); + scb.utils.off_on(workarea, 'click', '.scb_s_microscopy_choose_samples_order_list>li', function(e) { + scb.ui.static.MicroscopyView.scb_s_microscopy_choose_samples_order_list_select(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_prepare_slides', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_prepare_slides(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_sample_active_all', function(e, ui) { + scb.ui.static.MicroscopyView.scb_f_microscopy_sample_active_all(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_sample_inactive_all', function(e, ui) { + scb.ui.static.MicroscopyView.scb_f_microscopy_sample_inactive_all(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_sample_remove', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_sample_remove(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_red', function(e, ui) { + + var parsed = scb.ui.static.MicroscopyView.parse(this); + parsed = resetScrollValue(parsed); + if (parsed.microscopy_lane.kind != 'IF') { + parsed.microscopy.red_enabled = true; + parsed.microscopy.blue_enabled = false; + parsed.microscopy.green_enabled = false; + parsed.microscopy.merge_enabled = false; + $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Red.png'); + return; + } else if (parsed.microscopy_lane.kind == 'IF' && !parsed.microscopy_lane.lens_map.if_type) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("No available image for this filter", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; + } else { + for (var x = 0; x < parsed.microscopy.selected_lane.current_slides.length; x++) { + if (parsed.microscopy.selected_lane.current_slides[x].if_type == 'red') { + parsed.microscopy.red_enabled = true; + parsed.microscopy.blue_enabled = false; + parsed.microscopy.green_enabled = false; + parsed.microscopy.merge_enabled = false; + parsed.microscopy.selected_lane.lens_map.if_type = 'red'; + draw_lens('x', 0, parsed.microscopy.selected_lane.lens_map, document.getElementById("lens")); + $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Red.png'); + var new_state = copy_state(parsed.microscopy_lane.lens_map, scb.LensMap, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash]) + init(parsed.microscopy_lane.lens_map, false, true, draw, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash], null); + break; + } + } + } + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_blue', function(e, ui) { + + var parsed = scb.ui.static.MicroscopyView.parse(this); + parsed = resetScrollValue(parsed); + if (parsed.microscopy_lane.kind != 'IF') { + parsed.microscopy.red_enabled = false; + parsed.microscopy.blue_enabled = true; + parsed.microscopy.green_enabled = false; + parsed.microscopy.merge_enabled = false; + $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Blue.png'); + return; + } else if (parsed.microscopy_lane.kind == 'IF' && !parsed.microscopy_lane.lens_map.if_type) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("No available image for this filter", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; + } else { + for (var x = 0; x < parsed.microscopy.selected_lane.current_slides.length; x++) { + if (parsed.microscopy.selected_lane.current_slides[x].if_type == 'blue') { + parsed.microscopy.red_enabled = false; + parsed.microscopy.blue_enabled = true; + parsed.microscopy.green_enabled = false; + parsed.microscopy.merge_enabled = false; + parsed.microscopy.selected_lane.lens_map.if_type = 'blue'; + draw_lens('x', 0, parsed.microscopy.selected_lane.lens_map, document.getElementById("lens")); + $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Blue.png'); + var new_state = copy_state(parsed.microscopy_lane.lens_map, scb.LensMap, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash]) + init(parsed.microscopy_lane.lens_map, false, true, draw, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash], null); + break; + } + } + } + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_green', function(e, ui) { + + var parsed = scb.ui.static.MicroscopyView.parse(this); + parsed = resetScrollValue(parsed); + if (parsed.microscopy_lane.kind != 'IF') { + parsed.microscopy.red_enabled = false; + parsed.microscopy.blue_enabled = false; + parsed.microscopy.green_enabled = true; + parsed.microscopy.merge_enabled = false; + $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Green.png'); + return; + } else if (parsed.microscopy_lane.kind == 'IF' && !parsed.microscopy_lane.lens_map.if_type) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("No available image for this filter", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; + } else { + for (var x = 0; x < parsed.microscopy.selected_lane.current_slides.length; x++) { + if (parsed.microscopy.selected_lane.current_slides[x].if_type == 'green') { + parsed.microscopy.red_enabled = false; + parsed.microscopy.blue_enabled = false; + parsed.microscopy.green_enabled = true; + parsed.microscopy.merge_enabled = false; + parsed.microscopy.selected_lane.lens_map.if_type = 'green'; + draw_lens('x', 0, parsed.microscopy.selected_lane.lens_map, document.getElementById("lens")); + $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_Green.png'); + var new_state = copy_state(parsed.microscopy_lane.lens_map, scb.LensMap, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash]) + init(parsed.microscopy_lane.lens_map, false, true, draw, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash], null); + break; + } + } + } + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_all', function(e, ui) { + + var parsed = scb.ui.static.MicroscopyView.parse(this); + parsed = resetScrollValue(parsed); + if (parsed.microscopy_lane.kind != 'IF') { + parsed.microscopy.red_enabled = false; + parsed.microscopy.blue_enabled = false; + parsed.microscopy.green_enabled = false; + parsed.microscopy.merge_enabled = true; + $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_All.png'); + return; + } else if (parsed.microscopy_lane.kind == 'IF' && !parsed.microscopy_lane.lens_map.if_type) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("No available image for this filter", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + return; + } else { + for (var x = 0; x < parsed.microscopy.selected_lane.current_slides.length; x++) { + if (parsed.microscopy.selected_lane.current_slides[x].if_type == 'merge') { + parsed.microscopy.red_enabled = false; + parsed.microscopy.blue_enabled = false; + parsed.microscopy.green_enabled = false; + parsed.microscopy.merge_enabled = true; + parsed.microscopy.selected_lane.lens_map.if_type = 'merge'; + draw_lens('x', 0, parsed.microscopy.selected_lane.lens_map, document.getElementById("lens")); + $('.scb_s_microscopy_filter', '.scb_s_microscopy_view').prop('src', 'images/microscopy/Filter_Slider_All.png'); + var new_state = copy_state(parsed.microscopy_lane.lens_map, scb.LensMap, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash]) + init(parsed.microscopy_lane.lens_map, false, true, draw, parsed.assignment.template.slides[parsed.microscopy.selected_lane.current_slides[x].hash], null); + break; + } + } + } + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_tools_toggle', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_tools_toggle(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_microscopy_note_close_button', function(e) { + scb.ui.static.MicroscopyView.scb_f_microscopy_note_close_button(this); + }); + scb.utils.off_on(workarea, 'mouseup', document, function(e, ui) { + var container = $(".scb_f_controls_note"); + container.slideUp(); // hide + }); + scb.utils.off_on(workarea, 'click', '.scb_f_controls_note', function(e, ui) { + e.stopPropagation(); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_info_icon', function(e, ui) { + e.stopPropagation(); + var note = $(this).attr('note'); + note = '.' + note; + if ($(note).is(":visible")) { + $(note).slideUp(); + } else { + $(note).slideDown(); + } + }); } -scb.ui.static.MicroscopyView.draw_slides = function (workarea) { - $('.scb_s_microscopy_slide_content', '#main').each(function () { +scb.ui.static.MicroscopyView.draw_slides = function(workarea) { + $('.scb_s_microscopy_slide_content', '#main').each(function() { - var slide = $(this); - var parsed = scb.ui.static.MicroscopyView.parse(this); - parsed = resetScrollValue(parsed); + var slide = $(this); + var parsed = scb.ui.static.MicroscopyView.parse(this); + parsed = resetScrollValue(parsed); - parsed.slide = slide; - parsed.i_want = slide.attr('i_want'); - scb.ui.static.MicroscopyView.scb_s_microscopy_lens_draw_slide(parsed); - }) + parsed.slide = slide; + parsed.i_want = slide.attr('i_want'); + scb.ui.static.MicroscopyView.scb_s_microscopy_lens_draw_slide(parsed); + }) } //This function will initialize the image and serialize the data of the //original unprocessed image to a string -function init_wb(image_source){ - - $('#spy').remove(); - var controls = document.getElementById('scb_s_microscopy_lens_controls', '.scb_s_microscopy_view'); - var samples_area = $('body').find(".scb_s_microscopy_slide_content", '#main').get(0); - if(samples_area){ - $(samples_area).append(controls); - $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('width', scb.ui.static.MicroscopyView.PICTURE_LIM+'px'); - $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('height', scb.ui.static.MicroscopyView.PICTURE_LIM+'px'); - $('.scb_s_microscopy_slide_content_lens_outline svg', '.scb_s_microscopy_view').css('top', scb.ui.static.MicroscopyView.LENS_TOP_OFFSET+'px'); - $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('xlink:href', image_source); - - } +function init_wb(image_source) { + + $('#spy').remove(); + var controls = document.getElementById('scb_s_microscopy_lens_controls', '.scb_s_microscopy_view'); + var samples_area = $('body').find(".scb_s_microscopy_slide_content", '#main').get(0); + if (samples_area) { + $(samples_area).append(controls); + $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('width', scb.ui.static.MicroscopyView.PICTURE_LIM + 'px'); + $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('height', scb.ui.static.MicroscopyView.PICTURE_LIM + 'px'); + $('.scb_s_microscopy_slide_content_lens_outline svg', '.scb_s_microscopy_view').css('top', scb.ui.static.MicroscopyView.LENS_TOP_OFFSET + 'px'); + $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('xlink:href', image_source); + + } } //This function will initialize the image and serialize the data of the //original unprocessed image to a string -function init_wb_mod(state, image_source){ - - $('#spy').remove(); - var controls = document.getElementById('scb_s_microscopy_lens_controls', '.scb_s_microscopy_view'); - var samples_area = $('body').find(".scb_s_microscopy_slide_content", '#main').get(0); - if(samples_area){ - $(samples_area).append(controls); - $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('width', scb.ui.static.MicroscopyView.PICTURE_LIM+'px'); - $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('height', scb.ui.static.MicroscopyView.PICTURE_LIM+'px'); - $('.scb_s_microscopy_slide_content_lens_outline svg', '.scb_s_microscopy_view').css('top', scb.ui.static.MicroscopyView.LENS_TOP_OFFSET+'px'); - $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('xlink:href', image_source); - draw(state); - } +function init_wb_mod(state, image_source) { + + $('#spy').remove(); + var controls = document.getElementById('scb_s_microscopy_lens_controls', '.scb_s_microscopy_view'); + var samples_area = $('body').find(".scb_s_microscopy_slide_content", '#main').get(0); + if (samples_area) { + $(samples_area).append(controls); + $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('width', scb.ui.static.MicroscopyView.PICTURE_LIM + 'px'); + $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('height', scb.ui.static.MicroscopyView.PICTURE_LIM + 'px'); + $('.scb_s_microscopy_slide_content_lens_outline svg', '.scb_s_microscopy_view').css('top', scb.ui.static.MicroscopyView.LENS_TOP_OFFSET + 'px'); + $('.scb_s_microscopy_slide_content_lens_outline svg image', '.scb_s_microscopy_view').attr('xlink:href', image_source); + draw(state); + } } scb.ui.MicroscopyView = function scb_ui_MicroscopyView(gstate) { - var self = this; + var self = this; - self.show = function (state) { - var workarea = gstate.workarea; - var template = state.assignment.template; - var rows_state = state.microscopy.rows_state(); + self.show = function(state) { + var workarea = gstate.workarea; + var template = state.assignment.template; + var rows_state = state.microscopy.rows_state(); - var can_prepare_slide = rows_state.valid > 0; + var can_prepare_slide = rows_state.valid > 0; - var kind = 'sample_prep'; - if (state.microscopy.slide_prepared) { - kind = 'prepare_slide'; - } - state.experiment.last_technique_view = 'microscopy'; - var warning_visible = $('.scb_s_microscopy_load_followup', '.scb_s_microscopy_view').is(":visible"); - workarea.html(scb_microscopy.main({ - global_template: gstate.context.master_model, - assignment: state.assignment, - experiment: state.experiment, - context: gstate.context, - microscopy: state.microscopy, - t: template, - rows: rows_state.rows, - rows_valid: rows_state.valid, - last_step: state.experiment.last_step, - prev_step: state.experiment.prev_step, - kind: kind, - kinds: template.micro_kinds, - can_prepare_slide: can_prepare_slide - })); - - if (kind == 'sample_prep'){ - $('.scb_s_western_blot_samples_table', '.scb_s_microscopy_view').scrollTop(state.microscopy.prep_scroll); - - var conds= $("span.scb_s_western_blot_choose_gel_type_input_text"); - _.each(conds, function(c){ - if($(c).text().length > scb.ui.static.MicroscopyView.MAX_CONDITION_CHARS){ - $(c).parent().css('width', '200px'); - }else{ - $(c).parent().css('width', '100px'); - } - }) + var kind = 'sample_prep'; + if (state.microscopy.slide_prepared) { + kind = 'prepare_slide'; + } + state.experiment.last_technique_view = 'microscopy'; + var warning_visible = $('.scb_s_microscopy_load_followup', '.scb_s_microscopy_view').is(":visible"); + workarea.html(scb_microscopy.main({ + global_template: gstate.context.master_model, + assignment: state.assignment, + experiment: state.experiment, + context: gstate.context, + microscopy: state.microscopy, + t: template, + rows: rows_state.rows, + rows_valid: rows_state.valid, + last_step: state.experiment.last_step, + prev_step: state.experiment.prev_step, + kind: kind, + kinds: template.micro_kinds, + can_prepare_slide: can_prepare_slide + })); + + if (kind == 'sample_prep') { + $('.scb_s_western_blot_samples_table', '.scb_s_microscopy_view').scrollTop(state.microscopy.prep_scroll); + + var conds = $("span.scb_s_western_blot_choose_gel_type_input_text"); + _.each(conds, function(c) { + if ($(c).text().length > scb.ui.static.MicroscopyView.MAX_CONDITION_CHARS) { + $(c).parent().css('width', '200px'); + } else { + $(c).parent().css('width', '100px'); } - state.experiment.prev_step=6; - - if(state.experiment.last_step >= scb.ui.static.MicroscopyView.TOTAL_STEPS) - state.experiment.last_step = scb.ui.static.MicroscopyView.TOTAL_STEPS+1; - state.experiment.last_technique = 'MICROSCOPY'; - state.experiment.last_id = state.microscopy.id; - state.experiment.last_param = 'microscopy_id'; - - document.body.scrollTop = state.experiment.last_scroll; - state.experiment.last_view = 'microscopy'; - document.title = "Microscopy - StarCellBio"; - - state.microscopy.parent.selected_id = state.microscopy.id; - - if(state.microscopy.parent.start_tabs_index <= 0){ - state.microscopy.parent.start_tabs_index = 0; - $('.scb_s_microscopy_left_microscopy', '.scb_s_microscopy_view').prop('disabled', true); - $('.scb_s_microscopy_right_microscopy', '.scb_s_microscopy_view').prop('disabled', false); - } - else $('.scb_s_microscopy_left_microscopy', '.scb_s_microscopy_view').prop('disabled', false); - - if(state.microscopy.parent.start_tabs_index + scb.ui.static.MicroscopyView.TOTAL_TABS-1 ==state.microscopy.parent.list.length-1){ - $('.scb_s_microscopy_right_microscopy', '.scb_s_microscopy_view').prop('disabled', true); - $('.scb_s_microscopy_left_microscopy', '.scb_s_microscopy_view').prop('disabled', false); - } - else $('.scb_s_microscopy_right_microscopy', '.scb_s_microscopy_view').prop('disabled', false); - - if (kind == 'sample_prep') { - - }else{ - $('.scb_s_western_blot_progress_gray_bar', '.scb_s_microscopy_view').children().each(function () { console.log($(this).css('left')); - $(this).css('left', parseInt($(this).css('left'))-scb.ui.static.MicroscopyView.MAX_BRIGHTNESS+'px'); - }); - $('.scb_s_western_blot_progress_bar', '.scb_s_microscopy_view').css('top', scb.ui.static.MicroscopyView.GRAY_BAR_TOP_OFFSET+'px'); - } - if(!state.microscopy.light_on){ - $('#brightup').prop('disabled', true); - - $('#brightdown').prop('disabled', true); - } - - if (state.microscopy.samples_finished) { - $(".scb_s_microscopy_lane_left").prop('disabled', false); - $(".scb_s_microscopy_lane_right").prop('disabled', false); - var cell_treatment_id = state.microscopy.selected_lane.cell_treatment_id; - if(state.microscopy.start_tabs_index[cell_treatment_id] <= 0){ - $(".scb_s_microscopy_lane_left").prop('disabled', true); - } - if(state.microscopy.start_tabs_index[cell_treatment_id] + scb.ui.static.MicroscopyView.TOTAL_TABS >= - state.microscopy.total_num_tabs){ - $(".scb_s_microscopy_lane_right").prop('disabled', true); - } - //debugger; - if(!state.microscopy.warning_fired || warning_visible){ - $('.scb_s_microscopy_load_followup', '.scb_s_microscopy_view').show(); - $('.scb_s_microscopy_load_followup>.scb_f_controls_close_button', '.scb_s_microscopy_view').click(function(){ - $('.scb_s_microscopy_load_followup', '.scb_s_microscopy_view').fadeOut(); - //state.microscopy.enable_samples = true; - }); - state.microscopy.warning_fired = true; - } + }) + } + state.experiment.prev_step = 6; - } - - - if (state.microscopy.samples_finished) { - scb.ui.static.MicroscopyView.draw_slides(workarea); - $('.scb_s_microscopy_choose_samples_order_list', '.scb_s_microscopy_view').scrollTop(state.microscopy.scroll); - } - else{ - init_wb('../images/microscopy/black.jpg'); + if (state.experiment.last_step >= scb.ui.static.MicroscopyView.TOTAL_STEPS) { + state.experiment.last_step = scb.ui.static.MicroscopyView.TOTAL_STEPS + 1; + } + state.experiment.last_technique = 'MICROSCOPY'; + state.experiment.last_id = state.microscopy.id; + state.experiment.last_param = 'microscopy_id'; - } - - var elem = document.getElementById('slider'); - window.mySwipe = Swipe(elem, { - continuous: false, - disableScroll: true, - transitionEnd: function(index, element) { - $('.slider_dots li').attr('class',''); - $($('.slider_dots li')[index]).attr('class','on');} - }); - - _.each($(".scb_s_experiment_step_button"), function (e) { - if(!$(e).hasClass('scb_s_experiment_step_visited')) - $(e).attr('title', 'To use this button, start a new '+$(e).text()+' Experiment.'); - else $(e).removeAttr('title'); - }); - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + document.body.scrollTop = state.experiment.last_scroll; + state.experiment.last_view = 'microscopy'; + document.title = "Microscopy - StarCellBio"; + + state.microscopy.parent.selected_id = state.microscopy.id; + + if (state.microscopy.parent.start_tabs_index <= 0) { + state.microscopy.parent.start_tabs_index = 0; + $('.scb_s_microscopy_left_microscopy', '.scb_s_microscopy_view').prop('disabled', true); + $('.scb_s_microscopy_right_microscopy', '.scb_s_microscopy_view').prop('disabled', false); + } else { + $('.scb_s_microscopy_left_microscopy', '.scb_s_microscopy_view').prop('disabled', false); } + + if (state.microscopy.parent.start_tabs_index + scb.ui.static.MicroscopyView.TOTAL_TABS - 1 == state.microscopy.parent.list.length - 1) { + $('.scb_s_microscopy_right_microscopy', '.scb_s_microscopy_view').prop('disabled', true); + $('.scb_s_microscopy_left_microscopy', '.scb_s_microscopy_view').prop('disabled', false); + } else { + $('.scb_s_microscopy_right_microscopy', '.scb_s_microscopy_view').prop('disabled', false); + } + + if (kind == 'sample_prep') { + + } else { + $('.scb_s_western_blot_progress_gray_bar', '.scb_s_microscopy_view').children().each(function() { + console.log($(this).css('left')); + $(this).css('left', parseInt($(this).css('left')) - scb.ui.static.MicroscopyView.MAX_BRIGHTNESS + 'px'); + }); + $('.scb_s_western_blot_progress_bar', '.scb_s_microscopy_view').css('top', scb.ui.static.MicroscopyView.GRAY_BAR_TOP_OFFSET + 'px'); + } + if (!state.microscopy.light_on) { + $('#brightup').prop('disabled', true); + + $('#brightdown').prop('disabled', true); + } + + if (state.microscopy.samples_finished) { + $(".scb_s_microscopy_lane_left").prop('disabled', false); + $(".scb_s_microscopy_lane_right").prop('disabled', false); + var cell_treatment_id = state.microscopy.selected_lane.cell_treatment_id; + if (state.microscopy.start_tabs_index[cell_treatment_id] <= 0) { + $(".scb_s_microscopy_lane_left").prop('disabled', true); + } + if (state.microscopy.start_tabs_index[cell_treatment_id] + scb.ui.static.MicroscopyView.TOTAL_TABS >= + state.microscopy.total_num_tabs) { + $(".scb_s_microscopy_lane_right").prop('disabled', true); + } + //debugger; + if (!state.microscopy.warning_fired || warning_visible) { + $('.scb_s_microscopy_load_followup', '.scb_s_microscopy_view').show(); + $('.scb_s_microscopy_load_followup>.scb_f_controls_close_button', '.scb_s_microscopy_view').click(function() { + $('.scb_s_microscopy_load_followup', '.scb_s_microscopy_view').fadeOut(); + //state.microscopy.enable_samples = true; + }); + state.microscopy.warning_fired = true; + } + + } + + + if (state.microscopy.samples_finished) { + scb.ui.static.MicroscopyView.draw_slides(workarea); + $('.scb_s_microscopy_choose_samples_order_list', '.scb_s_microscopy_view').scrollTop(state.microscopy.scroll); + } else { + init_wb('../images/microscopy/black.jpg'); + + } + + var elem = document.getElementById('slider'); + window.mySwipe = Swipe(elem, { + continuous: false, + disableScroll: true, + transitionEnd: function(index, element) { + $('.slider_dots li').attr('class', ''); + $($('.slider_dots li')[index]).attr('class', 'on'); + } + }); + + _.each($(".scb_s_experiment_step_button"), function(e) { + if (!$(e).hasClass('scb_s_experiment_step_visited')) { + $(e).attr('title', 'To use this button, start a new ' + $(e).text() + ' Experiment.'); + } else { + $(e).removeAttr('title'); + } + }); + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + } } diff --git a/html_app/ui/NotebookView.js b/html_app/ui/NotebookView.js index 91b89f79..0be4b114 100644 --- a/html_app/ui/NotebookView.js +++ b/html_app/ui/NotebookView.js @@ -3,274 +3,282 @@ scb.ui = scb.ui || {}; scb.ui.static = scb.ui.static || {}; scb.ui.static.NotebookView = scb.ui.static.NotebookView || {}; -scb.ui.static.NotebookView.TOTAL_TABS = 4; -scb.ui.static.NotebookView.TOTAL_STEPS = 5; - - -scb.ui.static.NotebookView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); - var experiment_id = $(element).attr('experiment_id'); - var notebook_id = $(element).attr('notebook_id'); - var section_id = $(element).attr('section_id'); - - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - notebook_id: notebook_id, - section_id: section_id, - view: 'notebook', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - parsed.state = state; - return parsed; +scb.ui.static.NotebookView.TOTAL_TABS = 4; +scb.ui.static.NotebookView.TOTAL_STEPS = 5; + + +scb.ui.static.NotebookView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); + var experiment_id = $(element).attr('experiment_id'); + var notebook_id = $(element).attr('notebook_id'); + var section_id = $(element).attr('section_id'); + + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + notebook_id: notebook_id, + section_id: section_id, + view: 'notebook', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + parsed.state = state; + return parsed; } -scb.ui.static.NotebookView.scb_f_notebook_text_button = function (element, event) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - parsed.notebook.edit_text = true; - parsed.notebook.edit_image = false; - //tinyMCE.activeEditor.getContent() - if (event) { - scb.ui.static.MainFrame.refresh(); - } +scb.ui.static.NotebookView.scb_f_notebook_text_button = function(element, event) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + parsed.notebook.edit_text = true; + parsed.notebook.edit_image = false; + //tinyMCE.activeEditor.getContent() + if (event) { + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.NotebookView.scb_f_notebook_image_button = function (element, event) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - - parsed.notebook.edit_image = true; - parsed.notebook.edit_text = false; +scb.ui.static.NotebookView.scb_f_notebook_image_button = function(element, event) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); - if (event) { - scb.ui.static.MainFrame.refresh(); - } + parsed.notebook.edit_image = true; + parsed.notebook.edit_text = false; + + if (event) { + scb.ui.static.MainFrame.refresh(); + } } -scb.ui.static.NotebookView.scb_f_notebook_save_text_button = function (element, event) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } +scb.ui.static.NotebookView.scb_f_notebook_save_text_button = function(element, event) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } - if (event) { - scb.ui.static.MainFrame.refresh(); - - } + if (event) { + scb.ui.static.MainFrame.refresh(); + + } } -scb.ui.static.NotebookView.scb_f_notebook_image_close_button = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - - parsed.notebook.edit_image = false; +scb.ui.static.NotebookView.scb_f_notebook_image_close_button = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); - scb.ui.static.MainFrame.refresh(); + parsed.notebook.edit_image = false; + + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_image_insert_open_button = function(element){ +scb.ui.static.NotebookView.scb_f_notebook_image_insert_open_button = function(element) { - scb.ui.static.MainFrame.refresh(); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_save_text_button = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - - parsed.section.elements.start({type: 'text', - data: tinyMCE.activeEditor.getContent() - }); +scb.ui.static.NotebookView.scb_f_notebook_save_text_button = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); - parsed.notebook.edit_text = false; - scb.ui.static.MainFrame.refresh(); + parsed.section.elements.start({ + type: 'text', + data: tinyMCE.activeEditor.getContent() + }); + + parsed.notebook.edit_text = false; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_image_insert_close_button = function(element){ +scb.ui.static.NotebookView.scb_f_notebook_image_insert_close_button = function(element) { - scb.ui.static.MainFrame.refresh(); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_add_section_button = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - var new_section = parsed.notebook.sections.start({ - assignment_id: parsed.assignment.id, - experiment_id: parsed.experiment.id, - notebook_id: parsed.notebook.id - }); - parsed.notebook.sections.selected_id = new_section.id; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_f_notebook_add_section_button = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + var new_section = parsed.notebook.sections.start({ + assignment_id: parsed.assignment.id, + experiment_id: parsed.experiment.id, + notebook_id: parsed.notebook.id + }); + parsed.notebook.sections.selected_id = new_section.id; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_experiment_design_link = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - var image_id = $(element).attr('image_id'); - - - var current_experiment = parsed.assignment.experiments.get(image_id); - parsed.notebook.image_experiment_id = current_experiment.id; - - var selected_experiment = parsed.notebook.selected_experiment; - - - - parsed.section.elements.start({type: 'image', - view: 'experiment_design', - experiment_id: current_experiment.id - }); - parsed.experiment.last_view = 'notebook'; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_f_notebook_experiment_design_link = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + var image_id = $(element).attr('image_id'); + + + var current_experiment = parsed.assignment.experiments.get(image_id); + parsed.notebook.image_experiment_id = current_experiment.id; + + var selected_experiment = parsed.notebook.selected_experiment; + + + + parsed.section.elements.start({ + type: 'image', + view: 'experiment_design', + experiment_id: current_experiment.id + }); + parsed.experiment.last_view = 'notebook'; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_experiment_setup_link = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - var image_id = $(element).attr('image_id'); - - - var current_experiment = parsed.assignment.experiments.get(image_id); - parsed.notebook.image_experiment_id = current_experiment.id; - - var selected_experiment = parsed.notebook.selected_experiment; - - - var headings = scb.ui.static.ExperimentSetupView.headings(parsed.assignment.template.ui.experiment_setup.table); - var rows = scb.ui.static.ExperimentSetupView.rows(current_experiment.cell_treatment_list.list, headings, parsed.assignment.template); - _.each(rows, function(e){delete e.treatment }); - - parsed.section.elements.start({type: 'image', - view: 'experiment_setup', - experiment_id: current_experiment.id, - headings: headings, - rows: rows - }); - parsed.experiment.last_view = 'notebook'; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_f_notebook_experiment_setup_link = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + var image_id = $(element).attr('image_id'); + + + var current_experiment = parsed.assignment.experiments.get(image_id); + parsed.notebook.image_experiment_id = current_experiment.id; + + var selected_experiment = parsed.notebook.selected_experiment; + + + var headings = scb.ui.static.ExperimentSetupView.headings(parsed.assignment.template.ui.experiment_setup.table); + var rows = scb.ui.static.ExperimentSetupView.rows(current_experiment.cell_treatment_list.list, headings, parsed.assignment.template); + _.each(rows, function(e) { + delete e.treatment + }); + + parsed.section.elements.start({ + type: 'image', + view: 'experiment_setup', + experiment_id: current_experiment.id, + headings: headings, + rows: rows + }); + parsed.experiment.last_view = 'notebook'; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_wb_link = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var image_id = $(element).attr('image_id'); - var wb_id = $(element).attr('wb_id'); - var e_id = $(element).attr('e_id'); - var current_experiment = parsed.assignment.experiments.get(e_id); - var western_blot = current_experiment.western_blot_list.get(wb_id); - var gel = current_experiment.western_blot_list.get(wb_id).gel_list.get(image_id); - - - parsed.notebook.image_western_blot_id = western_blot.id; - parsed.notebook.image_experiment_id = current_experiment.id; - parsed.notebook.image_western_blot_gel_id = gel.id; - - - - var rows = western_blot.rows_state().rows; - _.each(rows, function(e){ - delete e.cell_treatment; - e.lane_id = e.lane.id; - e.lane_name = e.lane.kinds[e.lane.kind].name; - e.is_valid = e.is_valid ? true: false; - delete e.lane; - - }); - - parsed.section.elements.start({type: 'image', - view: 'western_blot', - experiment_id: current_experiment.id, - western_blot_id: western_blot.id, - gel_id: gel.id, - rows: rows, - exposure_time: scb.utils.print_time_w_seconds(gel.exposure_time) - }); - parsed.experiment.last_view = 'notebook'; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_f_notebook_wb_link = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var image_id = $(element).attr('image_id'); + var wb_id = $(element).attr('wb_id'); + var e_id = $(element).attr('e_id'); + var current_experiment = parsed.assignment.experiments.get(e_id); + var western_blot = current_experiment.western_blot_list.get(wb_id); + var gel = current_experiment.western_blot_list.get(wb_id).gel_list.get(image_id); + + + parsed.notebook.image_western_blot_id = western_blot.id; + parsed.notebook.image_experiment_id = current_experiment.id; + parsed.notebook.image_western_blot_gel_id = gel.id; + + + + var rows = western_blot.rows_state().rows; + _.each(rows, function(e) { + delete e.cell_treatment; + e.lane_id = e.lane.id; + e.lane_name = e.lane.kinds[e.lane.kind].name; + e.is_valid = e.is_valid ? true : false; + delete e.lane; + + }); + + parsed.section.elements.start({ + type: 'image', + view: 'western_blot', + experiment_id: current_experiment.id, + western_blot_id: western_blot.id, + gel_id: gel.id, + rows: rows, + exposure_time: scb.utils.print_time_w_seconds(gel.exposure_time) + }); + parsed.experiment.last_view = 'notebook'; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_facs_link = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var image_id = $(element).attr('image_id'); - var facs_id = $(element).attr('facs_id'); - var e_id = $(element).attr('e_id'); - var current_experiment = parsed.assignment.experiments.get(e_id); - var facs = current_experiment.facs_list.get(facs_id); - var lane = current_experiment.facs_list.get(facs_id).lanes_list.get(image_id); - - parsed.notebook.image_facs_id = facs.id; - parsed.notebook.image_experiment_id = current_experiment.id; - parsed.notebook.image_facs_lane_id = lane.id; - - - - parsed.section.elements.start({type: 'image', - view: 'facs', - experiment_id: current_experiment.id, - facs_id: facs.id, - facs_lane_id: lane.id - }); - parsed.experiment.last_view = 'notebook'; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_f_notebook_facs_link = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var image_id = $(element).attr('image_id'); + var facs_id = $(element).attr('facs_id'); + var e_id = $(element).attr('e_id'); + var current_experiment = parsed.assignment.experiments.get(e_id); + var facs = current_experiment.facs_list.get(facs_id); + var lane = current_experiment.facs_list.get(facs_id).lanes_list.get(image_id); + + parsed.notebook.image_facs_id = facs.id; + parsed.notebook.image_experiment_id = current_experiment.id; + parsed.notebook.image_facs_lane_id = lane.id; + + + + parsed.section.elements.start({ + type: 'image', + view: 'facs', + experiment_id: current_experiment.id, + facs_id: facs.id, + facs_lane_id: lane.id + }); + parsed.experiment.last_view = 'notebook'; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_micro_link = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var image_id = $(element).attr('image_id'); - var microscopy_id = $(element).attr('micro_id'); - var e_id = $(element).attr('e_id'); - var current_experiment = parsed.assignment.experiments.get(e_id); - var microscopy = current_experiment.microscopy_list.get(microscopy_id); - var lane = current_experiment.microscopy_list.get(microscopy_id).lanes_list.get(image_id); - - parsed.notebook.image_microscopy_id = microscopy.id; - parsed.notebook.image_experiment_id = current_experiment.id; - parsed.notebook.image_microscopy_lane_id = lane.id; - - - - parsed.section.elements.start({type: 'image', - view: 'microscopy', - experiment_id: current_experiment.id, - microscopy_id: microscopy.id, - microscopy_lane_id: lane.id - }); - parsed.experiment.last_view = 'notebook'; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_f_notebook_micro_link = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var image_id = $(element).attr('image_id'); + var microscopy_id = $(element).attr('micro_id'); + var e_id = $(element).attr('e_id'); + var current_experiment = parsed.assignment.experiments.get(e_id); + var microscopy = current_experiment.microscopy_list.get(microscopy_id); + var lane = current_experiment.microscopy_list.get(microscopy_id).lanes_list.get(image_id); + + parsed.notebook.image_microscopy_id = microscopy.id; + parsed.notebook.image_experiment_id = current_experiment.id; + parsed.notebook.image_microscopy_lane_id = lane.id; + + + + parsed.section.elements.start({ + type: 'image', + view: 'microscopy', + experiment_id: current_experiment.id, + microscopy_id: microscopy.id, + microscopy_lane_id: lane.id + }); + parsed.experiment.last_view = 'notebook'; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_f_notebook_section = function(element){ - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - - parsed.notebook.section_selected = parsed.section.id; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_f_notebook_section = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + + parsed.notebook.section_selected = parsed.section.id; + scb.ui.static.MainFrame.refresh(); } @@ -284,266 +292,268 @@ scb.ui.static.NotebookView.scb_f_notebook_section = function(element){ -scb.ui.static.NotebookView.scb_f_microscopy_sample_inactive_all = function (element) { - $('.scb_f_microscopy_sample_active').each(function(e){ - var element = this; - $(element).attr('checked', false); - scb.ui.static.NotebookView.scb_f_microscopy_sample_active(element); - }); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_f_microscopy_sample_inactive_all = function(element) { + $('.scb_f_microscopy_sample_active').each(function(e) { + var element = this; + $(element).attr('checked', false); + scb.ui.static.NotebookView.scb_f_microscopy_sample_active(element); + }); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_s_microscopy_slide_tab = function(element){ - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - - parsed.microscopy.lane_selected = parsed.microscopy_lane.id; - scb.ui.static.MainFrame.refresh(); +scb.ui.static.NotebookView.scb_s_microscopy_slide_tab = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + + parsed.microscopy.lane_selected = parsed.microscopy_lane.id; + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.NotebookView.scb_s_microscopy_choose_samples_order_list_select = function (element, event) { - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - if(parsed.microscopy.enable_samples){ - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if (parsed.microscopy.samples_finished) { - $('li', $(element).parent()).removeClass('scb_s_microscopy_sample_selected'); - $(element).addClass('scb_s_microscopy_sample_selected'); - parsed.microscopy.lane_selected = parsed.microscopy_lane.id; - parsed.microscopy.scroll = $('.scb_s_microscopy_choose_samples_order_list').scrollTop(); - scb.ui.static.MainFrame.refresh(); - } - } +scb.ui.static.NotebookView.scb_s_microscopy_choose_samples_order_list_select = function(element, event) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.microscopy.enable_samples) { + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.microscopy.samples_finished) { + $('li', $(element).parent()).removeClass('scb_s_microscopy_sample_selected'); + $(element).addClass('scb_s_microscopy_sample_selected'); + parsed.microscopy.lane_selected = parsed.microscopy_lane.id; + parsed.microscopy.scroll = $('.scb_s_microscopy_choose_samples_order_list').scrollTop(); + scb.ui.static.MainFrame.refresh(); + } + } } -scb.ui.static.NotebookView.scb_s_microscopy_right_microscopy = function(element, event){ - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.NotebookView.scb_s_microscopy_right_microscopy = function(element, event) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); - parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.start_tabs_index +1; - scb.ui.static.MainFrame.refresh(parsed.state); + parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.start_tabs_index + 1; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.NotebookView.scb_s_microscopy_add_microscopy= function(element, event){ - var parsed = scb.ui.static.NotebookView.parse(element); - parsed = resetScrollValue(parsed); - - console.log(parsed.microscopy.parent.start_tabs_index); - console.log(parsed.microscopy.parent.list.length); - if(parsed.microscopy.parent.list.length==scb.ui.static.NotebookView.TOTAL_TABS){ - parsed.microscopy.parent.start_tabs_index = 1; - } - else if (parsed.microscopy.parent.list.length >scb.ui.static.NotebookView.TOTAL_TABS) - parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.length-(scb.ui.static.NotebookView.TOTAL_TABS-1); - scb.ui.static.MainFrame.refresh(parsed.state); +scb.ui.static.NotebookView.scb_s_microscopy_add_microscopy = function(element, event) { + var parsed = scb.ui.static.NotebookView.parse(element); + parsed = resetScrollValue(parsed); + + console.log(parsed.microscopy.parent.start_tabs_index); + console.log(parsed.microscopy.parent.list.length); + if (parsed.microscopy.parent.list.length == scb.ui.static.NotebookView.TOTAL_TABS) { + parsed.microscopy.parent.start_tabs_index = 1; + } else if (parsed.microscopy.parent.list.length > scb.ui.static.NotebookView.TOTAL_TABS) { + parsed.microscopy.parent.start_tabs_index = parsed.microscopy.parent.length - (scb.ui.static.NotebookView.TOTAL_TABS - 1); + } + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.NotebookView.scb_f_microscopy_note_close_button= function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - var note = $(element).attr('note'); - note = '.' +note; - $(note).slideUp('400', function(){ - parsed.microscopy.navigation_show_state = $('.scb_s_microscopy_tools_navigation_followup', '.scb_s_microscopy_view').is(":visible"); - parsed.microscopy.samples_show_state = $('.scb_s_microscopy_tools_samples_followup', '.scb_s_microscopy_view').is(":visible"); - //scb.ui.static.MainFrame.refresh(); - }); - -} +scb.ui.static.NotebookView.scb_f_microscopy_note_close_button = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + var note = $(element).attr('note'); + note = '.' + note; + $(note).slideUp('400', function() { + parsed.microscopy.navigation_show_state = $('.scb_s_microscopy_tools_navigation_followup', '.scb_s_microscopy_view').is(":visible"); + parsed.microscopy.samples_show_state = $('.scb_s_microscopy_tools_samples_followup', '.scb_s_microscopy_view').is(":visible"); + //scb.ui.static.MainFrame.refresh(); + }); -scb.ui.static.NotebookView.scb_f_microscopy_tools_toggle = function (element) { - var parsed = scb.ui.static.NotebookView.parse(element); - var note = $(element).attr('note'); - note = '.' +note; - $(note).slideDown('400', function(){ - parsed.microscopy.navigation_show_state = $('.scb_s_microscopy_tools_navigation_followup', '.scb_s_microscopy_view').is(":visible"); - parsed.microscopy.samples_show_state = $('.scb_s_microscopy_tools_samples_followup', '.scb_s_microscopy_view').is(":visible"); - //scb.ui.static.MainFrame.refresh(); - }); - } -scb.ui.static.NotebookView.register = function (workarea) { +scb.ui.static.NotebookView.scb_f_microscopy_tools_toggle = function(element) { + var parsed = scb.ui.static.NotebookView.parse(element); + var note = $(element).attr('note'); + note = '.' + note; + $(note).slideDown('400', function() { + parsed.microscopy.navigation_show_state = $('.scb_s_microscopy_tools_navigation_followup', '.scb_s_microscopy_view').is(":visible"); + parsed.microscopy.samples_show_state = $('.scb_s_microscopy_tools_samples_followup', '.scb_s_microscopy_view').is(":visible"); + //scb.ui.static.MainFrame.refresh(); + }); +} - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_text_button', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_text_button(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_image_button', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_image_button(this, e); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_image_close_button', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_image_close_button(this); - }); - - - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_save_text_button', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_save_text_button(this); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_image_insert_open_button', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_image_insert_open_button(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_image_insert_close_button', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_image_insert_close_button(this); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_add_section_button', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_add_section_button(this); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_experiment_design_link', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_experiment_design_link(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_experiment_setup_link', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_experiment_setup_link(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_wb_link', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_wb_link(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_facs_link', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_facs_link(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_micro_link', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_micro_link(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_section', function (e) { - if(e.target.className.indexOf('scb_s_notebook_section') > -1){ - scb.ui.static.NotebookView.scb_f_notebook_section(this); - } - }); - - - - - scb.utils.off_on(workarea, 'click', '.scb_s_notebook_choose_samples_order_list>li', function (e) { - scb.ui.static.NotebookView.scb_s_notebook_choose_samples_order_list_select(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_sample_inactive_all', function (e, ui){ - scb.ui.static.NotebookView.scb_f_notebook_sample_inactive_all(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_sample_remove', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_sample_remove(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_tools_toggle', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_tools_toggle(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_notebook_note_close_button', function (e) { - scb.ui.static.NotebookView.scb_f_notebook_note_close_button(this); - }); - scb.utils.off_on(workarea, 'mouseup', document, function(e,ui){ - var container = $(".scb_f_controls_note"); - container.slideUp(); // hide - }); - scb.utils.off_on(workarea, 'click','.scb_f_controls_note', function(e,ui){ - e.stopPropagation(); - }); - scb.utils.off_on(workarea, 'click','.scb_f_info_icon', function(e,ui){ - e.stopPropagation(); - var note = $(this).attr('note'); - note = '.' +note; - if($(note).is(":visible")) - $(note).slideUp(); - else $(note).slideDown(); - }); +scb.ui.static.NotebookView.register = function(workarea) { + + + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_text_button', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_text_button(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_image_button', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_image_button(this, e); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_image_close_button', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_image_close_button(this); + }); + + + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_save_text_button', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_save_text_button(this); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_image_insert_open_button', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_image_insert_open_button(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_image_insert_close_button', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_image_insert_close_button(this); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_add_section_button', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_add_section_button(this); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_experiment_design_link', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_experiment_design_link(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_experiment_setup_link', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_experiment_setup_link(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_wb_link', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_wb_link(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_facs_link', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_facs_link(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_micro_link', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_micro_link(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_section', function(e) { + if (e.target.className.indexOf('scb_s_notebook_section') > -1) { + scb.ui.static.NotebookView.scb_f_notebook_section(this); + } + }); + + + + + scb.utils.off_on(workarea, 'click', '.scb_s_notebook_choose_samples_order_list>li', function(e) { + scb.ui.static.NotebookView.scb_s_notebook_choose_samples_order_list_select(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_sample_inactive_all', function(e, ui) { + scb.ui.static.NotebookView.scb_f_notebook_sample_inactive_all(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_sample_remove', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_sample_remove(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_tools_toggle', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_tools_toggle(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_notebook_note_close_button', function(e) { + scb.ui.static.NotebookView.scb_f_notebook_note_close_button(this); + }); + scb.utils.off_on(workarea, 'mouseup', document, function(e, ui) { + var container = $(".scb_f_controls_note"); + container.slideUp(); // hide + }); + scb.utils.off_on(workarea, 'click', '.scb_f_controls_note', function(e, ui) { + e.stopPropagation(); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_info_icon', function(e, ui) { + e.stopPropagation(); + var note = $(this).attr('note'); + note = '.' + note; + if ($(note).is(":visible")) { + $(note).slideUp(); + } else { + $(note).slideDown(); + } + }); } -scb.ui.static.NotebookView.draw_slides = function (workarea) { - $('.scb_s_microscopy_slide_content', '.scb_s_microscopy_view').each(function () { +scb.ui.static.NotebookView.draw_slides = function(workarea) { + $('.scb_s_microscopy_slide_content', '.scb_s_microscopy_view').each(function() { - var slide = $(this); - var parsed = scb.ui.static.NotebookView.parse(this); - parsed = resetScrollValue(parsed); + var slide = $(this); + var parsed = scb.ui.static.NotebookView.parse(this); + parsed = resetScrollValue(parsed); - parsed.slide = slide; - scb.ui.static.NotebookView.scb_s_microscopy_lens_draw_slide(parsed); - }) + parsed.slide = slide; + scb.ui.static.NotebookView.scb_s_microscopy_lens_draw_slide(parsed); + }) } scb.ui.NotebookView = function scb_ui_NotebookView(gstate) { - var self = this; - - self.show = function (state) { - var workarea = gstate.workarea; - var template = state.assignment.template; - - var kind = 'sample_prep'; - - var last_step=10; - var prev_step=10; - - workarea.html(scb_notebook.main({ - global_template: gstate.context.master_model, - assignment: state.assignment, - experiment: state.experiment, - context: gstate.context, - notebook: state.notebook, - section: state.section, - t: template, - last_step: state.experiment.last_step == 0 ? last_step :state.experiment.last_step, - prev_step: state.experiment.prev_step == 0 ? prev_step : state.experiment.prev_step, - })); - -// _.each(state.notebook.sections.list, function(s){ -// if(s){ -// _.each(s.elements.list, function(e){ -// if(e.view=='facs'){ -// // $($(".scb_s_notebook_section[section_id='"+s.id+"'] > .scb_s_notebook_text_section .scb_s_facs_chart")[x]).attr('facs_lane_id', e.lane_id); -// // $($(".scb_s_notebook_section[section_id='"+s.id+"'] > .scb_s_notebook_text_section .scb_s_facs_chart")[x]).attr('facs_id', e.facs_id); -// } -// if(e.view=='microscopy'){ -// // $($(".scb_s_notebook_section[section_id='"+s.id+"'] > .scb_s_notebook_text_section .scb_s_microscopy_slide_content")[x]).attr('microscopy_lane_id', s.elements[x].lane_id); -// // $($(".scb_s_notebook_section[section_id='"+s.id+"'] > .scb_s_notebook_text_section .scb_s_microscopy_slide_content_lens_outline")[x]).attr('id', 'scb_s_microscopy_slide_content_lens_outline_'+s.elements[x].lane_id); -// } -// -// }); -// } -// }); - - document.body.scrollTop = state.experiment.last_scroll; - if(state.notebook.edit_text){ - - tinymce.init({ - selector: "textarea.scb_s_notebook_text_edit", - menubar: false, - toolbar_items_size: 'small', - toolbar: "fontselect | fontsizeselect | bold italic underline | bullist numlist | outdent indent | link unlink" - }); - } - - scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint_all(workarea, gstate, state); - scb.ui.static.MicroscopyView.draw_slides(workarea); - scb.ui.static.FacsView.charts(workarea); - - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); - - - - + var self = this; + + self.show = function(state) { + var workarea = gstate.workarea; + var template = state.assignment.template; + + var kind = 'sample_prep'; + + var last_step = 10; + var prev_step = 10; + + workarea.html(scb_notebook.main({ + global_template: gstate.context.master_model, + assignment: state.assignment, + experiment: state.experiment, + context: gstate.context, + notebook: state.notebook, + section: state.section, + t: template, + last_step: state.experiment.last_step == 0 ? last_step : state.experiment.last_step, + prev_step: state.experiment.prev_step == 0 ? prev_step : state.experiment.prev_step, + })); + + // _.each(state.notebook.sections.list, function(s){ + // if(s){ + // _.each(s.elements.list, function(e){ + // if(e.view=='facs'){ + // // $($(".scb_s_notebook_section[section_id='"+s.id+"'] > .scb_s_notebook_text_section .scb_s_facs_chart")[x]).attr('facs_lane_id', e.lane_id); + // // $($(".scb_s_notebook_section[section_id='"+s.id+"'] > .scb_s_notebook_text_section .scb_s_facs_chart")[x]).attr('facs_id', e.facs_id); + // } + // if(e.view=='microscopy'){ + // // $($(".scb_s_notebook_section[section_id='"+s.id+"'] > .scb_s_notebook_text_section .scb_s_microscopy_slide_content")[x]).attr('microscopy_lane_id', s.elements[x].lane_id); + // // $($(".scb_s_notebook_section[section_id='"+s.id+"'] > .scb_s_notebook_text_section .scb_s_microscopy_slide_content_lens_outline")[x]).attr('id', 'scb_s_microscopy_slide_content_lens_outline_'+s.elements[x].lane_id); + // } + // + // }); + // } + // }); + + document.body.scrollTop = state.experiment.last_scroll; + if (state.notebook.edit_text) { + + tinymce.init({ + selector: "textarea.scb_s_notebook_text_edit", + menubar: false, + toolbar_items_size: 'small', + toolbar: "fontselect | fontsizeselect | bold italic underline | bullist numlist | outdent indent | link unlink" + }); } + + scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint_all(workarea, gstate, state); + scb.ui.static.MicroscopyView.draw_slides(workarea); + scb.ui.static.FacsView.charts(workarea); + + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + + + + } } diff --git a/html_app/ui/SelectTechniqueView.js b/html_app/ui/SelectTechniqueView.js index 0c574cf5..4786b2dc 100644 --- a/html_app/ui/SelectTechniqueView.js +++ b/html_app/ui/SelectTechniqueView.js @@ -3,141 +3,151 @@ scb.ui = scb.ui || {}; scb.ui.static = scb.ui.static || {}; scb.ui.static.SelectTechniqueView = scb.ui.static.SelectTechniqueView || {}; -scb.ui.static.SelectTechniqueView.TOTAL_STEPS = 5; -scb.ui.static.SelectTechniqueView.TOTAL_TABS = 5; - - - -scb.ui.static.SelectTechniqueView.wbparse = function (element) { - var assignment_id = $(element).attr('assignment_id'); - var experiment_id = $(element).attr('experiment_id'); - var western_blot_id = $(element).attr('western_blot_id'); - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - western_blot_id: western_blot_id, - view: 'western_blot', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - parsed.state = state; - return parsed; +scb.ui.static.SelectTechniqueView.TOTAL_STEPS = 5; +scb.ui.static.SelectTechniqueView.TOTAL_TABS = 5; + + + +scb.ui.static.SelectTechniqueView.wbparse = function(element) { + var assignment_id = $(element).attr('assignment_id'); + var experiment_id = $(element).attr('experiment_id'); + var western_blot_id = $(element).attr('western_blot_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + western_blot_id: western_blot_id, + view: 'western_blot', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + parsed.state = state; + return parsed; } -scb.ui.static.SelectTechniqueView.fparse = function (element) { - var assignment_id = $(element).attr('assignment_id'); - var experiment_id = $(element).attr('experiment_id'); - var facs_id = $(element).attr('facs_id'); - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - facs_id: facs_id, - view: 'facs', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - parsed.state = state; - return parsed; +scb.ui.static.SelectTechniqueView.fparse = function(element) { + var assignment_id = $(element).attr('assignment_id'); + var experiment_id = $(element).attr('experiment_id'); + var facs_id = $(element).attr('facs_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + facs_id: facs_id, + view: 'facs', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + parsed.state = state; + return parsed; } -scb.ui.static.SelectTechniqueView.mparse = function (element) { - var assignment_id = $(element).attr('assignment_id'); - var experiment_id = $(element).attr('experiment_id'); - var microscopy_id = $(element).attr('microscopy_id'); - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - microscopy_id: microscopy_id, - view: 'microscopy', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - parsed.state = state; - return parsed; +scb.ui.static.SelectTechniqueView.mparse = function(element) { + var assignment_id = $(element).attr('assignment_id'); + var experiment_id = $(element).attr('experiment_id'); + var microscopy_id = $(element).attr('microscopy_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + microscopy_id: microscopy_id, + view: 'microscopy', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + parsed.state = state; + return parsed; } -scb.ui.static.SelectTechniqueView.disable_techniques = function (state) { - var template = state.template; - var workarea = state.workarea; +scb.ui.static.SelectTechniqueView.disable_techniques = function(state) { + var template = state.template; + var workarea = state.workarea; - var techniques = template.ui.experimental_design.techniques; + var techniques = template.ui.experimental_design.techniques; - $('.scb_f_select_technique').addClass('scb_s_select_technique_disabled'); - _.each(techniques, function (e) { - if (e == 'wb') { - $('.scb_s_select_technique_western_blot').removeClass('scb_s_select_technique_disabled'); - } - else if (e == 'facs') { - $('.scb_s_select_technique_flow').removeClass('scb_s_select_technique_disabled'); - } - else if (e == 'micro') { - $('.scb_s_select_technique_micro').removeClass('scb_s_select_technique_disabled'); + $('.scb_f_select_technique').addClass('scb_s_select_technique_disabled'); + _.each(techniques, function(e) { + if (e == 'wb') { + $('.scb_s_select_technique_western_blot').removeClass('scb_s_select_technique_disabled'); + } else if (e == 'facs') { + $('.scb_s_select_technique_flow').removeClass('scb_s_select_technique_disabled'); + } else if (e == 'micro') { + $('.scb_s_select_technique_micro').removeClass('scb_s_select_technique_disabled'); - } - }); - $('a','.scb_s_select_technique_disabled').removeAttr('href').css('cursor','default'); + } + }); + $('a', '.scb_s_select_technique_disabled').removeAttr('href').css('cursor', 'default'); } -scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_western_blot = function(element, event){ - var parsed = scb.ui.static.SelectTechniqueView.wbparse(element); - var blot = $.grep(parsed.experiment.western_blot_list.list, function(e){ return e.id == $(element).attr('western_blot_id'); }); - var i = 0; - while( (element = element.previousSibling) != null ) - i++; - if(i/2 >= parsed.experiment.western_blot_list.length-5) - parsed.experiment.western_blot_list.start_tabs_index = parsed.experiment.western_blot_list.length -5; - else - parsed.experiment.western_blot_list.start_tabs_index = i/2; +scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_western_blot = function(element, event) { + var parsed = scb.ui.static.SelectTechniqueView.wbparse(element); + var blot = $.grep(parsed.experiment.western_blot_list.list, function(e) { + return e.id == $(element).attr('western_blot_id'); + }); + var i = 0; + while ((element = element.previousSibling) != null) { + i++; + } + if (i / 2 >= parsed.experiment.western_blot_list.length - 5) { + parsed.experiment.western_blot_list.start_tabs_index = parsed.experiment.western_blot_list.length - 5; + } else { + parsed.experiment.western_blot_list.start_tabs_index = i / 2; + } } -scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_facs = function(element, event){ - var parsed = scb.ui.static.SelectTechniqueView.fparse(element); - var blot = $.grep(parsed.experiment.facs_list.list, function(e){ return e.id == $(element).attr('facs_id'); }); - var i = 0; - while( (element = element.previousSibling) != null ) - i++; - if(i/2 >= parsed.experiment.facs_list.length-5) - parsed.experiment.facs_list.start_tabs_index = parsed.experiment.facs_list.length -5; - else - parsed.experiment.facs_list.start_tabs_index = i/2; +scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_facs = function(element, event) { + var parsed = scb.ui.static.SelectTechniqueView.fparse(element); + var blot = $.grep(parsed.experiment.facs_list.list, function(e) { + return e.id == $(element).attr('facs_id'); + }); + var i = 0; + while ((element = element.previousSibling) != null) { + i++; + } + if (i / 2 >= parsed.experiment.facs_list.length - 5) { + parsed.experiment.facs_list.start_tabs_index = parsed.experiment.facs_list.length - 5; + } else { + parsed.experiment.facs_list.start_tabs_index = i / 2; + } } -scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_microscopy = function(element, event){ - var parsed = scb.ui.static.SelectTechniqueView.mparse(element); - var blot = $.grep(parsed.experiment.microscopy_list.list, function(e){ return e.id == $(element).attr('microscopy_id'); }); - var i = 0; - while( (element = element.previousSibling) != null ) - i++; - if(i/2 >= parsed.experiment.microscopy_list.length-5) - parsed.experiment.microscopy_list.start_tabs_index = parsed.experiment.microscopy_list.length -5; - else - parsed.experiment.microscopy_list.start_tabs_index = i/2; +scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_microscopy = function(element, event) { + var parsed = scb.ui.static.SelectTechniqueView.mparse(element); + var blot = $.grep(parsed.experiment.microscopy_list.list, function(e) { + return e.id == $(element).attr('microscopy_id'); + }); + var i = 0; + while ((element = element.previousSibling) != null) { + i++; + } + if (i / 2 >= parsed.experiment.microscopy_list.length - 5) { + parsed.experiment.microscopy_list.start_tabs_index = parsed.experiment.microscopy_list.length - 5; + } else { + parsed.experiment.microscopy_list.start_tabs_index = i / 2; + } } -scb.ui.static.SelectTechniqueView.register = function (workarea) { - scb.utils.off_on(workarea, 'click', '.scb_s_select_technique_open_western_blot', function (e) { - scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_western_blot(this); - }); - - scb.utils.off_on(workarea, 'click', '.scb_s_select_technique_open_facs', function (e) { - scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_facs(this); - }); - - scb.utils.off_on(workarea, 'click', '.scb_s_select_technique_open_microscopy', function (e) { - scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_microscopy(this); - }); +scb.ui.static.SelectTechniqueView.register = function(workarea) { + scb.utils.off_on(workarea, 'click', '.scb_s_select_technique_open_western_blot', function(e) { + scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_western_blot(this); + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_select_technique_open_facs', function(e) { + scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_facs(this); + }); + + scb.utils.off_on(workarea, 'click', '.scb_s_select_technique_open_microscopy', function(e) { + scb.ui.static.SelectTechniqueView.scb_s_select_technique_open_microscopy(this); + }); } @@ -145,52 +155,58 @@ scb.ui.static.SelectTechniqueView.register = function (workarea) { scb.ui.SelectTechniqueView = function scb_ui_SelectTechniqueView(gstate) { - var self = this; - - self.show = function (state) { - var workarea = state.workarea; - var experiment = state.experiment; - var template = state.assignment.template; - - workarea.html(scb_select_technique.main({ - global_template: gstate.context.master_model, - t: template, - context: gstate.context, - last_step: state.experiment.last_step, - prev_step: state.experiment.prev_step, - assignment: state.assignment, - experiment: state.experiment - })); - state.experiment.prev_step=3; - if(state.experiment.last_step > scb.ui.static.SelectTechniqueView.TOTAL_STEPS) - state.experiment.last_step = scb.ui.static.SelectTechniqueView.TOTAL_STEPS+1; - else - state.experiment.last_step = scb.ui.static.SelectTechniqueView.TOTAL_STEPS; - - state.experiment.last_view = 'select_technique'; - - $('html').css("overflow", "auto"); - scb.ui.static.SelectTechniqueView.disable_techniques({template: template, workarea: workarea}); - - _.each($(".scb_s_experiment_step_button"), function (e) { - if(!$(e).hasClass('scb_s_experiment_step_visited')) - $(e).attr('title', 'To use this button, start a new '+$(e).text()+' Experiment.'); - else $(e).removeAttr('title'); - }); - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); + var self = this; + + self.show = function(state) { + var workarea = state.workarea; + var experiment = state.experiment; + var template = state.assignment.template; + + workarea.html(scb_select_technique.main({ + global_template: gstate.context.master_model, + t: template, + context: gstate.context, + last_step: state.experiment.last_step, + prev_step: state.experiment.prev_step, + assignment: state.assignment, + experiment: state.experiment + })); + state.experiment.prev_step = 3; + if (state.experiment.last_step > scb.ui.static.SelectTechniqueView.TOTAL_STEPS) { + state.experiment.last_step = scb.ui.static.SelectTechniqueView.TOTAL_STEPS + 1; + } else { + state.experiment.last_step = scb.ui.static.SelectTechniqueView.TOTAL_STEPS; } + state.experiment.last_view = 'select_technique'; + + $('html').css("overflow", "auto"); + scb.ui.static.SelectTechniqueView.disable_techniques({ + template: template, + workarea: workarea + }); + + _.each($(".scb_s_experiment_step_button"), function(e) { + if (!$(e).hasClass('scb_s_experiment_step_visited')) { + $(e).attr('title', 'To use this button, start a new ' + $(e).text() + ' Experiment.'); + } else { + $(e).removeAttr('title'); + } + }); + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + } + } \ No newline at end of file diff --git a/html_app/ui/WesternBlotGelView.js b/html_app/ui/WesternBlotGelView.js index 97b44cfb..c023a083 100644 --- a/html_app/ui/WesternBlotGelView.js +++ b/html_app/ui/WesternBlotGelView.js @@ -1,436 +1,442 @@ scb.ui = scb.ui || {}; scb.ui.static = scb.ui.static || {}; scb.ui.static.WesternBlotGelView = scb.ui.static.WesternBlotGelView || {}; -scb.ui.static.WesternBlotGelView.TOTAL_TABS = 4; -scb.ui.static.WesternBlotGelView.TOTAL_STEPS = 5; -scb.ui.static.WesternBlotGelView.Y_OFFSET = 40; +scb.ui.static.WesternBlotGelView.TOTAL_TABS = 4; +scb.ui.static.WesternBlotGelView.TOTAL_STEPS = 5; +scb.ui.static.WesternBlotGelView.Y_OFFSET = 40; -scb.ui.static.WesternBlotGelView.X_OFFSET = 12; -scb.ui.static.WesternBlotGelView.X_SCALE = 22; +scb.ui.static.WesternBlotGelView.X_OFFSET = 12; +scb.ui.static.WesternBlotGelView.X_SCALE = 22; -scb.ui.static.WesternBlotGelView.Y_LABEL_OFFSET = 12; -scb.ui.static.WesternBlotGelView.AMOUNT_PROTEIN_LOADED = 10; +scb.ui.static.WesternBlotGelView.Y_LABEL_OFFSET = 12; +scb.ui.static.WesternBlotGelView.AMOUNT_PROTEIN_LOADED = 10; -scb.ui.static.WesternBlotGelView.BOUND_OFFSET = 288; -scb.ui.static.WesternBlotGelView.CANVAS_HEIGHT = 247; +scb.ui.static.WesternBlotGelView.BOUND_OFFSET = 288; +scb.ui.static.WesternBlotGelView.CANVAS_HEIGHT = 247; scb.ui.static.WesternBlotGelView.CANVAS_WIDTH = 325; scb.ui.static.WesternBlotGelView.MOUSE_SLIDER_OFFSET = 20; -scb.ui.static.WesternBlotGelView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); - var experiment_id = $(element).attr('experiment_id'); - var western_blot_id = $(element).attr('western_blot_id'); - var western_blot_gel_id = $(element).attr('western_blot_gel_id'); - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - western_blot_id: western_blot_id, - western_blot_gel_id: western_blot_gel_id, - view: 'western_blot_gel', - skip_hash_update: false - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - parsed.state = state; - return parsed; +scb.ui.static.WesternBlotGelView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); + var experiment_id = $(element).attr('experiment_id'); + var western_blot_id = $(element).attr('western_blot_id'); + var western_blot_gel_id = $(element).attr('western_blot_gel_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + western_blot_id: western_blot_id, + western_blot_gel_id: western_blot_gel_id, + view: 'western_blot_gel', + skip_hash_update: false + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + parsed.state = state; + return parsed; } -scb.ui.static.WesternBlotGelView.scb_f_wb_anti_body_select_primary = function (element) { - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.WesternBlotGelView.scb_f_wb_anti_body_select_primary = function(element) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - console.info(parsed.western_blot_gel.primary_anti_body); - parsed.western_blot_gel.primary_anti_body = $('option:selected', element).attr('model_id'); - console.info(parsed.western_blot_gel.primary_anti_body); - console.info(parsed.western_blot_gel); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + console.info(parsed.western_blot_gel.primary_anti_body); + parsed.western_blot_gel.primary_anti_body = $('option:selected', element).attr('model_id'); + console.info(parsed.western_blot_gel.primary_anti_body); + console.info(parsed.western_blot_gel); } -scb.ui.static.WesternBlotGelView.scb_f_wb_anti_body_select_secondary = function (element) { - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.WesternBlotGelView.scb_f_wb_anti_body_select_secondary = function(element) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.western_blot_gel.secondary_anti_body = $('option:selected', element).attr('model_id'); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.western_blot_gel.secondary_anti_body = $('option:selected', element).attr('model_id'); } -scb.ui.static.WesternBlotGelView.scb_s_western_blot_blot_and_develop = function (element) { - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); - - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if (parsed.western_blot_gel.primary_anti_body && parsed.western_blot_gel.secondary_anti_body) { - parsed.western_blot_gel.is_developed = true; - if (parsed.context.template.primary_anti_body[parsed.western_blot_gel.primary_anti_body].gel_name) { - var gel_name = parsed.context.template.primary_anti_body[parsed.western_blot_gel.primary_anti_body].gel_name; - var counter = 0; - _.find(parsed.western_blot.gel_list.list, function (e) { - if (e.name.indexOf(gel_name) == 0) { - counter++; - } - }); - parsed.western_blot_gel.name = parsed.context.template.primary_anti_body[parsed.western_blot_gel.primary_anti_body].gel_name + (counter == 0 ? '' : ' - ' + (counter + 1)); +scb.ui.static.WesternBlotGelView.scb_s_western_blot_blot_and_develop = function(element) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.western_blot_gel.primary_anti_body && parsed.western_blot_gel.secondary_anti_body) { + parsed.western_blot_gel.is_developed = true; + if (parsed.context.template.primary_anti_body[parsed.western_blot_gel.primary_anti_body].gel_name) { + var gel_name = parsed.context.template.primary_anti_body[parsed.western_blot_gel.primary_anti_body].gel_name; + var counter = 0; + _.find(parsed.western_blot.gel_list.list, function(e) { + if (e.name.indexOf(gel_name) == 0) { + counter++; } - } else { - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("Please select primary & secondary antibodies.", - function() { $('html').css('overflow', 'visible'); - - $('.error_overlay').remove(); - /* callback function for 'OK' button*/ }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); + }); + parsed.western_blot_gel.name = parsed.context.template.primary_anti_body[parsed.western_blot_gel.primary_anti_body].gel_name + (counter == 0 ? '' : ' - ' + (counter + 1)); } - $('.scb_f_wb_exposure_slider').detach(); - var state = { - assignment_id: parsed.assignment.id, - experiment_id: parsed.experiment.id, - view: 'western_blot_gel', - western_blot_id: parsed.western_blot.id, - western_blot_gel_id: parsed.western_blot_gel.id, - onhashchange: true - }; - parsed.western_blot.last_gel = parsed.western_blot_gel.id; - scb.ui.static.MainFrame.refresh(state); -} + } else { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); -scb.ui.static.WesternBlotGelView.scb_s_western_blot_reprobe = function (element) { - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); + $.jqDialog.alert("Please select primary & secondary antibodies.", function() { + $('html').css('overflow', 'visible'); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if(parsed.western_blot.gel_list.list.length >= scb.ui.static.WesternBlotGelView.TOTAL_TABS){ - parsed.western_blot.gel_list.start_tabs_index = parsed.western_blot.gel_list.start_tabs_index +1; - } - var gel = parsed.western_blot.gel_list.start({}); - parsed.western_blot.last_gel = gel.id; - parsed.state.western_blot_gel_id = gel.id; - scb.ui.static.MainFrame.refresh(parsed.state); + $('.error_overlay').remove(); + /* callback function for 'OK' button*/ + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + } + $('.scb_f_wb_exposure_slider').detach(); + var state = { + assignment_id: parsed.assignment.id, + experiment_id: parsed.experiment.id, + view: 'western_blot_gel', + western_blot_id: parsed.western_blot.id, + western_blot_gel_id: parsed.western_blot_gel.id, + onhashchange: true + }; + parsed.western_blot.last_gel = parsed.western_blot_gel.id; + scb.ui.static.MainFrame.refresh(state); } +scb.ui.static.WesternBlotGelView.scb_s_western_blot_reprobe = function(element) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if (parsed.western_blot.gel_list.list.length >= scb.ui.static.WesternBlotGelView.TOTAL_TABS) { + parsed.western_blot.gel_list.start_tabs_index = parsed.western_blot.gel_list.start_tabs_index + 1; + } + var gel = parsed.western_blot.gel_list.start({}); + parsed.western_blot.last_gel = gel.id; + parsed.state.western_blot_gel_id = gel.id; + scb.ui.static.MainFrame.refresh(parsed.state); +} -scb.ui.static.WesternBlotGelView.scb_f_western_blot_gel_remove = function (element) { - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); +scb.ui.static.WesternBlotGelView.scb_f_western_blot_gel_remove = function(element) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var index = -1; + for (var i = 0; i < parsed.western_blot.gel_list.list.length; i++) { + if (parsed.western_blot.gel_list.list[i].id == parsed.western_blot_gel.id) { + index = i; + break; } - var index = -1; - for(var i = 0; i < parsed.western_blot.gel_list.list.length; i ++){ - if(parsed.western_blot.gel_list.list[i].id == parsed.western_blot_gel.id){ - index = i; - break; - } + } + parsed.western_blot.gel_list.remove(parsed.western_blot_gel.id); + if (parsed.western_blot.gel_list.start_tabs_index + scb.ui.static.WesternBlotGelView.TOTAL_TABS != parsed.western_blot.gel_list.list.length) { + parsed.western_blot.gel_list.start_tabs_index = parsed.western_blot.gel_list.start_tabs_index - 1; + if (parsed.western_blot.gel_list.start_tabs_index < 0) { + parsed.western_blot.gel_list.start_tabs_index = 0; } - parsed.western_blot.gel_list.remove(parsed.western_blot_gel.id); - if(parsed.western_blot.gel_list.start_tabs_index + scb.ui.static.WesternBlotGelView.TOTAL_TABS != parsed.western_blot.gel_list.list.length){ - parsed.western_blot.gel_list.start_tabs_index = parsed.western_blot.gel_list.start_tabs_index -1; - if(parsed.western_blot.gel_list.start_tabs_index <0) - parsed.western_blot.gel_list.start_tabs_index =0; - } - var list = parsed.western_blot.gel_list.list; - parsed.western_blot.last_gel = list.length > 0 ? list[index -1].id : null; - parsed.state.view = 'western_blot'; - scb.ui.static.MainFrame.refresh(parsed.state); + } + var list = parsed.western_blot.gel_list.list; + parsed.western_blot.last_gel = list.length > 0 ? list[index - 1].id : null; + parsed.state.view = 'western_blot'; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_array = [0, 0,1, 2, 5, 10, 30, 1 * 60, 2 * 60, 5 * 60, 10 * 60, 20 * 60, 60 * 60]; +scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_array = [0, 0, 1, 2, 5, 10, 30, 1 * 60, 2 * 60, 5 * 60, 10 * 60, 20 * 60, 60 * 60]; + +scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider = function(e, ui) { + var element = this; + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var value = ui.value || $(element).slider('value'); + parsed.western_blot_gel.exposure_time = scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_array[value]; -scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider = function (e, ui) { - var element = this; - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); + $('.scb_s_wb_exposure_time_value', $(element).parent()).text(scb.utils.print_time_w_seconds(parsed.western_blot_gel.exposure_time)); + $('.ui-slider-handle').mouseup(function() { + if (_.isObject(e)) { + var state = { + assignment_id: parsed.assignment.id, + experiment_id: parsed.experiment.id, + view: 'western_blot_gel', + western_blot_id: parsed.western_blot.id, + western_blot_gel_id: parsed.western_blot_gel.id, + onhashchange: false + }; + scb.ui.static.MainFrame.refresh(state); } - var value = ui.value || $(element).slider('value'); - parsed.western_blot_gel.exposure_time = scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_array[value]; - - - $('.scb_s_wb_exposure_time_value', $(element).parent()).text(scb.utils.print_time_w_seconds(parsed.western_blot_gel.exposure_time)); - $('.ui-slider-handle').mouseup(function(){ - if (_.isObject(e)) { - var state = { - assignment_id: parsed.assignment.id, - experiment_id: parsed.experiment.id, - view: 'western_blot_gel', - western_blot_id: parsed.western_blot.id, - western_blot_gel_id: parsed.western_blot_gel.id, - onhashchange: false - }; - scb.ui.static.MainFrame.refresh(state); - } - - }); - + + }); + } -scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_index = function (exposure_time) { - var ret = 0; - _.find(scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_array, function (a, b) { - if (exposure_time >= a) { - ret = b; - console.log(ret); - return false; - } - }); - console.log(ret); - return ret; +scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_index = function(exposure_time) { + var ret = 0; + _.find(scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_array, function(a, b) { + if (exposure_time >= a) { + ret = b; + console.log(ret); + return false; + } + }); + console.log(ret); + return ret; } -scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint_all = function (workarea, gstate, state) { - var gels = $('.scb_s_western_blot_gel[is_developed="true"]', workarea || $('body')); - gels.each(function (index, element) { - scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint(element, gstate, state); - }); +scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint_all = function(workarea, gstate, state) { + var gels = $('.scb_s_western_blot_gel[is_developed="true"]', workarea || $('body')); + gels.each(function(index, element) { + scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint(element, gstate, state); + }); } -scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint = function (element, gstate, state) { - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint = function(element, gstate, state) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); + + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var context = gstate.context; - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); + if (parsed.western_blot_gel.marks.length == 0) { + // develop gel + var rows_state = parsed.western_blot.rows_state(); + var lanes = []; + _.each(rows_state.rows, function(r) { + if (r.is_valid || r.is_marker) { + lanes.push(r.lane); + } + }); + var template = gstate.context.template; + var model = new scb.components.ModelFactory(template); + var lane_marks = []; + _.each(lanes, function(lane, index) { + var marks = []; + model.western_blot.compute(lane, parsed.western_blot_gel, marks); + lane_marks.push({ + marks: marks, + amount_of_protein_loaded: scb.ui.static.WesternBlotGelView.AMOUNT_PROTEIN_LOADED + }); + }); + parsed.western_blot_gel.marks = lane_marks; + } + + var gel = parsed.western_blot_gel; + if (gel.canvas_metadata == null) { + if (parsed.western_blot.canvas_metadata == null) { + var cstate = { + time: 0, + gel: gel, + lanes_length: gel.marks.length + } + + var c = new scb.components.WesternBlot(cstate, context); + c.initialize_bias(); + + parsed.western_blot.canvas_metadata = { + background: c.background, + lane_yslope: c.lane_yslope, + lane_xoffset: c.lane_xoffset + } } - var context = gstate.context; - - if (parsed.western_blot_gel.marks.length == 0) { - // develop gel - var rows_state = parsed.western_blot.rows_state(); - var lanes = []; - _.each(rows_state.rows, function (r) { - if (r.is_valid || r.is_marker) lanes.push(r.lane); - }); - var template = gstate.context.template; - var model = new scb.components.ModelFactory(template); - var lane_marks = []; - _.each(lanes, function (lane, index) { - var marks = []; - model.western_blot.compute(lane, parsed.western_blot_gel, marks); - lane_marks.push({marks: marks, amount_of_protein_loaded: scb.ui.static.WesternBlotGelView.AMOUNT_PROTEIN_LOADED}); - }); - parsed.western_blot_gel.marks = lane_marks; + gel.canvas_metadata = parsed.western_blot.canvas_metadata; + } + + var cstate = { + time: gel.exposure_time, + gel: gel + } + var c = new scb.components.WesternBlot(cstate, context); + c.background = gel.canvas_metadata.background; + c.lane_yslope = gel.canvas_metadata.lane_yslope; + c.lane_xoffset = gel.canvas_metadata.lane_xoffset; + c.build_one_tab(cstate); + var canvas_id = parsed.western_blot_gel.id; + c.paint_blot(canvas_id, c.tab); + gel.canvas_data = c.tab; + var parent = $($(element).parent()); + var slider = $('.scb_f_slider', $(parent)); + var slider_value = $('.scb_f_slider_value', $(parent)); + var vslider = $('.scb_f_vslider', $(parent)); + var vslider_value = $('.scb_f_vslider_value', $(parent)); + function set_slider(y) { + slider.css('top', (y - scb.ui.static.WesternBlotGelView.Y_OFFSET) + 'px'); + slider_value.css('top', (y - scb.ui.static.WesternBlotGelView.Y_OFFSET - scb.ui.static.WesternBlotGelView.Y_LABEL_OFFSET) + 'px'); + var ww = Math.round(c.position_to_weight(y - scb.ui.static.WesternBlotGelView.Y_OFFSET)); + var weight = ww > 0 ? ww + " kDa" : "N/A"; + if (!parsed.western_blot.marker_loaded) { + weight = "NaN"; } - - var gel = parsed.western_blot_gel; - if (gel.canvas_metadata == null) { - if (parsed.western_blot.canvas_metadata == null) { - var cstate = { - time: 0, - gel: gel, - lanes_length: gel.marks.length - } - - var c = new scb.components.WesternBlot(cstate, context); - c.initialize_bias(); - - parsed.western_blot.canvas_metadata = { - background: c.background, - lane_yslope: c.lane_yslope, - lane_xoffset: c.lane_xoffset - } - } - gel.canvas_metadata = parsed.western_blot.canvas_metadata; + slider_value.html(weight); + if (_.isUndefined(y)) { + slider.hide(); + slider_value.hide(); + } else { + slider.show(); + //slider_value.show(); } - - var cstate = { - time: gel.exposure_time, - gel: gel + } + function set_vslider(x) { + vslider.css('left', x + 'px'); + vslider_value.css('left', (x - scb.ui.static.WesternBlotGelView.X_OFFSET) + 'px'); + var ww = Math.round(c.position_to_weight(x)); + var weight = ww > 0 ? Math.round(x / scb.ui.static.WesternBlotGelView.X_SCALE) + " " : "N/A"; + if (!parsed.western_blot.marker_loaded) { + weight = "NaN"; } - var c = new scb.components.WesternBlot(cstate, context); - c.background = gel.canvas_metadata.background; - c.lane_yslope = gel.canvas_metadata.lane_yslope; - c.lane_xoffset = gel.canvas_metadata.lane_xoffset; - c.build_one_tab(cstate); - var canvas_id = parsed.western_blot_gel.id; - c.paint_blot(canvas_id, c.tab); - gel.canvas_data = c.tab; - var parent = $($(element).parent()); - var slider = $('.scb_f_slider', $(parent)); - var slider_value = $('.scb_f_slider_value', $(parent)); - var vslider = $('.scb_f_vslider', $(parent)); - var vslider_value = $('.scb_f_vslider_value', $(parent)); - function set_slider(y) { - slider.css('top', (y-scb.ui.static.WesternBlotGelView.Y_OFFSET )+ 'px'); - slider_value.css('top', (y-scb.ui.static.WesternBlotGelView.Y_OFFSET-scb.ui.static.WesternBlotGelView.Y_LABEL_OFFSET) + 'px'); - var ww = Math.round(c.position_to_weight(y-scb.ui.static.WesternBlotGelView.Y_OFFSET)); - var weight = ww > 0 ? ww + " kDa" : "N/A"; - if (!parsed.western_blot.marker_loaded) { - weight = "NaN"; - } - slider_value.html(weight); - if (_.isUndefined(y)) { - slider.hide(); - slider_value.hide(); - } - else { - slider.show(); - //slider_value.show(); - } + vslider_value.html(weight); + if (_.isUndefined(x)) { + vslider.hide(); + vslider_value.hide(); + } else { + vslider.show(); } - function set_vslider(x) { - vslider.css('left', x + 'px'); - vslider_value.css('left', (x-scb.ui.static.WesternBlotGelView.X_OFFSET ) + 'px'); - var ww = Math.round(c.position_to_weight(x)); - var weight = ww > 0 ? Math.round(x/scb.ui.static.WesternBlotGelView.X_SCALE ) + " " : "N/A"; - if (!parsed.western_blot.marker_loaded) { - weight = "NaN"; - } - vslider_value.html(weight); - if (_.isUndefined(x)) { - vslider.hide(); - vslider_value.hide(); - } - else { - vslider.show(); - } + } + + set_slider(gel.canvas_metadata.slider); + set_vslider(gel.canvas_metadata.vslider); + $(parent).unbind('mousemove').bind('mousemove', function(evt) { + var poffset = element.getBoundingClientRect(); + var eX = evt.clientX; + var eY = evt.clientY; + var bound = poffset.top; + var upper_bound = bound + scb.ui.static.WesternBlotGelView.BOUND_OFFSET; + bound = upper_bound - scb.ui.static.WesternBlotGelView.CANVAS_HEIGHT; + var y = (eY); + var x = (eX - poffset.left) - scb.ui.static.WesternBlotGelView.MOUSE_SLIDER_OFFSET; + window.__evt = evt ; + window.__element = element; + if (true || $(evt.srcElement ? evt.srcElement : evt.target).is('canvas')) { + gel.canvas_metadata.slider = evt.clientY - poffset.top; + gel.canvas_metadata.vslider = x; + if ((y ) < Math.abs(bound) || (y) > Math.abs(upper_bound) || x < 0 || x > scb.ui.static.WesternBlotGelView.CANVAS_WIDTH) { + slider.hide(); + slider_value.hide(); + vslider.hide(); + vslider_value.hide(); + delete gel.canvas_metadata.slider; + delete gel.canvas_metadata.vslider; + } else { + console.log('within bounds'); + set_slider(gel.canvas_metadata.slider); + set_vslider(gel.canvas_metadata.vslider); + } } - - set_slider(gel.canvas_metadata.slider); - set_vslider(gel.canvas_metadata.vslider); - $(parent).unbind('mousemove').bind('mousemove', function (evt) { - var poffset = element.getBoundingClientRect(); - var eX = evt.clientX; - var eY = evt.clientY; - var bound = poffset.top ; - var upper_bound = bound+scb.ui.static.WesternBlotGelView.BOUND_OFFSET; - bound = upper_bound - scb.ui.static.WesternBlotGelView.CANVAS_HEIGHT; - var y = (eY); - var x = (eX - poffset.left)- scb.ui.static.WesternBlotGelView.MOUSE_SLIDER_OFFSET ; - window.__evt = evt ; - window.__element = element; - if (true || $(evt.srcElement ? evt.srcElement: evt.target).is('canvas')) { - gel.canvas_metadata.slider = evt.clientY - poffset.top; - gel.canvas_metadata.vslider= x; - if ((y )< Math.abs(bound)|| (y) > Math.abs(upper_bound) || x < 0 || x > scb.ui.static.WesternBlotGelView.CANVAS_WIDTH) { - slider.hide(); - slider_value.hide(); - vslider.hide(); - vslider_value.hide(); - delete gel.canvas_metadata.slider; - delete gel.canvas_metadata.vslider; - } else { - console.log('within bounds'); - set_slider(gel.canvas_metadata.slider); - set_vslider(gel.canvas_metadata.vslider); - } - } - }); - $(parent).unbind('mouseout').bind('mouseout', function (evt) { - }); + }); + $(parent).unbind('mouseout').bind('mouseout', function(evt) {}); } -scb.ui.static.WesternBlotGelView.scb_s_western_blot_tab_select_many = function (element, event) { - var target = $("option:selected", element).attr('href'); - document.location = target; +scb.ui.static.WesternBlotGelView.scb_s_western_blot_tab_select_many = function(element, event) { + var target = $("option:selected", element).attr('href'); + document.location = target; } -scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_left_western_blot = function(element, event){ - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_left_western_blot = function(element, event) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); - parsed.western_blot.gel_list.start_tabs_index = parsed.western_blot.gel_list.start_tabs_index -1; - scb.ui.static.MainFrame.refresh(parsed.state); + parsed.western_blot.gel_list.start_tabs_index = parsed.western_blot.gel_list.start_tabs_index - 1; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_right_western_blot = function(element, event){ - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - parsed = resetScrollValue(parsed); +scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_right_western_blot = function(element, event) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + parsed = resetScrollValue(parsed); - parsed.western_blot.gel_list.start_tabs_index = parsed.western_blot.gel_list.start_tabs_index +1; - scb.ui.static.MainFrame.refresh(parsed.state); + parsed.western_blot.gel_list.start_tabs_index = parsed.western_blot.gel_list.start_tabs_index + 1; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.WesternBlotGelView.scb_f_western_blot_note_close_button= function (element) { - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - var note = $(element).attr('note'); - note = '.' +note; - $(note).slideUp('400', function(){ - parsed.western_blot.measure_show_state = $('.scb_s_western_blot_tools_measure_followup').is(":visible"); - parsed.western_blot.samples_show_state = $('.scb_s_western_blot_tools_samples_followup').is(":visible"); - scb.ui.static.MainFrame.refresh(); - }); - -} +scb.ui.static.WesternBlotGelView.scb_f_western_blot_note_close_button = function(element) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + var note = $(element).attr('note'); + note = '.' + note; + $(note).slideUp('400', function() { + parsed.western_blot.measure_show_state = $('.scb_s_western_blot_tools_measure_followup').is(":visible"); + parsed.western_blot.samples_show_state = $('.scb_s_western_blot_tools_samples_followup').is(":visible"); + scb.ui.static.MainFrame.refresh(); + }); -scb.ui.static.WesternBlotGelView.scb_f_western_blot_tools_toggle = function (element) { - var parsed = scb.ui.static.WesternBlotGelView.parse(element); - var note = $(element).attr('note'); - note = '.' +note; - $(note).slideDown('400', function(){ - parsed.western_blot.measure_show_state = $('.scb_s_western_blot_tools_measure_followup').is(":visible"); - parsed.western_blot.samples_show_state = $('.scb_s_western_blot_tools_samples_followup').is(":visible"); - scb.ui.static.MainFrame.refresh(); - }); - } +scb.ui.static.WesternBlotGelView.scb_f_western_blot_tools_toggle = function(element) { + var parsed = scb.ui.static.WesternBlotGelView.parse(element); + var note = $(element).attr('note'); + note = '.' + note; + $(note).slideDown('400', function() { + parsed.western_blot.measure_show_state = $('.scb_s_western_blot_tools_measure_followup').is(":visible"); + parsed.western_blot.samples_show_state = $('.scb_s_western_blot_tools_samples_followup').is(":visible"); + scb.ui.static.MainFrame.refresh(); + }); -scb.ui.static.WesternBlotGelView.register = function (workarea) { - scb.utils.off_on(workarea, 'change', '.scb_f_wb_anti_body_select_primary', function (e) { - scb.ui.static.WesternBlotGelView.scb_f_wb_anti_body_select_primary(this); - }); +} - scb.utils.off_on(workarea, 'change', '.scb_f_wb_anti_body_select_secondary', function (e) { - scb.ui.static.WesternBlotGelView.scb_f_wb_anti_body_select_secondary(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_blot_and_develop', function (e) { - scb.ui.static.WesternBlotGelView.scb_s_western_blot_blot_and_develop(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_reprobe', function (e) { - scb.ui.static.WesternBlotGelView.scb_s_western_blot_reprobe(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_gel_remove', function (e) { - scb.ui.static.WesternBlotGelView.scb_f_western_blot_gel_remove(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_gel_left_western_blot', function (e) { - scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_left_western_blot(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_gel_right_western_blot', function (e) { - scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_right_western_blot(this); - }); - scb.utils.off_on(workarea, 'change', '.scb_s_western_blot_tab_select_many', function (e) { - scb.ui.static.WesternBlotGelView.scb_s_western_blot_tab_select_many(this, e); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_tools_toggle', function (e) { - scb.ui.static.WesternBlotGelView.scb_f_western_blot_tools_toggle(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_note_close_button', function (e) { - scb.ui.static.WesternBlotGelView.scb_f_western_blot_note_close_button(this); - }); - scb.utils.off_on(workarea, 'mouseup', document, function(e,ui){ - var container = $(".scb_f_controls_note"); - container.slideUp(); // hide - }); - scb.utils.off_on(workarea, 'click','.scb_f_controls_note', function(e,ui){ - e.stopPropagation(); - }); - scb.utils.off_on(workarea, 'click','.scb_f_info_icon', function(e,ui){ - e.stopPropagation(); - var note = $(this).attr('note'); - note = '.' +note; - if($(note).is(":visible")) - $(note).slideUp(); - else $(note).slideDown(); - }); + +scb.ui.static.WesternBlotGelView.register = function(workarea) { + scb.utils.off_on(workarea, 'change', '.scb_f_wb_anti_body_select_primary', function(e) { + scb.ui.static.WesternBlotGelView.scb_f_wb_anti_body_select_primary(this); + }); + + scb.utils.off_on(workarea, 'change', '.scb_f_wb_anti_body_select_secondary', function(e) { + scb.ui.static.WesternBlotGelView.scb_f_wb_anti_body_select_secondary(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_blot_and_develop', function(e) { + scb.ui.static.WesternBlotGelView.scb_s_western_blot_blot_and_develop(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_reprobe', function(e) { + scb.ui.static.WesternBlotGelView.scb_s_western_blot_reprobe(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_gel_remove', function(e) { + scb.ui.static.WesternBlotGelView.scb_f_western_blot_gel_remove(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_gel_left_western_blot', function(e) { + scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_left_western_blot(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_gel_right_western_blot', function(e) { + scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_right_western_blot(this); + }); + scb.utils.off_on(workarea, 'change', '.scb_s_western_blot_tab_select_many', function(e) { + scb.ui.static.WesternBlotGelView.scb_s_western_blot_tab_select_many(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_tools_toggle', function(e) { + scb.ui.static.WesternBlotGelView.scb_f_western_blot_tools_toggle(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_note_close_button', function(e) { + scb.ui.static.WesternBlotGelView.scb_f_western_blot_note_close_button(this); + }); + scb.utils.off_on(workarea, 'mouseup', document, function(e, ui) { + var container = $(".scb_f_controls_note"); + container.slideUp(); // hide + }); + scb.utils.off_on(workarea, 'click', '.scb_f_controls_note', function(e, ui) { + e.stopPropagation(); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_info_icon', function(e, ui) { + e.stopPropagation(); + var note = $(this).attr('note'); + note = '.' + note; + if ($(note).is(":visible")) { + $(note).slideUp(); + } else { + $(note).slideDown(); + } + }); } @@ -439,103 +445,108 @@ scb.ui.static.WesternBlotGelView.register = function (workarea) { scb.ui.WesternBlotGelView = function scb_WesternBlotGelView(gstate) { - var self = this; - - self.show = function (state) { - state.experiment.last_technique_view = 'western_blot_gel'; - - var workarea = state.workarea; - var experiment = state.experiment; - var template = state.assignment.template; - var rows_state = state.western_blot.rows_state(); - var rows = rows_state.rows; - var kind = 'prepare_gel'; - - workarea.html(scb_western_blot_gel.main({ - global_template: gstate.context.master_model, - t: template, - assignment: state.assignment, - experiment: state.experiment, - western_blot: state.western_blot, - context: gstate.context, - last_step: state.experiment.last_step, - prev_step: state.experiment.prev_step, - western_blot_gel: state.western_blot_gel, - rows: rows, - kind: kind, - valid_rows: rows_state.valid - })); - state.experiment.prev_step=4; - if(state.experiment.last_step >= scb.ui.static.WesternBlotGelView.TOTAL_STEPS) - state.experiment.last_step = scb.ui.static.WesternBlotGelView.TOTAL_STEPS+1; - state.experiment.last_technique = 'WESTERN BLOT'; - state.experiment.last_id = state.western_blot.id; - state.experiment.last_param = 'western_blot_id'; - - - document.body.scrollTop = state.experiment.last_scroll; - if(state.western_blot.gel_list.start_tabs_index <= 0){ - state.western_blot.gel_list.start_tabs_index = 0; - $('.scb_s_western_blot_gel_left_western_blot').prop('disabled', true); - $('.scb_s_western_blot_gel_right_western_blot').prop('disabled', false); - } - else $('.scb_s_western_blot_gel_left_western_blot').prop('disabled', false); - - if(state.western_blot.gel_list.start_tabs_index + scb.ui.static.WesternBlotGelView.TOTAL_TABS-1 ==state.western_blot.gel_list.list.length-1){ - $('.scb_s_western_blot_gel_right_western_blot').prop('disabled', true); - $('.scb_s_western_blot_gel_left_western_blot').prop('disabled', false); - } - else $('.scb_s_western_blot_gel_right_western_blot').prop('disabled', false); - - if(kind != 'sample_prep') { - $('.scb_s_western_blot_video_box_wrapper').remove(); - } - state.experiment.last_view = 'western_blot_gel'; - - - state.western_blot.last_gel = state.western_blot_gel.id; - - state.western_blot.parent.selected_id = state.western_blot.id; - $('.scb_f_wb_exposure_slider').slider({ - orientation: "horizontal", - range: "min", - min: 1, - max: scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_array.length-1, - value: scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_index(state.western_blot_gel.exposure_time), - slide: scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider, - change: scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider, - create: function(event, ui){ - $('.scb_f_wb_exposure_slider').attr('role', 'slider'); - $('.scb_f_wb_exposure_slider .ui-slider-handle').attr({ - 'aria-labelledby': "scb_s_wb_exposure_time_value", - 'aria-valuemin': "0", - 'aria-valuemax': "100", - 'aria-valuenow': "0", - 'aria-valuetext': "1 minute" - }); - } - }).each(scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider); - scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint_all(workarea, gstate, state); - _.each($(".scb_s_experiment_step_button"), function (e) { - if(!$(e).hasClass('scb_s_experiment_step_visited')) - $(e).attr('title', 'To use this button, start a new '+$(e).text()+' Experiment.'); - else $(e).removeAttr('title'); - }); - $('.scb_s_western_blot_sortable_item').removeClass('scb_s_western_blot_sortable_item'); - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - - $(window).resize(function(){ - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - }); - - + var self = this; + + self.show = function(state) { + state.experiment.last_technique_view = 'western_blot_gel'; + + var workarea = state.workarea; + var experiment = state.experiment; + var template = state.assignment.template; + var rows_state = state.western_blot.rows_state(); + var rows = rows_state.rows; + var kind = 'prepare_gel'; + + workarea.html(scb_western_blot_gel.main({ + global_template: gstate.context.master_model, + t: template, + assignment: state.assignment, + experiment: state.experiment, + western_blot: state.western_blot, + context: gstate.context, + last_step: state.experiment.last_step, + prev_step: state.experiment.prev_step, + western_blot_gel: state.western_blot_gel, + rows: rows, + kind: kind, + valid_rows: rows_state.valid + })); + state.experiment.prev_step = 4; + if (state.experiment.last_step >= scb.ui.static.WesternBlotGelView.TOTAL_STEPS) { + state.experiment.last_step = scb.ui.static.WesternBlotGelView.TOTAL_STEPS + 1; } + state.experiment.last_technique = 'WESTERN BLOT'; + state.experiment.last_id = state.western_blot.id; + state.experiment.last_param = 'western_blot_id'; + + + document.body.scrollTop = state.experiment.last_scroll; + if (state.western_blot.gel_list.start_tabs_index <= 0) { + state.western_blot.gel_list.start_tabs_index = 0; + $('.scb_s_western_blot_gel_left_western_blot').prop('disabled', true); + $('.scb_s_western_blot_gel_right_western_blot').prop('disabled', false); + } else { + $('.scb_s_western_blot_gel_left_western_blot').prop('disabled', false); + } + + if (state.western_blot.gel_list.start_tabs_index + scb.ui.static.WesternBlotGelView.TOTAL_TABS - 1 == state.western_blot.gel_list.list.length - 1) { + $('.scb_s_western_blot_gel_right_western_blot').prop('disabled', true); + $('.scb_s_western_blot_gel_left_western_blot').prop('disabled', false); + } else { + $('.scb_s_western_blot_gel_right_western_blot').prop('disabled', false); + } + + if (kind != 'sample_prep') { + $('.scb_s_western_blot_video_box_wrapper').remove(); + } + state.experiment.last_view = 'western_blot_gel'; + + + state.western_blot.last_gel = state.western_blot_gel.id; + + state.western_blot.parent.selected_id = state.western_blot.id; + $('.scb_f_wb_exposure_slider').slider({ + orientation: "horizontal", + range: "min", + min: 1, + max: scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_array.length - 1, + value: scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider_index(state.western_blot_gel.exposure_time), + slide: scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider, + change: scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider, + create: function(event, ui) { + $('.scb_f_wb_exposure_slider').attr('role', 'slider'); + $('.scb_f_wb_exposure_slider .ui-slider-handle').attr({ + 'aria-labelledby': "scb_s_wb_exposure_time_value", + 'aria-valuemin': "0", + 'aria-valuemax': "100", + 'aria-valuenow': "0", + 'aria-valuetext': "1 minute" + }); + } + }).each(scb.ui.static.WesternBlotGelView.scb_f_wb_exposure_slider); + scb.ui.static.WesternBlotGelView.scb_s_western_blot_gel_paint_all(workarea, gstate, state); + _.each($(".scb_s_experiment_step_button"), function(e) { + if (!$(e).hasClass('scb_s_experiment_step_visited')) { + $(e).attr('title', 'To use this button, start a new ' + $(e).text() + ' Experiment.'); + } else { + $(e).removeAttr('title'); + } + }); + $('.scb_s_western_blot_sortable_item').removeClass('scb_s_western_blot_sortable_item'); + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + + $(window).resize(function() { + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + }); + + + } }; \ No newline at end of file diff --git a/html_app/ui/WesternBlotView.js b/html_app/ui/WesternBlotView.js index ef4e651f..efcdf23c 100644 --- a/html_app/ui/WesternBlotView.js +++ b/html_app/ui/WesternBlotView.js @@ -3,792 +3,803 @@ scb.ui = scb.ui || {}; scb.ui.static = scb.ui.static || {}; scb.ui.static.WesternBlotView = scb.ui.static.WesternBlotView || {}; -scb.ui.static.WesternBlotView.TOTAL_TABS = 4; -scb.ui.static.WesternBlotView.TOTAL_STEPS = 5; -scb.ui.static.WesternBlotView.TOTAL_SCROLL = 5; - -function resetScrollValue(parsed){ - parsed.experiment.last_scroll =0 ; - parsed.experiment.last_scroll=document.body.scrollTop; - return parsed; +scb.ui.static.WesternBlotView.TOTAL_TABS = 4; +scb.ui.static.WesternBlotView.TOTAL_STEPS = 5; +scb.ui.static.WesternBlotView.TOTAL_SCROLL = 5; + +function resetScrollValue(parsed) { + parsed.experiment.last_scroll = 0 ; + parsed.experiment.last_scroll = document.body.scrollTop; + return parsed; } -scb.ui.static.WesternBlotView.parse = function (element) { - var assignment_id = $(element).attr('assignment_id'); - var experiment_id = $(element).attr('experiment_id'); - var western_blot_id = $(element).attr('western_blot_id'); - - var state = { - experiment_id: experiment_id, - assignment_id: assignment_id, - western_blot_id: western_blot_id, - view: 'western_blot', - skip_hash_update: true - }; - var parsed = scb.ui.static.MainFrame.validate_state(state); - parsed.state = state; - return parsed; +scb.ui.static.WesternBlotView.parse = function(element) { + var assignment_id = $(element).attr('assignment_id'); + var experiment_id = $(element).attr('experiment_id'); + var western_blot_id = $(element).attr('western_blot_id'); + + var state = { + experiment_id: experiment_id, + assignment_id: assignment_id, + western_blot_id: western_blot_id, + view: 'western_blot', + skip_hash_update: true + }; + var parsed = scb.ui.static.MainFrame.validate_state(state); + parsed.state = state; + return parsed; } -scb.ui.static.WesternBlotView.scb_f_western_blot_sample_remove = function (element) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } +scb.ui.static.WesternBlotView.scb_f_western_blot_sample_remove = function(element) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } - var lysate_id = $(element).attr('lane_id'); - if (lysate_id != '') { - parsed.western_blot.lanes_list.remove(lysate_id); - } - scb.ui.static.MainFrame.refresh(); + var lysate_id = $(element).attr('lane_id'); + if (lysate_id != '') { + parsed.western_blot.lanes_list.remove(lysate_id); + } + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.WesternBlotView.scb_f_western_blot_remove = function (element) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var id_list = []; - for( var x=0; x < parsed.experiment.western_blot_list.list.length; x++){id_list.push(parsed.experiment.western_blot_list.list[x].id);} - parsed.state.index= id_list.indexOf(parsed.western_blot.id); - - - parsed.experiment.western_blot_list.remove(parsed.western_blot.id); - - - if(parsed.state.index == parsed.experiment.western_blot_list.list.length){ - parsed.state.index = parsed.state.index -1 ; - } - //fix tab indexing for display - if(parsed.state.index > parsed.experiment.western_blot_list.list.length -scb.ui.static.WesternBlotView.TOTAL_TABS) { - - if((parsed.experiment.western_blot_list.list.length == scb.ui.static.WesternBlotView.TOTAL_TABS+1 || parsed.experiment.western_blot_list.list.length == scb.ui.static.WesternBlotView.TOTAL_TABS+2) && parsed.experiment.western_blot_list.start_tabs_index <=1) - parsed.experiment.western_blot_list.start_tabs_index = parsed.experiment.western_blot_list.start_tabs_index+1; - else parsed.experiment.western_blot_list.start_tabs_index = parsed.experiment.western_blot_list.start_tabs_index-1; - } - - - delete parsed.state.skip_hash_update; - scb.ui.static.MainFrame.refresh(parsed.state); +scb.ui.static.WesternBlotView.scb_f_western_blot_remove = function(element) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var id_list = []; + for (var x = 0; x < parsed.experiment.western_blot_list.list.length; x++) { + id_list.push(parsed.experiment.western_blot_list.list[x].id); + } + parsed.state.index = id_list.indexOf(parsed.western_blot.id); -} + parsed.experiment.western_blot_list.remove(parsed.western_blot.id); -scb.ui.static.WesternBlotView.scb_f_western_blot_select_lysate_type = function (element, event) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if($(element).attr('kind')){ - lysate_type=$(element).attr('kind'); - } - else{ - var lysate_type = $(element).attr('value'); - if (lysate_type == '') { - return; - } - } - - var lysate_id = $(element).attr('lane_id'); - if (lysate_id == '') { - var cell_treatment_id = $(element).attr('cell_treatment_id'); - parsed.western_blot.lanes_list.start({ - kind: lysate_type, - cell_treatment_id: cell_treatment_id, - experiment_id: parsed.experiment.id - }); - if (event) { - scb.ui.static.MainFrame.refresh(); - } - } - else { - parsed.western_blot.lanes_list.get(lysate_id).kind = lysate_type; + + if (parsed.state.index == parsed.experiment.western_blot_list.list.length) { + parsed.state.index = parsed.state.index - 1; + } + //fix tab indexing for display + if (parsed.state.index > parsed.experiment.western_blot_list.list.length - scb.ui.static.WesternBlotView.TOTAL_TABS) { + + if ((parsed.experiment.western_blot_list.list.length == scb.ui.static.WesternBlotView.TOTAL_TABS + 1 || parsed.experiment.western_blot_list.list.length == scb.ui.static.WesternBlotView.TOTAL_TABS + 2) && parsed.experiment.western_blot_list.start_tabs_index <= 1) { + parsed.experiment.western_blot_list.start_tabs_index = parsed.experiment.western_blot_list.start_tabs_index + 1; + } else { + parsed.experiment.western_blot_list.start_tabs_index = parsed.experiment.western_blot_list.start_tabs_index - 1; } + } -} + delete parsed.state.skip_hash_update; + scb.ui.static.MainFrame.refresh(parsed.state); -scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active = function (element, event) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); + +} + +scb.ui.static.WesternBlotView.scb_f_western_blot_select_lysate_type = function(element, event) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if ($(element).attr('kind')) { + lysate_type = $(element).attr('kind'); + } else { + var lysate_type = $(element).attr('value'); + if (lysate_type == '') { + return; } - - var val = $(element).attr('checked'); - var cell_treatment_id = $(element).attr('cell_treatment_id'); + } - parsed.western_blot.is_cell_treatment_enabled[cell_treatment_id] = val; - - $('.scb_f_western_blot_select_lysate_type', $(element).parent().parent()).each(function (e) { - scb.ui.static.WesternBlotView.scb_f_western_blot_select_lysate_type(this); + var lysate_id = $(element).attr('lane_id'); + if (lysate_id == '') { + var cell_treatment_id = $(element).attr('cell_treatment_id'); + parsed.western_blot.lanes_list.start({ + kind: lysate_type, + cell_treatment_id: cell_treatment_id, + experiment_id: parsed.experiment.id }); - parsed.western_blot.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); if (event) { - - scb.ui.static.MainFrame.refresh(); - var rows_count = parsed.western_blot.rows_state(); - if (rows_count.valid > (scb.ui.static.WesternBlotView.MAX_ROWS - 1)) { - var element = $('.scb_f_western_blot_sample_active[cell_treatment_id="' + cell_treatment_id + '"]'); - var parent = $(element).parent(); - var note = $("" + rows_count.valid + ""); - note.appendTo(parent); - console.info(parent); - setTimeout(function () { - $(note).detach(); - }, 500); - } + scb.ui.static.MainFrame.refresh(); } + } else { + parsed.western_blot.lanes_list.get(lysate_id).kind = lysate_type; + } + } +scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active = function(element, event) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); -scb.ui.static.WesternBlotView.scb_s_western_blot_selected = function (element) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - if($(element).text().length <=1){ - scb.ui.static.MainFrame.refresh(); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + + var val = $(element).attr('checked'); + var cell_treatment_id = $(element).attr('cell_treatment_id'); + + parsed.western_blot.is_cell_treatment_enabled[cell_treatment_id] = val; + + $('.scb_f_western_blot_select_lysate_type', $(element).parent().parent()).each(function(e) { + scb.ui.static.WesternBlotView.scb_f_western_blot_select_lysate_type(this); + }); + parsed.western_blot.prep_scroll = $('.scb_s_western_blot_samples_table').scrollTop(); + if (event) { + + scb.ui.static.MainFrame.refresh(); + var rows_count = parsed.western_blot.rows_state(); + if (rows_count.valid > (scb.ui.static.WesternBlotView.MAX_ROWS - 1)) { + var element = $('.scb_f_western_blot_sample_active[cell_treatment_id="' + cell_treatment_id + '"]'); + var parent = $(element).parent(); + var note = $("" + rows_count.valid + ""); + note.appendTo(parent); + console.info(parent); + setTimeout(function() { + $(note).detach(); + }, 500); } - else{ + } +} + + + +scb.ui.static.WesternBlotView.scb_s_western_blot_selected = function(element) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + if ($(element).text().length <= 1) { + scb.ui.static.MainFrame.refresh(); + } else { parsed.western_blot.name = $(element).val(); - } + } } -scb.ui.static.WesternBlotView.scb_f_western_blot_prepare_lysates = function (element) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - var rows_state = parsed.western_blot.rows_state(); - if (rows_state.valid > scb.ui.static.WesternBlotView.MAX_ROWS) { - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - $('#jqDialog_box').css('width', '450px'); - $.jqDialog.alert(scb_western_blot.wb_sample_error(), - function() { /* callback function for 'OK' button*/ - $('#jqDialog_box').css('width', ''); - $('html').css('overflow', 'visible'); - $('.error_overlay').remove()}); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - - } else if(rows_state.valid === scb.ui.static.WesternBlotView.MAX_ROWS){ - $('#jqDialog_box').css('width', '450px'); - $.jqDialog.confirm(scb_western_blot.wb_15_samples_error(), - function() { /* callback function for 'YES' button */ - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - parsed.western_blot.lysate_prepared = true; - scb.ui.static.MainFrame.refresh(); - }, - function() { /* callback function for 'NO' button */ - $('.error_overlay').remove(); - $('html').css('overflow', 'visible'); - } - ); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - - } else if (rows_state.valid < 1) { - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - $.jqDialog.alert("Please select at least 1 lysate to prepare.", function() { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); /* callback function for 'OK' button*/ - }); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); - } - else { - parsed.western_blot.lysate_prepared = true; - window.scrollTo(0, 0); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.WesternBlotView.scb_f_western_blot_prepare_lysates = function(element) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + var rows_state = parsed.western_blot.rows_state(); + if (rows_state.valid > scb.ui.static.WesternBlotView.MAX_ROWS) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + $('#jqDialog_box').css('width', '450px'); + $.jqDialog.alert(scb_western_blot.wb_sample_error(), function() { /* callback function for 'OK' button*/ + $('#jqDialog_box').css('width', ''); + $('html').css('overflow', 'visible'); + $('.error_overlay').remove() + }); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + + } else if (rows_state.valid === scb.ui.static.WesternBlotView.MAX_ROWS) { + $('#jqDialog_box').css('width', '450px'); + $.jqDialog.confirm(scb_western_blot.wb_15_samples_error(), function() { /* callback function for 'YES' button */ + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + parsed.western_blot.lysate_prepared = true; + scb.ui.static.MainFrame.refresh(); + }, function() { /* callback function for 'NO' button */ + $('.error_overlay').remove(); + $('html').css('overflow', 'visible'); } -} + ); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); -scb.ui.static.WesternBlotView.scb_s_western_blot_load_marker = function (element) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.western_blot.lanes_list.start({ - id: 'marker', - name: 'Marker', - cell_treatment_id: "marker_treatment", - experiment_id: parsed.experiment.id, - kind: 'marker' + } else if (rows_state.valid < 1) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + $.jqDialog.alert("Please select at least 1 lysate to prepare.", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); /* callback function for 'OK' button*/ }); - parsed.western_blot.marker_loaded = true; + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + } else { + parsed.western_blot.lysate_prepared = true; + window.scrollTo(0, 0); scb.ui.static.MainFrame.refresh(); + } } +scb.ui.static.WesternBlotView.scb_s_western_blot_load_marker = function(element) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.western_blot.lanes_list.start({ + id: 'marker', + name: 'Marker', + cell_treatment_id: "marker_treatment", + experiment_id: parsed.experiment.id, + kind: 'marker' + }); + parsed.western_blot.marker_loaded = true; + scb.ui.static.MainFrame.refresh(); +} -scb.ui.static.WesternBlotView.populate_wells = function (rows, state) { - state.western_blot.wells_loaded = true; - var canvas = $('.scb_s_western_blot_gel', '.scb_s_western_blot_view').get(0); - canvas.width = canvas.clientWidth; - canvas.height = canvas.clientHeight; - - var g = canvas.getContext('2d'); - function getImage(index) { - return $('img', '.scb_wells')[index]; - } +scb.ui.static.WesternBlotView.populate_wells = function(rows, state) { + state.western_blot.wells_loaded = true; + var canvas = $('.scb_s_western_blot_gel', '.scb_s_western_blot_view').get(0); + canvas.width = canvas.clientWidth; + canvas.height = canvas.clientHeight; - g.drawImage(getImage(15), 0, 0); + var g = canvas.getContext('2d'); - var i = 0; - _.each(rows, function (elem, index, array) { - if (elem.is_sample_enabled) { - g.drawImage(getImage(i++), 0, 0); - } - }); - if (state.western_blot.marker_loaded) { - g.drawImage(getImage(i), 0, 0); + function getImage(index) { + return $('img', '.scb_wells')[index]; + } + + g.drawImage(getImage(15), 0, 0); + + var i = 0; + _.each(rows, function(elem, index, array) { + if (elem.is_sample_enabled) { + g.drawImage(getImage(i++), 0, 0); } + }); + if (state.western_blot.marker_loaded) { + g.drawImage(getImage(i), 0, 0); + } } -scb.ui.static.WesternBlotView.draw_wells=function(rows,state){ - var canvas = $('.scb_s_western_blot_gel', '.scb_s_western_blot_view').get(0); - canvas.width = canvas.clientWidth; - canvas.height = canvas.clientHeight; +scb.ui.static.WesternBlotView.draw_wells = function(rows, state) { + var canvas = $('.scb_s_western_blot_gel', '.scb_s_western_blot_view').get(0); + canvas.width = canvas.clientWidth; + canvas.height = canvas.clientHeight; - var g = canvas.getContext('2d'); + var g = canvas.getContext('2d'); - function getImage(index) { - return $('img', '.scb_wells')[index]; - } + function getImage(index) { + return $('img', '.scb_wells')[index]; + } - g.drawImage(getImage(15), 0, 0); + g.drawImage(getImage(15), 0, 0); } -scb.ui.static.WesternBlotView.scb_s_western_blot_choose_gel_type_input = function (element) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.western_blot.gel_type = $(element).val(); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.WesternBlotView.scb_s_western_blot_choose_gel_type_input = function(element) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.western_blot.gel_type = $(element).val(); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.WesternBlotView.scb_s_western_blot_run_gel_and_transfer = function (element) { - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - if (parsed.redisplay) { - alert("INVALID ELEMENT!"); - } - parsed.western_blot.is_transfered = true; - //TODO: before repaint need to do steps in animation... - scb.ui.static.MainFrame.refresh(); +scb.ui.static.WesternBlotView.scb_s_western_blot_run_gel_and_transfer = function(element) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + if (parsed.redisplay) { + alert("INVALID ELEMENT!"); + } + parsed.western_blot.is_transfered = true; + //TODO: before repaint need to do steps in animation... + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active_all = function (element) { - $('.scb_f_western_blot_sample_active').each(function (e) { - var element = this; - $(element).attr('checked', true); - scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active(element); - }); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active_all = function(element) { + $('.scb_f_western_blot_sample_active').each(function(e) { + var element = this; + $(element).attr('checked', true); + scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active(element); + }); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.WesternBlotView.scb_f_western_blot_sample_inactive_all = function (element) { - $('.scb_f_western_blot_sample_active').each(function(e){ - var element = this; - $(element).attr('checked', false); - scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active(element); - }); - scb.ui.static.MainFrame.refresh(); +scb.ui.static.WesternBlotView.scb_f_western_blot_sample_inactive_all = function(element) { + $('.scb_f_western_blot_sample_active').each(function(e) { + var element = this; + $(element).attr('checked', false); + scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active(element); + }); + scb.ui.static.MainFrame.refresh(); } -scb.ui.static.WesternBlotView.scb_s_western_blot_left_western_blot = function(element, event){ - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - parsed.western_blot.parent.start_tabs_index = parsed.western_blot.parent.start_tabs_index -1; - scb.ui.static.MainFrame.refresh(parsed.state); +scb.ui.static.WesternBlotView.scb_s_western_blot_left_western_blot = function(element, event) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + parsed.western_blot.parent.start_tabs_index = parsed.western_blot.parent.start_tabs_index - 1; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.WesternBlotView.scb_s_western_blot_right_western_blot = function(element, event){ - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - parsed.western_blot.parent.start_tabs_index = parsed.western_blot.parent.start_tabs_index +1; - scb.ui.static.MainFrame.refresh(parsed.state); +scb.ui.static.WesternBlotView.scb_s_western_blot_right_western_blot = function(element, event) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + parsed.western_blot.parent.start_tabs_index = parsed.western_blot.parent.start_tabs_index + 1; + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.WesternBlotView.scb_s_western_blot_add_western_blot= function(element, event){ - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - console.log(parsed.western_blot.parent.start_tabs_index); - console.log(parsed.western_blot.parent.list.length); - if(parsed.western_blot.parent.list.length==scb.ui.static.WesternBlotView.TOTAL_TABS){ - parsed.western_blot.parent.start_tabs_index = 1; - } - else if (parsed.western_blot.parent.list.length >scb.ui.static.WesternBlotView.TOTAL_TABS) - parsed.western_blot.parent.start_tabs_index = parsed.western_blot.parent.length-(scb.ui.static.WesternBlotView.TOTAL_TABS-1); - scb.ui.static.MainFrame.refresh(parsed.state); +scb.ui.static.WesternBlotView.scb_s_western_blot_add_western_blot = function(element, event) { + var parsed = scb.ui.static.WesternBlotView.parse(element); + parsed = resetScrollValue(parsed); + console.log(parsed.western_blot.parent.start_tabs_index); + console.log(parsed.western_blot.parent.list.length); + if (parsed.western_blot.parent.list.length == scb.ui.static.WesternBlotView.TOTAL_TABS) { + parsed.western_blot.parent.start_tabs_index = 1; + } else if (parsed.western_blot.parent.list.length > scb.ui.static.WesternBlotView.TOTAL_TABS) { + parsed.western_blot.parent.start_tabs_index = parsed.western_blot.parent.length - (scb.ui.static.WesternBlotView.TOTAL_TABS - 1); + } + scb.ui.static.MainFrame.refresh(parsed.state); } -scb.ui.static.WesternBlotView.scb_s_western_blot_choose_samples_list_item = function (element) { - - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - var new_order = []; - var list = $('.scb_s_western_blot_choose_samples_order_list', '.scb_s_western_blot_view').get(0); - var children =$(list.children); - - for(var v = 0; v < children.length; v ++){ - $(list).append($(children[v])); - if($(children[v]).attr('class').indexOf('ui-sortable-helper') > -1){ - $('.ui-sortable-placeholder').text($(children[v]).text()); - $('.ui-sortable-placeholder').css('visibility', 'visible'); - $('.ui-sortable-placeholder').attr('id', $(children[v]).attr('id')); - $('.ui-sortable-placeholder').attr('class', 'scb_s_western_blot_choose_samples_list_item'); - - } - } - for(var v=0; v -1) { + $('.ui-sortable-placeholder').text($(children[v]).text()); + $('.ui-sortable-placeholder').css('visibility', 'visible'); + $('.ui-sortable-placeholder').attr('id', $(children[v]).attr('id')); + $('.ui-sortable-placeholder').attr('class', 'scb_s_western_blot_choose_samples_list_item'); + + } + } + for (var v = 0; v < children.length; v++) { + if ($(children[v]).attr('class').indexOf('ui-sortable-helper') <= -1) { + new_order[v] = $(children[v]).attr('id'); + } + } + for (var v = 0; v < new_order.length; v++) { + if (new_order[v] == undefined) { + new_order.splice(v, 1); + } + } + console.log(new_order); + parsed.western_blot.lanes_list.reorder(new_order); } -scb.ui.static.WesternBlotView.scb_s_western_blot_sort_up_button = function (element) { - - var parsed = scb.ui.static.WesternBlotView.parse(element); - parsed = resetScrollValue(parsed); - var new_order = []; - var list = $('.scb_s_western_blot_choose_samples_order_list', '.scb_s_western_blot_view').get(0); - var children =$(list.children); - var v=0; - while(v 10) { - $('.scb_s_western_blot_selected').text() - e.preventDefault(); - this.textContent= this.textContent.substring(0, this.textContent.length-1) - return false; - - } - - }); - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_prepare_lysates', function (e) { - scb.ui.static.WesternBlotView.scb_f_western_blot_prepare_lysates(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_load_marker', function (e) { - scb.ui.static.WesternBlotView.scb_s_western_blot_load_marker(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_load_all', function (e) { - var parsed = scb.ui.static.WesternBlotView.parse(this); - var rows_state = parsed.western_blot.rows_state(); - console.log(rows_state.valid); - if (!parsed.western_blot.marker_loaded && - rows_state.valid !== scb.ui.static.WesternBlotView.MAX_ROWS) { - $('html').css('overflow', 'hidden'); - $('body').prepend(scb_experiment_setup.general_error_overlay()); - - - $.jqDialog.confirm("The protein size marker has not been added to your samples. Would you like to continue?", - function () { - $('html').css('overflow', 'visible'); - $('.error_overlay').remove(); - parsed = resetScrollValue(parsed); - scb.ui.static.WesternBlotView.populate_wells(rows_state.rows, parsed); - - scb.ui.static.MainFrame.refresh(); - },// callback function for 'YES' button - function () { - $('.error_overlay').remove(); - $('html').css('overflow', 'visible'); - return; - } // callback function for 'NO' button - ); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); - $('#jqDialog_box').attr('role', 'alertdialog'); +scb.ui.static.WesternBlotView.register = function(workarea) { + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_select_lysate_type', function(e) { + scb.ui.static.WesternBlotView.scb_f_western_blot_select_lysate_type(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_sample_remove', function(e) { + scb.ui.static.WesternBlotView.scb_f_western_blot_sample_remove(this); + }); + scb.utils.off_on(workarea, 'change', '.scb_f_western_blot_sample_active', function(e) { + scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active(this, e); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_remove', function(e) { + scb.ui.static.WesternBlotView.scb_f_western_blot_remove(this); + }); + scb.utils.off_on(workarea, 'blur', '.scb_s_western_blot_selected', function(e) { + $('.scb_s_western_blot_selected').text($('.scb_s_western_blot_selected').attr('value')); + scb.ui.static.WesternBlotView.scb_s_western_blot_selected(this); + }); + scb.utils.off_on(workarea, 'keydown', '.scb_s_western_blot_selected', function(e) { + if ($('.scb_s_western_blot_selected').text().length > 10) { + $('.scb_s_western_blot_selected').text() + e.preventDefault(); + this.textContent = this.textContent.substring(0, this.textContent.length - 1) + return false; + } - } else { - var parsed = scb.ui.static.WesternBlotView.parse(this); - parsed = resetScrollValue(parsed); - scb.ui.static.WesternBlotView.populate_wells(parsed.western_blot.rows_state().rows, parsed); - scb.ui.static.MainFrame.refresh(); - } - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_choose_gel_type_input', function (e, ui) { - scb.ui.static.WesternBlotView.scb_s_western_blot_choose_gel_type_input(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_run_gel_and_transfer', function (e, ui) { - scb.ui.static.WesternBlotView.scb_s_western_blot_run_gel_and_transfer(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_left_western_blot', function (e) { - scb.ui.static.WesternBlotView.scb_s_western_blot_left_western_blot(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_right_western_blot', function (e) { - scb.ui.static.WesternBlotView.scb_s_western_blot_right_western_blot(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_sample_active_all', function (e, ui) { - scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active_all(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_add_western_blot', function (e, ui) { - scb.ui.static.WesternBlotView.scb_s_western_blot_add_western_blot(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_tools_toggle', function (e) { - scb.ui.static.WesternBlotView.scb_f_western_blot_tools_toggle(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_note_close_button', function (e) { - scb.ui.static.WesternBlotView.scb_f_western_blot_note_close_button(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_sample_inactive_all', function (e, ui){ - scb.ui.static.WesternBlotView.scb_f_western_blot_sample_inactive_all(this); - }); - scb.utils.off_on(workarea, 'click', '.scb_f_wb_up_button', function (e, ui){ - var item = $('.markedLi'); - var prev = item.prev(); - if (prev.length == 0) - return; - prev.css('z-index', 999).css('position','relative').animate({ top: item.height() }, 250); - item.css('z-index', 1000).css('position', 'relative').animate({ top: '-' + prev.height() }, 300, function () { - prev.css('z-index', '').css('top', '').css('position', ''); - item.css('z-index', '').css('top', '').css('position', ''); - item.insertBefore(prev); - }); - scb.ui.static.WesternBlotView.scb_s_western_blot_sort_up_button($('.markedLi', '.scb_s_western_blot_view').get(0)); - }); - - scb.utils.off_on(workarea, 'click', '.scb_f_wb_down_button', function (e, ui){ - var item = $('.markedLi'); - var next = item.next(); - if (next.length == 0) - return; - next.css('z-index', 999).css('position', 'relative').animate({ top: '-' + item.height() }, 250); - item.css('z-index', 1000).css('position', 'relative').animate({ top: next.height() }, 300, function () { - next.css('z-index', '').css('top', '').css('position', ''); - item.css('z-index', '').css('top', '').css('position', ''); - item.insertAfter(next); - }); - scb.ui.static.WesternBlotView.scb_s_western_blot_sort_down_button($('.markedLi', '.scb_s_western_blot_view').get(0)); - - - }); - - - scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_gel_tab', function (e, ui) { - var link = $('a', $(this)); - var href = link.attr('href'); - if( href ) - { - document.location = href; - e.preventDefault(); - } - }); - scb.utils.off_on(workarea, 'mouseup', '.scb_s_western_blot_choose_samples_list_item', function(e, ui){ - scb.ui.static.WesternBlotView.scb_s_western_blot_choose_samples_list_item(this); - }); - - scb.utils.off_on(workarea, 'mouseup', document, function(e,ui){ - var container = $(".scb_f_controls_note"); - container.slideUp(); // hide - }); - scb.utils.off_on(workarea, 'click','.scb_f_controls_note', function(e,ui){ - e.stopPropagation(); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_prepare_lysates', function(e) { + scb.ui.static.WesternBlotView.scb_f_western_blot_prepare_lysates(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_load_marker', function(e) { + scb.ui.static.WesternBlotView.scb_s_western_blot_load_marker(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_load_all', function(e) { + var parsed = scb.ui.static.WesternBlotView.parse(this); + var rows_state = parsed.western_blot.rows_state(); + console.log(rows_state.valid); + if (!parsed.western_blot.marker_loaded && + rows_state.valid !== scb.ui.static.WesternBlotView.MAX_ROWS) { + $('html').css('overflow', 'hidden'); + $('body').prepend(scb_experiment_setup.general_error_overlay()); + + + $.jqDialog.confirm("The protein size marker has not been added to your samples. Would you like to continue?", function() { + $('html').css('overflow', 'visible'); + $('.error_overlay').remove(); + parsed = resetScrollValue(parsed); + scb.ui.static.WesternBlotView.populate_wells(rows_state.rows, parsed); + + scb.ui.static.MainFrame.refresh(); + }, // callback function for 'YES' button + function() { + $('.error_overlay').remove(); + $('html').css('overflow', 'visible'); + return; + } // callback function for 'NO' button + ); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend(scb_experiment_setup.experiment_error()); + $('#jqDialog_box').attr('role', 'alertdialog'); + + + } else { + var parsed = scb.ui.static.WesternBlotView.parse(this); + parsed = resetScrollValue(parsed); + scb.ui.static.WesternBlotView.populate_wells(parsed.western_blot.rows_state().rows, parsed); + scb.ui.static.MainFrame.refresh(); + } + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_choose_gel_type_input', function(e, ui) { + scb.ui.static.WesternBlotView.scb_s_western_blot_choose_gel_type_input(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_run_gel_and_transfer', function(e, ui) { + scb.ui.static.WesternBlotView.scb_s_western_blot_run_gel_and_transfer(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_left_western_blot', function(e) { + scb.ui.static.WesternBlotView.scb_s_western_blot_left_western_blot(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_right_western_blot', function(e) { + scb.ui.static.WesternBlotView.scb_s_western_blot_right_western_blot(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_sample_active_all', function(e, ui) { + scb.ui.static.WesternBlotView.scb_f_western_blot_sample_active_all(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_add_western_blot', function(e, ui) { + scb.ui.static.WesternBlotView.scb_s_western_blot_add_western_blot(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_tools_toggle', function(e) { + scb.ui.static.WesternBlotView.scb_f_western_blot_tools_toggle(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_note_close_button', function(e) { + scb.ui.static.WesternBlotView.scb_f_western_blot_note_close_button(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_western_blot_sample_inactive_all', function(e, ui) { + scb.ui.static.WesternBlotView.scb_f_western_blot_sample_inactive_all(this); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_wb_up_button', function(e, ui) { + var item = $('.markedLi'); + var prev = item.prev(); + if (prev.length == 0) { + return; + } + prev.css('z-index', 999).css('position', 'relative').animate({ + top: item.height() + }, 250); + item.css('z-index', 1000).css('position', 'relative').animate({ + top: '-' + prev.height() + }, 300, function() { + prev.css('z-index', '').css('top', '').css('position', ''); + item.css('z-index', '').css('top', '').css('position', ''); + item.insertBefore(prev); }); - scb.utils.off_on(workarea, 'click','.scb_f_info_icon', function(e,ui){ - e.stopPropagation(); - var note = $(this).attr('note'); - note = '.' +note; - if($(note).is(":visible")) - $(note).slideUp(); - else $(note).slideDown(); + scb.ui.static.WesternBlotView.scb_s_western_blot_sort_up_button($('.markedLi', '.scb_s_western_blot_view').get(0)); + }); + + scb.utils.off_on(workarea, 'click', '.scb_f_wb_down_button', function(e, ui) { + var item = $('.markedLi'); + var next = item.next(); + if (next.length == 0) { + return; + } + next.css('z-index', 999).css('position', 'relative').animate({ + top: '-' + item.height() + }, 250); + item.css('z-index', 1000).css('position', 'relative').animate({ + top: next.height() + }, 300, function() { + next.css('z-index', '').css('top', '').css('position', ''); + item.css('z-index', '').css('top', '').css('position', ''); + item.insertAfter(next); }); + scb.ui.static.WesternBlotView.scb_s_western_blot_sort_down_button($('.markedLi', '.scb_s_western_blot_view').get(0)); + + + }); + + + scb.utils.off_on(workarea, 'click', '.scb_s_western_blot_gel_tab', function(e, ui) { + var link = $('a', $(this)); + var href = link.attr('href'); + if (href) { + document.location = href; + e.preventDefault(); + } + }); + scb.utils.off_on(workarea, 'mouseup', '.scb_s_western_blot_choose_samples_list_item', function(e, ui) { + scb.ui.static.WesternBlotView.scb_s_western_blot_choose_samples_list_item(this); + }); + + scb.utils.off_on(workarea, 'mouseup', document, function(e, ui) { + var container = $(".scb_f_controls_note"); + container.slideUp(); // hide + }); + scb.utils.off_on(workarea, 'click', '.scb_f_controls_note', function(e, ui) { + e.stopPropagation(); + }); + scb.utils.off_on(workarea, 'click', '.scb_f_info_icon', function(e, ui) { + e.stopPropagation(); + var note = $(this).attr('note'); + note = '.' + note; + if ($(note).is(":visible")) { + $(note).slideUp(); + } else { + $(note).slideDown(); + } + }); } scb.ui.static.WesternBlotView.MAX_ROWS = 15; scb.ui.WesternBlotView = function scb_ui_WesternBlotView(gstate) { - var self = this; + var self = this; - self.show = function (state) { - var workarea = state.workarea; - var experiment = state.experiment; - var template = state.assignment.template; - var rows_state = state.western_blot.rows_state(); + self.show = function(state) { + var workarea = state.workarea; + var experiment = state.experiment; + var template = state.assignment.template; + var rows_state = state.western_blot.rows_state(); - var kind = 'sample_prep'; - if (state.western_blot.lysate_prepared) { - kind = 'prepare_gel'; - } + var kind = 'sample_prep'; + if (state.western_blot.lysate_prepared) { + kind = 'prepare_gel'; + } - var can_prepare_lysate = rows_state.valid > 0; - - state.experiment.last_technique_view = 'western_blot'; - - - workarea.html(scb_western_blot.main({ - global_template: gstate.context.master_model, - t: template, - assignment: state.assignment, - experiment: state.experiment, - western_blot: state.western_blot, - rows: rows_state.rows, - context: gstate.context, - rows_valid: rows_state.valid, - last_step: state.experiment.last_step, - prev_step: state.experiment.prev_step, - kind: kind, - kinds: template.lysate_kinds, - can_prepare_lysate: can_prepare_lysate - })); - if (kind == 'sample_prep'){ - $('.scb_s_western_blot_samples_table').scrollTop(state.western_blot.prep_scroll); - } - state.experiment.prev_step=4; - if(state.experiment.last_step >= scb.ui.static.WesternBlotView.TOTAL_STEPS) - state.experiment.last_step = scb.ui.static.WesternBlotView.TOTAL_STEPS+1; - state.experiment.last_technique = 'WESTERN BLOT'; - state.experiment.last_id = state.western_blot.id; - state.experiment.last_param = 'western_blot_id'; - - document.body.scrollTop = state.experiment.last_scroll; - if(state.western_blot.parent.start_tabs_index <= 0){ - state.western_blot.parent.start_tabs_index = 0; - $('.scb_s_western_blot_left_western_blot').prop('disabled', true); - $('.scb_s_western_blot_right_western_blot').prop('disabled', false); - } - else $('.scb_s_western_blot_left_western_blot').prop('disabled', false); - - if(state.western_blot.parent.start_tabs_index + scb.ui.static.WesternBlotView.TOTAL_TABS -1 ==state.western_blot.parent.list.length-1){ - $('.scb_s_western_blot_right_western_blot').prop('disabled', true); - $('.scb_s_western_blot_left_western_blot').prop('disabled', false); - } - else $('.scb_s_western_blot_right_western_blot').prop('disabled', false); - - - document.title = "Western Blot - StarCellBio"; - - - if(kind != 'sample_prep') { - $('.scb_s_western_blot_video_box_wrapper').remove(); - } - else { - if (_.keys(template.lysate_kinds).length == 1) { - $('button.scb_f_western_blot_sample_remove').hide(); - //strange bug where clicks not reflected in place, hitting cancel button corrects this problem. - } - } - if (kind == 'prepare_gel') { - if(state.western_blot.wells_loaded) { - scb.ui.static.WesternBlotView.populate_wells(rows_state.rows, state); - } else { - scb.ui.static.WesternBlotView.draw_wells(rows_state.rows, state); - } - if(rows_state.valid === scb.ui.static.WesternBlotView.MAX_ROWS){ - $(".scb_s_western_blot_add_marker_wrapper").css('opacity','.25').children().prop('disabled', true); - } + var can_prepare_lysate = rows_state.valid > 0; + + state.experiment.last_technique_view = 'western_blot'; + + + workarea.html(scb_western_blot.main({ + global_template: gstate.context.master_model, + t: template, + assignment: state.assignment, + experiment: state.experiment, + western_blot: state.western_blot, + rows: rows_state.rows, + context: gstate.context, + rows_valid: rows_state.valid, + last_step: state.experiment.last_step, + prev_step: state.experiment.prev_step, + kind: kind, + kinds: template.lysate_kinds, + can_prepare_lysate: can_prepare_lysate + })); + if (kind == 'sample_prep') { + $('.scb_s_western_blot_samples_table').scrollTop(state.western_blot.prep_scroll); + } + state.experiment.prev_step = 4; + if (state.experiment.last_step >= scb.ui.static.WesternBlotView.TOTAL_STEPS) { + state.experiment.last_step = scb.ui.static.WesternBlotView.TOTAL_STEPS + 1; + } + state.experiment.last_technique = 'WESTERN BLOT'; + state.experiment.last_id = state.western_blot.id; + state.experiment.last_param = 'western_blot_id'; + + document.body.scrollTop = state.experiment.last_scroll; + if (state.western_blot.parent.start_tabs_index <= 0) { + state.western_blot.parent.start_tabs_index = 0; + $('.scb_s_western_blot_left_western_blot').prop('disabled', true); + $('.scb_s_western_blot_right_western_blot').prop('disabled', false); + } else { + $('.scb_s_western_blot_left_western_blot').prop('disabled', false); + } - } + if (state.western_blot.parent.start_tabs_index + scb.ui.static.WesternBlotView.TOTAL_TABS - 1 == state.western_blot.parent.list.length - 1) { + $('.scb_s_western_blot_right_western_blot').prop('disabled', true); + $('.scb_s_western_blot_left_western_blot').prop('disabled', false); + } else { + $('.scb_s_western_blot_right_western_blot').prop('disabled', false); + } - if (state.western_blot.gel_type == null) { - $('.scb_s_western_blot_samples_area').children().not('.scb_s_western_blot_choose_gel_type').not('.scb_s_western_blot_gel_type_info').not('.scb_f_wb_gel_type_followup').css('opacity', '.25'); - $('.scb_s_western_blot_samples_area button').not('.scb_s_western_blot_gel_type_info').prop('disabled', true); - $('.scb_s_western_blot_samples_area button').not('.scb_s_western_blot_gel_type_info').css('cursor', 'default'); - $('.scb_s_western_blot_samples_gel_area').css('opacity', '.25'); - $('canvas', $('.scb_s_western_blot_samples_gel_area')).hide(); - } - state.western_blot.parent.selected_id = state.western_blot.id; - - state.experiment.last_view = 'western_blot'; - if(!state.western_blot.wells_loaded){ - $('ol.scb_s_western_blot_choose_samples_order_list').sortable(); - } - else{ - $('.scb_s_western_blot_choose_samples_list_item').removeClass('scb_s_western_blot_sortable_item'); - $('.scb_s_western_blot_choose_samples_list_item').removeClass('scb_s_movable_item'); - } - - _.each($(".scb_s_experiment_step_button"), function (e) { - if(!$(e).hasClass('scb_s_experiment_step_visited')) - $(e).attr('title', 'To use this button, start a new '+$(e).text()+' Experiment.'); - else $(e).removeAttr('title'); - }); - var stopVideo = function (player) { - var vidSrc = player.prop('src'); - player.prop('src', ''); // to force it to pause - player.prop('src', vidSrc); - }; - - - $(".scb_s_western_blot_selected").keypress(function (e) { - return e.which != 13; - }); - var elem = document.getElementById('slider'); - window.mySwipe = Swipe(elem, { - continuous: false, - disableScroll: true, - transitionEnd: function (index, element) { - var current_video = $($(element).find('iframe')[0]).attr('id'); - _.each($(element).parent().children(), function (video) { - if ($($(video).find('iframe')[0]).attr('id') !== current_video) { - stopVideo($($(video).find('iframe')[0])); - } - - }); - $('.slider_dots li').attr('class', ''); - $($('.slider_dots li')[index]).attr('class', 'on'); - } + document.title = "Western Blot - StarCellBio"; + + + if (kind != 'sample_prep') { + $('.scb_s_western_blot_video_box_wrapper').remove(); + } else { + if (_.keys(template.lysate_kinds).length == 1) { + $('button.scb_f_western_blot_sample_remove').hide(); + //strange bug where clicks not reflected in place, hitting cancel button corrects this problem. + } + } + if (kind == 'prepare_gel') { + if (state.western_blot.wells_loaded) { + scb.ui.static.WesternBlotView.populate_wells(rows_state.rows, state); + } else { + scb.ui.static.WesternBlotView.draw_wells(rows_state.rows, state); + } + if (rows_state.valid === scb.ui.static.WesternBlotView.MAX_ROWS) { + $(".scb_s_western_blot_add_marker_wrapper").css('opacity', '.25').children().prop('disabled', true); + } + + } + + if (state.western_blot.gel_type == null) { + $('.scb_s_western_blot_samples_area').children().not('.scb_s_western_blot_choose_gel_type').not('.scb_s_western_blot_gel_type_info').not('.scb_f_wb_gel_type_followup').css('opacity', '.25'); + $('.scb_s_western_blot_samples_area button').not('.scb_s_western_blot_gel_type_info').prop('disabled', true); + $('.scb_s_western_blot_samples_area button').not('.scb_s_western_blot_gel_type_info').css('cursor', 'default'); + $('.scb_s_western_blot_samples_gel_area').css('opacity', '.25'); + $('canvas', $('.scb_s_western_blot_samples_gel_area')).hide(); + } + + state.western_blot.parent.selected_id = state.western_blot.id; + + state.experiment.last_view = 'western_blot'; + if (!state.western_blot.wells_loaded) { + $('ol.scb_s_western_blot_choose_samples_order_list').sortable(); + } else { + $('.scb_s_western_blot_choose_samples_list_item').removeClass('scb_s_western_blot_sortable_item'); + $('.scb_s_western_blot_choose_samples_list_item').removeClass('scb_s_movable_item'); + } + + _.each($(".scb_s_experiment_step_button"), function(e) { + if (!$(e).hasClass('scb_s_experiment_step_visited')) { + $(e).attr('title', 'To use this button, start a new ' + $(e).text() + ' Experiment.'); + } else { + $(e).removeAttr('title'); + } + }); + var stopVideo = function(player) { + var vidSrc = player.prop('src'); + player.prop('src', ''); // to force it to pause + player.prop('src', vidSrc); + }; + + + $(".scb_s_western_blot_selected").keypress(function(e) { + return e.which != 13; + }); + var elem = document.getElementById('slider'); + window.mySwipe = Swipe(elem, { + continuous: false, + disableScroll: true, + transitionEnd: function(index, element) { + var current_video = $($(element).find('iframe')[0]).attr('id'); + _.each($(element).parent().children(), function(video) { + if ($($(video).find('iframe')[0]).attr('id') !== current_video) { + stopVideo($($(video).find('iframe')[0])); + } + }); - /* Click on the slider dots - $('#nav li').on('click', function () { - $('.slider_dots li').attr('class',''); - $($('.slider_dots li')[$(this).index()]).attr('class','on'); - window.mySwipe.slide($(this).index(), 200); - }); - */ - $('.slider_dots li').css('cursor', 'default'); - - - if(!state.western_blot.wells_loaded){ - $('body').mousedown(function(e){ - if($(e.target).parents('.scb_s_western_blot_samples_area').length ==1){ - if($(e.target).hasClass('scb_s_western_blot_sortable_item')){ - $('.markedLi').removeClass('markedLi'); - $(e.target).addClass('markedLi'); - } - } - else - $('.markedLi').removeClass('markedLi'); - }); - } - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: 0 - }); - $(window).resize(function(){ - - $('#main').css({ - position:'absolute', - left: ($(window).width() - $('#main').outerWidth())/2, - top: ($(window).height() - $('#main').outerHeight())/2 - }); - - }); - - + $('.slider_dots li').attr('class', ''); + $($('.slider_dots li')[index]).attr('class', 'on'); + } + }); + /* Click on the slider dots + $('#nav li').on('click', function () { + $('.slider_dots li').attr('class',''); + $($('.slider_dots li')[$(this).index()]).attr('class','on'); + window.mySwipe.slide($(this).index(), 200); + }); + */ + $('.slider_dots li').css('cursor', 'default'); + + + if (!state.western_blot.wells_loaded) { + $('body').mousedown(function(e) { + if ($(e.target).parents('.scb_s_western_blot_samples_area').length == 1) { + if ($(e.target).hasClass('scb_s_western_blot_sortable_item')) { + $('.markedLi').removeClass('markedLi'); + $(e.target).addClass('markedLi'); + } + } else { + $('.markedLi').removeClass('markedLi'); + } + }); } + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: 0 + }); + $(window).resize(function() { + + $('#main').css({ + position: 'absolute', + left: ($(window).width() - $('#main').outerWidth()) / 2, + top: ($(window).height() - $('#main').outerHeight()) / 2 + }); + + }); + + + } } \ No newline at end of file diff --git a/html_app/utils/CSFRFix.js b/html_app/utils/CSFRFix.js index cedd83b2..1040dce3 100644 --- a/html_app/utils/CSFRFix.js +++ b/html_app/utils/CSFRFix.js @@ -1,72 +1,72 @@ -$(document).ajaxSend(function (event, xhr, settings) { - function getCookie(name) { - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } +$(document).ajaxSend(function(event, xhr, settings) { + function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; } - return cookieValue; + } } + return cookieValue; + } - function sameOrigin(url) { - // url could be relative or scheme relative or absolute - var host = document.location.host; // host + port - var protocol = document.location.protocol; - var sr_origin = '//' + host; - var origin = protocol + sr_origin; - // Allow absolute or scheme relative URLs to same origin - return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || - (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || - // or any other URL that isn't scheme relative or absolute i.e relative. - !(/^(\/\/|http:|https:).*/.test(url)); - } + function sameOrigin(url) { + // url could be relative or scheme relative or absolute + var host = document.location.host; // host + port + var protocol = document.location.protocol; + var sr_origin = '//' + host; + var origin = protocol + sr_origin; + // Allow absolute or scheme relative URLs to same origin + return (url == origin || url.slice(0, origin.length + 1) == origin + '/') || + (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') || + // or any other URL that isn't scheme relative or absolute i.e relative. + !(/^(\/\/|http:|https:).*/.test(url)); + } - function safeMethod(method) { - return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); - } + function safeMethod(method) { + return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); + } - if (!safeMethod(settings.type) && sameOrigin(settings.url)) { - xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); - } + if (!safeMethod(settings.type) && sameOrigin(settings.url)) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + } }); -if (typeof (scb.Utils ) == 'undefined') { - scb.Utils = {}; - scb.utils = scb.Utils; +if (typeof (scb.Utils) == 'undefined') { + scb.Utils = {}; + scb.utils = scb.Utils; } scb.utils.server = scb.utils.server || {}; -scb.utils.getCsfrToken = function () { - var name = 'csrftoken'; - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } +scb.utils.getCsfrToken = function() { + var name = 'csrftoken'; + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } } - return cookieValue; + } + return cookieValue; } -scb.utils.server.is_auth = function (callback) { -scb.utils.call_back(callback, { - success: true, - data: {} - }); - return; +scb.utils.server.is_auth = function(callback) { + scb.utils.call_back(callback, { + success: true, + data: {} + }); + return; /* $.ajax({url: '/scb/is_auth/', data: '', type: 'GET', success: function (a, b, c) { if (b == "success") { @@ -87,12 +87,12 @@ scb.utils.call_back(callback, { */ } -scb.utils.server.call = function (data, callback) { - scb.utils.call_back(callback, { - success: true, - data: {} - }); - return; +scb.utils.server.call = function(data, callback) { + scb.utils.call_back(callback, { + success: true, + data: {} + }); + return; /* $.ajax({url: '/scb/is_auth/', type: data ? 'POST' : 'GET', data: data, diff --git a/html_app/utils/Utilities.js b/html_app/utils/Utilities.js index 6edaa3f5..39a1d5af 100644 --- a/html_app/utils/Utilities.js +++ b/html_app/utils/Utilities.js @@ -1,23 +1,22 @@ //'use strict'; -if (typeof (scb.Utils ) == 'undefined') { - scb.Utils = {}; - scb.utils = scb.Utils; +if (typeof (scb.Utils) == 'undefined') { + scb.Utils = {}; + scb.utils = scb.Utils; } -scb.utils.generateUUID = function (name) { - var prefix; - if (typeof (name ) == 'undefined') { - prefix = 'scb_'; - } else { - prefix = name; - } - var token = Math.floor(Math.random() * 1000000000).toString(27) + Math.floor(Math.random() * 1000000000).toString(27); - //+ Math.floor(Math.random() * 1000000000).toString(27); - return prefix + token; +scb.utils.generateUUID = function(name) { + var prefix; + if (typeof (name ) == 'undefined') { + prefix = 'scb_'; + } else { + prefix = name; + } + var token = Math.floor(Math.random() * 1000000000).toString(27) + Math.floor(Math.random() * 1000000000).toString(27); + //+ Math.floor(Math.random() * 1000000000).toString(27); + return prefix + token; } -scb.utils.noop = function () { -}; +scb.utils.noop = function() {}; /** * Special serializer * It will assume that stuff is: @@ -27,401 +26,418 @@ scb.utils.noop = function () { * -- it will be able to recreate things with calling constructor * */ -scb.utils.print = function (data) { - if (typeof (data) == 'object') { - var name = data.__proto__.constructor.name; - if (data.hasOwnProperty('data')) { - var dump = {}; - for (var x in data.data) { - dump[x] = scb_Utils.print(data.data[x]); - } - var ret = {}; - ret[name] = dump; - return ret; - } else if (name == 'Array') { - var dump = []; - for (var x in data) { - dump.push(scb_Utils.print(data[x])); - } - var ret = {}; - ret['Array'] = dump; - return ret; - } - } else if (typeof (data) == 'string') { - return data; - } else { - return data.toString(); +scb.utils.print = function(data) { + if (typeof (data) == 'object') { + var name = data.__proto__.constructor.name; + if (data.hasOwnProperty('data')) { + var dump = {}; + for (var x in data.data) { + dump[x] = scb_Utils.print(data.data[x]); + } + var ret = {}; + ret[name] = dump; + return ret; + } else if (name == 'Array') { + var dump = []; + for (var x in data) { + dump.push(scb_Utils.print(data[x])); + } + var ret = {}; + ret['Array'] = dump; + return ret; } -} - -scb.utils.initialize_accessor_field = function (self, data, name, default_value, proto, context) { - scb.utils.initialize_field(data, name, default_value); - if (proto == null) { - scb.Utils.accessor2(self, name, data); + } else if (typeof (data) == 'string') { + return data; + } else { + return data.toString(); + } +} + +scb.utils.initialize_accessor_field = function(self, data, name, default_value, proto, context) { + scb.utils.initialize_field(data, name, default_value); + if (proto == null) { + scb.Utils.accessor2(self, name, data); + } else { + self[name] = new proto(data[name], context, self); + } +} + +scb.utils.initialize_field = function(obj, name, default_value) { + if (typeof (obj) != 'undefined') { + if (!obj.hasOwnProperty(name)) { + obj[name] = default_value; } - else { - self[name] = new proto(data[name], context, self); + if (typeof (obj[name]) == 'undefined') { + obj[name] = default_value; } -} - -scb.utils.initialize_field = function (obj, name, default_value) { - if (typeof (obj) != 'undefined') { - if (!obj.hasOwnProperty(name)) { - obj[name] = default_value; - } - if (typeof (obj[name] ) == 'undefined') { - obj[name] = default_value; - } - } else { - console.info("OBJ is null!"); + } else { + console.info("OBJ is null!"); + } +} + +scb.utils.accessor = function(obj, name, new_value) { + var ret = obj[name]; + if (typeof (new_value) != 'undefined') { + obj[name] = new_value; + } + return ret; +} + +scb.utils.accessor_toString = function(fn) { + fn.toString = function() { + return fn(); + } +} + +scb.utils.parse_time = function(str, unit) { + var time = 0; + var input = "" + str; + input = input.trim(); + if (input.match('[nN][oO][wW]')) { + return 0; + } + var daysRegex = new RegExp("([0-9\.]+) *d"); + if (true) { + var match = input.match(hourRegex); + if (match != null && match.length > 1) { + time += parseFloat(match[1]) * 24 * 3600; } -} - -scb.utils.accessor = function (obj, name, new_value) { - var ret = obj[name]; - if (typeof (new_value) != 'undefined') { - obj[name] = new_value; + } + var hourRegex = new RegExp("([0-9\.]+) *h"); + if (true) { + var match = input.match(hourRegex); + if (match != null && match.length > 1) { + time += parseFloat(match[1]) * 3600; } - return ret; -} - -scb.utils.accessor_toString = function (fn) { - fn.toString = function () { - return fn(); - } -} - -scb.utils.parse_time = function (str, unit) { - var time = 0; - var input = "" + str; - input = input.trim(); - if (input.match('[nN][oO][wW]')) { - return 0; - } - var daysRegex = new RegExp("([0-9\.]+) *d"); - if (true) { - var match = input.match(hourRegex); - if (match != null && match.length > 1) { - time += parseFloat(match[1]) * 24 * 3600; - } - } - var hourRegex = new RegExp("([0-9\.]+) *h"); - if (true) { - var match = input.match(hourRegex); - if (match != null && match.length > 1) { - time += parseFloat(match[1]) * 3600; - } + } + var minuteRegex = new RegExp("([0-9\.]+) *m"); + if (true) { + var match = input.match(minuteRegex); + if (match != null && match.length > 1) { + time += parseFloat(match[1]) * 60; } - var minuteRegex = new RegExp("([0-9\.]+) *m"); - if (true) { - var match = input.match(minuteRegex); - if (match != null && match.length > 1) { - time += parseFloat(match[1]) * 60; - } + } + var secondRegex = new RegExp("([0-9\.]+) *s"); + if (true) { + var match = input.match(secondRegex); + if (match != null && match.length > 1) { + time += parseFloat(match[1]) * 1; } - var secondRegex = new RegExp("([0-9\.]+) *s"); - if (true) { - var match = input.match(secondRegex); - if (match != null && match.length > 1) { - time += parseFloat(match[1]) * 1; - } - } - var hourSecondRegex = new RegExp("([0-9]+):([0-9]+)") - if (true) { - var match = input.match(hourSecondRegex); - if (match != null && match.length > 1) { - time += parseFloat(match[1]) * 3600 + parseFloat(match[2]) * 60; - } + } + var hourSecondRegex = new RegExp("([0-9]+):([0-9]+)") + if (true) { + var match = input.match(hourSecondRegex); + if (match != null && match.length > 1) { + time += parseFloat(match[1]) * 3600 + parseFloat(match[2]) * 60; } + } - if (time == 0) { - var funit = 60; - if (unit == 'hours') { - funit = 3600; - } - if (unit == 'seconds') { - funit = 1; - } - time = parseFloat(input) * funit; + if (time == 0) { + var funit = 60; + if (unit == 'hours') { + funit = 3600; } - return time; -} - -scb.utils.print_time = function (value) { - var time = parseFloat(value); - //var days = Math.floor(time / 86400); - var days = Math.floor((time % 604800) / 86400); - - var hours = Math.floor((time % 86400) / 3600); - var minutes = Math.floor((time % 3600) / 60); - var seconds = Math.floor(time % 60); - var months = Math.floor(time /2592000); - - var weeks = Math.floor((time % 2592000) / 604800); - var now = (time < 60 ); - return scb_common.format_time_detailed({ - weeks: weeks, - days:days, - hours:hours, - minutes:minutes, - months: months, - seconds:seconds, - now:now - }).trim(); -} - -scb.utils.print_time_w_seconds = function (value) { - var time = parseFloat(value); - var days = Math.floor(time / 86400); - //var days = Math.floor((time % 604800) / 86400); - - var hours = Math.floor((time % 86400) / 3600); - var minutes = Math.floor((time % 3600) / 60); - var seconds = Math.floor(time % 60); - - var months = Math.floor(time /2592000); - - var weeks = Math.floor((time % 2592000) / 604800); - - var now = (time < 1 ); - return scb_common.format_time_detailed_w_sec({ - days:days, - hours:hours, - minutes:minutes, - months: months, - seconds:seconds, - now:now - }).trim(); -} - - -scb.utils.keys = function (map) { - return _.map(map, function (v, k, l) { - return k; - }); -} - -scb.utils.get_attribute = function (object, attribute) { - var ret = $(object).attr(attribute) - if (typeof (ret) == 'undefined') { - var undefined; - $(object).parent().each(function (i, e) { - ret = typeof (ret) == 'undefined' ? scb.Utils.get_attribute(e, attribute) : undefined - }); - return ret; - } else { - return ret; + if (unit == 'seconds') { + funit = 1; } + time = parseFloat(input) * funit; + } + return time; +} + +scb.utils.print_time = function(value) { + var time = parseFloat(value); + //var days = Math.floor(time / 86400); + var days = Math.floor((time % 604800) / 86400); + + var hours = Math.floor((time % 86400) / 3600); + var minutes = Math.floor((time % 3600) / 60); + var seconds = Math.floor(time % 60); + var months = Math.floor(time / 2592000); + + var weeks = Math.floor((time % 2592000) / 604800); + var now = (time < 60); + return scb_common.format_time_detailed({ + weeks: weeks, + days: days, + hours: hours, + minutes: minutes, + months: months, + seconds: seconds, + now: now + }).trim(); +} + +scb.utils.print_time_w_seconds = function(value) { + var time = parseFloat(value); + var days = Math.floor(time / 86400); + //var days = Math.floor((time % 604800) / 86400); + + var hours = Math.floor((time % 86400) / 3600); + var minutes = Math.floor((time % 3600) / 60); + var seconds = Math.floor(time % 60); + + var months = Math.floor(time / 2592000); + + var weeks = Math.floor((time % 2592000) / 604800); + + var now = (time < 1); + return scb_common.format_time_detailed_w_sec({ + days: days, + hours: hours, + minutes: minutes, + months: months, + seconds: seconds, + now: now + }).trim(); +} + + +scb.utils.keys = function(map) { + return _.map(map, function(v, k, l) { + return k; + }); +} + +scb.utils.get_attribute = function(object, attribute) { + var ret = $(object).attr(attribute) + if (typeof (ret) == 'undefined') { + var undefined; + $(object).parent().each(function(i, e) { + ret = typeof (ret) == 'undefined' ? scb.Utils.get_attribute(e, attribute) : undefined + }); + return ret; + } else { + return ret; + } } -scb.utils.clone_and_clear = function (obj) { - var ret = JSON.parse(JSON.stringify(obj)); - delete ret.id; - return ret; +scb.utils.clone_and_clear = function(obj) { + var ret = JSON.parse(JSON.stringify(obj)); + delete ret.id; + return ret; } -scb.utils.position_div_over = function (t, div) { - var offset = $(t).position(); - var top = offset.top + 3; - var left = offset.left + 3; - var width = parseFloat($(t).width()) + 6; - var height = parseFloat($(t).height()) + 6; - var top_offset = div.parent().position().top; - div.css('position', 'absolute').css('top', (top - top_offset) + 'px').css('left', left + 'px').css('width', width + 'px').css('min-height', height + 'px').show().unbind('click'); +scb.utils.position_div_over = function(t, div) { + var offset = $(t).position(); + var top = offset.top + 3; + var left = offset.left + 3; + var width = parseFloat($(t).width()) + 6; + var height = parseFloat($(t).height()) + 6; + var top_offset = div.parent().position().top; + div.css('position', 'absolute').css('top', (top - top_offset) + 'px').css('left', left + 'px').css('width', width + 'px').css('min-height', height + 'px').show().unbind('click'); } -scb.utils.isUndefined = function (a) { - return typeof (a) == 'undefined' || a == null; +scb.utils.isUndefined = function(a) { + return typeof (a) == 'undefined' || a == null; } -scb.utils.isDefined = function (a) { - return typeof (a) != 'undefined'; +scb.utils.isDefined = function(a) { + return typeof (a) != 'undefined'; } -scb.utils.accessor2 = function (obj, field, source) { - Object.defineProperty(obj, field, { get:function () { - return source[field]; - }, set:function (d) { - source[field] = d; - },enumerable:true}); +scb.utils.accessor2 = function(obj, field, source) { + Object.defineProperty(obj, field, { + get: function() { + return source[field]; + }, + set: function(d) { + source[field] = d; + }, + enumerable: true + }); } -scb.utils.value_hidden = function (obj, field, value) { - Object.defineProperty(obj, field, { get:function () { - return value; - }, set:function (d) { - value = d; - },enumerable:false}); +scb.utils.value_hidden = function(obj, field, value) { + Object.defineProperty(obj, field, { + get: function() { + return value; + }, + set: function(d) { + value = d; + }, + enumerable: false + }); } -scb.utils.accessor2_with_setter = function (obj, field, source, setter) { - Object.defineProperty(obj, field, { get:function () { - return source[field]; - }, set:function (d) { - source[field] = d; - setter(d); - }}); +scb.utils.accessor2_with_setter = function(obj, field, source, setter) { + Object.defineProperty(obj, field, { + get: function() { + return source[field]; + }, + set: function(d) { + source[field] = d; + setter(d); + } + }); } //JSON getter -scb.utils.accessor2_getter_only = function (obj, field, source) { - Object.defineProperty(obj, field, { get:function () { - return source[field]; - }, set:function (d) { - throw "READ ONLY FIELD"; - }}); +scb.utils.accessor2_getter_only = function(obj, field, source) { + Object.defineProperty(obj, field, { + get: function() { + return source[field]; + }, + set: function(d) { + throw "READ ONLY FIELD"; + } + }); } -scb.utils.accessor2_custom = function (obj, field, getter, setter) { - Object.defineProperty(obj, field, { get:function () { - return getter(); - }, set:function (d) { - return setter(d); - }}); +scb.utils.accessor2_custom = function(obj, field, getter, setter) { + Object.defineProperty(obj, field, { + get: function() { + return getter(); + }, + set: function(d) { + return setter(d); + } + }); } -scb.utils.read_only_exception = function () { - throw "READ ONLY FIELD"; +scb.utils.read_only_exception = function() { + throw "READ ONLY FIELD"; } -scb.utils.tools_hover = function (target, top) { - scb.utils.off_on($(top), 'mouseenter', target, function () { - $(this).addClass('highlight_editable_element'); - $('.experiment_row_treatment_tools', $(this)).show(); - $('.experiment_row_treatment_tools_spacer', $(this)).hide(); - }); - scb.utils.off_on($(top), 'mouseleave', target, function () { - $(this).removeClass('highlight_editable_element'); - $('.experiment_row_treatment_tools', $(this)).hide(); - $('.experiment_row_treatment_tools_spacer', $(this)).show(); - }); +scb.utils.tools_hover = function(target, top) { + scb.utils.off_on($(top), 'mouseenter', target, function() { + $(this).addClass('highlight_editable_element'); + $('.experiment_row_treatment_tools', $(this)).show(); + $('.experiment_row_treatment_tools_spacer', $(this)).hide(); + }); + scb.utils.off_on($(top), 'mouseleave', target, function() { + $(this).removeClass('highlight_editable_element'); + $('.experiment_row_treatment_tools', $(this)).hide(); + $('.experiment_row_treatment_tools_spacer', $(this)).show(); + }); } -scb.utils.tools_hover_off = function (target, top) { - $(top).off('mouseenter', target); - $(top).off('mouseleave', target); +scb.utils.tools_hover_off = function(target, top) { + $(top).off('mouseenter', target); + $(top).off('mouseleave', target); } -scb.utils.find = function (list, id) { - return _.find(list, function (s) { - return s.id == id - }); +scb.utils.find = function(list, id) { + return _.find(list, function(s) { + return s.id == id + }); } -scb.utils.reject = function (list, id) { - return _.reject(list, function (s) { - return s.id == id - }); +scb.utils.reject = function(list, id) { + return _.reject(list, function(s) { + return s.id == id + }); } -scb.utils.wrap_list = function (obj, field, source, proto, context) { - Object.defineProperty(obj, field, { - get:function () { - var ret = []; - var list = source[field]; - for (var i in list) { - var d = list[i]; - if (obj.sort_order == 'reverse') { - ret.unshift(new proto(d, context, obj)); - } else { - ret.push(new proto(d, context, obj)); - } - } - return ret; - }, set:function (d) { - throw 'READ ONLY FIELD'; - }}); - Object.defineProperty(obj, field + "_size", { - get:function () { - return source[field].length; - }, set:function (d) { - throw 'READ ONLY FIELD'; - }}); -} - -scb.utils.call_back = function (callback, state) { - if (typeof (callback ) == 'function') { - callback(state); +scb.utils.wrap_list = function(obj, field, source, proto, context) { + Object.defineProperty(obj, field, { + get: function() { + var ret = []; + var list = source[field]; + for (var i in list) { + var d = list[i]; + if (obj.sort_order == 'reverse') { + ret.unshift(new proto(d, context, obj)); + } else { + ret.push(new proto(d, context, obj)); + } + } + return ret; + }, + set: function(d) { + throw 'READ ONLY FIELD'; + } + }); + Object.defineProperty(obj, field + "_size", { + get: function() { + return source[field].length; + }, + set: function(d) { + throw 'READ ONLY FIELD'; } + }); } -scb.utils.off_on = function (jq, event, selector, fn) { - $(jq).off(event, selector); - $(jq).on(event, selector, fn); +scb.utils.call_back = function(callback, state) { + if (typeof (callback ) == 'function') { + callback(state); + } } -scb.utils.any_key = function (map) { - return Object.keys(map)[0]; +scb.utils.off_on = function(jq, event, selector, fn) { + $(jq).off(event, selector); + $(jq).on(event, selector, fn); } -scb.utils.get = function (root, accessors, _default) { - if (accessors.length == 0) { - return root; - } - var x = accessors.shift(); - if (root.hasOwnProperty(x)) { - return scb.utils.get(root[x], accessors, _default); - } - return _default; +scb.utils.any_key = function(map) { + return Object.keys(map)[0]; +} + +scb.utils.get = function(root, accessors, _default) { + if (accessors.length == 0) { + return root; + } + var x = accessors.shift(); + if (root.hasOwnProperty(x)) { + return scb.utils.get(root[x], accessors, _default); + } + return _default; } /// WORKS WITH ASCII ONLY - NEED TO FIX FOR HIGH CHARS scb.utils.lzw_encode = function(s) { - var d = new Date(); - - var dict = {}; - var data = (s + "").split(""); - var out = []; - var currChar; - var phrase = data[0]; - var code = 256; - for (var i=1; i 1 ? dict[phrase] : phrase.charCodeAt(0)); - dict[phrase + currChar] = code; - code++; - phrase=currChar; - } - } - out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0)); - for (var i=0; i 1 ? dict[phrase] : phrase.charCodeAt(0)); + dict[phrase + currChar] = code; + code++; + phrase = currChar; } + } + out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0)); + for (var i = 0; i < out.length; i++) { + out[i] = String.fromCharCode(out[i]); + } - var retrunedresult = out.join(""); - console.log("Input: " + s.length/1024 + "kb Output:"+ retrunedresult.length/1024 + "kb Rate: " +(s.length/retrunedresult.length) ); - console.log((new Date()).getTime() - d.getTime() + ' ms.'); - return retrunedresult; + var retrunedresult = out.join(""); + console.log("Input: " + s.length / 1024 + "kb Output:" + retrunedresult.length / 1024 + "kb Rate: " + (s.length / retrunedresult.length)); + console.log((new Date()).getTime() - d.getTime() + ' ms.'); + return retrunedresult; } scb.utils.lzw_decode = function(s) { -var dict = {}; -var data = (s + "").split(""); -var currChar = data[0]; -var oldPhrase = currChar; -var out = [currChar]; -var code = 256; -var phrase; -for (var i=1; i"); - $('.scb_s_dashboard_table_row').hover(function(){ - $('.scb_s_dashboard_link', this).toggle(); - }); - /** - * Course setup - */ - $('.scb_f_course_setup_create_new_course_option input').click(function(){ - $(".scb_ab_f_course_formset_list").show(); - $('.scb_f_course_setup_choose_existing_course input').prop('checked', false); - $(".scb_f_use_existing_course").hide(); - $(".scb_s_course_setup_course_list label select").prop('disabled', true); - - - }); - $(".scb_f_course_setup_choose_existing_course input").click(function(){ - $(".scb_ab_f_course_formset_list").hide(); - $('.scb_f_course_setup_create_new_course_option input').prop('checked', false); - $(".scb_f_use_existing_course").css('display','inline-block'); - $(".scb_s_course_setup_course_list label select").prop('disabled', false); - }); - /* Course Modify */ - /* If the user is choosing an existing course want - * to pass course pk */ - $("#course_formset").submit(function(){ - var course_pk = $("input:checked[type='radio']").data('id'); - $(this).append($("",{ - type: 'hidden', - name: 'course_pk', - value: course_pk - } - )); - }); - - $(".scb_ab_f_select_course").click(function(){ - $('input.scb_ab_f_select_course').prop('checked', false); - $(this).prop('checked', true); - }); - /** - * Assignment setup - */ - - $(".scb_f_assignment_setup_radio_new").click(function(){ - $('.scb_f_assignment_setup_radio_existing').attr('checked', false); - $('#scb_f_select_base_assignment').attr('disabled', true); - $('#based_on').val(''); - - }); - $(".scb_f_assignment_setup_radio_existing").click(function(){ - $(".scb_f_assignment_setup_radio_new").attr('checked', false); - $('#scb_f_select_base_assignment').attr('disabled', false); - var assignment_id=$("#scb_f_select_base_assignment").find(":selected").val(); - $('#based_on').val(assignment_id); - - }); - $('#scb_f_select_base_assignment').change(function(){ - var assignment_id=$("#scb_f_select_base_assignment").find(":selected").val(); - $('#based_on').val(assignment_id); - +$(function() { + $('.scb_ab_s_sidebar_page_name_selected').append( + "
"); + $('.scb_s_dashboard_table_row').hover(function() { + $('.scb_s_dashboard_link', this).toggle(); + }); + /** + * Course setup + */ + $('.scb_f_course_setup_create_new_course_option input').click(function() { + $(".scb_ab_f_course_formset_list").show(); + $('.scb_f_course_setup_choose_existing_course input').prop('checked', false); + $(".scb_f_use_existing_course").hide(); + $(".scb_s_course_setup_course_list label select").prop('disabled', true); + + + }); + $(".scb_f_course_setup_choose_existing_course input").click(function() { + $(".scb_ab_f_course_formset_list").hide(); + $('.scb_f_course_setup_create_new_course_option input').prop('checked', false); + $(".scb_f_use_existing_course").css('display', 'inline-block'); + $(".scb_s_course_setup_course_list label select").prop('disabled', false); + }); + /* Course Modify */ + /* If the user is choosing an existing course want + * to pass course pk */ + $("#course_formset").submit(function() { + var course_pk = $("input:checked[type='radio']").data('id'); + $(this).append($("", { + type: 'hidden', + name: 'course_pk', + value: course_pk + } + )); + }); + + $(".scb_ab_f_select_course").click(function() { + $('input.scb_ab_f_select_course').prop('checked', false); + $(this).prop('checked', true); + }); + /** + * Assignment setup + */ + + $(".scb_f_assignment_setup_radio_new").click(function() { + $('.scb_f_assignment_setup_radio_existing').attr('checked', false); + $('#scb_f_select_base_assignment').attr('disabled', true); + $('#based_on').val(''); + + }); + $(".scb_f_assignment_setup_radio_existing").click(function() { + $(".scb_f_assignment_setup_radio_new").attr('checked', false); + $('#scb_f_select_base_assignment').attr('disabled', false); + var assignment_id = $("#scb_f_select_base_assignment").find(":selected").val(); + $('#based_on').val(assignment_id); + + }); + $('#scb_f_select_base_assignment').change(function() { + var assignment_id = $("#scb_f_select_base_assignment").find(":selected").val(); + $('#based_on').val(assignment_id); + + }); + + /** + * For all text input boxes inside a form + */ + $("form input[type = 'text'], form input[type = 'number']").addClass("scb_ab_s_input_text_field"); + $("form select").addClass("scb_ab_s_from_select_field"); + /** + * Edit Strains + */ + + $('.delete_checkbox input').each(function() { + $(this).hide().after('
'); + + }); + if (typeof (access) !== 'undefined' && access === 'private') { + $('.checkbox_delete_image').on('click', function() { + /* Check the hidden checkbox */ + $(this).prev().prop('checked', true); + /* Want to disable the input box for the strain */ + var input_element = $(this).parent().parent().find("input[id$='name']")[0]; + $(input_element).attr('disabled', true); + /* Set opacity for the entire line, ul element */ + $(this).parent().parent().css('opacity', 0.5); + /* Set cursor on the trash image */ + $(this).css('cursor', 'default'); }); + } + /** + * Select variables + */ + var showed_warning = false; + $('.scb_ab_f_select_variable>input').click(function() { + /* Want to warn the instructor*/ + var $checkbox = $(this); + /* Var created is initialized in select_variables template */ + if (created && !showed_warning) { + var message = "Previously generated data will be lost. Would you like to continue?"; + var confirm_func = function() { + $('.error_overlay').remove(); + select_variables(); + }; + var cancel_func = function() { + $('.error_overlay').remove(); + $checkbox.prop('checked', !$checkbox.prop('checked')); + }; + show_message(message, confirm_func, cancel_func); + showed_warning = true; + } else { + select_variables(); + } + }); - /** - * For all text input boxes inside a form - */ - $("form input[type = 'text'], form input[type = 'number']").addClass("scb_ab_s_input_text_field"); - $("form select").addClass("scb_ab_s_from_select_field"); - /** - * Edit Strains - */ + if ($('.scb_ab_f_select_variable').length) { - $('.delete_checkbox input').each(function(){ - $(this).hide().after('
'); + select_variables() + } - }); - if(typeof(access) !== 'undefined' && access === 'private') { - $('.checkbox_delete_image').on('click', function () { - /* Check the hidden checkbox */ - $(this).prev().prop('checked', true); - /* Want to disable the input box for the strain */ - var input_element = $(this).parent().parent().find("input[id$='name']")[0]; - $(input_element).attr('disabled', true); - /* Set opacity for the entire line, ul element */ - $(this).parent().parent().css('opacity', 0.5); - /* Set cursor on the trash image */ - $(this).css('cursor', 'default'); - }); + function select_variables() { + var num_checked = $("input:checked[type='checkbox']").length; + if (num_checked >= 3) { + /* grey out the rest*/ + $('input:checkbox:not(:checked)').attr('disabled', true).parent().addClass('scb_ab_s_grayed'); + } else { + $('input:checkbox:not(:checked)').attr('disabled', false).parent().removeClass('scb_ab_s_grayed'); } - /** - * Select variables - */ - var showed_warning = false; - $('.scb_ab_f_select_variable>input').click(function(){ - /* Want to warn the instructor*/ - var $checkbox= $(this); - /* Var created is initialized in select_variables template */ - if (created && !showed_warning) { - var message = "Previously generated data will be lost. Would you like to continue?"; - var confirm_func = function () { - $('.error_overlay').remove(); - select_variables(); - }; - var cancel_func = function () { - $('.error_overlay').remove(); - $checkbox.prop('checked', !$checkbox.prop('checked')); - }; - show_message(message, confirm_func, cancel_func); - showed_warning=true; - }else{ - select_variables(); - } - }); - - if($('.scb_ab_f_select_variable').length){ + } - select_variables() + if ($('#select_variables_form').length) { + /* Drug concentration unit */ + var $inputs = $('.concentration_unit_box>input'); + for (var i = 0; i < $inputs.length; i++) { + $($inputs[i]).attr('list', 'concentration_unit_list'); } - - function select_variables(){ - var num_checked= $("input:checked[type='checkbox']").length; - if(num_checked>=3){ - /* grey out the rest*/ - $('input:checkbox:not(:checked)').attr('disabled', true).parent().addClass('scb_ab_s_grayed'); - }else{ - $('input:checkbox:not(:checked)').attr('disabled', false).parent().removeClass('scb_ab_s_grayed'); - } + /* Drug time unit */ + $inputs = $('.drug_time_unit_box>input'); + for (i = 0; i < $inputs.length; i++) { + $($inputs[i]).attr('list', 'drug_time_unit_list'); } - - if($('#select_variables_form').length){ - /* Drug concentration unit */ - var $inputs=$('.concentration_unit_box>input'); - for(var i=0; i<$inputs.length; i++){ - $($inputs[i]).attr('list', 'concentration_unit_list'); - } - /* Drug time unit */ - $inputs= $('.drug_time_unit_box>input'); - for(i=0; i<$inputs.length; i++){ - $($inputs[i]).attr('list', 'drug_time_unit_list'); - } - /* Drug duration time unit */ - $inputs= $('.drug_duration_unit_box>input'); - for(i=0; i<$inputs.length; i++){ - $($inputs[i]).attr('list', 'drug_duration_unit_list'); - } - /* Collection time unit */ - $inputs= $('.collection_time_unit_box>input'); - for(i=0; i<$inputs.length; i++){ - $($inputs[i]).attr('list', 'collection_time_unit_list'); - } - + /* Drug duration time unit */ + $inputs = $('.drug_duration_unit_box>input'); + for (i = 0; i < $inputs.length; i++) { + $($inputs[i]).attr('list', 'drug_duration_unit_list'); + } + /* Collection time unit */ + $inputs = $('.collection_time_unit_box>input'); + for (i = 0; i < $inputs.length; i++) { + $($inputs[i]).attr('list', 'collection_time_unit_list'); } - $(".toggle_protocols").click(function(){ - var show= $(".toggle_protocols").data("show"); - if(show){ - $(".scb_ab_s_row").show(); - $(".toggle_protocols").data("show", false).html("SHOW ONLY SELECTED"); - }else{ - $("input:checkbox:not(:checked)").parent().parent().hide(); - $(".toggle_protocols").data("show", true).html("SHOW ALL"); - } - }); - /** - * Western Blotting: lysate types - */ - $("#id_has_nuclear_fractination").attr('disabled', true).parent().addClass('scb_ab_s_grayed'); - $("#id_has_cytoplasmic_fractination").attr('disabled', true).parent().addClass('scb_ab_s_grayed'); - - $('.acrylamide_input_checkbox>input').click(function(){ - var $checkbox=$(this); - if($(".acrylamide_input_checkbox>input:checkbox:checked").length<1){ - $('body').prepend(""); - $.jqDialog.alert("You must select at least one percentage of acrylamide to continue.", - function () { - $('.error_overlay').remove(); - $checkbox.prop('checked', true); - } - ); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Warning

"); - } - }); - /** - * Western Blotting: Antibodies - */ - if($("#id_form-0-primary").length){ - if($(".scb_ab_s_form_input_list").length < 2){ - $("#id_form-0-primary").attr('placeholder', 'goat anti-protein'); - $("#id_form-0-secondary").attr('placeholder', 'rabbit anti-goat'); - } + } + $(".toggle_protocols").click(function() { + var show = $(".toggle_protocols").data("show"); + if (show) { + $(".scb_ab_s_row").show(); + $(".toggle_protocols").data("show", false).html("SHOW ONLY SELECTED"); + } else { + $("input:checkbox:not(:checked)").parent().parent().hide(); + $(".toggle_protocols").data("show", true).html("SHOW ALL"); } - /** - * Facs: Sample Prep - */ - if($("#id_form-0-fixed").length){ - if($(".scb_ab_s_form_input_list").length < 2){ - $("#id_form-0-condition").attr('placeholder', 'Condition Name'); - } - $("option:first").attr('disabled', true); + }); + + /** + * Western Blotting: lysate types + */ + $("#id_has_nuclear_fractination").attr('disabled', true).parent().addClass('scb_ab_s_grayed'); + $("#id_has_cytoplasmic_fractination").attr('disabled', true).parent().addClass('scb_ab_s_grayed'); + + $('.acrylamide_input_checkbox>input').click(function() { + var $checkbox = $(this); + if ($(".acrylamide_input_checkbox>input:checkbox:checked").length < 1) { + $('body').prepend(""); + $.jqDialog.alert("You must select at least one percentage of acrylamide to continue.", function() { + $('.error_overlay').remove(); + $checkbox.prop('checked', true); + } + ); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Warning

"); } - - /** - * Western Blotting: band intensity - */ - $(".intensity_slider").each(function(){ - var intensity=$($(this).siblings('input')[0]).attr('value'); - var $intensity_text=$($(this).parent().siblings('.scb_ab_s_intensity_text')); - $intensity_text.text(intensity_text(intensity)); - $(this).slider({ - min: 0, - max: 2, - range: "min", - value: intensity, - step: 0.5, - slide: function( event, ui ) { - $(this).siblings()[0].value=ui.value; - $intensity_text.text(intensity_text(ui.value)); - - } - }); - - }); - function intensity_text(num){ - if(num<0.25){ - return ''; - }else if(num<0.75){ - return "low"; - }else if(num<1.25){ - return 'med'; - }else if(num<1.75){ - return 'high'; - }else{ - return 'extra high'; - } + }); + /** + * Western Blotting: Antibodies + */ + if ($("#id_form-0-primary").length) { + if ($(".scb_ab_s_form_input_list").length < 2) { + $("#id_form-0-primary").attr('placeholder', 'goat anti-protein'); + $("#id_form-0-secondary").attr('placeholder', 'rabbit anti-goat'); } - - if($('.scb_ab_s_protein_size_input').length>0){ - if(error !== ''){ - $('body').prepend(""); - $.jqDialog.alert(error, - function () { - $('.error_overlay').remove(); - } - ); - $('#jqDialog_box').attr('role', 'alertdialog'); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Warning

"); - - } + } + /** + * Facs: Sample Prep + */ + if ($("#id_form-0-fixed").length) { + if ($(".scb_ab_s_form_input_list").length < 2) { + $("#id_form-0-condition").attr('placeholder', 'Condition Name'); } - $('.block-ellipsis').each(function(){ - var text= $(this).text().replace(/\s\s+/g, ' '); - $($(this).parent()).prop('title',text); + $("option:first").attr('disabled', true); + } + + /** + * Western Blotting: band intensity + */ + $(".intensity_slider").each(function() { + var intensity = $($(this).siblings('input')[0]).attr('value'); + var $intensity_text = $($(this).parent().siblings('.scb_ab_s_intensity_text')); + $intensity_text.text(intensity_text(intensity)); + $(this).slider({ + min: 0, + max: 2, + range: "min", + value: intensity, + step: 0.5, + slide: function(event, ui) { + $(this).siblings()[0].value = ui.value; + $intensity_text.text(intensity_text(ui.value)); + + } }); -/* Temporarily disable techniques */ - $('.disabled').bind('click', false); - $("#id_has_micro").attr('disabled', true).parent().addClass('scb_ab_s_grayed'); - - /* Publish assignment on the dashboard */ - $(".scb_ab_f_publish").click(function(){ - var message = "Please confirm that you would like to publish your assignment. " + - "Once an assignment is published, the assignment will no longer be able " + - "to be edited in the Assignment Builder. Users will be able to access the " + - "assignment using the provided course code on the StarCellBio website. " + - "Would you like to continue?"; - var assignment_pk=$(this).data("assignment-pk"); - var confirm_publish = function(){ - $.ajax({ - type: "POST", - url: "publish/", - data: {pk: assignment_pk} - }).then(function(){ - window.location="/ab/assignments/"; - }).fail(function(response){ - show_alert(response.responseText); - - }); - }; - var cancel_publish = function(){ - $('.error_overlay').remove(); - }; - show_message(message, confirm_publish, cancel_publish); - - }); - - /* Preview assignment*/ - $(".scb_ab_f_preview").click(function() { - var assignment_pk = $(this).data("assignment-pk"); - $.ajax({ - type: "POST", - url: "assignment_complete/", - data: {pk: assignment_pk} - }).then(function () { - window.open('preview/' + assignment_pk + "#view=assignments", '_blank'); - }).fail(function (response) { - show_alert(response.responseText); - }); - }); + }); + function intensity_text(num) { + if (num < 0.25) { + return ''; + } else if (num < 0.75) { + return "low"; + } else if (num < 1.25) { + return 'med'; + } else if (num < 1.75) { + return 'high'; + } else { + return 'extra high'; + } + } + + if ($('.scb_ab_s_protein_size_input').length > 0) { + if (error !== '') { + $('body').prepend(""); + $.jqDialog.alert(error, function() { + $('.error_overlay').remove(); + } + ); + $('#jqDialog_box').attr('role', 'alertdialog'); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Warning

"); - /* Delete assignment*/ - $(".scb_ab_f_delete_assignment").click(function(){ - var assignment_pk = $(this).data("assignment-pk"); - var message = "Your assignment will be removed permanently from your dashboard. " + - "Would you like to continue?"; - if($(this).data("access") === 'published'){ - message = "Your assignment will be removed permanently from your dashboard " + - "and students will no longer be able to access this assignment within this " + - "course and their work will be deleted. Would you like to continue?" + } + } + $('.block-ellipsis').each(function() { + var text = $(this).text().replace(/\s\s+/g, ' '); + $($(this).parent()).prop('title', text); + }); + + /* Temporarily disable techniques */ + $('.disabled').bind('click', false); + $("#id_has_micro").attr('disabled', true).parent().addClass('scb_ab_s_grayed'); + + /* Publish assignment on the dashboard */ + $(".scb_ab_f_publish").click(function() { + var message = "Please confirm that you would like to publish your assignment. " + + "Once an assignment is published, the assignment will no longer be able " + + "to be edited in the Assignment Builder. Users will be able to access the " + + "assignment using the provided course code on the StarCellBio website. " + + "Would you like to continue?"; + var assignment_pk = $(this).data("assignment-pk"); + var confirm_publish = function() { + $.ajax({ + type: "POST", + url: "publish/", + data: { + pk: assignment_pk } - var confirm_publish = function(){ - $('.error_overlay').remove(); - window.location = "delete/"+assignment_pk; - }; - var cancel_publish = function(){ - $('.error_overlay').remove(); - }; - show_message(message, confirm_publish, cancel_publish); + }).then(function() { + window.location = "/ab/assignments/"; + }).fail(function(response) { + show_alert(response.responseText); + + }); + }; + var cancel_publish = function() { + $('.error_overlay').remove(); + }; + show_message(message, confirm_publish, cancel_publish); + + }); + + /* Preview assignment*/ + $(".scb_ab_f_preview").click(function() { + var assignment_pk = $(this).data("assignment-pk"); + $.ajax({ + type: "POST", + url: "assignment_complete/", + data: { + pk: assignment_pk + } + }).then(function() { + window.open('preview/' + assignment_pk + "#view=assignments", '_blank'); + }).fail(function(response) { + show_alert(response.responseText); }); - - function show_message(message, confirm_func, cancel_func) { - $('body').prepend(""); - $.jqDialog.confirm(message, confirm_func, cancel_func); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Confirmation

"); + }); + + /* Delete assignment*/ + $(".scb_ab_f_delete_assignment").click(function() { + var assignment_pk = $(this).data("assignment-pk"); + var message = "Your assignment will be removed permanently from your dashboard. " + + "Would you like to continue?"; + if ($(this).data("access") === 'published') { + message = "Your assignment will be removed permanently from your dashboard " + + "and students will no longer be able to access this assignment within this " + + "course and their work will be deleted. Would you like to continue?" } - -/* View assignment, when assignment is public */ - if(typeof(access) !== 'undefined' && access !=='private'){ - $('input[type="text"],input[type="number"],input[type="checkbox"],input[type="radio"]') - .attr('disabled', true); - $('input[type="checkbox"],input[type="radio"]').addClass('disabled'); - $('input[value="ADD"]').attr('disabled', true).addClass('disabled'); - $('.checkbox_delete_image').addClass('disabled'); - } - - function show_alert(error) { - $('body').prepend(""); - $.jqDialog.alert(error, - function () { - $('.error_overlay').remove(); - } - ); - $('#jqDialog_box').attr('role', 'alertdialog'); - $('.jqDialog_header').remove(); - $('#jqDialog_box').prepend("

Error

"); + var confirm_publish = function() { + $('.error_overlay').remove(); + window.location = "delete/" + assignment_pk; + }; + var cancel_publish = function() { + $('.error_overlay').remove(); + }; + show_message(message, confirm_publish, cancel_publish); + }); + + function show_message(message, confirm_func, cancel_func) { + $('body').prepend(""); + $.jqDialog.confirm(message, confirm_func, cancel_func); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Confirmation

"); + } + + /* View assignment, when assignment is public */ + if (typeof (access) !== 'undefined' && access !== 'private') { + $('input[type="text"],input[type="number"],input[type="checkbox"],input[type="radio"]') + .attr('disabled', true); + $('input[type="checkbox"],input[type="radio"]').addClass('disabled'); + $('input[value="ADD"]').attr('disabled', true).addClass('disabled'); + $('.checkbox_delete_image').addClass('disabled'); + } + + function show_alert(error) { + $('body').prepend(""); + $.jqDialog.alert(error, function() { + $('.error_overlay').remove(); } + ); + $('#jqDialog_box').attr('role', 'alertdialog'); + $('.jqDialog_header').remove(); + $('#jqDialog_box').prepend("

Error

"); + } }); diff --git a/microscopy/old_microscopy/CamanJS-4.1.1/adapters/jquery.js b/microscopy/old_microscopy/CamanJS-4.1.1/adapters/jquery.js index fa940a85..9d60c6f3 100755 --- a/microscopy/old_microscopy/CamanJS-4.1.1/adapters/jquery.js +++ b/microscopy/old_microscopy/CamanJS-4.1.1/adapters/jquery.js @@ -2,8 +2,8 @@ * jQuery plugin adapter for CamanJS */ if (window.jQuery) { - window.jQuery.fn.caman = function (callback) { - return this.each(function () { + window.jQuery.fn.caman = function(callback) { + return this.each(function() { Caman(this, callback); }); }; diff --git a/microscopy/old_microscopy/base64.js b/microscopy/old_microscopy/base64.js index 3bad6d82..e1a882cc 100644 --- a/microscopy/old_microscopy/base64.js +++ b/microscopy/old_microscopy/base64.js @@ -12,102 +12,119 @@ (function() { -var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var base64DecodeChars = new Array( + var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var base64DecodeChars = new Array( -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); -function base64encode(str) { - var out, i, len; - var c1, c2, c3; + function base64encode(str) { + var out; + var i; + var len; + var c1; + var c2; + var c3; len = str.length; i = 0; out = ""; - while(i < len) { - c1 = str.charCodeAt(i++) & 0xff; - if(i == len) - { - out += base64EncodeChars.charAt(c1 >> 2); - out += base64EncodeChars.charAt((c1 & 0x3) << 4); - out += "=="; - break; - } - c2 = str.charCodeAt(i++); - if(i == len) - { - out += base64EncodeChars.charAt(c1 >> 2); - out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); - out += base64EncodeChars.charAt((c2 & 0xF) << 2); - out += "="; - break; - } - c3 = str.charCodeAt(i++); - out += base64EncodeChars.charAt(c1 >> 2); - out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); - out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)); - out += base64EncodeChars.charAt(c3 & 0x3F); + while (i < len) { + c1 = str.charCodeAt(i++) & 0xff; + if (i == len) { + out += base64EncodeChars.charAt(c1 >> 2); + out += base64EncodeChars.charAt((c1 & 0x3) << 4); + out += "=="; + break; + } + c2 = str.charCodeAt(i++); + if (i == len) { + out += base64EncodeChars.charAt(c1 >> 2); + out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); + out += base64EncodeChars.charAt((c2 & 0xF) << 2); + out += "="; + break; + } + c3 = str.charCodeAt(i++); + out += base64EncodeChars.charAt(c1 >> 2); + out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); + out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6)); + out += base64EncodeChars.charAt(c3 & 0x3F); } return out; -} + } -function base64decode(str) { - var c1, c2, c3, c4; - var i, len, out; + function base64decode(str) { + var c1; + var c2; + var c3; + var c4; + var i; + var len; + var out; len = str.length; i = 0; out = ""; - while(i < len) { - /* c1 */ - do { - c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff]; - } while(i < len && c1 == -1); - if(c1 == -1) - break; + while (i < len) { + /* c1 */ + do { + c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff]; + } while (i < len && c1 == -1); + if (c1 == -1) { + break; + } - /* c2 */ - do { - c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff]; - } while(i < len && c2 == -1); - if(c2 == -1) - break; + /* c2 */ + do { + c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff]; + } while (i < len && c2 == -1); + if (c2 == -1) { + break; + } - out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)); + out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)); - /* c3 */ - do { - c3 = str.charCodeAt(i++) & 0xff; - if(c3 == 61) - return out; - c3 = base64DecodeChars[c3]; - } while(i < len && c3 == -1); - if(c3 == -1) - break; + /* c3 */ + do { + c3 = str.charCodeAt(i++) & 0xff; + if (c3 == 61) { + return out; + } + c3 = base64DecodeChars[c3]; + } while (i < len && c3 == -1); + if (c3 == -1) { + break; + } - out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2)); + out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2)); - /* c4 */ - do { - c4 = str.charCodeAt(i++) & 0xff; - if(c4 == 61) - return out; - c4 = base64DecodeChars[c4]; - } while(i < len && c4 == -1); - if(c4 == -1) - break; - out += String.fromCharCode(((c3 & 0x03) << 6) | c4); + /* c4 */ + do { + c4 = str.charCodeAt(i++) & 0xff; + if (c4 == 61) { + return out; + } + c4 = base64DecodeChars[c4]; + } while (i < len && c4 == -1); + if (c4 == -1) { + break; + } + out += String.fromCharCode(((c3 & 0x03) << 6) | c4); } return out; -} + } -if (!window.btoa) window.btoa = base64encode; -if (!window.atob) window.atob = base64decode; + if (!window.btoa) { + window.btoa = base64encode; + } + if (!window.atob) { + window.atob = base64decode; + } })(); \ No newline at end of file diff --git a/microscopy/old_microscopy/caman.full.js b/microscopy/old_microscopy/caman.full.js index cd3150db..7f977dc3 100755 --- a/microscopy/old_microscopy/caman.full.js +++ b/microscopy/old_microscopy/caman.full.js @@ -1,10 +1,41 @@ // Generated by CoffeeScript 1.6.1 (function() { - var $, Analyze, Blender, Calculate, Caman, CamanParser, Canvas, Convert, Event, Fiber, Filter, IO, Image, Layer, Log, Logger, PixelInfo, Plugin, Renderer, Root, Store, Util, fs, slice, vignetteFilters, - __hasProp = {}.hasOwnProperty, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, - __slice = [].slice, - _this = this; + var $; + var Analyze; + var Blender; + var Calculate; + var Caman; + var CamanParser; + var Canvas; + var Convert; + var Event; + var Fiber; + var Filter; + var IO; + var Image; + var Layer; + var Log; + var Logger; + var PixelInfo; + var Plugin; + var Renderer; + var Root; + var Store; + var Util; + var fs; + var slice; + var vignetteFilters; + var __hasProp = {}.hasOwnProperty; + var __indexOf = [].indexOf || function(item) { + for (var i = 0, l = this.length; i < l; i++) { + if (i in this && this[i] === item) { + return i; + } + } + return -1; + }; + var __slice = [].slice; + var _this = this; slice = Array.prototype.slice; @@ -20,7 +51,8 @@ Util = (function() { - function Util() {} + function Util() { + } Util.uniqid = (function() { var id; @@ -33,13 +65,20 @@ })(); Util.extend = function(obj) { - var copy, dest, prop, src, _i, _len; + var copy; + var dest; + var prop; + var src; + var _i; + var _len; dest = obj; src = slice.call(arguments, 1); for (_i = 0, _len = src.length; _i < _len; _i++) { copy = src[_i]; for (prop in copy) { - if (!__hasProp.call(copy, prop)) continue; + if (!__hasProp.call(copy, prop)) { + continue; + } dest[prop] = copy[prop]; } } @@ -57,7 +96,12 @@ }; Util.copyAttributes = function(from, to, opts) { - var attr, _i, _len, _ref, _ref1, _results; + var attr; + var _i; + var _len; + var _ref; + var _ref1; + var _results; if (opts == null) { opts = {}; } @@ -136,8 +180,10 @@ }; function Caman() { - var args, callback, id, - _this = this; + var args; + var callback; + var id; + var _this = this; if (arguments.length === 0) { throw "Invalid arguments"; } @@ -178,8 +224,8 @@ } Caman.prototype.domIsLoaded = function(cb) { - var listener, - _this = this; + var listener; + var _this = this; if (Caman.NodeJS) { return setTimeout(function() { return cb.call(_this); @@ -203,7 +249,10 @@ }; Caman.prototype.parseArguments = function(args) { - var key, val, _ref, _results; + var key; + var val; + var _ref; + var _results; if (args.length === 0) { throw "Invalid arguments given"; } @@ -230,7 +279,9 @@ _ref = args[4]; _results = []; for (key in _ref) { - if (!__hasProp.call(_ref, key)) continue; + if (!__hasProp.call(_ref, key)) { + continue; + } val = _ref[key]; _results.push(this.options[key] = val); } @@ -357,7 +408,11 @@ }; Caman.prototype.finishInit = function() { - var i, pixel, _i, _len, _ref; + var i; + var pixel; + var _i; + var _len; + var _ref; if (this.context == null) { this.context = this.canvas.getContext('2d'); } @@ -396,7 +451,11 @@ }; Caman.prototype.resetOriginalPixelData = function() { - var pixel, _i, _len, _ref, _results; + var pixel; + var _i; + var _len; + var _ref; + var _results; if (!Caman.allowRevert) { throw "Revert disabled"; } @@ -447,7 +506,8 @@ }; Caman.prototype.hiDPIRatio = function() { - var backingStoreRatio, devicePixelRatio; + var backingStoreRatio; + var devicePixelRatio; devicePixelRatio = window.devicePixelRatio || 1; backingStoreRatio = this.context.webkitBackingStorePixelRatio || this.context.mozBackingStorePixelRatio || this.context.msBackingStorePixelRatio || this.context.oBackingStorePixelRatio || this.context.backingStorePixelRatio || 1; return devicePixelRatio / backingStoreRatio; @@ -499,7 +559,11 @@ }; Caman.prototype.revert = function() { - var i, pixel, _i, _len, _ref; + var i; + var pixel; + var _i; + var _len; + var _ref; if (!Caman.allowRevert) { throw "Revert disabled"; } @@ -512,7 +576,15 @@ }; Caman.prototype.reset = function() { - var canvas, ctx, i, imageData, pixel, pixelData, _i, _len, _ref; + var canvas; + var ctx; + var i; + var imageData; + var pixel; + var pixelData; + var _i; + var _len; + var _ref; canvas = document.createElement('canvas'); Util.copyAttributes(this.canvas, canvas); canvas.width = this.originalWidth; @@ -535,7 +607,27 @@ }; Caman.prototype.originalVisiblePixels = function() { - var canvas, coord, ctx, endX, endY, i, imageData, pixel, pixelData, pixels, scaledCanvas, startX, startY, width, _i, _j, _len, _ref, _ref1, _ref2, _ref3; + var canvas; + var coord; + var ctx; + var endX; + var endY; + var i; + var imageData; + var pixel; + var pixelData; + var pixels; + var scaledCanvas; + var startX; + var startY; + var width; + var _i; + var _j; + var _len; + var _ref; + var _ref1; + var _ref2; + var _ref3; if (!Caman.allowRevert) { throw "Revert disabled"; } @@ -587,7 +679,9 @@ }; Caman.prototype.processKernel = function(name, adjust, divisor, bias) { - var i, _i, _ref; + var i; + var _i; + var _ref; if (!divisor) { divisor = 0; for (i = _i = 0, _ref = adjust.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { @@ -658,7 +752,13 @@ } Analyze.prototype.calculateLevels = function() { - var i, levels, numPixels, _i, _j, _k, _ref; + var i; + var levels; + var numPixels; + var _i; + var _j; + var _k; + var _ref; levels = { r: {}, g: {}, @@ -671,8 +771,8 @@ } for (i = _j = 0, _ref = this.c.pixelData.length; _j < _ref; i = _j += 4) { levels.r[this.c.pixelData[i]]++; - levels.g[this.c.pixelData[i + 1]]++; - levels.b[this.c.pixelData[i + 2]]++; + levels.g[this.c.pixelData[i+1]]++; + levels.b[this.c.pixelData[i+2]]++; } numPixels = this.c.pixelData.length / 4; for (i = _k = 0; _k <= 255; i = ++_k) { @@ -688,7 +788,12 @@ })(); Caman.DOMUpdated = function() { - var img, imgs, parser, _i, _len, _results; + var img; + var imgs; + var parser; + var _i; + var _len; + var _results; imgs = document.querySelectorAll("img[data-caman]"); if (!(imgs.length > 0)) { return; @@ -725,7 +830,18 @@ } CamanParser.prototype.parse = function() { - var args, filter, func, inst, instFunc, m, r, unparsedInstructions, _i, _len, _ref, _results; + var args; + var filter; + var func; + var inst; + var instFunc; + var m; + var r; + var unparsedInstructions; + var _i; + var _len; + var _ref; + var _results; this.ele = this.caman.canvas; r = new RegExp(INST_REGEX, 'g'); unparsedInstructions = this.dataStr.match(r); @@ -741,7 +857,7 @@ try { func = instFunc(); _results.push(func.call(this.caman)); - } catch (e) { + } catch ( e ) { _results.push(Log.debug(e)); } } @@ -762,7 +878,8 @@ Caman.Blender = Blender = (function() { - function Blender() {} + function Blender() { + } Blender.blenders = {}; @@ -780,7 +897,8 @@ Caman.Calculate = Calculate = (function() { - function Calculate() {} + function Calculate() { + } Calculate.distance = function(x1, y1, x2, y2) { return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); @@ -804,7 +922,33 @@ }; Calculate.bezier = function(start, ctrl1, ctrl2, end, lowBound, highBound) { - var Ax, Ay, Bx, By, Cx, Cy, bezier, curveX, curveY, i, j, leftCoord, rightCoord, t, x0, x1, x2, x3, y0, y1, y2, y3, _i, _j, _k, _ref, _ref1; + var Ax; + var Ay; + var Bx; + var By; + var Cx; + var Cy; + var bezier; + var curveX; + var curveY; + var i; + var j; + var leftCoord; + var rightCoord; + var t; + var x0; + var x1; + var x2; + var x3; + var y0; + var y1; + var y2; + var y3; + var _i; + var _j; + var _k; + var _ref; + var _ref1; x0 = start[0]; y0 = start[1]; x1 = ctrl1[0]; @@ -857,10 +1001,13 @@ Convert = (function() { - function Convert() {} + function Convert() { + } Convert.hexToRGB = function(hex) { - var b, g, r; + var b; + var g; + var r; if (hex.charAt(0) === "#") { hex = hex.substr(1); } @@ -875,7 +1022,12 @@ }; Convert.rgbToHSL = function(r, g, b) { - var d, h, l, max, min, s; + var d; + var h; + var l; + var max; + var min; + var s; if (typeof r === "object") { g = r.g; b = r.b; @@ -912,7 +1064,11 @@ }; Convert.hslToRGB = function(h, s, l) { - var b, g, p, q, r; + var b; + var g; + var p; + var q; + var r; if (typeof h === "object") { s = h.s; l = h.l; @@ -954,7 +1110,12 @@ }; Convert.rgbToHSV = function(r, g, b) { - var d, h, max, min, s, v; + var d; + var h; + var max; + var min; + var s; + var v; r /= 255; g /= 255; b /= 255; @@ -986,7 +1147,14 @@ }; Convert.hsvToRGB = function(h, s, v) { - var b, f, g, i, p, q, r, t; + var b; + var f; + var g; + var i; + var p; + var q; + var r; + var t; i = Math.floor(h * 6); f = h * 6 - i; p = v * (1 - s); @@ -1031,7 +1199,9 @@ }; Convert.rgbToXYZ = function(r, g, b) { - var x, y, z; + var x; + var y; + var z; r /= 255; g /= 255; b /= 255; @@ -1061,7 +1231,9 @@ }; Convert.xyzToRGB = function(x, y, z) { - var b, g, r; + var b; + var g; + var r; x /= 100; y /= 100; z /= 100; @@ -1091,7 +1263,12 @@ }; Convert.xyzToLab = function(x, y, z) { - var a, b, l, whiteX, whiteY, whiteZ; + var a; + var b; + var l; + var whiteX; + var whiteY; + var whiteZ; if (typeof x === "object") { y = x.y; z = x.z; @@ -1129,7 +1306,9 @@ }; Convert.labToXYZ = function(l, a, b) { - var x, y, z; + var x; + var y; + var z; if (typeof l === "object") { a = l.a; b = l.b; @@ -1179,14 +1358,19 @@ Event = (function() { - function Event() {} + function Event() { + } Event.events = {}; Event.types = ["processStart", "processComplete", "renderStart", "renderFinished", "blockStarted", "blockFinished"]; Event.trigger = function(target, type, data) { - var event, _i, _len, _ref, _results; + var event; + var _i; + var _len; + var _ref; + var _results; if (this.events[type] && this.events[type].length) { _ref = this.events[type]; _results = []; @@ -1203,7 +1387,8 @@ }; Event.listen = function(target, type, fn) { - var _fn, _type; + var _fn; + var _type; if (typeof target === "string") { _type = target; _fn = type; @@ -1232,7 +1417,8 @@ Caman.Filter = Filter = (function() { - function Filter() {} + function Filter() { + } Filter.Type = { Single: 1, @@ -1253,7 +1439,8 @@ Caman.IO = IO = (function() { - function IO() {} + function IO() { + } IO.domainRegex = /(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/; @@ -1347,7 +1534,7 @@ if (stats.isFile() && !overwrite) { return false; } - } catch (e) { + } catch ( e ) { Log.debug("Creating output file " + file); } return fs.writeFile(file, this.canvas.toBuffer(), function() { @@ -1410,7 +1597,10 @@ }; Layer.prototype.copyParent = function() { - var i, parentData, _i, _ref; + var i; + var parentData; + var _i; + var _ref; parentData = this.c.pixelData; for (i = _i = 0, _ref = this.c.pixelData.length; _i < _ref; i = _i += 4) { this.pixelData[i] = parentData[i]; @@ -1443,7 +1633,15 @@ }; Layer.prototype.applyToParent = function() { - var i, layerData, parentData, result, rgbaLayer, rgbaParent, _i, _ref, _results; + var i; + var layerData; + var parentData; + var result; + var rgbaLayer; + var rgbaParent; + var _i; + var _ref; + var _results; parentData = this.c.pixelStack[this.c.pixelStack.length - 1]; layerData = this.c.pixelData; _results = []; @@ -1481,7 +1679,10 @@ Logger = (function() { function Logger() { - var name, _i, _len, _ref; + var name; + var _i; + var _len; + var _ref; _ref = ['log', 'info', 'warn', 'error']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { name = _ref[_i]; @@ -1494,7 +1695,7 @@ } try { return console[name].apply(console, args); - } catch (e) { + } catch ( e ) { return console[name](args); } }; @@ -1516,7 +1717,8 @@ }; PixelInfo.locationToCoordinates = function(loc, width) { - var x, y; + var x; + var y; y = Math.floor(loc / (width * 4)); x = (loc % (width * 4)) / 4; return { @@ -1531,7 +1733,8 @@ } PixelInfo.prototype.locationXY = function() { - var x, y; + var x; + var y; y = this.c.dimensions.height - Math.floor(this.loc / (this.c.dimensions.width * 4)); x = (this.loc % (this.c.dimensions.width * 4)) / 4; return { @@ -1598,7 +1801,8 @@ Plugin = (function() { - function Plugin() {} + function Plugin() { + } Plugin.plugins = {}; @@ -1672,8 +1876,19 @@ }; Renderer.prototype.eachBlock = function(fn) { - var blockN, blockPixelLength, bnum, end, f, i, lastBlockN, n, start, _i, _ref, _results, - _this = this; + var blockN; + var blockPixelLength; + var bnum; + var end; + var f; + var i; + var lastBlockN; + var n; + var start; + var _i; + var _ref; + var _results; + var _this = this; this.blocksDone = 0; n = this.c.pixelData.length; blockPixelLength = Math.floor((n / 4) / Renderer.Blocks); @@ -1717,7 +1932,11 @@ }; Renderer.prototype.renderBlock = function(bnum, start, end) { - var data, i, pixelInfo, res, _i; + var data; + var i; + var pixelInfo; + var res; + var _i; Log.debug("Block #" + bnum + " - Filter: " + this.currentJob.name + ", Start: " + start + ", End: " + end); Event.trigger(this.c, "blockStarted", { blockNum: bnum, @@ -1755,7 +1974,24 @@ }; Renderer.prototype.renderKernel = function(bnum, start, end) { - var adjust, adjustSize, bias, builder, builderIndex, divisor, i, j, k, kernel, n, name, pixel, pixelInfo, res, _i, _j, _k; + var adjust; + var adjustSize; + var bias; + var builder; + var builderIndex; + var divisor; + var i; + var j; + var k; + var kernel; + var n; + var name; + var pixel; + var pixelInfo; + var res; + var _i; + var _j; + var _k; name = this.currentJob.name; bias = this.currentJob.bias; divisor = this.currentJob.divisor; @@ -1794,7 +2030,9 @@ }; Renderer.prototype.blockFinished = function(bnum) { - var i, _i, _ref; + var i; + var _i; + var _ref; if (bnum >= 0) { Log.debug("Block #" + bnum + " finished! Filter: " + this.currentJob.name); } @@ -1819,7 +2057,10 @@ }; Renderer.prototype.processKernel = function(adjust, kernel, divisor, bias) { - var i, val, _i, _ref; + var i; + var val; + var _i; + var _ref; val = { r: 0, g: 0, @@ -1837,8 +2078,9 @@ }; Renderer.prototype.loadOverlay = function(layer, src) { - var img, proxyUrl, - _this = this; + var img; + var proxyUrl; + var _this = this; img = document.createElement('img'); img.onload = function() { layer.context.drawImage(img, 0, 0, _this.c.dimensions.width, _this.c.dimensions.height); @@ -1857,7 +2099,8 @@ Caman.Store = Store = (function() { - function Store() {} + function Store() { + } Store.items = {}; @@ -2029,7 +2272,9 @@ Filter.register("vibrance", function(adjust) { adjust *= -1; return this.process("vibrance", function(rgba) { - var amt, avg, max; + var amt; + var avg; + var max; max = Math.max(rgba.r, rgba.g, rgba.b); avg = (rgba.r + rgba.g + rgba.b) / 3; amt = ((Math.abs(max - avg) * 2 / 255) * adjust) / 100; @@ -2081,7 +2326,9 @@ Filter.register("hue", function(adjust) { return this.process("hue", function(rgba) { - var h, hsv, rgb; + var h; + var hsv; + var rgb; hsv = Convert.rgbToHSV(rgba.r, rgba.g, rgba.b); h = hsv.h * 100; h += Math.abs(adjust); @@ -2095,7 +2342,8 @@ }); Filter.register("colorize", function() { - var level, rgb; + var level; + var rgb; if (arguments.length === 2) { rgb = Convert.hexToRGB(arguments[0]); level = arguments[1]; @@ -2181,12 +2429,15 @@ }); Filter.register("channels", function(options) { - var chan, value; + var chan; + var value; if (typeof options !== "object") { return this; } for (chan in options) { - if (!__hasProp.call(options, chan)) continue; + if (!__hasProp.call(options, chan)) { + continue; + } value = options[chan]; if (value === 0) { delete options[chan]; @@ -2224,7 +2475,18 @@ }); Filter.register("curves", function() { - var bezier, chans, cps, ctrl1, ctrl2, end, i, start, _i, _j, _ref, _ref1; + var bezier; + var chans; + var cps; + var ctrl1; + var ctrl2; + var end; + var i; + var start; + var _i; + var _j; + var _ref; + var _ref1; chans = arguments[0], cps = 2 <= arguments.length ? __slice.call(arguments, 1) : []; if (typeof chans === "string") { chans = chans.split(""); @@ -2251,7 +2513,8 @@ } } return this.process("curves", function(rgba) { - var _k, _ref2; + var _k; + var _ref2; for (i = _k = 0, _ref2 = chans.length; 0 <= _ref2 ? _k < _ref2 : _k > _ref2; i = 0 <= _ref2 ? ++_k : --_k) { rgba[chans[i]] = bezier[rgba[chans[i]]]; } @@ -2260,7 +2523,9 @@ }); Filter.register("exposure", function(adjust) { - var ctrl1, ctrl2, p; + var ctrl1; + var ctrl2; + var p; p = Math.abs(adjust) / 100; ctrl1 = [0, 255 * p]; ctrl2 = [255 - (255 * p), 255]; @@ -2272,7 +2537,8 @@ }); Caman.Plugin.register("crop", function(width, height, x, y) { - var canvas, ctx; + var canvas; + var ctx; if (x == null) { x = 0; } @@ -2298,7 +2564,8 @@ }); Caman.Plugin.register("resize", function(newDims) { - var canvas, ctx; + var canvas; + var ctx; if (newDims == null) { newDims = null; } @@ -2389,7 +2656,10 @@ }; Filter.register("vignette", function(size, strength) { - var bezier, center, end, start; + var bezier; + var center; + var end; + var start; if (strength == null) { strength = 60; } @@ -2406,7 +2676,9 @@ end = start - size; bezier = Calculate.bezier([0, 1], [30, 30], [70, 60], [100, 80]); return this.process("vignette", function(rgba) { - var dist, div, loc; + var dist; + var div; + var loc; loc = this.locationXY(); dist = Calculate.distance(loc.x, loc.y, center[0], center[1]); if (dist > end) { @@ -2420,7 +2692,13 @@ }); Filter.register("rectangularVignette", function(opts) { - var defaults, dim, percent, size, _i, _len, _ref; + var defaults; + var dim; + var percent; + var size; + var _i; + var _len; + var _ref; defaults = { strength: 50, cornerRadius: 0, @@ -2491,7 +2769,9 @@ ]; opts.maxDist = Calculate.distance(0, 0, opts.corners[3].x, opts.corners[3].y) - opts.cornerRadius; return this.process("rectangularVignette", function(rgba) { - var amt, loc, radialDist; + var amt; + var loc; + var radialDist; loc = this.locationXY(); if ((loc.x > opts.corners[0].x && loc.x < opts.corners[1].x) && (loc.y > opts.coords.bottom && loc.y < opts.coords.top)) { return rgba; @@ -2567,11 +2847,21 @@ (function() { - var BlurStack, getLinearGradientMap, getRadialGradientMap, mul_table, shg_table; + var BlurStack; + var getLinearGradientMap; + var getRadialGradientMap; + var mul_table; + var shg_table; mul_table = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259]; shg_table = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]; getLinearGradientMap = function(width, height, centerX, centerY, angle, length, mirrored) { - var cnv, context, gradient, x1, x2, y1, y2; + var cnv; + var context; + var gradient; + var x1; + var x2; + var y1; + var y2; cnv = typeof exports !== "undefined" && exports !== null ? new Canvas() : document.createElement('canvas'); cnv.width = width; cnv.height = height; @@ -2594,7 +2884,9 @@ return context.getImageData(0, 0, width, height); }; getRadialGradientMap = function(width, height, centerX, centerY, radius1, radius2) { - var cnv, context, gradient; + var cnv; + var context; + var gradient; cnv = typeof exports !== "undefined" && exports !== null ? new Canvas() : document.createElement('canvas'); cnv.width = width; cnv.height = height; @@ -2614,7 +2906,64 @@ return this.next = null; }; Caman.Plugin.register("compoundBlur", function(radiusData, radius, increaseFactor, blurLevels) { - var b_in_sum, b_out_sum, b_sum, blend, currentIndex, div, g_in_sum, g_out_sum, g_sum, height, heightMinus1, i, iblend, idx, imagePixels, index, iradius, lookupValue, mul_sum, p, pb, pg, pixels, pr, r_in_sum, r_out_sum, r_sum, radiusPixels, radiusPlus1, rbs, shg_sum, stack, stackEnd, stackIn, stackOut, stackStart, steps, sumFactor, w4, wh, wh4, width, widthMinus1, x, y, yi, yp, yw, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r; + var b_in_sum; + var b_out_sum; + var b_sum; + var blend; + var currentIndex; + var div; + var g_in_sum; + var g_out_sum; + var g_sum; + var height; + var heightMinus1; + var i; + var iblend; + var idx; + var imagePixels; + var index; + var iradius; + var lookupValue; + var mul_sum; + var p; + var pb; + var pg; + var pixels; + var pr; + var r_in_sum; + var r_out_sum; + var r_sum; + var radiusPixels; + var radiusPlus1; + var rbs; + var shg_sum; + var stack; + var stackEnd; + var stackIn; + var stackOut; + var stackStart; + var steps; + var sumFactor; + var w4; + var wh; + var wh4; + var width; + var widthMinus1; + var x; + var y; + var yi; + var yp; + var yw; + var _i; + var _j; + var _k; + var _l; + var _m; + var _n; + var _o; + var _p; + var _q; + var _r; width = this.dimensions.width; height = this.dimensions.height; imagePixels = this.pixelData; @@ -2795,7 +3144,8 @@ return this; }); Caman.Filter.register("tiltShift", function(opts) { - var defaults, gradient; + var defaults; + var gradient; defaults = { center: { x: this.dimensions.width / 2, @@ -2813,7 +3163,10 @@ return this.processPlugin("compoundBlur", [gradient, opts.startRadius, opts.radiusFactor, opts.steps]); }); return Caman.Filter.register("radialBlur", function(opts) { - var defaults, gradient, radius1, radius2; + var defaults; + var gradient; + var radius1; + var radius2; defaults = { size: 50, center: { @@ -2849,7 +3202,8 @@ }); Caman.Filter.register("posterize", function(adjust) { - var numOfAreas, numOfValues; + var numOfAreas; + var numOfValues; numOfAreas = 256 / adjust; numOfValues = 255 / (adjust - 1); return this.process("posterize", function(rgba) { @@ -3206,7 +3560,9 @@ (function() { - var BlurStack, mul_table, shg_table; + var BlurStack; + var mul_table; + var shg_table; mul_table = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259]; shg_table = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]; BlurStack = function() { @@ -3217,7 +3573,51 @@ return this.next = null; }; Caman.Plugin.register("stackBlur", function(radius) { - var b_in_sum, b_out_sum, b_sum, div, g_in_sum, g_out_sum, g_sum, height, heightMinus1, i, mul_sum, p, pb, pg, pixels, pr, r_in_sum, r_out_sum, r_sum, radiusPlus1, rbs, shg_sum, stack, stackEnd, stackIn, stackOut, stackStart, sumFactor, w4, width, widthMinus1, x, y, yi, yp, yw, _i, _j, _k, _l, _m, _n, _o, _p, _q; + var b_in_sum; + var b_out_sum; + var b_sum; + var div; + var g_in_sum; + var g_out_sum; + var g_sum; + var height; + var heightMinus1; + var i; + var mul_sum; + var p; + var pb; + var pg; + var pixels; + var pr; + var r_in_sum; + var r_out_sum; + var r_sum; + var radiusPlus1; + var rbs; + var shg_sum; + var stack; + var stackEnd; + var stackIn; + var stackOut; + var stackStart; + var sumFactor; + var w4; + var width; + var widthMinus1; + var x; + var y; + var yi; + var yp; + var yw; + var _i; + var _j; + var _k; + var _l; + var _m; + var _n; + var _o; + var _p; + var _q; if (isNaN(radius) || radius < 1) { return; } diff --git a/microscopy/old_microscopy/caman.full.min.js b/microscopy/old_microscopy/caman.full.min.js index 9cd57e9d..b8aefe5d 100755 --- a/microscopy/old_microscopy/caman.full.min.js +++ b/microscopy/old_microscopy/caman.full.min.js @@ -1,217 +1,3037 @@ -(function(){var $,Analyze,Blender,Calculate,Caman,CamanParser,Canvas,Convert,Event,Fiber,Filter,IO,Image,Layer,Log,Logger,PixelInfo,Plugin,Renderer,Root,Store,Util,fs,slice,vignetteFilters,__hasProp={}.hasOwnProperty,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i255){return 255;} -return val;};Util.copyAttributes=function(from,to,opts){var attr,_i,_len,_ref,_ref1,_results;if(opts==null){opts={};} -_ref=from.attributes;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){attr=_ref[_i];if((opts.except!=null)&&(_ref1=attr.nodeName,__indexOf.call(opts.except,_ref1)>=0)){continue;} -_results.push(to.setAttribute(attr.nodeName,attr.nodeValue));} -return _results;};Util.dataArray=function(length){if(length==null){length=0;} -if(Caman.NodeJS||(window.Uint8Array!=null)){return new Uint8Array(length);} -return new Array(length);};return Util;})();if(typeof exports!=="undefined"&&exports!==null){Root=exports;Canvas=require('canvas');Image=Canvas.Image;Fiber=require('fibers');fs=require('fs');}else{Root=window;} -Root.Caman=Caman=(function(){Caman.version={release:"4.1.1",date:"4/8/2013"};Caman.DEBUG=false;Caman.NodeJS=typeof exports!=="undefined"&&exports!==null;Caman.autoload=!Caman.NodeJS;Caman.allowRevert=true;Caman.crossOrigin="anonymous";Caman.toString=function(){return"Version "+Caman.version.release+", Released "+Caman.version.date;};Caman.remoteProxy="";Caman.proxyParam="camanProxyUrl";Caman.getAttrId=function(canvas){if(Caman.NodeJS){return true;} -if(typeof canvas==="string"){canvas=$(canvas);} -if(!((canvas!=null)&&(canvas.getAttribute!=null))){return null;} -return canvas.getAttribute('data-caman-id');};function Caman(){var args,callback,id,_this=this;if(arguments.length===0){throw"Invalid arguments";} -if(this instanceof Caman){this.finishInit=this.finishInit.bind(this);this.imageLoaded=this.imageLoaded.bind(this);args=arguments[0];if(!Caman.NodeJS){id=parseInt(Caman.getAttrId(args[0]),10);callback=typeof args[1]==="function"?args[1]:typeof args[2]==="function"?args[2]:function(){};if(!isNaN(id)&&Store.has(id)){return Store.execute(id,callback);}} -this.id=Util.uniqid.get();this.initializedPixelData=this.originalPixelData=null;this.cropCoordinates={x:0,y:0};this.cropped=false;this.resized=false;this.pixelStack=[];this.layerStack=[];this.canvasQueue=[];this.currentLayer=null;this.scaled=false;this.analyze=new Analyze(this);this.renderer=new Renderer(this);this.domIsLoaded(function(){_this.parseArguments(args);return _this.setup();});return this;}else{return new Caman(arguments);}} -Caman.prototype.domIsLoaded=function(cb){var listener,_this=this;if(Caman.NodeJS){return setTimeout(function(){return cb.call(_this);},0);}else{if(document.readyState==="complete"){Log.debug("DOM initialized");return setTimeout(function(){return cb.call(_this);},0);}else{listener=function(){if(document.readyState==="complete"){Log.debug("DOM initialized");return cb.call(_this);}};return document.addEventListener("readystatechange",listener,false);}}};Caman.prototype.parseArguments=function(args){var key,val,_ref,_results;if(args.length===0){throw"Invalid arguments given";} -this.initObj=null;this.initType=null;this.imageUrl=null;this.callback=function(){};this.setInitObject(args[0]);if(args.length===1){return;} -switch(typeof args[1]){case"string":this.imageUrl=args[1];break;case"function":this.callback=args[1];} -if(args.length===2){return;} -this.callback=args[2];if(args.length===4){_ref=args[4];_results=[];for(key in _ref){if(!__hasProp.call(_ref,key))continue;val=_ref[key];_results.push(this.options[key]=val);} -return _results;}};Caman.prototype.setInitObject=function(obj){if(Caman.NodeJS){this.initObj=obj;this.initType='node';return;} -if(typeof obj==="object"){this.initObj=obj;}else{this.initObj=$(obj);} -if(this.initObj==null){throw"Could not find image or canvas for initialization.";} -return this.initType=this.initObj.nodeName.toLowerCase();};Caman.prototype.setup=function(){switch(this.initType){case"node":return this.initNode();case"img":return this.initImage();case"canvas":return this.initCanvas();}};Caman.prototype.initNode=function(){var _this=this;Log.debug("Initializing for NodeJS");this.image=new Image();this.image.onload=function(){Log.debug("Image loaded. Width = "+(_this.imageWidth())+", Height = "+(_this.imageHeight()));_this.canvas=new Canvas(_this.imageWidth(),_this.imageHeight());return _this.finishInit();};this.image.onerror=function(err){throw err;};return this.image.src=this.initObj;};Caman.prototype.initImage=function(){this.image=this.initObj;this.canvas=document.createElement('canvas');this.context=this.canvas.getContext('2d');Util.copyAttributes(this.image,this.canvas,{except:['src']});this.image.parentNode.replaceChild(this.canvas,this.image);this.imageAdjustments();return this.waitForImageLoaded();};Caman.prototype.initCanvas=function(){this.canvas=this.initObj;this.context=this.canvas.getContext('2d');if(this.imageUrl!=null){this.image=document.createElement('img');this.image.src=this.imageUrl;this.imageAdjustments();return this.waitForImageLoaded();}else{return this.finishInit();}};Caman.prototype.imageAdjustments=function(){if(this.needsHiDPISwap()){Log.debug(this.image.src,"->",this.hiDPIReplacement());this.swapped=true;this.image.src=this.hiDPIReplacement();} -if(IO.isRemote(this.image)){this.image.src=IO.proxyUrl(this.image.src);return Log.debug("Remote image detected, using URL = "+this.image.src);}};Caman.prototype.waitForImageLoaded=function(){if(this.isImageLoaded()){return this.imageLoaded();}else{return this.image.onload=this.imageLoaded;}};Caman.prototype.isImageLoaded=function(){if(!this.image.complete){return false;} -if((this.image.naturalWidth!=null)&&this.image.naturalWidth===0){return false;} -return true;};Caman.prototype.imageWidth=function(){return this.image.width||this.image.naturalWidth;};Caman.prototype.imageHeight=function(){return this.image.height||this.image.naturalHeight;};Caman.prototype.imageLoaded=function(){Log.debug("Image loaded. Width = "+(this.imageWidth())+", Height = "+(this.imageHeight()));if(this.swapped){this.canvas.width=this.imageWidth()/this.hiDPIRatio();this.canvas.height=this.imageHeight()/this.hiDPIRatio();}else{this.canvas.width=this.imageWidth();this.canvas.height=this.imageHeight();} -return this.finishInit();};Caman.prototype.finishInit=function(){var i,pixel,_i,_len,_ref;if(this.context==null){this.context=this.canvas.getContext('2d');} -this.originalWidth=this.preScaledWidth=this.width=this.canvas.width;this.originalHeight=this.preScaledHeight=this.height=this.canvas.height;this.hiDPIAdjustments();if(!this.hasId()){this.assignId();} -if(this.image!=null){this.context.drawImage(this.image,0,0,this.imageWidth(),this.imageHeight(),0,0,this.preScaledWidth,this.preScaledHeight);} -this.reloadCanvasData();if(Caman.allowRevert){this.initializedPixelData=Util.dataArray(this.pixelData.length);this.originalPixelData=Util.dataArray(this.pixelData.length);_ref=this.pixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];this.initializedPixelData[i]=pixel;this.originalPixelData[i]=pixel;}} -this.dimensions={width:this.canvas.width,height:this.canvas.height};Store.put(this.id,this);this.callback.call(this,this);return this.callback=function(){};};Caman.prototype.reloadCanvasData=function(){this.imageData=this.context.getImageData(0,0,this.canvas.width,this.canvas.height);return this.pixelData=this.imageData.data;};Caman.prototype.resetOriginalPixelData=function(){var pixel,_i,_len,_ref,_results;if(!Caman.allowRevert){throw"Revert disabled";} -this.originalPixelData=Util.dataArray(this.pixelData.length);_ref=this.pixelData;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){pixel=_ref[_i];_results.push(this.originalPixelData.push(pixel));} -return _results;};Caman.prototype.hasId=function(){return Caman.getAttrId(this.canvas)!=null;};Caman.prototype.assignId=function(){if(Caman.NodeJS||this.canvas.getAttribute('data-caman-id')){return;} -return this.canvas.setAttribute('data-caman-id',this.id);};Caman.prototype.hiDPIDisabled=function(){return this.canvas.getAttribute('data-caman-hidpi-disabled')!==null;};Caman.prototype.hiDPIAdjustments=function(){var ratio;if(Caman.NodeJS||this.hiDPIDisabled()){return;} -ratio=this.hiDPIRatio();if(ratio!==1){Log.debug("HiDPI ratio = "+ratio);this.scaled=true;this.preScaledWidth=this.canvas.width;this.preScaledHeight=this.canvas.height;this.canvas.width=this.preScaledWidth*ratio;this.canvas.height=this.preScaledHeight*ratio;this.canvas.style.width=""+this.preScaledWidth+"px";this.canvas.style.height=""+this.preScaledHeight+"px";this.context.scale(ratio,ratio);this.width=this.originalWidth=this.canvas.width;return this.height=this.originalHeight=this.canvas.height;}};Caman.prototype.hiDPIRatio=function(){var backingStoreRatio,devicePixelRatio;devicePixelRatio=window.devicePixelRatio||1;backingStoreRatio=this.context.webkitBackingStorePixelRatio||this.context.mozBackingStorePixelRatio||this.context.msBackingStorePixelRatio||this.context.oBackingStorePixelRatio||this.context.backingStorePixelRatio||1;return devicePixelRatio/backingStoreRatio;};Caman.prototype.hiDPICapable=function(){return(window.devicePixelRatio!=null)&&window.devicePixelRatio!==1;};Caman.prototype.needsHiDPISwap=function(){if(this.hiDPIDisabled()||!this.hiDPICapable()){return false;} -return this.hiDPIReplacement()!==null;};Caman.prototype.hiDPIReplacement=function(){if(this.image==null){return null;} -return this.image.getAttribute('data-caman-hidpi');};Caman.prototype.replaceCanvas=function(newCanvas){var oldCanvas;oldCanvas=this.canvas;this.canvas=newCanvas;this.context=this.canvas.getContext('2d');oldCanvas.parentNode.replaceChild(this.canvas,oldCanvas);this.width=this.canvas.width;this.height=this.canvas.height;this.reloadCanvasData();return this.dimensions={width:this.canvas.width,height:this.canvas.height};};Caman.prototype.render=function(callback){var _this=this;if(callback==null){callback=function(){};} -Event.trigger(this,"renderStart");return this.renderer.execute(function(){_this.context.putImageData(_this.imageData,0,0);return callback.call(_this);});};Caman.prototype.revert=function(){var i,pixel,_i,_len,_ref;if(!Caman.allowRevert){throw"Revert disabled";} -_ref=this.originalVisiblePixels();for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];this.pixelData[i]=pixel;} -return this.context.putImageData(this.imageData,0,0);};Caman.prototype.reset=function(){var canvas,ctx,i,imageData,pixel,pixelData,_i,_len,_ref;canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=this.originalWidth;canvas.height=this.originalHeight;ctx=canvas.getContext('2d');imageData=ctx.getImageData(0,0,canvas.width,canvas.height);pixelData=imageData.data;_ref=this.initializedPixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];pixelData[i]=pixel;} -ctx.putImageData(imageData,0,0);this.cropCoordinates={x:0,y:0};this.resized=false;return this.replaceCanvas(canvas);};Caman.prototype.originalVisiblePixels=function(){var canvas,coord,ctx,endX,endY,i,imageData,pixel,pixelData,pixels,scaledCanvas,startX,startY,width,_i,_j,_len,_ref,_ref1,_ref2,_ref3;if(!Caman.allowRevert){throw"Revert disabled";} -pixels=[];startX=this.cropCoordinates.x;endX=startX+this.width;startY=this.cropCoordinates.y;endY=startY+this.height;if(this.resized){canvas=document.createElement('canvas');canvas.width=this.originalWidth;canvas.height=this.originalHeight;ctx=canvas.getContext('2d');imageData=ctx.getImageData(0,0,canvas.width,canvas.height);pixelData=imageData.data;_ref=this.originalPixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];pixelData[i]=pixel;} -ctx.putImageData(imageData,0,0);scaledCanvas=document.createElement('canvas');scaledCanvas.width=this.width;scaledCanvas.height=this.height;ctx=scaledCanvas.getContext('2d');ctx.drawImage(canvas,0,0,this.originalWidth,this.originalHeight,0,0,this.width,this.height);pixelData=ctx.getImageData(0,0,this.width,this.height).data;width=this.width;}else{pixelData=this.originalPixelData;width=this.originalWidth;} -for(i=_j=0,_ref1=pixelData.length;_j<_ref1;i=_j+=4){coord=PixelInfo.locationToCoordinates(i,width);if(((startX<=(_ref2=coord.x)&&_ref2_ref;i=0<=_ref?++_i:--_i){divisor+=adjust[i];}} -this.renderer.add({type:Filter.Type.Kernel,name:name,adjust:adjust,divisor:divisor,bias:bias||0});return this;};Caman.prototype.processPlugin=function(plugin,args){this.renderer.add({type:Filter.Type.Plugin,plugin:plugin,args:args});return this;};Caman.prototype.newLayer=function(callback){var layer;layer=new Layer(this);this.canvasQueue.push(layer);this.renderer.add({type:Filter.Type.LayerDequeue});callback.call(layer);this.renderer.add({type:Filter.Type.LayerFinished});return this;};Caman.prototype.executeLayer=function(layer){return this.pushContext(layer);};Caman.prototype.pushContext=function(layer){this.layerStack.push(this.currentLayer);this.pixelStack.push(this.pixelData);this.currentLayer=layer;return this.pixelData=layer.pixelData;};Caman.prototype.popContext=function(){this.pixelData=this.pixelStack.pop();return this.currentLayer=this.layerStack.pop();};Caman.prototype.applyCurrentLayer=function(){return this.currentLayer.applyToParent();};return Caman;})();Analyze=(function(){function Analyze(c){this.c=c;} -Analyze.prototype.calculateLevels=function(){var i,levels,numPixels,_i,_j,_k,_ref;levels={r:{},g:{},b:{}};for(i=_i=0;_i<=255;i=++_i){levels.r[i]=0;levels.g[i]=0;levels.b[i]=0;} -for(i=_j=0,_ref=this.c.pixelData.length;_j<_ref;i=_j+=4){levels.r[this.c.pixelData[i]]++;levels.g[this.c.pixelData[i+1]]++;levels.b[this.c.pixelData[i+2]]++;} -numPixels=this.c.pixelData.length/4;for(i=_k=0;_k<=255;i=++_k){levels.r[i]/=numPixels;levels.g[i]/=numPixels;levels.b[i]/=numPixels;} -return levels;};return Analyze;})();Caman.DOMUpdated=function(){var img,imgs,parser,_i,_len,_results;imgs=document.querySelectorAll("img[data-caman]");if(!(imgs.length>0)){return;} -_results=[];for(_i=0,_len=imgs.length;_i<_len;_i++){img=imgs[_i];_results.push(parser=new CamanParser(img,function(){this.parse();return this.execute();}));} -return _results;};if(Caman.autoload){(function(){if(document.readyState==="complete"){return Caman.DOMUpdated();}else{return document.addEventListener("DOMContentLoaded",Caman.DOMUpdated,false);}})();} -CamanParser=(function(){var INST_REGEX;INST_REGEX="(\\w+)\\((.*?)\\)";function CamanParser(ele,ready){this.dataStr=ele.getAttribute('data-caman');this.caman=Caman(ele,ready.bind(this));} -CamanParser.prototype.parse=function(){var args,filter,func,inst,instFunc,m,r,unparsedInstructions,_i,_len,_ref,_results;this.ele=this.caman.canvas;r=new RegExp(INST_REGEX,'g');unparsedInstructions=this.dataStr.match(r);if(!(unparsedInstructions.length>0)){return;} -r=new RegExp(INST_REGEX);_results=[];for(_i=0,_len=unparsedInstructions.length;_i<_len;_i++){inst=unparsedInstructions[_i];_ref=inst.match(r),m=_ref[0],filter=_ref[1],args=_ref[2];instFunc=new Function("return function() { this."+filter+"("+args+"); };");try{func=instFunc();_results.push(func.call(this.caman));}catch(e){_results.push(Log.debug(e));}} -return _results;};CamanParser.prototype.execute=function(){var ele;ele=this.ele;return this.caman.render(function(){return ele.parentNode.replaceChild(this.toImage(),ele);});};return CamanParser;})();Caman.Blender=Blender=(function(){function Blender(){} -Blender.blenders={};Blender.register=function(name,func){return this.blenders[name]=func;};Blender.execute=function(name,rgbaLayer,rgbaParent){return this.blenders[name](rgbaLayer,rgbaParent);};return Blender;})();Caman.Calculate=Calculate=(function(){function Calculate(){} -Calculate.distance=function(x1,y1,x2,y2){return Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));};Calculate.randomRange=function(min,max,getFloat){var rand;if(getFloat==null){getFloat=false;} -rand=min+(Math.random()*(max-min));if(getFloat){return rand.toFixed(getFloat);}else{return Math.round(rand);}};Calculate.luminance=function(rgba){return(0.299*rgba.r)+(0.587*rgba.g)+(0.114*rgba.b);};Calculate.bezier=function(start,ctrl1,ctrl2,end,lowBound,highBound){var Ax,Ay,Bx,By,Cx,Cy,bezier,curveX,curveY,i,j,leftCoord,rightCoord,t,x0,x1,x2,x3,y0,y1,y2,y3,_i,_j,_k,_ref,_ref1;x0=start[0];y0=start[1];x1=ctrl1[0];y1=ctrl1[1];x2=ctrl2[0];y2=ctrl2[1];x3=end[0];y3=end[1];bezier={};Cx=parseInt(3*(x1-x0),10);Bx=3*(x2-x1)-Cx;Ax=x3-x0-Cx-Bx;Cy=3*(y1-y0);By=3*(y2-y1)-Cy;Ay=y3-y0-Cy-By;for(i=_i=0;_i<1000;i=++_i){t=i/1000;curveX=Math.round((Ax*Math.pow(t,3))+(Bx*Math.pow(t,2))+(Cx*t)+x0);curveY=Math.round((Ay*Math.pow(t,3))+(By*Math.pow(t,2))+(Cy*t)+y0);if(lowBound&&curveYhighBound){curveY=highBound;} -bezier[curveX]=curveY;} -if(bezier.length=_ref;i=0<=_ref?++_j:--_j){if(bezier[i]==null){leftCoord=[i-1,bezier[i-1]];for(j=_k=i,_ref1=end[0];i<=_ref1?_k<=_ref1:_k>=_ref1;j=i<=_ref1?++_k:--_k){if(bezier[j]!=null){rightCoord=[j,bezier[j]];break;}} -bezier[i]=leftCoord[1]+((rightCoord[1]-leftCoord[1])/(rightCoord[0]-leftCoord[0]))*(i-leftCoord[0]);}}} -if(bezier[end[0]]==null){bezier[end[0]]=bezier[end[0]-1];} -return bezier;};return Calculate;})();Convert=(function(){function Convert(){} -Convert.hexToRGB=function(hex){var b,g,r;if(hex.charAt(0)==="#"){hex=hex.substr(1);} -r=parseInt(hex.substr(0,2),16);g=parseInt(hex.substr(2,2),16);b=parseInt(hex.substr(4,2),16);return{r:r,g:g,b:b};};Convert.rgbToHSL=function(r,g,b){var d,h,l,max,min,s;if(typeof r==="object"){g=r.g;b=r.b;r=r.r;} -r/=255;g/=255;b/=255;max=Math.max(r,g,b);min=Math.min(r,g,b);l=(max+min)/2;if(max===min){h=s=0;}else{d=max-min;s=l>0.5?d/(2-max-min):d/(max+min);h=(function(){switch(max){case r:return(g-b)/d+(g1){t-=1;} -if(t<1/6){return p+(q-p)*6*t;} -if(t<1/2){return q;} -if(t<2/3){return p+(q-p)*(2/3-t)*6;} -return p;};Convert.rgbToHSV=function(r,g,b){var d,h,max,min,s,v;r/=255;g/=255;b/=255;max=Math.max(r,g,b);min=Math.min(r,g,b);v=max;d=max-min;s=max===0?0:d/max;if(max===min){h=0;}else{h=(function(){switch(max){case r:return(g-b)/d+(g0.04045){r=Math.pow((r+0.055)/1.055,2.4);}else{r/=12.92;} -if(g>0.04045){g=Math.pow((g+0.055)/1.055,2.4);}else{g/=12.92;} -if(b>0.04045){b=Math.pow((b+0.055)/1.055,2.4);}else{b/=12.92;} -x=r*0.4124+g*0.3576+b*0.1805;y=r*0.2126+g*0.7152+b*0.0722;z=r*0.0193+g*0.1192+b*0.9505;return{x:x*100,y:y*100,z:z*100};};Convert.xyzToRGB=function(x,y,z){var b,g,r;x/=100;y/=100;z/=100;r=(3.2406*x)+(-1.5372*y)+(-0.4986*z);g=(-0.9689*x)+(1.8758*y)+(0.0415*z);b=(0.0557*x)+(-0.2040*y)+(1.0570*z);if(r>0.0031308){r=(1.055*Math.pow(r,0.4166666667))-0.055;}else{r*=12.92;} -if(g>0.0031308){g=(1.055*Math.pow(g,0.4166666667))-0.055;}else{g*=12.92;} -if(b>0.0031308){b=(1.055*Math.pow(b,0.4166666667))-0.055;}else{b*=12.92;} -return{r:r*255,g:g*255,b:b*255};};Convert.xyzToLab=function(x,y,z){var a,b,l,whiteX,whiteY,whiteZ;if(typeof x==="object"){y=x.y;z=x.z;x=x.x;} -whiteX=95.047;whiteY=100.0;whiteZ=108.883;x/=whiteX;y/=whiteY;z/=whiteZ;if(x>0.008856451679){x=Math.pow(x,0.3333333333);}else{x=(7.787037037*x)+0.1379310345;} -if(y>0.008856451679){y=Math.pow(y,0.3333333333);}else{y=(7.787037037*y)+0.1379310345;} -if(z>0.008856451679){z=Math.pow(z,0.3333333333);}else{z=(7.787037037*z)+0.1379310345;} -l=116*y-16;a=500*(x-y);b=200*(y-z);return{l:l,a:a,b:b};};Convert.labToXYZ=function(l,a,b){var x,y,z;if(typeof l==="object"){a=l.a;b=l.b;l=l.l;} -y=(l+16)/116;x=y+(a/500);z=y-(b/200);if(x>0.2068965517){x=x*x*x;}else{x=0.1284185493*(x-0.1379310345);} -if(y>0.2068965517){y=y*y*y;}else{y=0.1284185493*(y-0.1379310345);} -if(z>0.2068965517){z=z*z*z;}else{z=0.1284185493*(z-0.1379310345);} -return{x:x*95.047,y:y*100.0,z:z*108.883};};Convert.rgbToLab=function(r,g,b){var xyz;if(typeof r==="object"){g=r.g;b=r.b;r=r.r;} -xyz=this.rgbToXYZ(r,g,b);return this.xyzToLab(xyz);};Convert.labToRGB=function(l,a,b){};return Convert;})();Event=(function(){function Event(){} -Event.events={};Event.types=["processStart","processComplete","renderStart","renderFinished","blockStarted","blockFinished"];Event.trigger=function(target,type,data){var event,_i,_len,_ref,_results;if(this.events[type]&&this.events[type].length){_ref=this.events[type];_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){event=_ref[_i];if(event.target===null||target.id===event.target.id){_results.push(event.fn.call(target,data));}else{_results.push(void 0);}} -return _results;}};Event.listen=function(target,type,fn){var _fn,_type;if(typeof target==="string"){_type=target;_fn=type;target=null;type=_type;fn=_fn;} -if(__indexOf.call(this.types,type)<0){return false;} -if(!this.events[type]){this.events[type]=[];} -this.events[type].push({target:target,fn:fn});return true;};return Event;})();Caman.Event=Event;Caman.Filter=Filter=(function(){function Filter(){} -Filter.Type={Single:1,Kernel:2,LayerDequeue:3,LayerFinished:4,LoadOverlay:5,Plugin:6};Filter.register=function(name,filterFunc){return Caman.prototype[name]=filterFunc;};return Filter;})();Caman.IO=IO=(function(){function IO(){} -IO.domainRegex=/(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/;IO.isRemote=function(img){if(img==null){return false;} -if(this.corsEnabled(img)){return false;} -return this.isURLRemote(img.src);};IO.corsEnabled=function(img){var _ref;return(img.crossOrigin!=null)&&((_ref=img.crossOrigin.toLowerCase())==='anonymous'||_ref==='use-credentials');};IO.isURLRemote=function(url){var matches;matches=url.match(this.domainRegex);if(matches){return matches[1]!==document.domain;}else{return false;}};IO.remoteCheck=function(src){if(this.isURLRemote(src)){if(!Caman.remoteProxy.length){Log.info("Attempting to load a remote image without a configured proxy. URL: "+src);}else{if(Caman.isURLRemote(Caman.remoteProxy)){Log.info("Cannot use a remote proxy for loading images.");return;} -return""+Caman.remoteProxy+"?camanProxyUrl="+(encodeURIComponent(src));}}};IO.proxyUrl=function(src){return""+Caman.remoteProxy+"?"+Caman.proxyParam+"="+(encodeURIComponent(src));};IO.useProxy=function(lang){var langToExt;langToExt={ruby:'rb',python:'py',perl:'pl',javascript:'js'};lang=lang.toLowerCase();if(langToExt[lang]!=null){lang=langToExt[lang];} -return"proxies/caman_proxy."+lang;};return IO;})();Caman.prototype.save=function(){if(typeof exports!=="undefined"&&exports!==null){return this.nodeSave.apply(this,arguments);}else{return this.browserSave.apply(this,arguments);}};Caman.prototype.browserSave=function(type){var image;if(type==null){type="png";} -type=type.toLowerCase();image=this.toBase64(type).replace("image/"+type,"image/octet-stream");return document.location.href=image;};Caman.prototype.nodeSave=function(file,overwrite){var stats;if(overwrite==null){overwrite=true;} -try{stats=fs.statSync(file);if(stats.isFile()&&!overwrite){return false;}}catch(e){Log.debug("Creating output file "+file);} -return fs.writeFile(file,this.canvas.toBuffer(),function(){return Log.debug("Finished writing to "+file);});};Caman.prototype.toImage=function(type){var img;img=document.createElement('img');img.src=this.toBase64(type);img.width=this.dimensions.width;img.height=this.dimensions.height;if(window.devicePixelRatio){img.width/=window.devicePixelRatio;img.height/=window.devicePixelRatio;} -return img;};Caman.prototype.toBase64=function(type){if(type==null){type="png";} -type=type.toLowerCase();return this.canvas.toDataURL("image/"+type);};Layer=(function(){function Layer(c){this.c=c;this.filter=this.c;this.options={blendingMode:'normal',opacity:1.0};this.layerID=Util.uniqid.get();this.canvas=typeof exports!=="undefined"&&exports!==null?new Canvas():document.createElement('canvas');this.canvas.width=this.c.dimensions.width;this.canvas.height=this.c.dimensions.height;this.context=this.canvas.getContext('2d');this.context.createImageData(this.canvas.width,this.canvas.height);this.imageData=this.context.getImageData(0,0,this.canvas.width,this.canvas.height);this.pixelData=this.imageData.data;} -Layer.prototype.newLayer=function(cb){return this.c.newLayer.call(this.c,cb);};Layer.prototype.setBlendingMode=function(mode){this.options.blendingMode=mode;return this;};Layer.prototype.opacity=function(opacity){this.options.opacity=opacity/100;return this;};Layer.prototype.copyParent=function(){var i,parentData,_i,_ref;parentData=this.c.pixelData;for(i=_i=0,_ref=this.c.pixelData.length;_i<_ref;i=_i+=4){this.pixelData[i]=parentData[i];this.pixelData[i+1]=parentData[i+1];this.pixelData[i+2]=parentData[i+2];this.pixelData[i+3]=parentData[i+3];} -return this;};Layer.prototype.fillColor=function(){return this.c.fillColor.apply(this.c,arguments);};Layer.prototype.overlayImage=function(image){if(typeof image==="object"){image=image.src;}else if(typeof image==="string"&&image[0]==="#"){image=$(image).src;} -if(!image){return this;} -this.c.renderer.renderQueue.push({type:Filter.Type.LoadOverlay,src:image,layer:this});return this;};Layer.prototype.applyToParent=function(){var i,layerData,parentData,result,rgbaLayer,rgbaParent,_i,_ref,_results;parentData=this.c.pixelStack[this.c.pixelStack.length-1];layerData=this.c.pixelData;_results=[];for(i=_i=0,_ref=layerData.length;_i<_ref;i=_i+=4){rgbaParent={r:parentData[i],g:parentData[i+1],b:parentData[i+2],a:parentData[i+3]};rgbaLayer={r:layerData[i],g:layerData[i+1],b:layerData[i+2],a:layerData[i+3]};result=Blender.execute(this.options.blendingMode,rgbaLayer,rgbaParent);result.r=Util.clampRGB(result.r);result.g=Util.clampRGB(result.g);result.b=Util.clampRGB(result.b);if(result.a==null){result.a=rgbaLayer.a;} -parentData[i]=rgbaParent.r-((rgbaParent.r-result.r)*(this.options.opacity*(result.a/255)));parentData[i+1]=rgbaParent.g-((rgbaParent.g-result.g)*(this.options.opacity*(result.a/255)));_results.push(parentData[i+2]=rgbaParent.b-((rgbaParent.b-result.b)*(this.options.opacity*(result.a/255))));} -return _results;};return Layer;})();Logger=(function(){function Logger(){var name,_i,_len,_ref;_ref=['log','info','warn','error'];for(_i=0,_len=_ref.length;_i<_len;_i++){name=_ref[_i];this[name]=(function(name){return function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];if(!Caman.DEBUG){return;} -try{return console[name].apply(console,args);}catch(e){return console[name](args);}};})(name);} -this.debug=this.log;} -return Logger;})();Log=new Logger();PixelInfo=(function(){PixelInfo.coordinatesToLocation=function(x,y,width){return(y*width+x)*4;};PixelInfo.locationToCoordinates=function(loc,width){var x,y;y=Math.floor(loc/(width*4));x=(loc%(width*4))/4;return{x:x,y:y};};function PixelInfo(c){this.c=c;this.loc=0;} -PixelInfo.prototype.locationXY=function(){var x,y;y=this.c.dimensions.height-Math.floor(this.loc/(this.c.dimensions.width*4));x=(this.loc%(this.c.dimensions.width*4))/4;return{x:x,y:y};};PixelInfo.prototype.getPixelRelative=function(horiz,vert){var newLoc;newLoc=this.loc+(this.c.dimensions.width*4*(vert*-1))+(4*horiz);if(newLoc>this.c.pixelData.length||newLoc<0){return{r:0,g:0,b:0,a:0};} -return{r:this.c.pixelData[newLoc],g:this.c.pixelData[newLoc+1],b:this.c.pixelData[newLoc+2],a:this.c.pixelData[newLoc+3]};};PixelInfo.prototype.putPixelRelative=function(horiz,vert,rgba){var nowLoc;nowLoc=this.loc+(this.c.dimensions.width*4*(vert*-1))+(4*horiz);if(newLoc>this.c.pixelData.length||newLoc<0){return;} -this.c.pixelData[newLoc]=rgba.r;this.c.pixelData[newLoc+1]=rgba.g;this.c.pixelData[newLoc+2]=rgba.b;this.c.pixelData[newLoc+3]=rgba.a;return true;};PixelInfo.prototype.getPixel=function(x,y){var loc;loc=this.coordinatesToLocation(x,y,this.width);return{r:this.c.pixelData[loc],g:this.c.pixelData[loc+1],b:this.c.pixelData[loc+2],a:this.c.pixelData[loc+3]};};PixelInfo.prototype.putPixel=function(x,y,rgba){var loc;loc=this.coordinatesToLocation(x,y,this.width);this.c.pixelData[loc]=rgba.r;this.c.pixelData[loc+1]=rgba.g;this.c.pixelData[loc+2]=rgba.b;return this.c.pixelData[loc+3]=rgba.a;};return PixelInfo;})();Plugin=(function(){function Plugin(){} -Plugin.plugins={};Plugin.register=function(name,plugin){return this.plugins[name]=plugin;};Plugin.execute=function(context,name,args){return this.plugins[name].apply(context,args);};return Plugin;})();Caman.Plugin=Plugin;Caman.Renderer=Renderer=(function(){Renderer.Blocks=Caman.NodeJS?require('os').cpus().length:4;function Renderer(c){var _this=this;this.c=c;this.processNext=function(){return Renderer.prototype.processNext.apply(_this,arguments);};this.renderQueue=[];this.modPixelData=null;} -Renderer.prototype.add=function(job){if(job==null){return;} -return this.renderQueue.push(job);};Renderer.prototype.processNext=function(){var layer;if(this.renderQueue.length===0){Event.trigger(this,"renderFinished");if(this.finishedFn!=null){this.finishedFn.call(this.c);} -return this;} -this.currentJob=this.renderQueue.shift();switch(this.currentJob.type){case Filter.Type.LayerDequeue:layer=this.c.canvasQueue.shift();this.c.executeLayer(layer);return this.processNext();case Filter.Type.LayerFinished:this.c.applyCurrentLayer();this.c.popContext();return this.processNext();case Filter.Type.LoadOverlay:return this.loadOverlay(this.currentJob.layer,this.currentJob.src);case Filter.Type.Plugin:return this.executePlugin();default:return this.executeFilter();}};Renderer.prototype.execute=function(callback){this.finishedFn=callback;this.modPixelData=Util.dataArray(this.c.pixelData.length);return this.processNext();};Renderer.prototype.eachBlock=function(fn){var blockN,blockPixelLength,bnum,end,f,i,lastBlockN,n,start,_i,_ref,_results,_this=this;this.blocksDone=0;n=this.c.pixelData.length;blockPixelLength=Math.floor((n/4)/Renderer.Blocks);blockN=blockPixelLength*4;lastBlockN=blockN+((n/4)%Renderer.Blocks)*4;_results=[];for(i=_i=0,_ref=Renderer.Blocks;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){start=i*blockN;end=start+(i===Renderer.Blocks-1?lastBlockN:blockN);if(Caman.NodeJS){f=Fiber(function(){return fn.call(_this,i,start,end);});bnum=f.run();_results.push(this.blockFinished(bnum));}else{_results.push(setTimeout((function(i,start,end){return function(){return fn.call(_this,i,start,end);};})(i,start,end),0));}} -return _results;};Renderer.prototype.executeFilter=function(){Event.trigger(this.c,"processStart",this.currentJob);if(this.currentJob.type===Filter.Type.Single){return this.eachBlock(this.renderBlock);}else{return this.eachBlock(this.renderKernel);}};Renderer.prototype.executePlugin=function(){Log.debug("Executing plugin "+this.currentJob.plugin);Plugin.execute(this.c,this.currentJob.plugin,this.currentJob.args);Log.debug("Plugin "+this.currentJob.plugin+" finished!");return this.processNext();};Renderer.prototype.renderBlock=function(bnum,start,end){var data,i,pixelInfo,res,_i;Log.debug("Block #"+bnum+" - Filter: "+this.currentJob.name+", Start: "+start+", End: "+end);Event.trigger(this.c,"blockStarted",{blockNum:bnum,totalBlocks:Renderer.Blocks,startPixel:start,endPixel:end});data={r:0,g:0,b:0,a:0};pixelInfo=new PixelInfo(this.c);for(i=_i=start;_i=builder;j=-builder<=builder?++_j:--_j){for(k=_k=builder;builder<=-builder?_k<=-builder:_k>=-builder;k=builder<=-builder?++_k:--_k){pixel=pixelInfo.getPixelRelative(j,k);kernel[builderIndex*3]=pixel.r;kernel[builderIndex*3+1]=pixel.g;kernel[builderIndex*3+2]=pixel.b;builderIndex++;}} -res=this.processKernel(adjust,kernel,divisor,bias);this.modPixelData[i]=Util.clampRGB(res.r);this.modPixelData[i+1]=Util.clampRGB(res.g);this.modPixelData[i+2]=Util.clampRGB(res.b);this.modPixelData[i+3]=this.c.pixelData[i+3];} -if(Caman.NodeJS){return Fiber["yield"](bnum);}else{return this.blockFinished(bnum);}};Renderer.prototype.blockFinished=function(bnum){var i,_i,_ref;if(bnum>=0){Log.debug("Block #"+bnum+" finished! Filter: "+this.currentJob.name);} -this.blocksDone++;Event.trigger(this.c,"blockFinished",{blockNum:bnum,blocksFinished:this.blocksDone,totalBlocks:Renderer.Blocks});if(this.blocksDone===Renderer.Blocks){if(this.currentJob.type===Filter.Type.Kernel){for(i=_i=0,_ref=this.c.pixelData.length;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){this.c.pixelData[i]=this.modPixelData[i];}} -if(bnum>=0){Log.debug("Filter "+this.currentJob.name+" finished!");} -Event.trigger(this.c,"processComplete",this.currentJob);return this.processNext();}};Renderer.prototype.processKernel=function(adjust,kernel,divisor,bias){var i,val,_i,_ref;val={r:0,g:0,b:0};for(i=_i=0,_ref=adjust.length;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){val.r+=adjust[i]*kernel[i*3];val.g+=adjust[i]*kernel[i*3+1];val.b+=adjust[i]*kernel[i*3+2];} -val.r=(val.r/divisor)+bias;val.g=(val.g/divisor)+bias;val.b=(val.b/divisor)+bias;return val;};Renderer.prototype.loadOverlay=function(layer,src){var img,proxyUrl,_this=this;img=document.createElement('img');img.onload=function(){layer.context.drawImage(img,0,0,_this.c.dimensions.width,_this.c.dimensions.height);layer.imageData=layer.context.getImageData(0,0,_this.c.dimensions.width,_this.c.dimensions.height);layer.pixelData=layer.imageData.data;_this.c.pixelData=layer.pixelData;return _this.processNext();};proxyUrl=IO.remoteCheck(src);return img.src=proxyUrl!=null?proxyUrl:src;};return Renderer;})();Caman.Store=Store=(function(){function Store(){} -Store.items={};Store.has=function(search){return this.items[search]!=null;};Store.get=function(search){return this.items[search];};Store.put=function(name,obj){return this.items[name]=obj;};Store.execute=function(search,callback){var _this=this;setTimeout(function(){return callback.call(_this.get(search),_this.get(search));},0);return this.get(search);};Store.flush=function(name){if(name==null){name=false;} -if(name){return delete this.items[name];}else{return this.items={};}};return Store;})();Blender.register("normal",function(rgbaLayer,rgbaParent){return{r:rgbaLayer.r,g:rgbaLayer.g,b:rgbaLayer.b};});Blender.register("multiply",function(rgbaLayer,rgbaParent){return{r:(rgbaLayer.r*rgbaParent.r)/255,g:(rgbaLayer.g*rgbaParent.g)/255,b:(rgbaLayer.b*rgbaParent.b)/255};});Blender.register("screen",function(rgbaLayer,rgbaParent){return{r:255-(((255-rgbaLayer.r)*(255-rgbaParent.r))/255),g:255-(((255-rgbaLayer.g)*(255-rgbaParent.g))/255),b:255-(((255-rgbaLayer.b)*(255-rgbaParent.b))/255)};});Blender.register("overlay",function(rgbaLayer,rgbaParent){var result;result={};result.r=rgbaParent.r>128?255-2*(255-rgbaLayer.r)*(255-rgbaParent.r)/255:(rgbaParent.r*rgbaLayer.r*2)/255;result.g=rgbaParent.g>128?255-2*(255-rgbaLayer.g)*(255-rgbaParent.g)/255:(rgbaParent.g*rgbaLayer.g*2)/255;result.b=rgbaParent.b>128?255-2*(255-rgbaLayer.b)*(255-rgbaParent.b)/255:(rgbaParent.b*rgbaLayer.b*2)/255;return result;});Blender.register("difference",function(rgbaLayer,rgbaParent){return{r:rgbaLayer.r-rgbaParent.r,g:rgbaLayer.g-rgbaParent.g,b:rgbaLayer.b-rgbaParent.b};});Blender.register("addition",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r+rgbaLayer.r,g:rgbaParent.g+rgbaLayer.g,b:rgbaParent.b+rgbaLayer.b};});Blender.register("exclusion",function(rgbaLayer,rgbaParent){return{r:128-2*(rgbaParent.r-128)*(rgbaLayer.r-128)/255,g:128-2*(rgbaParent.g-128)*(rgbaLayer.g-128)/255,b:128-2*(rgbaParent.b-128)*(rgbaLayer.b-128)/255};});Blender.register("softLight",function(rgbaLayer,rgbaParent){var result;result={};result.r=rgbaParent.r>128?255-((255-rgbaParent.r)*(255-(rgbaLayer.r-128)))/255:(rgbaParent.r*(rgbaLayer.r+128))/255;result.g=rgbaParent.g>128?255-((255-rgbaParent.g)*(255-(rgbaLayer.g-128)))/255:(rgbaParent.g*(rgbaLayer.g+128))/255;result.b=rgbaParent.b>128?255-((255-rgbaParent.b)*(255-(rgbaLayer.b-128)))/255:(rgbaParent.b*(rgbaLayer.b+128))/255;return result;});Blender.register("lighten",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r>rgbaLayer.r?rgbaParent.r:rgbaLayer.r,g:rgbaParent.g>rgbaLayer.g?rgbaParent.g:rgbaLayer.g,b:rgbaParent.b>rgbaLayer.b?rgbaParent.b:rgbaLayer.b};});Blender.register("darken",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r>rgbaLayer.r?rgbaLayer.r:rgbaParent.r,g:rgbaParent.g>rgbaLayer.g?rgbaLayer.g:rgbaParent.g,b:rgbaParent.b>rgbaLayer.b?rgbaLayer.b:rgbaParent.b};});Filter.register("fillColor",function(){var color;if(arguments.length===1){color=Convert.hexToRGB(arguments[0]);}else{color={r:arguments[0],g:arguments[1],b:arguments[2]};} -return this.process("fillColor",function(rgba){rgba.r=color.r;rgba.g=color.g;rgba.b=color.b;rgba.a=255;return rgba;});});Filter.register("brightness",function(adjust){adjust=Math.floor(255*(adjust/100));return this.process("brightness",function(rgba){rgba.r+=adjust;rgba.g+=adjust;rgba.b+=adjust;return rgba;});});Filter.register("saturation",function(adjust){adjust*=-0.01;return this.process("saturation",function(rgba){var max;max=Math.max(rgba.r,rgba.g,rgba.b);if(rgba.r!==max){rgba.r+=(max-rgba.r)*adjust;} -if(rgba.g!==max){rgba.g+=(max-rgba.g)*adjust;} -if(rgba.b!==max){rgba.b+=(max-rgba.b)*adjust;} -return rgba;});});Filter.register("vibrance",function(adjust){adjust*=-1;return this.process("vibrance",function(rgba){var amt,avg,max;max=Math.max(rgba.r,rgba.g,rgba.b);avg=(rgba.r+rgba.g+rgba.b)/3;amt=((Math.abs(max-avg)*2/255)*adjust)/100;if(rgba.r!==max){rgba.r+=(max-rgba.r)*amt;} -if(rgba.g!==max){rgba.g+=(max-rgba.g)*amt;} -if(rgba.b!==max){rgba.b+=(max-rgba.b)*amt;} -return rgba;});});Filter.register("greyscale",function(adjust){return this.process("greyscale",function(rgba){var avg;avg=Calculate.luminance(rgba);rgba.r=avg;rgba.g=avg;rgba.b=avg;return rgba;});});Filter.register("contrast",function(adjust){adjust=Math.pow((adjust+100)/100,2);return this.process("contrast",function(rgba){rgba.r/=255;rgba.r-=0.5;rgba.r*=adjust;rgba.r+=0.5;rgba.r*=255;rgba.g/=255;rgba.g-=0.5;rgba.g*=adjust;rgba.g+=0.5;rgba.g*=255;rgba.b/=255;rgba.b-=0.5;rgba.b*=adjust;rgba.b+=0.5;rgba.b*=255;return rgba;});});Filter.register("hue",function(adjust){return this.process("hue",function(rgba){var h,hsv,rgb;hsv=Convert.rgbToHSV(rgba.r,rgba.g,rgba.b);h=hsv.h*100;h+=Math.abs(adjust);h=h%100;h/=100;hsv.h=h;rgb=Convert.hsvToRGB(hsv.h,hsv.s,hsv.v);rgb.a=rgba.a;return rgb;});});Filter.register("colorize",function(){var level,rgb;if(arguments.length===2){rgb=Convert.hexToRGB(arguments[0]);level=arguments[1];}else if(arguments.length===4){rgb={r:arguments[0],g:arguments[1],b:arguments[2]};level=arguments[3];} -return this.process("colorize",function(rgba){rgba.r-=(rgba.r-rgb.r)*(level/100);rgba.g-=(rgba.g-rgb.g)*(level/100);rgba.b-=(rgba.b-rgb.b)*(level/100);return rgba;});});Filter.register("invert",function(){return this.process("invert",function(rgba){rgba.r=255-rgba.r;rgba.g=255-rgba.g;rgba.b=255-rgba.b;return rgba;});});Filter.register("sepia",function(adjust){if(adjust==null){adjust=100;} -adjust/=100;return this.process("sepia",function(rgba){rgba.r=Math.min(255,(rgba.r*(1-(0.607*adjust)))+(rgba.g*(0.769*adjust))+(rgba.b*(0.189*adjust)));rgba.g=Math.min(255,(rgba.r*(0.349*adjust))+(rgba.g*(1-(0.314*adjust)))+(rgba.b*(0.168*adjust)));rgba.b=Math.min(255,(rgba.r*(0.272*adjust))+(rgba.g*(0.534*adjust))+(rgba.b*(1-(0.869*adjust))));return rgba;});});Filter.register("gamma",function(adjust){return this.process("gamma",function(rgba){rgba.r=Math.pow(rgba.r/255,adjust)*255;rgba.g=Math.pow(rgba.g/255,adjust)*255;rgba.b=Math.pow(rgba.b/255,adjust)*255;return rgba;});});Filter.register("noise",function(adjust){adjust=Math.abs(adjust)*2.55;return this.process("noise",function(rgba){var rand;rand=Calculate.randomRange(adjust*-1,adjust);rgba.r+=rand;rgba.g+=rand;rgba.b+=rand;return rgba;});});Filter.register("clip",function(adjust){adjust=Math.abs(adjust)*2.55;return this.process("clip",function(rgba){if(rgba.r>255-adjust){rgba.r=255;}else if(rgba.r255-adjust){rgba.g=255;}else if(rgba.g255-adjust){rgba.b=255;}else if(rgba.b0){rgba.r+=(255-rgba.r)*options.red;}else{rgba.r-=rgba.r*Math.abs(options.red);}} -if(options.green!=null){if(options.green>0){rgba.g+=(255-rgba.g)*options.green;}else{rgba.g-=rgba.g*Math.abs(options.green);}} -if(options.blue!=null){if(options.blue>0){rgba.b+=(255-rgba.b)*options.blue;}else{rgba.b-=rgba.b*Math.abs(options.blue);}} -return rgba;});});Filter.register("curves",function(){var bezier,chans,cps,ctrl1,ctrl2,end,i,start,_i,_j,_ref,_ref1;chans=arguments[0],cps=2<=arguments.length?__slice.call(arguments,1):[];if(typeof chans==="string"){chans=chans.split("");} -if(chans[0]==="v"){chans=['r','g','b'];} -if(cps.length<3||cps.length>4){throw"Invalid number of arguments to curves filter";} -start=cps[0];ctrl1=cps[1];ctrl2=cps.length===4?cps[2]:cps[1];end=cps[cps.length-1];bezier=Calculate.bezier(start,ctrl1,ctrl2,end,0,255);if(start[0]>0){for(i=_i=0,_ref=start[0];0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){bezier[i]=start[1];}} -if(end[0]<255){for(i=_j=_ref1=end[0];_ref1<=255?_j<=255:_j>=255;i=_ref1<=255?++_j:--_j){bezier[i]=end[1];}} -return this.process("curves",function(rgba){var _k,_ref2;for(i=_k=0,_ref2=chans.length;0<=_ref2?_k<_ref2:_k>_ref2;i=0<=_ref2?++_k:--_k){rgba[chans[i]]=bezier[rgba[chans[i]]];} -return rgba;});});Filter.register("exposure",function(adjust){var ctrl1,ctrl2,p;p=Math.abs(adjust)/100;ctrl1=[0,255*p];ctrl2=[255-(255*p),255];if(adjust<0){ctrl1=ctrl1.reverse();ctrl2=ctrl2.reverse();} -return this.curves('rgb',[0,0],ctrl1,ctrl2,[255,255]);});Caman.Plugin.register("crop",function(width,height,x,y){var canvas,ctx;if(x==null){x=0;} -if(y==null){y=0;} -if(typeof exports!=="undefined"&&exports!==null){canvas=new Canvas(width,height);}else{canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=width;canvas.height=height;} -ctx=canvas.getContext('2d');ctx.drawImage(this.canvas,x,y,width,height,0,0,width,height);this.cropCoordinates={x:x,y:y};this.cropped=true;return this.replaceCanvas(canvas);});Caman.Plugin.register("resize",function(newDims){var canvas,ctx;if(newDims==null){newDims=null;} -if(newDims===null||((newDims.width==null)&&(newDims.height==null))){Log.error("Invalid or missing dimensions given for resize");return;} -if(newDims.width==null){newDims.width=this.canvas.width*newDims.height/this.canvas.height;}else if(newDims.height==null){newDims.height=this.canvas.height*newDims.width/this.canvas.width;} -if(typeof exports!=="undefined"&&exports!==null){canvas=new Canvas(newDims.width,newDims.height);}else{canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=newDims.width;canvas.height=newDims.height;} -ctx=canvas.getContext('2d');ctx.drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,newDims.width,newDims.height);this.resized=true;return this.replaceCanvas(canvas);});Caman.Filter.register("crop",function(){return this.processPlugin("crop",Array.prototype.slice.call(arguments,0));});Caman.Filter.register("resize",function(){return this.processPlugin("resize",Array.prototype.slice.call(arguments,0));});Caman.Filter.register("boxBlur",function(){return this.processKernel("Box Blur",[1,1,1,1,1,1,1,1,1]);});Caman.Filter.register("heavyRadialBlur",function(){return this.processKernel("Heavy Radial Blur",[0,0,1,0,0,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,0,0,1,0,0]);});Caman.Filter.register("gaussianBlur",function(){return this.processKernel("Gaussian Blur",[1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1]);});Caman.Filter.register("motionBlur",function(degrees){var kernel;if(degrees===0||degrees===180){kernel=[0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0];}else if((degrees>0&°rees<90)||(degrees>180&°rees<270)){kernel=[0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0];}else if(degrees===90||degrees===270){kernel=[0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0];}else{kernel=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1];} -return this.processKernel("Motion Blur",kernel);});Caman.Filter.register("sharpen",function(amt){if(amt==null){amt=100;} -amt/=100;return this.processKernel("Sharpen",[0,-amt,0,-amt,4*amt+1,-amt,0,-amt,0]);});vignetteFilters={brightness:function(rgba,amt,opts){rgba.r=rgba.r-(rgba.r*amt*opts.strength);rgba.g=rgba.g-(rgba.g*amt*opts.strength);rgba.b=rgba.b-(rgba.b*amt*opts.strength);return rgba;},gamma:function(rgba,amt,opts){rgba.r=Math.pow(rgba.r/255,Math.max(10*amt*opts.strength,1))*255;rgba.g=Math.pow(rgba.g/255,Math.max(10*amt*opts.strength,1))*255;rgba.b=Math.pow(rgba.b/255,Math.max(10*amt*opts.strength,1))*255;return rgba;},colorize:function(rgba,amt,opts){rgba.r-=(rgba.r-opts.color.r)*amt;rgba.g-=(rgba.g-opts.color.g)*amt;rgba.b-=(rgba.b-opts.color.b)*amt;return rgba;}};Filter.register("vignette",function(size,strength){var bezier,center,end,start;if(strength==null){strength=60;} -if(typeof size==="string"&&size.substr(-1)==="%"){if(this.dimensions.height>this.dimensions.width){size=this.dimensions.width*(parseInt(size.substr(0,size.length-1),10)/100);}else{size=this.dimensions.height*(parseInt(size.substr(0,size.length-1),10)/100);}} -strength/=100;center=[this.dimensions.width/2,this.dimensions.height/2];start=Math.sqrt(Math.pow(center[0],2)+Math.pow(center[1],2));end=start-size;bezier=Calculate.bezier([0,1],[30,30],[70,60],[100,80]);return this.process("vignette",function(rgba){var dist,div,loc;loc=this.locationXY();dist=Calculate.distance(loc.x,loc.y,center[0],center[1]);if(dist>end){div=Math.max(1,(bezier[Math.round(((dist-end)/size)*100)]/10)*strength);rgba.r=Math.pow(rgba.r/255,div)*255;rgba.g=Math.pow(rgba.g/255,div)*255;rgba.b=Math.pow(rgba.b/255,div)*255;} -return rgba;});});Filter.register("rectangularVignette",function(opts){var defaults,dim,percent,size,_i,_len,_ref;defaults={strength:50,cornerRadius:0,method:'brightness',color:{r:0,g:0,b:0}};opts=Util.extend(defaults,opts);if(!opts.size){return this;}else if(typeof opts.size==="string"){percent=parseInt(opts.size,10)/100;opts.size={width:this.dimensions.width*percent,height:this.dimensions.height*percent};}else if(typeof opts.size==="object"){_ref=["width","height"];for(_i=0,_len=_ref.length;_i<_len;_i++){dim=_ref[_i];if(typeof opts.size[dim]==="string"){opts.size[dim]=this.dimensions[dim]*(parseInt(opts.size[dim],10)/100);}}}else if(opts.size==="number"){size=opts.size;opts.size={width:size,height:size};} -if(typeof opts.cornerRadius==="string"){opts.cornerRadius=(opts.size.width/2)*(parseInt(opts.cornerRadius,10)/100);} -opts.strength/=100;opts.size.width=Math.floor(opts.size.width);opts.size.height=Math.floor(opts.size.height);opts.image={width:this.dimensions.width,height:this.dimensions.height};if(opts.method==="colorize"&&typeof opts.color==="string"){opts.color=Convert.hexToRGB(opts.color);} -opts.coords={left:(this.dimensions.width-opts.size.width)/2,right:this.dimensions.width-opts.coords.left,bottom:(this.dimensions.height-opts.size.height)/2,top:this.dimensions.height-opts.coords.bottom};opts.corners=[{x:opts.coords.left+opts.cornerRadius,y:opts.coords.top-opts.cornerRadius},{x:opts.coords.right-opts.cornerRadius,y:opts.coords.top-opts.cornerRadius},{x:opts.coords.right-opts.cornerRadius,y:opts.coords.bottom+opts.cornerRadius},{x:opts.coords.left+opts.cornerRadius,y:opts.coords.bottom+opts.cornerRadius}];opts.maxDist=Calculate.distance(0,0,opts.corners[3].x,opts.corners[3].y)-opts.cornerRadius;return this.process("rectangularVignette",function(rgba){var amt,loc,radialDist;loc=this.locationXY();if((loc.x>opts.corners[0].x&&loc.xopts.coords.bottom&&loc.yopts.coords.left&&loc.xopts.corners[3].y&&loc.yopts.corners[0].x&&loc.xopts.coords.top){amt=(loc.y-opts.coords.top)/opts.maxDist;}else if(loc.y>opts.corners[2].y&&loc.yopts.coords.right){amt=(loc.x-opts.coords.right)/opts.maxDist;}else if(loc.x>opts.corners[0].x&&loc.xopts.corners[2].y&&loc.y=opts.corners[0].y){radialDist=Caman.distance(loc.x,loc.y,opts.corners[0].x,opts.corners[0].y);amt=(radialDist-opts.cornerRadius)/opts.maxDist;}else if(loc.x>=opts.corners[1].x&&loc.y>=opts.corners[1].y){radialDist=Caman.distance(loc.x,loc.y,opts.corners[1].x,opts.corners[1].y);amt=(radialDist-opts.cornerRadius)/opts.maxDist;}else if(loc.x>=opts.corners[2].x&&loc.y<=opts.corners[2].y){radialDist=Caman.distance(loc.x,loc.y,opts.corners[2].x,opts.corners[2].y);amt=(radialDist-opts.cornerRadius)/opts.maxDist;}else if(loc.x<=opts.corners[3].x&&loc.y<=opts.corners[3].y){radialDist=Caman.distance(loc.x,loc.y,opts.corners[3].x,opts.corners[3].y);amt=(radialDist-opts.cornerRadius)/opts.maxDist;} -if(amt<0){return rgba;} -return vignetteFilters[opts.method](rgba,amt,opts);});});(function(){var BlurStack,getLinearGradientMap,getRadialGradientMap,mul_table,shg_table;mul_table=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259];shg_table=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];getLinearGradientMap=function(width,height,centerX,centerY,angle,length,mirrored){var cnv,context,gradient,x1,x2,y1,y2;cnv=typeof exports!=="undefined"&&exports!==null?new Canvas():document.createElement('canvas');cnv.width=width;cnv.height=height;x1=centerX+Math.cos(angle)*length*0.5;y1=centerY+Math.sin(angle)*length*0.5;x2=centerX-Math.cos(angle)*length*0.5;y2=centerY-Math.sin(angle)*length*0.5;context=cnv.getContext("2d");gradient=context.createLinearGradient(x1,y1,x2,y2);if(!mirrored){gradient.addColorStop(0,"white");gradient.addColorStop(1,"black");}else{gradient.addColorStop(0,"white");gradient.addColorStop(0.5,"black");gradient.addColorStop(1,"white");} -context.fillStyle=gradient;context.fillRect(0,0,width,height);return context.getImageData(0,0,width,height);};getRadialGradientMap=function(width,height,centerX,centerY,radius1,radius2){var cnv,context,gradient;cnv=typeof exports!=="undefined"&&exports!==null?new Canvas():document.createElement('canvas');cnv.width=width;cnv.height=height;context=cnv.getContext("2d");gradient=context.createRadialGradient(centerX,centerY,radius1,centerX,centerY,radius2);gradient.addColorStop(1,"white");gradient.addColorStop(0,"black");context.fillStyle=gradient;context.fillRect(0,0,width,height);return context.getImageData(0,0,width,height);};BlurStack=function(){this.r=0;this.g=0;this.b=0;this.a=0;return this.next=null;};Caman.Plugin.register("compoundBlur",function(radiusData,radius,increaseFactor,blurLevels){var b_in_sum,b_out_sum,b_sum,blend,currentIndex,div,g_in_sum,g_out_sum,g_sum,height,heightMinus1,i,iblend,idx,imagePixels,index,iradius,lookupValue,mul_sum,p,pb,pg,pixels,pr,r_in_sum,r_out_sum,r_sum,radiusPixels,radiusPlus1,rbs,shg_sum,stack,stackEnd,stackIn,stackOut,stackStart,steps,sumFactor,w4,wh,wh4,width,widthMinus1,x,y,yi,yp,yw,_i,_j,_k,_l,_m,_n,_o,_p,_q,_r;width=this.dimensions.width;height=this.dimensions.height;imagePixels=this.pixelData;radiusPixels=radiusData.data;wh=width*height;wh4=wh<<2;pixels=[];for(i=_i=0;0<=wh4?_iwh4;i=0<=wh4?++_i:--_i){pixels[i]=imagePixels[i];} -currentIndex=0;steps=blurLevels;blurLevels-=1;while(steps-->=0){iradius=(radius+0.5)|0;if(iradius===0){continue;} -if(iradius>256){iradius=256;} -div=iradius+iradius+1;w4=width<<2;widthMinus1=width-1;heightMinus1=height-1;radiusPlus1=iradius+1;sumFactor=radiusPlus1*(radiusPlus1+1)/2;stackStart=new BlurStack();stackEnd=void 0;stack=stackStart;for(i=_j=1;1<=div?_jdiv;i=1<=div?++_j:--_j){stack=stack.next=new BlurStack();if(i===radiusPlus1){stackEnd=stack;}} -stack.next=stackStart;stackIn=null;stackOut=null;yw=yi=0;mul_sum=mul_table[iradius];shg_sum=shg_table[iradius];for(y=_k=0;0<=height?_kheight;y=0<=height?++_k:--_k){r_in_sum=g_in_sum=b_in_sum=r_sum=g_sum=b_sum=0;r_out_sum=radiusPlus1*(pr=pixels[yi]);g_out_sum=radiusPlus1*(pg=pixels[yi+1]);b_out_sum=radiusPlus1*(pb=pixels[yi+2]);r_sum+=sumFactor*pr;g_sum+=sumFactor*pg;b_sum+=sumFactor*pb;stack=stackStart;for(i=_l=0;0<=radiusPlus1?_lradiusPlus1;i=0<=radiusPlus1?++_l:--_l){stack.r=pr;stack.g=pg;stack.b=pb;stack=stack.next;} -for(i=_m=1;1<=radiusPlus1?_mradiusPlus1;i=1<=radiusPlus1?++_m:--_m){p=yi+((widthMinus1width;x=0<=width?++_n:--_n){pixels[yi]=(r_sum*mul_sum)>>shg_sum;pixels[yi+1]=(g_sum*mul_sum)>>shg_sum;pixels[yi+2]=(b_sum*mul_sum)>>shg_sum;r_sum-=r_out_sum;g_sum-=g_out_sum;b_sum-=b_out_sum;r_out_sum-=stackIn.r;g_out_sum-=stackIn.g;b_out_sum-=stackIn.b;p=(yw+((p=x+radiusPlus1)width;x=0<=width?++_o:--_o){g_in_sum=b_in_sum=r_in_sum=g_sum=b_sum=r_sum=0;yi=x<<2;r_out_sum=radiusPlus1*(pr=pixels[yi]);g_out_sum=radiusPlus1*(pg=pixels[yi+1]);b_out_sum=radiusPlus1*(pb=pixels[yi+2]);r_sum+=sumFactor*pr;g_sum+=sumFactor*pg;b_sum+=sumFactor*pb;stack=stackStart;for(i=_p=0;0<=radiusPlus1?_pradiusPlus1;i=0<=radiusPlus1?++_p:--_p){stack.r=pr;stack.g=pg;stack.b=pb;stack=stack.next;} -yp=width;for(i=_q=1;1<=radiusPlus1?_qradiusPlus1;i=1<=radiusPlus1?++_q:--_q){yi=(yp+x)<<2;r_sum+=(stack.r=(pr=pixels[yi]))*(rbs=radiusPlus1-i);g_sum+=(stack.g=(pg=pixels[yi+1]))*rbs;b_sum+=(stack.b=(pb=pixels[yi+2]))*rbs;r_in_sum+=pr;g_in_sum+=pg;b_in_sum+=pb;stack=stack.next;if(iheight;y=0<=height?++_r:--_r){p=yi<<2;pixels[p]=(r_sum*mul_sum)>>shg_sum;pixels[p+1]=(g_sum*mul_sum)>>shg_sum;pixels[p+2]=(b_sum*mul_sum)>>shg_sum;r_sum-=r_out_sum;g_sum-=g_out_sum;b_sum-=b_out_sum;r_out_sum-=stackIn.r;g_out_sum-=stackIn.g;b_out_sum-=stackIn.b;p=(x+(((p=y+radiusPlus1)-1){idx=i<<2;lookupValue=(radiusPixels[idx+2]&0xff)/255.0*blurLevels;index=lookupValue|0;if(index===currentIndex){blend=256.0*(lookupValue-(lookupValue|0));iblend=256-blend;imagePixels[idx]=(imagePixels[idx]*iblend+pixels[idx]*blend)>>8;imagePixels[idx+1]=(imagePixels[idx+1]*iblend+pixels[idx+1]*blend)>>8;imagePixels[idx+2]=(imagePixels[idx+2]*iblend+pixels[idx+2]*blend)>>8;}else if(index===currentIndex+1){imagePixels[idx]=pixels[idx];imagePixels[idx+1]=pixels[idx+1];imagePixels[idx+2]=pixels[idx+2];}} -currentIndex++;} -return this;});Caman.Filter.register("tiltShift",function(opts){var defaults,gradient;defaults={center:{x:this.dimensions.width/2,y:this.dimensions.height/2},angle:45,focusWidth:200,startRadius:3,radiusFactor:1.5,steps:3};opts=Util.extend(defaults,opts);opts.angle*=Math.PI/180;gradient=getLinearGradientMap(this.dimensions.width,this.dimensions.height,opts.center.x,opts.center.y,opts.angle,opts.focusWidth,true);return this.processPlugin("compoundBlur",[gradient,opts.startRadius,opts.radiusFactor,opts.steps]);});return Caman.Filter.register("radialBlur",function(opts){var defaults,gradient,radius1,radius2;defaults={size:50,center:{x:this.dimensions.width/2,y:this.dimensions.height/2},startRadius:3,radiusFactor:1.5,steps:3,radius:null};opts=Util.extend(defaults,opts);if(!opts.radius){opts.radius=this.dimensions.widthdiv;i=1<=div?++_i:--_i){stack=stack.next=new BlurStack();if(i===radiusPlus1){stackEnd=stack;}} -stack.next=stackStart;stackIn=null;stackOut=null;yw=yi=0;mul_sum=mul_table[radius];shg_sum=shg_table[radius];for(y=_j=0;0<=height?_jheight;y=0<=height?++_j:--_j){r_in_sum=g_in_sum=b_in_sum=r_sum=g_sum=b_sum=0;r_out_sum=radiusPlus1*(pr=pixels[yi]);g_out_sum=radiusPlus1*(pg=pixels[yi+1]);b_out_sum=radiusPlus1*(pb=pixels[yi+2]);r_sum+=sumFactor*pr;g_sum+=sumFactor*pg;b_sum+=sumFactor*pb;stack=stackStart;for(i=_k=0;0<=radiusPlus1?_kradiusPlus1;i=0<=radiusPlus1?++_k:--_k){stack.r=pr;stack.g=pg;stack.b=pb;stack=stack.next;} -for(i=_l=1;1<=radiusPlus1?_lradiusPlus1;i=1<=radiusPlus1?++_l:--_l){p=yi+((widthMinus1width;x=0<=width?++_m:--_m){pixels[yi]=(r_sum*mul_sum)>>shg_sum;pixels[yi+1]=(g_sum*mul_sum)>>shg_sum;pixels[yi+2]=(b_sum*mul_sum)>>shg_sum;r_sum-=r_out_sum;g_sum-=g_out_sum;b_sum-=b_out_sum;r_out_sum-=stackIn.r;g_out_sum-=stackIn.g;b_out_sum-=stackIn.b;p=(yw+((p=x+radius+1)width;x=0<=width?++_n:--_n){g_in_sum=b_in_sum=r_in_sum=g_sum=b_sum=r_sum=0;yi=x<<2;r_out_sum=radiusPlus1*(pr=pixels[yi]);g_out_sum=radiusPlus1*(pg=pixels[yi+1]);b_out_sum=radiusPlus1*(pb=pixels[yi+2]);r_sum+=sumFactor*pr;g_sum+=sumFactor*pg;b_sum+=sumFactor*pb;stack=stackStart;for(i=_o=0;0<=radiusPlus1?_oradiusPlus1;i=0<=radiusPlus1?++_o:--_o){stack.r=pr;stack.g=pg;stack.b=pb;stack=stack.next;} -yp=width;for(i=_p=1;1<=radius?_p<=radius:_p>=radius;i=1<=radius?++_p:--_p){yi=(yp+x)<<2;r_sum+=(stack.r=(pr=pixels[yi]))*(rbs=radiusPlus1-i);g_sum+=(stack.g=(pg=pixels[yi+1]))*rbs;b_sum+=(stack.b=(pb=pixels[yi+2]))*rbs;r_in_sum+=pr;g_in_sum+=pg;b_in_sum+=pb;stack=stack.next;if(iheight;y=0<=height?++_q:--_q){p=yi<<2;pixels[p]=(r_sum*mul_sum)>>shg_sum;pixels[p+1]=(g_sum*mul_sum)>>shg_sum;pixels[p+2]=(b_sum*mul_sum)>>shg_sum;r_sum-=r_out_sum;g_sum-=g_out_sum;b_sum-=b_out_sum;r_out_sum-=stackIn.r;g_out_sum-=stackIn.g;b_out_sum-=stackIn.b;p=(x+(((p=y+radiusPlus1) 255) { + return 255; + } + return val; + }; + Util.copyAttributes = function(from, to, opts) { + var attr; + var _i; + var _len; + var _ref; + var _ref1; + var _results; + if (opts == null) { + opts = {}; + } + _ref = from.attributes; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + attr = _ref[_i]; + if ((opts.except != null) && (_ref1 = attr.nodeName, __indexOf.call(opts.except, _ref1) >= 0)) { + continue; + } + _results.push(to.setAttribute(attr.nodeName, attr.nodeValue)); + } + return _results; + }; + Util.dataArray = function(length) { + if (length == null) { + length = 0; + } + if (Caman.NodeJS || (window.Uint8Array != null)) { + return new Uint8Array(length); + } + return new Array(length); + };return Util; + })(); + if (typeof exports !== "undefined" && exports !== null) { + Root = exports; + Canvas = require('canvas'); + Image = Canvas.Image; + Fiber = require('fibers'); + fs = require('fs'); + } else { + Root = window; + } + Root.Caman = Caman = (function() { + Caman.version = { + release: "4.1.1", + date: "4/8/2013" + }; + Caman.DEBUG = false; + Caman.NodeJS = typeof exports !== "undefined" && exports !== null; + Caman.autoload = !Caman.NodeJS; + Caman.allowRevert = true; + Caman.crossOrigin = "anonymous"; + Caman.toString = function() { + return "Version " + Caman.version.release + ", Released " + Caman.version.date; + }; + Caman.remoteProxy = ""; + Caman.proxyParam = "camanProxyUrl"; + Caman.getAttrId = function(canvas) { + if (Caman.NodeJS) { + return true; + } + if (typeof canvas === "string") { + canvas = $(canvas); + } + if (!((canvas != null) && (canvas.getAttribute != null))) { + return null; + } + return canvas.getAttribute('data-caman-id'); + }; + function Caman() { + var args; + var callback; + var id; + var _this = this; + if (arguments.length === 0) { + throw "Invalid arguments"; + } + if (this instanceof Caman) { + this.finishInit = this.finishInit.bind(this); + this.imageLoaded = this.imageLoaded.bind(this); + args = arguments[0]; + if (!Caman.NodeJS) { + id = parseInt(Caman.getAttrId(args[0]), 10); + callback = typeof args[1] === "function" ? args[1] : typeof args[2] === "function" ? args[2] : function() {}; + if (!isNaN(id) && Store.has(id)) { + return Store.execute(id, callback); + } + } + this.id = Util.uniqid.get(); + this.initializedPixelData = this.originalPixelData = null; + this.cropCoordinates = { + x: 0, + y: 0 + }; + this.cropped = false; + this.resized = false; + this.pixelStack = []; + this.layerStack = []; + this.canvasQueue = []; + this.currentLayer = null; + this.scaled = false; + this.analyze = new Analyze(this); + this.renderer = new Renderer(this);this.domIsLoaded(function() { + _this.parseArguments(args);return _this.setup(); + });return this; + } else { + return new Caman(arguments); + } + } + Caman.prototype.domIsLoaded = function(cb) { + var listener; + var _this = this; + if (Caman.NodeJS) { + return setTimeout(function() { + return cb.call(_this); + }, 0); + } else { + if (document.readyState === "complete") { + Log.debug("DOM initialized");return setTimeout(function() { + return cb.call(_this); + }, 0); + } else { + listener = function() { + if (document.readyState === "complete") { + Log.debug("DOM initialized");return cb.call(_this); + } + };return document.addEventListener("readystatechange", listener, false); + } + } + }; + Caman.prototype.parseArguments = function(args) { + var key; + var val; + var _ref; + var _results; + if (args.length === 0) { + throw "Invalid arguments given"; + } + this.initObj = null; + this.initType = null; + this.imageUrl = null; + this.callback = function() {};this.setInitObject(args[0]); + if (args.length === 1) { + return; + } + switch (typeof args[1]) { + case "string": + this.imageUrl = args[1]; + break;case "function": + this.callback = args[1]; + } + if (args.length === 2) { + return; + } + this.callback = args[2]; + if (args.length === 4) { + _ref = args[4]; + _results = []; + for (key in _ref) { + if (!__hasProp.call(_ref, key)) { + continue; + } + val = _ref[key];_results.push(this.options[key] = val); + } + return _results; + } + }; + Caman.prototype.setInitObject = function(obj) { + if (Caman.NodeJS) { + this.initObj = obj; + this.initType = 'node';return; + } + if (typeof obj === "object") { + this.initObj = obj; + } else { + this.initObj = $(obj); + } + if (this.initObj == null) { + throw "Could not find image or canvas for initialization."; + } + return this.initType = this.initObj.nodeName.toLowerCase(); + }; + Caman.prototype.setup = function() { + switch (this.initType) { + case "node": + return this.initNode();case "img": + return this.initImage();case "canvas": + return this.initCanvas(); + } + }; + Caman.prototype.initNode = function() { + var _this = this; + Log.debug("Initializing for NodeJS"); + this.image = new Image(); + this.image.onload = function() { + Log.debug("Image loaded. Width = " + (_this.imageWidth()) + ", Height = " + (_this.imageHeight())); + _this.canvas = new Canvas(_this.imageWidth(), _this.imageHeight());return _this.finishInit(); + }; + this.image.onerror = function(err) { + throw err; + };return this.image.src = this.initObj; + }; + Caman.prototype.initImage = function() { + this.image = this.initObj; + this.canvas = document.createElement('canvas'); + this.context = this.canvas.getContext('2d');Util.copyAttributes(this.image, this.canvas, { + except: ['src'] + });this.image.parentNode.replaceChild(this.canvas, this.image);this.imageAdjustments();return this.waitForImageLoaded(); + }; + Caman.prototype.initCanvas = function() { + this.canvas = this.initObj; + this.context = this.canvas.getContext('2d'); + if (this.imageUrl != null) { + this.image = document.createElement('img'); + this.image.src = this.imageUrl;this.imageAdjustments();return this.waitForImageLoaded(); + } else { + return this.finishInit(); + } + }; + Caman.prototype.imageAdjustments = function() { + if (this.needsHiDPISwap()) { + Log.debug(this.image.src, "->", this.hiDPIReplacement()); + this.swapped = true; + this.image.src = this.hiDPIReplacement(); + } + if (IO.isRemote(this.image)) { + this.image.src = IO.proxyUrl(this.image.src);return Log.debug("Remote image detected, using URL = " + this.image.src); + } + }; + Caman.prototype.waitForImageLoaded = function() { + if (this.isImageLoaded()) { + return this.imageLoaded(); + } else { + return this.image.onload = this.imageLoaded; + } + }; + Caman.prototype.isImageLoaded = function() { + if (!this.image.complete) { + return false; + } + if ((this.image.naturalWidth != null) && this.image.naturalWidth === 0) { + return false; + } + return true; + }; + Caman.prototype.imageWidth = function() { + return this.image.width || this.image.naturalWidth; + }; + Caman.prototype.imageHeight = function() { + return this.image.height || this.image.naturalHeight; + }; + Caman.prototype.imageLoaded = function() { + Log.debug("Image loaded. Width = " + (this.imageWidth()) + ", Height = " + (this.imageHeight())); + if (this.swapped) { + this.canvas.width = this.imageWidth() / this.hiDPIRatio(); + this.canvas.height = this.imageHeight() / this.hiDPIRatio(); + } else { + this.canvas.width = this.imageWidth(); + this.canvas.height = this.imageHeight(); + } + return this.finishInit(); + }; + Caman.prototype.finishInit = function() { + var i; + var pixel; + var _i; + var _len; + var _ref; + if (this.context == null) { + this.context = this.canvas.getContext('2d'); + } + this.originalWidth = this.preScaledWidth = this.width = this.canvas.width; + this.originalHeight = this.preScaledHeight = this.height = this.canvas.height;this.hiDPIAdjustments(); + if (!this.hasId()) { + this.assignId(); + } + if (this.image != null) { + this.context.drawImage(this.image, 0, 0, this.imageWidth(), this.imageHeight(), 0, 0, this.preScaledWidth, this.preScaledHeight); + } + this.reloadCanvasData(); + if (Caman.allowRevert) { + this.initializedPixelData = Util.dataArray(this.pixelData.length); + this.originalPixelData = Util.dataArray(this.pixelData.length); + _ref = this.pixelData; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + pixel = _ref[i]; + this.initializedPixelData[i] = pixel; + this.originalPixelData[i] = pixel; + } + } + this.dimensions = { + width: this.canvas.width, + height: this.canvas.height + };Store.put(this.id, this);this.callback.call(this, this);return this.callback = function() {}; + }; + Caman.prototype.reloadCanvasData = function() { + this.imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height);return this.pixelData = this.imageData.data; + }; + Caman.prototype.resetOriginalPixelData = function() { + var pixel; + var _i; + var _len; + var _ref; + var _results; + if (!Caman.allowRevert) { + throw "Revert disabled"; + } + this.originalPixelData = Util.dataArray(this.pixelData.length); + _ref = this.pixelData; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + pixel = _ref[_i];_results.push(this.originalPixelData.push(pixel)); + } + return _results; + }; + Caman.prototype.hasId = function() { + return Caman.getAttrId(this.canvas) != null; + }; + Caman.prototype.assignId = function() { + if (Caman.NodeJS || this.canvas.getAttribute('data-caman-id')) { + return; + } + return this.canvas.setAttribute('data-caman-id', this.id); + }; + Caman.prototype.hiDPIDisabled = function() { + return this.canvas.getAttribute('data-caman-hidpi-disabled') !== null; + }; + Caman.prototype.hiDPIAdjustments = function() { + var ratio; + if (Caman.NodeJS || this.hiDPIDisabled()) { + return; + } + ratio = this.hiDPIRatio(); + if (ratio !== 1) { + Log.debug("HiDPI ratio = " + ratio); + this.scaled = true; + this.preScaledWidth = this.canvas.width; + this.preScaledHeight = this.canvas.height; + this.canvas.width = this.preScaledWidth * ratio; + this.canvas.height = this.preScaledHeight * ratio; + this.canvas.style.width = "" + this.preScaledWidth + "px"; + this.canvas.style.height = "" + this.preScaledHeight + "px";this.context.scale(ratio, ratio); + this.width = this.originalWidth = this.canvas.width;return this.height = this.originalHeight = this.canvas.height; + } + }; + Caman.prototype.hiDPIRatio = function() { + var backingStoreRatio; + var devicePixelRatio; + devicePixelRatio = window.devicePixelRatio || 1; + backingStoreRatio = this.context.webkitBackingStorePixelRatio || this.context.mozBackingStorePixelRatio || this.context.msBackingStorePixelRatio || this.context.oBackingStorePixelRatio || this.context.backingStorePixelRatio || 1;return devicePixelRatio / backingStoreRatio; + }; + Caman.prototype.hiDPICapable = function() { + return (window.devicePixelRatio != null) && window.devicePixelRatio !== 1; + }; + Caman.prototype.needsHiDPISwap = function() { + if (this.hiDPIDisabled() || !this.hiDPICapable()) { + return false; + } + return this.hiDPIReplacement() !== null; + }; + Caman.prototype.hiDPIReplacement = function() { + if (this.image == null) { + return null; + } + return this.image.getAttribute('data-caman-hidpi'); + }; + Caman.prototype.replaceCanvas = function(newCanvas) { + var oldCanvas; + oldCanvas = this.canvas; + this.canvas = newCanvas; + this.context = this.canvas.getContext('2d');oldCanvas.parentNode.replaceChild(this.canvas, oldCanvas); + this.width = this.canvas.width; + this.height = this.canvas.height;this.reloadCanvasData();return this.dimensions = { + width: this.canvas.width, + height: this.canvas.height + }; + }; + Caman.prototype.render = function(callback) { + var _this = this; + if (callback == null) { + callback = function() {}; + } + Event.trigger(this, "renderStart");return this.renderer.execute(function() { + _this.context.putImageData(_this.imageData, 0, 0);return callback.call(_this); + }); + }; + Caman.prototype.revert = function() { + var i; + var pixel; + var _i; + var _len; + var _ref; + if (!Caman.allowRevert) { + throw "Revert disabled"; + } + _ref = this.originalVisiblePixels(); + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + pixel = _ref[i]; + this.pixelData[i] = pixel; + } + return this.context.putImageData(this.imageData, 0, 0); + }; + Caman.prototype.reset = function() { + var canvas; + var ctx; + var i; + var imageData; + var pixel; + var pixelData; + var _i; + var _len; + var _ref; + canvas = document.createElement('canvas');Util.copyAttributes(this.canvas, canvas); + canvas.width = this.originalWidth; + canvas.height = this.originalHeight; + ctx = canvas.getContext('2d'); + imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); + pixelData = imageData.data; + _ref = this.initializedPixelData; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + pixel = _ref[i]; + pixelData[i] = pixel; + } + ctx.putImageData(imageData, 0, 0); + this.cropCoordinates = { + x: 0, + y: 0 + }; + this.resized = false;return this.replaceCanvas(canvas); + }; + Caman.prototype.originalVisiblePixels = function() { + var canvas; + var coord; + var ctx; + var endX; + var endY; + var i; + var imageData; + var pixel; + var pixelData; + var pixels; + var scaledCanvas; + var startX; + var startY; + var width; + var _i; + var _j; + var _len; + var _ref; + var _ref1; + var _ref2; + var _ref3; + if (!Caman.allowRevert) { + throw "Revert disabled"; + } + pixels = []; + startX = this.cropCoordinates.x; + endX = startX + this.width; + startY = this.cropCoordinates.y; + endY = startY + this.height; + if (this.resized) { + canvas = document.createElement('canvas'); + canvas.width = this.originalWidth; + canvas.height = this.originalHeight; + ctx = canvas.getContext('2d'); + imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); + pixelData = imageData.data; + _ref = this.originalPixelData; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + pixel = _ref[i]; + pixelData[i] = pixel; + } + ctx.putImageData(imageData, 0, 0); + scaledCanvas = document.createElement('canvas'); + scaledCanvas.width = this.width; + scaledCanvas.height = this.height; + ctx = scaledCanvas.getContext('2d');ctx.drawImage(canvas, 0, 0, this.originalWidth, this.originalHeight, 0, 0, this.width, this.height); + pixelData = ctx.getImageData(0, 0, this.width, this.height).data; + width = this.width; + } else { + pixelData = this.originalPixelData; + width = this.originalWidth; + } + for (i = _j = 0, _ref1 = pixelData.length; _j < _ref1; i = _j += 4) { + coord = PixelInfo.locationToCoordinates(i, width); + if (((startX <= (_ref2 = coord.x) && _ref2 < endX)) && ((startY <= (_ref3 = coord.y) && _ref3 < endY))) { + pixels.push(pixelData[i], pixelData[i + 1], pixelData[i + 2], pixelData[i + 3]); + } + } + return pixels; + }; + Caman.prototype.process = function(name, processFn) { + this.renderer.add({ + type: Filter.Type.Single, + name: name, + processFn: processFn + });return this; + }; + Caman.prototype.processKernel = function(name, adjust, divisor, bias) { + var i; + var _i; + var _ref; + if (!divisor) { + divisor = 0; + for (i = _i = 0, _ref = adjust.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + divisor += adjust[i]; + } + } + this.renderer.add({ + type: Filter.Type.Kernel, + name: name, + adjust: adjust, + divisor: divisor, + bias: bias || 0 + });return this; + }; + Caman.prototype.processPlugin = function(plugin, args) { + this.renderer.add({ + type: Filter.Type.Plugin, + plugin: plugin, + args: args + });return this; + }; + Caman.prototype.newLayer = function(callback) { + var layer; + layer = new Layer(this);this.canvasQueue.push(layer);this.renderer.add({ + type: Filter.Type.LayerDequeue + });callback.call(layer);this.renderer.add({ + type: Filter.Type.LayerFinished + });return this; + }; + Caman.prototype.executeLayer = function(layer) { + return this.pushContext(layer); + }; + Caman.prototype.pushContext = function(layer) { + this.layerStack.push(this.currentLayer);this.pixelStack.push(this.pixelData); + this.currentLayer = layer;return this.pixelData = layer.pixelData; + }; + Caman.prototype.popContext = function() { + this.pixelData = this.pixelStack.pop();return this.currentLayer = this.layerStack.pop(); + }; + Caman.prototype.applyCurrentLayer = function() { + return this.currentLayer.applyToParent(); + };return Caman; + })(); + Analyze = (function() { + function Analyze(c) { + this.c = c; + } + Analyze.prototype.calculateLevels = function() { + var i; + var levels; + var numPixels; + var _i; + var _j; + var _k; + var _ref; + levels = { + r: {}, + g: {}, + b: {} + }; + for (i = _i = 0; _i <= 255; i = ++_i) { + levels.r[i] = 0; + levels.g[i] = 0; + levels.b[i] = 0; + } + for (i = _j = 0, _ref = this.c.pixelData.length; _j < _ref; i = _j += 4) { + levels.r[this.c.pixelData[i]]++;levels.g[this.c.pixelData[i+1]]++;levels.b[this.c.pixelData[i+2]]++; + } + numPixels = this.c.pixelData.length / 4; + for (i = _k = 0; _k <= 255; i = ++_k) { + levels.r[i] /= numPixels; + levels.g[i] /= numPixels; + levels.b[i] /= numPixels; + } + return levels; + };return Analyze; + })(); + Caman.DOMUpdated = function() { + var img; + var imgs; + var parser; + var _i; + var _len; + var _results; + imgs = document.querySelectorAll("img[data-caman]"); + if (!(imgs.length > 0)) { + return; + } + _results = []; + for (_i = 0, _len = imgs.length; _i < _len; _i++) { + img = imgs[_i];_results.push(parser = new CamanParser(img, function() { + this.parse();return this.execute(); + })); + } + return _results; + }; + if (Caman.autoload) { + (function() { + if (document.readyState === "complete") { + return Caman.DOMUpdated(); + } else { + return document.addEventListener("DOMContentLoaded", Caman.DOMUpdated, false); + } + })(); + } + CamanParser = (function() { + var INST_REGEX; + INST_REGEX = "(\\w+)\\((.*?)\\)"; + function CamanParser(ele, ready) { + this.dataStr = ele.getAttribute('data-caman'); + this.caman = Caman(ele, ready.bind(this)); + } + CamanParser.prototype.parse = function() { + var args; + var filter; + var func; + var inst; + var instFunc; + var m; + var r; + var unparsedInstructions; + var _i; + var _len; + var _ref; + var _results; + this.ele = this.caman.canvas; + r = new RegExp(INST_REGEX, 'g'); + unparsedInstructions = this.dataStr.match(r); + if (!(unparsedInstructions.length > 0)) { + return; + } + r = new RegExp(INST_REGEX); + _results = []; + for (_i = 0, _len = unparsedInstructions.length; _i < _len; _i++) { + inst = unparsedInstructions[_i];_ref = inst.match(r), m = _ref[0], filter = _ref[1], args = _ref[2]; + instFunc = new Function("return function() { this." + filter + "(" + args + "); };");try { + func = instFunc();_results.push(func.call(this.caman)); + } catch ( e ) { + _results.push(Log.debug(e)); + } + } + return _results; + }; + CamanParser.prototype.execute = function() { + var ele; + ele = this.ele;return this.caman.render(function() { + return ele.parentNode.replaceChild(this.toImage(), ele); + }); + };return CamanParser; + })(); + Caman.Blender = Blender = (function() { + function Blender() { + } + Blender.blenders = {}; + Blender.register = function(name, func) { + return this.blenders[name] = func; + }; + Blender.execute = function(name, rgbaLayer, rgbaParent) { + return this.blenders[name](rgbaLayer, rgbaParent); + };return Blender; + })(); + Caman.Calculate = Calculate = (function() { + function Calculate() { + } + Calculate.distance = function(x1, y1, x2, y2) { + return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); + }; + Calculate.randomRange = function(min, max, getFloat) { + var rand; + if (getFloat == null) { + getFloat = false; + } + rand = min + (Math.random() * (max - min)); + if (getFloat) { + return rand.toFixed(getFloat); + } else { + return Math.round(rand); + } + }; + Calculate.luminance = function(rgba) { + return (0.299 * rgba.r) + (0.587 * rgba.g) + (0.114 * rgba.b); + }; + Calculate.bezier = function(start, ctrl1, ctrl2, end, lowBound, highBound) { + var Ax; + var Ay; + var Bx; + var By; + var Cx; + var Cy; + var bezier; + var curveX; + var curveY; + var i; + var j; + var leftCoord; + var rightCoord; + var t; + var x0; + var x1; + var x2; + var x3; + var y0; + var y1; + var y2; + var y3; + var _i; + var _j; + var _k; + var _ref; + var _ref1; + x0 = start[0]; + y0 = start[1]; + x1 = ctrl1[0]; + y1 = ctrl1[1]; + x2 = ctrl2[0]; + y2 = ctrl2[1]; + x3 = end[0]; + y3 = end[1]; + bezier = {}; + Cx = parseInt(3 * (x1 - x0), 10); + Bx = 3 * (x2 - x1) - Cx; + Ax = x3 - x0 - Cx - Bx; + Cy = 3 * (y1 - y0); + By = 3 * (y2 - y1) - Cy; + Ay = y3 - y0 - Cy - By; + for (i = _i = 0; _i < 1000; i = ++_i) { + t = i / 1000; + curveX = Math.round((Ax * Math.pow(t, 3)) + (Bx * Math.pow(t, 2)) + (Cx * t) + x0); + curveY = Math.round((Ay * Math.pow(t, 3)) + (By * Math.pow(t, 2)) + (Cy * t) + y0); + if (lowBound && curveY < lowBound) { + curveY = lowBound; + } else if (highBound && curveY > highBound) { + curveY = highBound; + } + bezier[curveX] = curveY; + } + if (bezier.length < end[0] + 1) { + for (i = _j = 0, _ref = end[0]; 0 <= _ref ? _j <= _ref : _j >= _ref; i = 0 <= _ref ? ++_j : --_j) { + if (bezier[i] == null) { + leftCoord = [i - 1, bezier[i - 1]]; + for (j = _k = i, _ref1 = end[0]; i <= _ref1 ? _k <= _ref1 : _k >= _ref1; j = i <= _ref1 ? ++_k : --_k) { + if (bezier[j] != null) { + rightCoord = [j, bezier[j]];break; + } + } + bezier[i] = leftCoord[1] + ((rightCoord[1] - leftCoord[1]) / (rightCoord[0] - leftCoord[0])) * (i - leftCoord[0]); + } + } + } + if (bezier[end[0]] == null) { + bezier[end[0]] = bezier[end[0] - 1]; + } + return bezier; + };return Calculate; + })(); + Convert = (function() { + function Convert() { + } + Convert.hexToRGB = function(hex) { + var b; + var g; + var r; + if (hex.charAt(0) === "#") { + hex = hex.substr(1); + } + r = parseInt(hex.substr(0, 2), 16); + g = parseInt(hex.substr(2, 2), 16); + b = parseInt(hex.substr(4, 2), 16);return { + r: r, + g: g, + b: b + }; + }; + Convert.rgbToHSL = function(r, g, b) { + var d; + var h; + var l; + var max; + var min; + var s; + if (typeof r === "object") { + g = r.g; + b = r.b; + r = r.r; + } + r /= 255; + g /= 255; + b /= 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = (function() { + switch (max) { + case r: + return (g - b) / d + (g < b ? 6 : 0);case g: + return (b - r) / d + 2;case b: + return (r - g) / d + 4; + } + })(); + h /= 6; + } + return { + h: h, + s: s, + l: l + }; + }; + Convert.hslToRGB = function(h, s, l) { + var b; + var g; + var p; + var q; + var r; + if (typeof h === "object") { + s = h.s; + l = h.l; + h = h.h; + } + if (s === 0) { + r = g = b = l; + } else { + q = l < 0.5 ? l * (1 + s) : l + s - l * s; + p = 2 * l - q; + r = this.hueToRGB(p, q, h + 1 / 3); + g = this.hueToRGB(p, q, h); + b = this.hueToRGB(p, q, h - 1 / 3); + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + }; + Convert.hueToRGB = function(p, q, t) { + if (t < 0) { + t += 1; + } + if (t > 1) { + t -= 1; + } + if (t < 1 / 6) { + return p + (q - p) * 6 * t; + } + if (t < 1 / 2) { + return q; + } + if (t < 2 / 3) { + return p + (q - p) * (2 / 3 - t) * 6; + } + return p; + }; + Convert.rgbToHSV = function(r, g, b) { + var d; + var h; + var max; + var min; + var s; + var v; + r /= 255; + g /= 255; + b /= 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + v = max; + d = max - min; + s = max === 0 ? 0 : d / max; + if (max === min) { + h = 0; + } else { + h = (function() { + switch (max) { + case r: + return (g - b) / d + (g < b ? 6 : 0);case g: + return (b - r) / d + 2;case b: + return (r - g) / d + 4; + } + })(); + h /= 6; + } + return { + h: h, + s: s, + v: v + }; + }; + Convert.hsvToRGB = function(h, s, v) { + var b; + var f; + var g; + var i; + var p; + var q; + var r; + var t; + i = Math.floor(h * 6); + f = h * 6 - i; + p = v * (1 - s); + q = v * (1 - f * s); + t = v * (1 - (1 - f) * s);switch (i % 6) { + case 0: + r = v;g = t;b = p; + break;case 1: + r = q;g = v;b = p; + break;case 2: + r = p;g = v;b = t; + break;case 3: + r = p;g = q;b = v; + break;case 4: + r = t;g = p;b = v; + break;case 5: + r = v;g = p;b = q; + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + }; + Convert.rgbToXYZ = function(r, g, b) { + var x; + var y; + var z; + r /= 255; + g /= 255; + b /= 255; + if (r > 0.04045) { + r = Math.pow((r + 0.055) / 1.055, 2.4); + } else { + r /= 12.92; + } + if (g > 0.04045) { + g = Math.pow((g + 0.055) / 1.055, 2.4); + } else { + g /= 12.92; + } + if (b > 0.04045) { + b = Math.pow((b + 0.055) / 1.055, 2.4); + } else { + b /= 12.92; + } + x = r * 0.4124 + g * 0.3576 + b * 0.1805; + y = r * 0.2126 + g * 0.7152 + b * 0.0722; + z = r * 0.0193 + g * 0.1192 + b * 0.9505;return { + x: x * 100, + y: y * 100, + z: z * 100 + }; + }; + Convert.xyzToRGB = function(x, y, z) { + var b; + var g; + var r; + x /= 100; + y /= 100; + z /= 100; + r = (3.2406 * x) + (-1.5372 * y) + (-0.4986 * z); + g = (-0.9689 * x) + (1.8758 * y) + (0.0415 * z); + b = (0.0557 * x) + (-0.2040 * y) + (1.0570 * z); + if (r > 0.0031308) { + r = (1.055 * Math.pow(r, 0.4166666667)) - 0.055; + } else { + r *= 12.92; + } + if (g > 0.0031308) { + g = (1.055 * Math.pow(g, 0.4166666667)) - 0.055; + } else { + g *= 12.92; + } + if (b > 0.0031308) { + b = (1.055 * Math.pow(b, 0.4166666667)) - 0.055; + } else { + b *= 12.92; + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + }; + Convert.xyzToLab = function(x, y, z) { + var a; + var b; + var l; + var whiteX; + var whiteY; + var whiteZ; + if (typeof x === "object") { + y = x.y; + z = x.z; + x = x.x; + } + whiteX = 95.047; + whiteY = 100.0; + whiteZ = 108.883; + x /= whiteX; + y /= whiteY; + z /= whiteZ; + if (x > 0.008856451679) { + x = Math.pow(x, 0.3333333333); + } else { + x = (7.787037037 * x) + 0.1379310345; + } + if (y > 0.008856451679) { + y = Math.pow(y, 0.3333333333); + } else { + y = (7.787037037 * y) + 0.1379310345; + } + if (z > 0.008856451679) { + z = Math.pow(z, 0.3333333333); + } else { + z = (7.787037037 * z) + 0.1379310345; + } + l = 116 * y - 16; + a = 500 * (x - y); + b = 200 * (y - z);return { + l: l, + a: a, + b: b + }; + }; + Convert.labToXYZ = function(l, a, b) { + var x; + var y; + var z; + if (typeof l === "object") { + a = l.a; + b = l.b; + l = l.l; + } + y = (l + 16) / 116; + x = y + (a / 500); + z = y - (b / 200); + if (x > 0.2068965517) { + x = x * x * x; + } else { + x = 0.1284185493 * (x - 0.1379310345); + } + if (y > 0.2068965517) { + y = y * y * y; + } else { + y = 0.1284185493 * (y - 0.1379310345); + } + if (z > 0.2068965517) { + z = z * z * z; + } else { + z = 0.1284185493 * (z - 0.1379310345); + } + return { + x: x * 95.047, + y: y * 100.0, + z: z * 108.883 + }; + }; + Convert.rgbToLab = function(r, g, b) { + var xyz; + if (typeof r === "object") { + g = r.g; + b = r.b; + r = r.r; + } + xyz = this.rgbToXYZ(r, g, b);return this.xyzToLab(xyz); + }; + Convert.labToRGB = function(l, a, b) {};return Convert; + })(); + Event = (function() { + function Event() { + } + Event.events = {}; + Event.types = ["processStart", "processComplete", "renderStart", "renderFinished", "blockStarted", "blockFinished"]; + Event.trigger = function(target, type, data) { + var event; + var _i; + var _len; + var _ref; + var _results; + if (this.events[type] && this.events[type].length) { + _ref = this.events[type]; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + event = _ref[_i]; + if (event.target === null || target.id === event.target.id) { + _results.push(event.fn.call(target, data)); + } else { + _results.push(void 0); + } + } + return _results; + } + }; + Event.listen = function(target, type, fn) { + var _fn; + var _type; + if (typeof target === "string") { + _type = target; + _fn = type; + target = null; + type = _type; + fn = _fn; + } + if (__indexOf.call(this.types, type) < 0) { + return false; + } + if (!this.events[type]) { + this.events[type] = []; + } + this.events[type].push({ + target: target, + fn: fn + });return true; + };return Event; + })(); + Caman.Event = Event; + Caman.Filter = Filter = (function() { + function Filter() { + } + Filter.Type = { + Single: 1, + Kernel: 2, + LayerDequeue: 3, + LayerFinished: 4, + LoadOverlay: 5, + Plugin: 6 + }; + Filter.register = function(name, filterFunc) { + return Caman.prototype[name] = filterFunc; + };return Filter; + })(); + Caman.IO = IO = (function() { + function IO() { + } + IO.domainRegex = /(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/; + IO.isRemote = function(img) { + if (img == null) { + return false; + } + if (this.corsEnabled(img)) { + return false; + } + return this.isURLRemote(img.src); + }; + IO.corsEnabled = function(img) { + var _ref; + return (img.crossOrigin != null) && ((_ref = img.crossOrigin.toLowerCase()) === 'anonymous' || _ref === 'use-credentials'); + }; + IO.isURLRemote = function(url) { + var matches; + matches = url.match(this.domainRegex); + if (matches) { + return matches[1] !== document.domain; + } else { + return false; + } + }; + IO.remoteCheck = function(src) { + if (this.isURLRemote(src)) { + if (!Caman.remoteProxy.length) { + Log.info("Attempting to load a remote image without a configured proxy. URL: " + src); + } else { + if (Caman.isURLRemote(Caman.remoteProxy)) { + Log.info("Cannot use a remote proxy for loading images.");return; + } + return "" + Caman.remoteProxy + "?camanProxyUrl=" + (encodeURIComponent(src)); + } + } + }; + IO.proxyUrl = function(src) { + return "" + Caman.remoteProxy + "?" + Caman.proxyParam + "=" + (encodeURIComponent(src)); + }; + IO.useProxy = function(lang) { + var langToExt; + langToExt = { + ruby: 'rb', + python: 'py', + perl: 'pl', + javascript: 'js' + }; + lang = lang.toLowerCase(); + if (langToExt[lang] != null) { + lang = langToExt[lang]; + } + return "proxies/caman_proxy." + lang; + };return IO; + })(); + Caman.prototype.save = function() { + if (typeof exports !== "undefined" && exports !== null) { + return this.nodeSave.apply(this, arguments); + } else { + return this.browserSave.apply(this, arguments); + } + }; + Caman.prototype.browserSave = function(type) { + var image; + if (type == null) { + type = "png"; + } + type = type.toLowerCase(); + image = this.toBase64(type).replace("image/" + type, "image/octet-stream");return document.location.href = image; + }; + Caman.prototype.nodeSave = function(file, overwrite) { + var stats; + if (overwrite == null) { + overwrite = true; + } + try { + stats = fs.statSync(file); + if (stats.isFile() && !overwrite) { + return false; + } + } catch ( e ) { + Log.debug("Creating output file " + file); + } + return fs.writeFile(file, this.canvas.toBuffer(), function() { + return Log.debug("Finished writing to " + file); + }); + }; + Caman.prototype.toImage = function(type) { + var img; + img = document.createElement('img'); + img.src = this.toBase64(type); + img.width = this.dimensions.width; + img.height = this.dimensions.height; + if (window.devicePixelRatio) { + img.width /= window.devicePixelRatio; + img.height /= window.devicePixelRatio; + } + return img; + }; + Caman.prototype.toBase64 = function(type) { + if (type == null) { + type = "png"; + } + type = type.toLowerCase();return this.canvas.toDataURL("image/" + type); + }; + Layer = (function() { + function Layer(c) { + this.c = c; + this.filter = this.c; + this.options = { + blendingMode: 'normal', + opacity: 1.0 + }; + this.layerID = Util.uniqid.get(); + this.canvas = typeof exports !== "undefined" && exports !== null ? new Canvas() : document.createElement('canvas'); + this.canvas.width = this.c.dimensions.width; + this.canvas.height = this.c.dimensions.height; + this.context = this.canvas.getContext('2d');this.context.createImageData(this.canvas.width, this.canvas.height); + this.imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height); + this.pixelData = this.imageData.data; + } + Layer.prototype.newLayer = function(cb) { + return this.c.newLayer.call(this.c, cb); + }; + Layer.prototype.setBlendingMode = function(mode) { + this.options.blendingMode = mode;return this; + }; + Layer.prototype.opacity = function(opacity) { + this.options.opacity = opacity / 100;return this; + }; + Layer.prototype.copyParent = function() { + var i; + var parentData; + var _i; + var _ref; + parentData = this.c.pixelData; + for (i = _i = 0, _ref = this.c.pixelData.length; _i < _ref; i = _i += 4) { + this.pixelData[i] = parentData[i]; + this.pixelData[i + 1] = parentData[i + 1]; + this.pixelData[i + 2] = parentData[i + 2]; + this.pixelData[i + 3] = parentData[i + 3]; + } + return this; + }; + Layer.prototype.fillColor = function() { + return this.c.fillColor.apply(this.c, arguments); + }; + Layer.prototype.overlayImage = function(image) { + if (typeof image === "object") { + image = image.src; + } else if (typeof image === "string" && image[0] === "#") { + image = $(image).src; + } + if (!image) { + return this; + } + this.c.renderer.renderQueue.push({ + type: Filter.Type.LoadOverlay, + src: image, + layer: this + });return this; + }; + Layer.prototype.applyToParent = function() { + var i; + var layerData; + var parentData; + var result; + var rgbaLayer; + var rgbaParent; + var _i; + var _ref; + var _results; + parentData = this.c.pixelStack[this.c.pixelStack.length - 1]; + layerData = this.c.pixelData; + _results = []; + for (i = _i = 0, _ref = layerData.length; _i < _ref; i = _i += 4) { + rgbaParent = { + r: parentData[i], + g: parentData[i + 1], + b: parentData[i + 2], + a: parentData[i + 3] + }; + rgbaLayer = { + r: layerData[i], + g: layerData[i + 1], + b: layerData[i + 2], + a: layerData[i + 3] + }; + result = Blender.execute(this.options.blendingMode, rgbaLayer, rgbaParent); + result.r = Util.clampRGB(result.r); + result.g = Util.clampRGB(result.g); + result.b = Util.clampRGB(result.b); + if (result.a == null) { + result.a = rgbaLayer.a; + } + parentData[i] = rgbaParent.r - ((rgbaParent.r - result.r) * (this.options.opacity * (result.a / 255))); + parentData[i + 1] = rgbaParent.g - ((rgbaParent.g - result.g) * (this.options.opacity * (result.a / 255)));_results.push(parentData[i + 2] = rgbaParent.b - ((rgbaParent.b - result.b) * (this.options.opacity * (result.a / 255)))); + } + return _results; + };return Layer; + })(); + Logger = (function() { + function Logger() { + var name; + var _i; + var _len; + var _ref; + _ref = ['log', 'info', 'warn', 'error']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + name = _ref[_i]; + this[name] = (function(name) { + return function() { + var args; + args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + if (!Caman.DEBUG) { + return; + } + try { + return console[name].apply(console, args); + } catch ( e ) { + return console[name](args); + } + }; + })(name); + } + this.debug = this.log; + } + return Logger; + })(); + Log = new Logger(); + PixelInfo = (function() { + PixelInfo.coordinatesToLocation = function(x, y, width) { + return (y * width + x) * 4; + }; + PixelInfo.locationToCoordinates = function(loc, width) { + var x; + var y; + y = Math.floor(loc / (width * 4)); + x = (loc % (width * 4)) / 4;return { + x: x, + y: y + }; + }; + function PixelInfo(c) { + this.c = c; + this.loc = 0; + } + PixelInfo.prototype.locationXY = function() { + var x; + var y; + y = this.c.dimensions.height - Math.floor(this.loc / (this.c.dimensions.width * 4)); + x = (this.loc % (this.c.dimensions.width * 4)) / 4;return { + x: x, + y: y + }; + }; + PixelInfo.prototype.getPixelRelative = function(horiz, vert) { + var newLoc; + newLoc = this.loc + (this.c.dimensions.width * 4 * (vert * -1)) + (4 * horiz); + if (newLoc > this.c.pixelData.length || newLoc < 0) { + return { + r: 0, + g: 0, + b: 0, + a: 0 + }; + } + return { + r: this.c.pixelData[newLoc], + g: this.c.pixelData[newLoc + 1], + b: this.c.pixelData[newLoc + 2], + a: this.c.pixelData[newLoc + 3] + }; + }; + PixelInfo.prototype.putPixelRelative = function(horiz, vert, rgba) { + var nowLoc; + nowLoc = this.loc + (this.c.dimensions.width * 4 * (vert * -1)) + (4 * horiz); + if (newLoc > this.c.pixelData.length || newLoc < 0) { + return; + } + this.c.pixelData[newLoc] = rgba.r; + this.c.pixelData[newLoc + 1] = rgba.g; + this.c.pixelData[newLoc + 2] = rgba.b; + this.c.pixelData[newLoc + 3] = rgba.a;return true; + }; + PixelInfo.prototype.getPixel = function(x, y) { + var loc; + loc = this.coordinatesToLocation(x, y, this.width);return { + r: this.c.pixelData[loc], + g: this.c.pixelData[loc + 1], + b: this.c.pixelData[loc + 2], + a: this.c.pixelData[loc + 3] + }; + }; + PixelInfo.prototype.putPixel = function(x, y, rgba) { + var loc; + loc = this.coordinatesToLocation(x, y, this.width); + this.c.pixelData[loc] = rgba.r; + this.c.pixelData[loc + 1] = rgba.g; + this.c.pixelData[loc + 2] = rgba.b;return this.c.pixelData[loc + 3] = rgba.a; + };return PixelInfo; + })(); + Plugin = (function() { + function Plugin() { + } + Plugin.plugins = {}; + Plugin.register = function(name, plugin) { + return this.plugins[name] = plugin; + }; + Plugin.execute = function(context, name, args) { + return this.plugins[name].apply(context, args); + };return Plugin; + })(); + Caman.Plugin = Plugin; + Caman.Renderer = Renderer = (function() { + Renderer.Blocks = Caman.NodeJS ? require('os').cpus().length : 4; + function Renderer(c) { + var _this = this; + this.c = c; + this.processNext = function() { + return Renderer.prototype.processNext.apply(_this, arguments); + }; + this.renderQueue = []; + this.modPixelData = null; + } + Renderer.prototype.add = function(job) { + if (job == null) { + return; + } + return this.renderQueue.push(job); + }; + Renderer.prototype.processNext = function() { + var layer; + if (this.renderQueue.length === 0) { + Event.trigger(this, "renderFinished"); + if (this.finishedFn != null) { + this.finishedFn.call(this.c); + } + return this; + } + this.currentJob = this.renderQueue.shift();switch (this.currentJob.type) { + case Filter.Type.LayerDequeue: + layer = this.c.canvasQueue.shift();this.c.executeLayer(layer);return this.processNext();case Filter.Type.LayerFinished: + this.c.applyCurrentLayer();this.c.popContext();return this.processNext();case Filter.Type.LoadOverlay: + return this.loadOverlay(this.currentJob.layer, this.currentJob.src);case Filter.Type.Plugin: + return this.executePlugin();default: + return this.executeFilter(); + } + }; + Renderer.prototype.execute = function(callback) { + this.finishedFn = callback; + this.modPixelData = Util.dataArray(this.c.pixelData.length);return this.processNext(); + }; + Renderer.prototype.eachBlock = function(fn) { + var blockN; + var blockPixelLength; + var bnum; + var end; + var f; + var i; + var lastBlockN; + var n; + var start; + var _i; + var _ref; + var _results; + var _this = this; + this.blocksDone = 0; + n = this.c.pixelData.length; + blockPixelLength = Math.floor((n / 4) / Renderer.Blocks); + blockN = blockPixelLength * 4; + lastBlockN = blockN + ((n / 4) % Renderer.Blocks) * 4; + _results = []; + for (i = _i = 0, _ref = Renderer.Blocks; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + start = i * blockN; + end = start + (i === Renderer.Blocks - 1 ? lastBlockN : blockN); + if (Caman.NodeJS) { + f = Fiber(function() { + return fn.call(_this, i, start, end); + }); + bnum = f.run();_results.push(this.blockFinished(bnum)); + } else { + _results.push(setTimeout((function(i, start, end) { + return function() { + return fn.call(_this, i, start, end); + }; + })(i, start, end), 0)); + } + } + return _results; + }; + Renderer.prototype.executeFilter = function() { + Event.trigger(this.c, "processStart", this.currentJob); + if (this.currentJob.type === Filter.Type.Single) { + return this.eachBlock(this.renderBlock); + } else { + return this.eachBlock(this.renderKernel); + } + }; + Renderer.prototype.executePlugin = function() { + Log.debug("Executing plugin " + this.currentJob.plugin);Plugin.execute(this.c, this.currentJob.plugin, this.currentJob.args);Log.debug("Plugin " + this.currentJob.plugin + " finished!");return this.processNext(); + }; + Renderer.prototype.renderBlock = function(bnum, start, end) { + var data; + var i; + var pixelInfo; + var res; + var _i; + Log.debug("Block #" + bnum + " - Filter: " + this.currentJob.name + ", Start: " + start + ", End: " + end);Event.trigger(this.c, "blockStarted", { + blockNum: bnum, + totalBlocks: Renderer.Blocks, + startPixel: start, + endPixel: end + }); + data = { + r: 0, + g: 0, + b: 0, + a: 0 + }; + pixelInfo = new PixelInfo(this.c); + for (i = _i = start; _i < end; i = _i += 4) { + pixelInfo.loc = i; + data.r = this.c.pixelData[i]; + data.g = this.c.pixelData[i + 1]; + data.b = this.c.pixelData[i + 2]; + data.a = this.c.pixelData[i + 3]; + res = this.currentJob.processFn.call(pixelInfo, data); + if (res.a == null) { + res.a = data.a; + } + this.c.pixelData[i] = Util.clampRGB(res.r); + this.c.pixelData[i + 1] = Util.clampRGB(res.g); + this.c.pixelData[i + 2] = Util.clampRGB(res.b); + this.c.pixelData[i + 3] = Util.clampRGB(res.a); + } + if (Caman.NodeJS) { + return Fiber["yield"](bnum); + } else { + return this.blockFinished(bnum); + } + }; + Renderer.prototype.renderKernel = function(bnum, start, end) { + var adjust; + var adjustSize; + var bias; + var builder; + var builderIndex; + var divisor; + var i; + var j; + var k; + var kernel; + var n; + var name; + var pixel; + var pixelInfo; + var res; + var _i; + var _j; + var _k; + name = this.currentJob.name; + bias = this.currentJob.bias; + divisor = this.currentJob.divisor; + n = this.c.pixelData.length; + adjust = this.currentJob.adjust; + adjustSize = Math.sqrt(adjust.length); + kernel = [];Log.debug("Rendering kernel - Filter: " + this.currentJob.name); + start = Math.max(start, this.c.dimensions.width * 4 * ((adjustSize - 1) / 2)); + end = Math.min(end, n - (this.c.dimensions.width * 4 * ((adjustSize - 1) / 2))); + builder = (adjustSize - 1) / 2; + pixelInfo = new PixelInfo(this.c); + for (i = _i = start; _i < end; i = _i += 4) { + pixelInfo.loc = i; + builderIndex = 0; + for (j = _j = -builder; -builder <= builder ? _j <= builder : _j >= builder; j = -builder <= builder ? ++_j : --_j) { + for (k = _k = builder; builder <= -builder ? _k <= -builder : _k >= -builder; k = builder <= -builder ? ++_k : --_k) { + pixel = pixelInfo.getPixelRelative(j, k); + kernel[builderIndex * 3] = pixel.r; + kernel[builderIndex * 3 + 1] = pixel.g; + kernel[builderIndex * 3 + 2] = pixel.b;builderIndex++; + } + } + res = this.processKernel(adjust, kernel, divisor, bias); + this.modPixelData[i] = Util.clampRGB(res.r); + this.modPixelData[i + 1] = Util.clampRGB(res.g); + this.modPixelData[i + 2] = Util.clampRGB(res.b); + this.modPixelData[i + 3] = this.c.pixelData[i + 3]; + } + if (Caman.NodeJS) { + return Fiber["yield"](bnum); + } else { + return this.blockFinished(bnum); + } + }; + Renderer.prototype.blockFinished = function(bnum) { + var i; + var _i; + var _ref; + if (bnum >= 0) { + Log.debug("Block #" + bnum + " finished! Filter: " + this.currentJob.name); + } + this.blocksDone++;Event.trigger(this.c, "blockFinished", { + blockNum: bnum, + blocksFinished: this.blocksDone, + totalBlocks: Renderer.Blocks + }); + if (this.blocksDone === Renderer.Blocks) { + if (this.currentJob.type === Filter.Type.Kernel) { + for (i = _i = 0, _ref = this.c.pixelData.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + this.c.pixelData[i] = this.modPixelData[i]; + } + } + if (bnum >= 0) { + Log.debug("Filter " + this.currentJob.name + " finished!"); + } + Event.trigger(this.c, "processComplete", this.currentJob);return this.processNext(); + } + }; + Renderer.prototype.processKernel = function(adjust, kernel, divisor, bias) { + var i; + var val; + var _i; + var _ref; + val = { + r: 0, + g: 0, + b: 0 + }; + for (i = _i = 0, _ref = adjust.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + val.r += adjust[i] * kernel[i * 3]; + val.g += adjust[i] * kernel[i * 3 + 1]; + val.b += adjust[i] * kernel[i * 3 + 2]; + } + val.r = (val.r / divisor) + bias; + val.g = (val.g / divisor) + bias; + val.b = (val.b / divisor) + bias;return val; + }; + Renderer.prototype.loadOverlay = function(layer, src) { + var img; + var proxyUrl; + var _this = this; + img = document.createElement('img'); + img.onload = function() { + layer.context.drawImage(img, 0, 0, _this.c.dimensions.width, _this.c.dimensions.height); + layer.imageData = layer.context.getImageData(0, 0, _this.c.dimensions.width, _this.c.dimensions.height); + layer.pixelData = layer.imageData.data; + _this.c.pixelData = layer.pixelData;return _this.processNext(); + }; + proxyUrl = IO.remoteCheck(src);return img.src = proxyUrl != null ? proxyUrl : src; + };return Renderer; + })(); + Caman.Store = Store = (function() { + function Store() { + } + Store.items = {}; + Store.has = function(search) { + return this.items[search] != null; + }; + Store.get = function(search) { + return this.items[search]; + }; + Store.put = function(name, obj) { + return this.items[name] = obj; + }; + Store.execute = function(search, callback) { + var _this = this; + setTimeout(function() { + return callback.call(_this.get(search), _this.get(search)); + }, 0);return this.get(search); + }; + Store.flush = function(name) { + if (name == null) { + name = false; + } + if (name) { + return delete this.items[name]; + } else { + return this.items = {}; + } + };return Store; + })();Blender.register("normal", function(rgbaLayer, rgbaParent) { + return { + r: rgbaLayer.r, + g: rgbaLayer.g, + b: rgbaLayer.b + }; + });Blender.register("multiply", function(rgbaLayer, rgbaParent) { + return { + r: (rgbaLayer.r * rgbaParent.r) / 255, + g: (rgbaLayer.g * rgbaParent.g) / 255, + b: (rgbaLayer.b * rgbaParent.b) / 255 + }; + });Blender.register("screen", function(rgbaLayer, rgbaParent) { + return { + r: 255 - (((255 - rgbaLayer.r) * (255 - rgbaParent.r)) / 255), + g: 255 - (((255 - rgbaLayer.g) * (255 - rgbaParent.g)) / 255), + b: 255 - (((255 - rgbaLayer.b) * (255 - rgbaParent.b)) / 255) + }; + });Blender.register("overlay", function(rgbaLayer, rgbaParent) { + var result; + result = {}; + result.r = rgbaParent.r > 128 ? 255 - 2 * (255 - rgbaLayer.r) * (255 - rgbaParent.r) / 255 : (rgbaParent.r * rgbaLayer.r * 2) / 255; + result.g = rgbaParent.g > 128 ? 255 - 2 * (255 - rgbaLayer.g) * (255 - rgbaParent.g) / 255 : (rgbaParent.g * rgbaLayer.g * 2) / 255; + result.b = rgbaParent.b > 128 ? 255 - 2 * (255 - rgbaLayer.b) * (255 - rgbaParent.b) / 255 : (rgbaParent.b * rgbaLayer.b * 2) / 255;return result; + });Blender.register("difference", function(rgbaLayer, rgbaParent) { + return { + r: rgbaLayer.r - rgbaParent.r, + g: rgbaLayer.g - rgbaParent.g, + b: rgbaLayer.b - rgbaParent.b + }; + });Blender.register("addition", function(rgbaLayer, rgbaParent) { + return { + r: rgbaParent.r + rgbaLayer.r, + g: rgbaParent.g + rgbaLayer.g, + b: rgbaParent.b + rgbaLayer.b + }; + });Blender.register("exclusion", function(rgbaLayer, rgbaParent) { + return { + r: 128 - 2 * (rgbaParent.r - 128) * (rgbaLayer.r - 128) / 255, + g: 128 - 2 * (rgbaParent.g - 128) * (rgbaLayer.g - 128) / 255, + b: 128 - 2 * (rgbaParent.b - 128) * (rgbaLayer.b - 128) / 255 + }; + });Blender.register("softLight", function(rgbaLayer, rgbaParent) { + var result; + result = {}; + result.r = rgbaParent.r > 128 ? 255 - ((255 - rgbaParent.r) * (255 - (rgbaLayer.r - 128))) / 255 : (rgbaParent.r * (rgbaLayer.r + 128)) / 255; + result.g = rgbaParent.g > 128 ? 255 - ((255 - rgbaParent.g) * (255 - (rgbaLayer.g - 128))) / 255 : (rgbaParent.g * (rgbaLayer.g + 128)) / 255; + result.b = rgbaParent.b > 128 ? 255 - ((255 - rgbaParent.b) * (255 - (rgbaLayer.b - 128))) / 255 : (rgbaParent.b * (rgbaLayer.b + 128)) / 255;return result; + });Blender.register("lighten", function(rgbaLayer, rgbaParent) { + return { + r: rgbaParent.r > rgbaLayer.r ? rgbaParent.r : rgbaLayer.r, + g: rgbaParent.g > rgbaLayer.g ? rgbaParent.g : rgbaLayer.g, + b: rgbaParent.b > rgbaLayer.b ? rgbaParent.b : rgbaLayer.b + }; + });Blender.register("darken", function(rgbaLayer, rgbaParent) { + return { + r: rgbaParent.r > rgbaLayer.r ? rgbaLayer.r : rgbaParent.r, + g: rgbaParent.g > rgbaLayer.g ? rgbaLayer.g : rgbaParent.g, + b: rgbaParent.b > rgbaLayer.b ? rgbaLayer.b : rgbaParent.b + }; + });Filter.register("fillColor", function() { + var color; + if (arguments.length === 1) { + color = Convert.hexToRGB(arguments[0]); + } else { + color = { + r: arguments[0], + g: arguments[1], + b: arguments[2] + }; + } + return this.process("fillColor", function(rgba) { + rgba.r = color.r; + rgba.g = color.g; + rgba.b = color.b; + rgba.a = 255;return rgba; + }); + });Filter.register("brightness", function(adjust) { + adjust = Math.floor(255 * (adjust / 100));return this.process("brightness", function(rgba) { + rgba.r += adjust; + rgba.g += adjust; + rgba.b += adjust;return rgba; + }); + });Filter.register("saturation", function(adjust) { + adjust *= -0.01;return this.process("saturation", function(rgba) { + var max; + max = Math.max(rgba.r, rgba.g, rgba.b); + if (rgba.r !== max) { + rgba.r += (max - rgba.r) * adjust; + } + if (rgba.g !== max) { + rgba.g += (max - rgba.g) * adjust; + } + if (rgba.b !== max) { + rgba.b += (max - rgba.b) * adjust; + } + return rgba; + }); + });Filter.register("vibrance", function(adjust) { + adjust *= -1;return this.process("vibrance", function(rgba) { + var amt; + var avg; + var max; + max = Math.max(rgba.r, rgba.g, rgba.b); + avg = (rgba.r + rgba.g + rgba.b) / 3; + amt = ((Math.abs(max - avg) * 2 / 255) * adjust) / 100; + if (rgba.r !== max) { + rgba.r += (max - rgba.r) * amt; + } + if (rgba.g !== max) { + rgba.g += (max - rgba.g) * amt; + } + if (rgba.b !== max) { + rgba.b += (max - rgba.b) * amt; + } + return rgba; + }); + });Filter.register("greyscale", function(adjust) { + return this.process("greyscale", function(rgba) { + var avg; + avg = Calculate.luminance(rgba); + rgba.r = avg; + rgba.g = avg; + rgba.b = avg;return rgba; + }); + });Filter.register("contrast", function(adjust) { + adjust = Math.pow((adjust + 100) / 100, 2);return this.process("contrast", function(rgba) { + rgba.r /= 255; + rgba.r -= 0.5; + rgba.r *= adjust; + rgba.r += 0.5; + rgba.r *= 255; + rgba.g /= 255; + rgba.g -= 0.5; + rgba.g *= adjust; + rgba.g += 0.5; + rgba.g *= 255; + rgba.b /= 255; + rgba.b -= 0.5; + rgba.b *= adjust; + rgba.b += 0.5; + rgba.b *= 255;return rgba; + }); + });Filter.register("hue", function(adjust) { + return this.process("hue", function(rgba) { + var h; + var hsv; + var rgb; + hsv = Convert.rgbToHSV(rgba.r, rgba.g, rgba.b); + h = hsv.h * 100; + h += Math.abs(adjust); + h = h % 100; + h /= 100; + hsv.h = h; + rgb = Convert.hsvToRGB(hsv.h, hsv.s, hsv.v); + rgb.a = rgba.a;return rgb; + }); + });Filter.register("colorize", function() { + var level; + var rgb; + if (arguments.length === 2) { + rgb = Convert.hexToRGB(arguments[0]); + level = arguments[1]; + } else if (arguments.length === 4) { + rgb = { + r: arguments[0], + g: arguments[1], + b: arguments[2] + }; + level = arguments[3]; + } + return this.process("colorize", function(rgba) { + rgba.r -= (rgba.r - rgb.r) * (level / 100); + rgba.g -= (rgba.g - rgb.g) * (level / 100); + rgba.b -= (rgba.b - rgb.b) * (level / 100);return rgba; + }); + });Filter.register("invert", function() { + return this.process("invert", function(rgba) { + rgba.r = 255 - rgba.r; + rgba.g = 255 - rgba.g; + rgba.b = 255 - rgba.b;return rgba; + }); + });Filter.register("sepia", function(adjust) { + if (adjust == null) { + adjust = 100; + } + adjust /= 100;return this.process("sepia", function(rgba) { + rgba.r = Math.min(255, (rgba.r * (1 - (0.607 * adjust))) + (rgba.g * (0.769 * adjust)) + (rgba.b * (0.189 * adjust))); + rgba.g = Math.min(255, (rgba.r * (0.349 * adjust)) + (rgba.g * (1 - (0.314 * adjust))) + (rgba.b * (0.168 * adjust))); + rgba.b = Math.min(255, (rgba.r * (0.272 * adjust)) + (rgba.g * (0.534 * adjust)) + (rgba.b * (1 - (0.869 * adjust))));return rgba; + }); + });Filter.register("gamma", function(adjust) { + return this.process("gamma", function(rgba) { + rgba.r = Math.pow(rgba.r / 255, adjust) * 255; + rgba.g = Math.pow(rgba.g / 255, adjust) * 255; + rgba.b = Math.pow(rgba.b / 255, adjust) * 255;return rgba; + }); + });Filter.register("noise", function(adjust) { + adjust = Math.abs(adjust) * 2.55;return this.process("noise", function(rgba) { + var rand; + rand = Calculate.randomRange(adjust * -1, adjust); + rgba.r += rand; + rgba.g += rand; + rgba.b += rand;return rgba; + }); + });Filter.register("clip", function(adjust) { + adjust = Math.abs(adjust) * 2.55;return this.process("clip", function(rgba) { + if (rgba.r > 255 - adjust) { + rgba.r = 255; + } else if (rgba.r < adjust) { + rgba.r = 0; + } + if (rgba.g > 255 - adjust) { + rgba.g = 255; + } else if (rgba.g < adjust) { + rgba.g = 0; + } + if (rgba.b > 255 - adjust) { + rgba.b = 255; + } else if (rgba.b < adjust) { + rgba.b = 0; + } + return rgba; + }); + });Filter.register("channels", function(options) { + var chan; + var value; + if (typeof options !== "object") { + return this; + } + for (chan in options) { + if (!__hasProp.call(options, chan)) { + continue; + } + value = options[chan]; + if (value === 0) { + delete options[chan]; + continue; + } + options[chan] /= 100; + } + if (options.length === 0) { + return this; + } + return this.process("channels", function(rgba) { + if (options.red != null) { + if (options.red > 0) { + rgba.r += (255 - rgba.r) * options.red; + } else { + rgba.r -= rgba.r * Math.abs(options.red); + } + } + if (options.green != null) { + if (options.green > 0) { + rgba.g += (255 - rgba.g) * options.green; + } else { + rgba.g -= rgba.g * Math.abs(options.green); + } + } + if (options.blue != null) { + if (options.blue > 0) { + rgba.b += (255 - rgba.b) * options.blue; + } else { + rgba.b -= rgba.b * Math.abs(options.blue); + } + } + return rgba; + }); + });Filter.register("curves", function() { + var bezier; + var chans; + var cps; + var ctrl1; + var ctrl2; + var end; + var i; + var start; + var _i; + var _j; + var _ref; + var _ref1; + chans = arguments[0], cps = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if (typeof chans === "string") { + chans = chans.split(""); + } + if (chans[0] === "v") { + chans = ['r', 'g', 'b']; + } + if (cps.length < 3 || cps.length > 4) { + throw "Invalid number of arguments to curves filter"; + } + start = cps[0]; + ctrl1 = cps[1]; + ctrl2 = cps.length === 4 ? cps[2] : cps[1]; + end = cps[cps.length - 1]; + bezier = Calculate.bezier(start, ctrl1, ctrl2, end, 0, 255); + if (start[0] > 0) { + for (i = _i = 0, _ref = start[0]; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + bezier[i] = start[1]; + } + } + if (end[0] < 255) { + for (i = _j = _ref1 = end[0]; _ref1 <= 255 ? _j <= 255 : _j >= 255; i = _ref1 <= 255 ? ++_j : --_j) { + bezier[i] = end[1]; + } + } + return this.process("curves", function(rgba) { + var _k; + var _ref2; + for (i = _k = 0, _ref2 = chans.length; 0 <= _ref2 ? _k < _ref2 : _k > _ref2; i = 0 <= _ref2 ? ++_k : --_k) { + rgba[chans[i]] = bezier[rgba[chans[i]]]; + } + return rgba; + }); + });Filter.register("exposure", function(adjust) { + var ctrl1; + var ctrl2; + var p; + p = Math.abs(adjust) / 100; + ctrl1 = [0, 255 * p]; + ctrl2 = [255 - (255 * p), 255]; + if (adjust < 0) { + ctrl1 = ctrl1.reverse(); + ctrl2 = ctrl2.reverse(); + } + return this.curves('rgb', [0, 0], ctrl1, ctrl2, [255, 255]); + });Caman.Plugin.register("crop", function(width, height, x, y) { + var canvas; + var ctx; + if (x == null) { + x = 0; + } + if (y == null) { + y = 0; + } + if (typeof exports !== "undefined" && exports !== null) { + canvas = new Canvas(width, height); + } else { + canvas = document.createElement('canvas');Util.copyAttributes(this.canvas, canvas); + canvas.width = width; + canvas.height = height; + } + ctx = canvas.getContext('2d');ctx.drawImage(this.canvas, x, y, width, height, 0, 0, width, height); + this.cropCoordinates = { + x: x, + y: y + }; + this.cropped = true;return this.replaceCanvas(canvas); + });Caman.Plugin.register("resize", function(newDims) { + var canvas; + var ctx; + if (newDims == null) { + newDims = null; + } + if (newDims === null || ((newDims.width == null) && (newDims.height == null))) { + Log.error("Invalid or missing dimensions given for resize");return; + } + if (newDims.width == null) { + newDims.width = this.canvas.width * newDims.height / this.canvas.height; + } else if (newDims.height == null) { + newDims.height = this.canvas.height * newDims.width / this.canvas.width; + } + if (typeof exports !== "undefined" && exports !== null) { + canvas = new Canvas(newDims.width, newDims.height); + } else { + canvas = document.createElement('canvas');Util.copyAttributes(this.canvas, canvas); + canvas.width = newDims.width; + canvas.height = newDims.height; + } + ctx = canvas.getContext('2d');ctx.drawImage(this.canvas, 0, 0, this.canvas.width, this.canvas.height, 0, 0, newDims.width, newDims.height); + this.resized = true;return this.replaceCanvas(canvas); + });Caman.Filter.register("crop", function() { + return this.processPlugin("crop", Array.prototype.slice.call(arguments, 0)); + });Caman.Filter.register("resize", function() { + return this.processPlugin("resize", Array.prototype.slice.call(arguments, 0)); + });Caman.Filter.register("boxBlur", function() { + return this.processKernel("Box Blur", [1, 1, 1, 1, 1, 1, 1, 1, 1]); + });Caman.Filter.register("heavyRadialBlur", function() { + return this.processKernel("Heavy Radial Blur", [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0]); + });Caman.Filter.register("gaussianBlur", function() { + return this.processKernel("Gaussian Blur", [1, 4, 6, 4, 1, 4, 16, 24, 16, 4, 6, 24, 36, 24, 6, 4, 16, 24, 16, 4, 1, 4, 6, 4, 1]); + });Caman.Filter.register("motionBlur", function(degrees) { + var kernel; + if (degrees === 0 || degrees === 180) { + kernel = [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0]; + } else if ((degrees > 0 && degrees < 90) || (degrees > 180 && degrees < 270)) { + kernel = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0]; + } else if (degrees === 90 || degrees === 270) { + kernel = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + } else { + kernel = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]; + } + return this.processKernel("Motion Blur", kernel); + });Caman.Filter.register("sharpen", function(amt) { + if (amt == null) { + amt = 100; + } + amt /= 100;return this.processKernel("Sharpen", [0, -amt, 0, -amt, 4 * amt + 1, -amt, 0, -amt, 0]); + }); + vignetteFilters = { + brightness: function(rgba, amt, opts) { + rgba.r = rgba.r - (rgba.r * amt * opts.strength); + rgba.g = rgba.g - (rgba.g * amt * opts.strength); + rgba.b = rgba.b - (rgba.b * amt * opts.strength);return rgba; + }, + gamma: function(rgba, amt, opts) { + rgba.r = Math.pow(rgba.r / 255, Math.max(10 * amt * opts.strength, 1)) * 255; + rgba.g = Math.pow(rgba.g / 255, Math.max(10 * amt * opts.strength, 1)) * 255; + rgba.b = Math.pow(rgba.b / 255, Math.max(10 * amt * opts.strength, 1)) * 255;return rgba; + }, + colorize: function(rgba, amt, opts) { + rgba.r -= (rgba.r - opts.color.r) * amt; + rgba.g -= (rgba.g - opts.color.g) * amt; + rgba.b -= (rgba.b - opts.color.b) * amt;return rgba; + } + };Filter.register("vignette", function(size, strength) { + var bezier; + var center; + var end; + var start; + if (strength == null) { + strength = 60; + } + if (typeof size === "string" && size.substr(-1) === "%") { + if (this.dimensions.height > this.dimensions.width) { + size = this.dimensions.width * (parseInt(size.substr(0, size.length - 1), 10) / 100); + } else { + size = this.dimensions.height * (parseInt(size.substr(0, size.length - 1), 10) / 100); + } + } + strength /= 100; + center = [this.dimensions.width / 2, this.dimensions.height / 2]; + start = Math.sqrt(Math.pow(center[0], 2) + Math.pow(center[1], 2)); + end = start - size; + bezier = Calculate.bezier([0, 1], [30, 30], [70, 60], [100, 80]);return this.process("vignette", function(rgba) { + var dist; + var div; + var loc; + loc = this.locationXY(); + dist = Calculate.distance(loc.x, loc.y, center[0], center[1]); + if (dist > end) { + div = Math.max(1, (bezier[Math.round(((dist - end) / size) * 100)] / 10) * strength); + rgba.r = Math.pow(rgba.r / 255, div) * 255; + rgba.g = Math.pow(rgba.g / 255, div) * 255; + rgba.b = Math.pow(rgba.b / 255, div) * 255; + } + return rgba; + }); + });Filter.register("rectangularVignette", function(opts) { + var defaults; + var dim; + var percent; + var size; + var _i; + var _len; + var _ref; + defaults = { + strength: 50, + cornerRadius: 0, + method: 'brightness', + color: { + r: 0, + g: 0, + b: 0 + } + }; + opts = Util.extend(defaults, opts); + if (!opts.size) { + return this; + } else if (typeof opts.size === "string") { + percent = parseInt(opts.size, 10) / 100; + opts.size = { + width: this.dimensions.width * percent, + height: this.dimensions.height * percent + }; + } else if (typeof opts.size === "object") { + _ref = ["width", "height"]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + dim = _ref[_i]; + if (typeof opts.size[dim] === "string") { + opts.size[dim] = this.dimensions[dim] * (parseInt(opts.size[dim], 10) / 100); + } + } + } else if (opts.size === "number") { + size = opts.size; + opts.size = { + width: size, + height: size + }; + } + if (typeof opts.cornerRadius === "string") { + opts.cornerRadius = (opts.size.width / 2) * (parseInt(opts.cornerRadius, 10) / 100); + } + opts.strength /= 100; + opts.size.width = Math.floor(opts.size.width); + opts.size.height = Math.floor(opts.size.height); + opts.image = { + width: this.dimensions.width, + height: this.dimensions.height + }; + if (opts.method === "colorize" && typeof opts.color === "string") { + opts.color = Convert.hexToRGB(opts.color); + } + opts.coords = { + left: (this.dimensions.width - opts.size.width) / 2, + right: this.dimensions.width - opts.coords.left, + bottom: (this.dimensions.height - opts.size.height) / 2, + top: this.dimensions.height - opts.coords.bottom + }; + opts.corners = [{ + x: opts.coords.left + opts.cornerRadius, + y: opts.coords.top - opts.cornerRadius + }, { + x: opts.coords.right - opts.cornerRadius, + y: opts.coords.top - opts.cornerRadius + }, { + x: opts.coords.right - opts.cornerRadius, + y: opts.coords.bottom + opts.cornerRadius + }, { + x: opts.coords.left + opts.cornerRadius, + y: opts.coords.bottom + opts.cornerRadius + }]; + opts.maxDist = Calculate.distance(0, 0, opts.corners[3].x, opts.corners[3].y) - opts.cornerRadius;return this.process("rectangularVignette", function(rgba) { + var amt; + var loc; + var radialDist; + loc = this.locationXY(); + if ((loc.x > opts.corners[0].x && loc.x < opts.corners[1].x) && (loc.y > opts.coords.bottom && loc.y < opts.coords.top)) { + return rgba; + } + if ((loc.x > opts.coords.left && loc.x < opts.coords.right) && (loc.y > opts.corners[3].y && loc.y < opts.corners[2].y)) { + return rgba; + } + if (loc.x > opts.corners[0].x && loc.x < opts.corners[1].x && loc.y > opts.coords.top) { + amt = (loc.y - opts.coords.top) / opts.maxDist; + } else if (loc.y > opts.corners[2].y && loc.y < opts.corners[1].y && loc.x > opts.coords.right) { + amt = (loc.x - opts.coords.right) / opts.maxDist; + } else if (loc.x > opts.corners[0].x && loc.x < opts.corners[1].x && loc.y < opts.coords.bottom) { + amt = (opts.coords.bottom - loc.y) / opts.maxDist; + } else if (loc.y > opts.corners[2].y && loc.y < opts.corners[1].y && loc.x < opts.coords.left) { + amt = (opts.coords.left - loc.x) / opts.maxDist; + } else if (loc.x <= opts.corners[0].x && loc.y >= opts.corners[0].y) { + radialDist = Caman.distance(loc.x, loc.y, opts.corners[0].x, opts.corners[0].y); + amt = (radialDist - opts.cornerRadius) / opts.maxDist; + } else if (loc.x >= opts.corners[1].x && loc.y >= opts.corners[1].y) { + radialDist = Caman.distance(loc.x, loc.y, opts.corners[1].x, opts.corners[1].y); + amt = (radialDist - opts.cornerRadius) / opts.maxDist; + } else if (loc.x >= opts.corners[2].x && loc.y <= opts.corners[2].y) { + radialDist = Caman.distance(loc.x, loc.y, opts.corners[2].x, opts.corners[2].y); + amt = (radialDist - opts.cornerRadius) / opts.maxDist; + } else if (loc.x <= opts.corners[3].x && loc.y <= opts.corners[3].y) { + radialDist = Caman.distance(loc.x, loc.y, opts.corners[3].x, opts.corners[3].y); + amt = (radialDist - opts.cornerRadius) / opts.maxDist; + } + if (amt < 0) { + return rgba; + } + return vignetteFilters[opts.method](rgba, amt, opts); + }); + });(function() { + var BlurStack; + var getLinearGradientMap; + var getRadialGradientMap; + var mul_table; + var shg_table; + mul_table = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259]; + shg_table = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]; + getLinearGradientMap = function(width, height, centerX, centerY, angle, length, mirrored) { + var cnv; + var context; + var gradient; + var x1; + var x2; + var y1; + var y2; + cnv = typeof exports !== "undefined" && exports !== null ? new Canvas() : document.createElement('canvas'); + cnv.width = width; + cnv.height = height; + x1 = centerX + Math.cos(angle) * length * 0.5; + y1 = centerY + Math.sin(angle) * length * 0.5; + x2 = centerX - Math.cos(angle) * length * 0.5; + y2 = centerY - Math.sin(angle) * length * 0.5; + context = cnv.getContext("2d"); + gradient = context.createLinearGradient(x1, y1, x2, y2); + if (!mirrored) { + gradient.addColorStop(0, "white");gradient.addColorStop(1, "black"); + } else { + gradient.addColorStop(0, "white");gradient.addColorStop(0.5, "black");gradient.addColorStop(1, "white"); + } + context.fillStyle = gradient;context.fillRect(0, 0, width, height);return context.getImageData(0, 0, width, height); + }; + getRadialGradientMap = function(width, height, centerX, centerY, radius1, radius2) { + var cnv; + var context; + var gradient; + cnv = typeof exports !== "undefined" && exports !== null ? new Canvas() : document.createElement('canvas'); + cnv.width = width; + cnv.height = height; + context = cnv.getContext("2d"); + gradient = context.createRadialGradient(centerX, centerY, radius1, centerX, centerY, radius2);gradient.addColorStop(1, "white");gradient.addColorStop(0, "black"); + context.fillStyle = gradient;context.fillRect(0, 0, width, height);return context.getImageData(0, 0, width, height); + }; + BlurStack = function() { + this.r = 0; + this.g = 0; + this.b = 0; + this.a = 0;return this.next = null; + };Caman.Plugin.register("compoundBlur", function(radiusData, radius, increaseFactor, blurLevels) { + var b_in_sum; + var b_out_sum; + var b_sum; + var blend; + var currentIndex; + var div; + var g_in_sum; + var g_out_sum; + var g_sum; + var height; + var heightMinus1; + var i; + var iblend; + var idx; + var imagePixels; + var index; + var iradius; + var lookupValue; + var mul_sum; + var p; + var pb; + var pg; + var pixels; + var pr; + var r_in_sum; + var r_out_sum; + var r_sum; + var radiusPixels; + var radiusPlus1; + var rbs; + var shg_sum; + var stack; + var stackEnd; + var stackIn; + var stackOut; + var stackStart; + var steps; + var sumFactor; + var w4; + var wh; + var wh4; + var width; + var widthMinus1; + var x; + var y; + var yi; + var yp; + var yw; + var _i; + var _j; + var _k; + var _l; + var _m; + var _n; + var _o; + var _p; + var _q; + var _r; + width = this.dimensions.width; + height = this.dimensions.height; + imagePixels = this.pixelData; + radiusPixels = radiusData.data; + wh = width * height; + wh4 = wh << 2; + pixels = []; + for (i = _i = 0; 0 <= wh4 ? _i < wh4 : _i > wh4; i = 0 <= wh4 ? ++_i : --_i) { + pixels[i] = imagePixels[i]; + } + currentIndex = 0; + steps = blurLevels; + blurLevels -= 1; + while (steps-- >= 0) { + iradius = (radius + 0.5) | 0; + if (iradius === 0) { + continue; + } + if (iradius > 256) { + iradius = 256; + } + div = iradius + iradius + 1; + w4 = width << 2; + widthMinus1 = width - 1; + heightMinus1 = height - 1; + radiusPlus1 = iradius + 1; + sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2; + stackStart = new BlurStack(); + stackEnd = void 0; + stack = stackStart; + for (i = _j = 1; 1 <= div ? _j < div : _j > div; i = 1 <= div ? ++_j : --_j) { + stack = stack.next = new BlurStack(); + if (i === radiusPlus1) { + stackEnd = stack; + } + } + stack.next = stackStart; + stackIn = null; + stackOut = null; + yw = yi = 0; + mul_sum = mul_table[iradius]; + shg_sum = shg_table[iradius]; + for (y = _k = 0; 0 <= height ? _k < height : _k > height; y = 0 <= height ? ++_k : --_k) { + r_in_sum = g_in_sum = b_in_sum = r_sum = g_sum = b_sum = 0; + r_out_sum = radiusPlus1 * (pr = pixels[yi]); + g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]); + b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]); + r_sum += sumFactor * pr; + g_sum += sumFactor * pg; + b_sum += sumFactor * pb; + stack = stackStart; + for (i = _l = 0; 0 <= radiusPlus1 ? _l < radiusPlus1 : _l > radiusPlus1; i = 0 <= radiusPlus1 ? ++_l : --_l) { + stack.r = pr; + stack.g = pg; + stack.b = pb; + stack = stack.next; + } + for (i = _m = 1; 1 <= radiusPlus1 ? _m < radiusPlus1 : _m > radiusPlus1; i = 1 <= radiusPlus1 ? ++_m : --_m) { + p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2); + r_sum += (stack.r = (pr = pixels[p])) * (rbs = radiusPlus1 - i); + g_sum += (stack.g = (pg = pixels[p + 1])) * rbs; + b_sum += (stack.b = (pb = pixels[p + 2])) * rbs; + r_in_sum += pr; + g_in_sum += pg; + b_in_sum += pb; + stack = stack.next; + } + stackIn = stackStart; + stackOut = stackEnd; + for (x = _n = 0; 0 <= width ? _n < width : _n > width; x = 0 <= width ? ++_n : --_n) { + pixels[yi] = (r_sum * mul_sum) >> shg_sum; + pixels[yi + 1] = (g_sum * mul_sum) >> shg_sum; + pixels[yi + 2] = (b_sum * mul_sum) >> shg_sum; + r_sum -= r_out_sum; + g_sum -= g_out_sum; + b_sum -= b_out_sum; + r_out_sum -= stackIn.r; + g_out_sum -= stackIn.g; + b_out_sum -= stackIn.b; + p = (yw + ((p = x + radiusPlus1) < widthMinus1 ? p : widthMinus1)) << 2; + r_in_sum += (stackIn.r = pixels[p]); + g_in_sum += (stackIn.g = pixels[p + 1]); + b_in_sum += (stackIn.b = pixels[p + 2]); + r_sum += r_in_sum; + g_sum += g_in_sum; + b_sum += b_in_sum; + stackIn = stackIn.next; + r_out_sum += (pr = stackOut.r); + g_out_sum += (pg = stackOut.g); + b_out_sum += (pb = stackOut.b); + r_in_sum -= pr; + g_in_sum -= pg; + b_in_sum -= pb; + stackOut = stackOut.next; + yi += 4; + } + yw += width; + } + for (x = _o = 0; 0 <= width ? _o < width : _o > width; x = 0 <= width ? ++_o : --_o) { + g_in_sum = b_in_sum = r_in_sum = g_sum = b_sum = r_sum = 0; + yi = x << 2; + r_out_sum = radiusPlus1 * (pr = pixels[yi]); + g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]); + b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]); + r_sum += sumFactor * pr; + g_sum += sumFactor * pg; + b_sum += sumFactor * pb; + stack = stackStart; + for (i = _p = 0; 0 <= radiusPlus1 ? _p < radiusPlus1 : _p > radiusPlus1; i = 0 <= radiusPlus1 ? ++_p : --_p) { + stack.r = pr; + stack.g = pg; + stack.b = pb; + stack = stack.next; + } + yp = width; + for (i = _q = 1; 1 <= radiusPlus1 ? _q < radiusPlus1 : _q > radiusPlus1; i = 1 <= radiusPlus1 ? ++_q : --_q) { + yi = (yp + x) << 2; + r_sum += (stack.r = (pr = pixels[yi])) * (rbs = radiusPlus1 - i); + g_sum += (stack.g = (pg = pixels[yi + 1])) * rbs; + b_sum += (stack.b = (pb = pixels[yi + 2])) * rbs; + r_in_sum += pr; + g_in_sum += pg; + b_in_sum += pb; + stack = stack.next; + if (i < heightMinus1) { + yp += width; + } + } + yi = x; + stackIn = stackStart; + stackOut = stackEnd; + for (y = _r = 0; 0 <= height ? _r < height : _r > height; y = 0 <= height ? ++_r : --_r) { + p = yi << 2; + pixels[p] = (r_sum * mul_sum) >> shg_sum; + pixels[p + 1] = (g_sum * mul_sum) >> shg_sum; + pixels[p + 2] = (b_sum * mul_sum) >> shg_sum; + r_sum -= r_out_sum; + g_sum -= g_out_sum; + b_sum -= b_out_sum; + r_out_sum -= stackIn.r; + g_out_sum -= stackIn.g; + b_out_sum -= stackIn.b; + p = (x + (((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width)) << 2; + r_sum += (r_in_sum += (stackIn.r = pixels[p])); + g_sum += (g_in_sum += (stackIn.g = pixels[p + 1])); + b_sum += (b_in_sum += (stackIn.b = pixels[p + 2])); + stackIn = stackIn.next; + r_out_sum += (pr = stackOut.r); + g_out_sum += (pg = stackOut.g); + b_out_sum += (pb = stackOut.b); + r_in_sum -= pr; + g_in_sum -= pg; + b_in_sum -= pb; + stackOut = stackOut.next; + yi += width; + } + } + radius *= increaseFactor; + i = wh; + while (--i > -1) { + idx = i << 2; + lookupValue = (radiusPixels[idx + 2] & 0xff) / 255.0 * blurLevels; + index = lookupValue | 0; + if (index === currentIndex) { + blend = 256.0 * (lookupValue - (lookupValue | 0)); + iblend = 256 - blend; + imagePixels[idx] = (imagePixels[idx] * iblend + pixels[idx] * blend) >> 8; + imagePixels[idx + 1] = (imagePixels[idx + 1] * iblend + pixels[idx + 1] * blend) >> 8; + imagePixels[idx + 2] = (imagePixels[idx + 2] * iblend + pixels[idx + 2] * blend) >> 8; + } else if (index === currentIndex + 1) { + imagePixels[idx] = pixels[idx]; + imagePixels[idx + 1] = pixels[idx + 1]; + imagePixels[idx + 2] = pixels[idx + 2]; + } + } + currentIndex++; + } + return this; + });Caman.Filter.register("tiltShift", function(opts) { + var defaults; + var gradient; + defaults = { + center: { + x: this.dimensions.width / 2, + y: this.dimensions.height / 2 + }, + angle: 45, + focusWidth: 200, + startRadius: 3, + radiusFactor: 1.5, + steps: 3 + }; + opts = Util.extend(defaults, opts); + opts.angle *= Math.PI / 180; + gradient = getLinearGradientMap(this.dimensions.width, this.dimensions.height, opts.center.x, opts.center.y, opts.angle, opts.focusWidth, true);return this.processPlugin("compoundBlur", [gradient, opts.startRadius, opts.radiusFactor, opts.steps]); + });return Caman.Filter.register("radialBlur", function(opts) { + var defaults; + var gradient; + var radius1; + var radius2; + defaults = { + size: 50, + center: { + x: this.dimensions.width / 2, + y: this.dimensions.height / 2 + }, + startRadius: 3, + radiusFactor: 1.5, + steps: 3, + radius: null + }; + opts = Util.extend(defaults, opts); + if (!opts.radius) { + opts.radius = this.dimensions.width < this.dimensions.height ? this.dimensions.height : this.dimensions.width; + } + radius1 = (opts.radius / 2) - opts.size; + radius2 = opts.radius / 2; + gradient = getRadialGradientMap(this.dimensions.width, this.dimensions.height, opts.center.x, opts.center.y, radius1, radius2);return this.processPlugin("compoundBlur", [gradient, opts.startRadius, opts.radiusFactor, opts.steps]); + }); + })();Caman.Filter.register("edgeEnhance", function() { + return this.processKernel("Edge Enhance", [0, 0, 0, -1, 1, 0, 0, 0, 0]); + });Caman.Filter.register("edgeDetect", function() { + return this.processKernel("Edge Detect", [-1, -1, -1, -1, 8, -1, -1, -1, -1]); + });Caman.Filter.register("emboss", function() { + return this.processKernel("Emboss", [-2, -1, 0, -1, 1, 1, 0, 1, 2]); + });Caman.Filter.register("posterize", function(adjust) { + var numOfAreas; + var numOfValues; + numOfAreas = 256 / adjust; + numOfValues = 255 / (adjust - 1);return this.process("posterize", function(rgba) { + rgba.r = Math.floor(Math.floor(rgba.r / numOfAreas) * numOfValues); + rgba.g = Math.floor(Math.floor(rgba.g / numOfAreas) * numOfValues); + rgba.b = Math.floor(Math.floor(rgba.b / numOfAreas) * numOfValues);return rgba; + }); + });Caman.Filter.register("vintage", function(vignette) { + if (vignette == null) { + vignette = true; + } + this.greyscale();this.contrast(5);this.noise(3);this.sepia(100);this.channels({ + red: 8, + blue: 2, + green: 4 + });this.gamma(0.87); + if (vignette) { + return this.vignette("40%", 30); + } + });Caman.Filter.register("lomo", function(vignette) { + if (vignette == null) { + vignette = true; + } + this.brightness(15);this.exposure(15);this.curves('rgb', [0, 0], [200, 0], [155, 255], [255, 255]);this.saturation(-20);this.gamma(1.8); + if (vignette) { + this.vignette("50%", 60); + } + return this.brightness(5); + });Caman.Filter.register("clarity", function(grey) { + if (grey == null) { + grey = false; + } + this.vibrance(20);this.curves('rgb', [5, 0], [130, 150], [190, 220], [250, 255]);this.sharpen(15);this.vignette("45%", 20); + if (grey) { + this.greyscale();this.contrast(4); + } + return this; + });Caman.Filter.register("sinCity", function() { + this.contrast(100);this.brightness(15);this.exposure(10);this.posterize(80);this.clip(30);return this.greyscale(); + });Caman.Filter.register("sunrise", function() { + this.exposure(3.5);this.saturation(-5);this.vibrance(50);this.sepia(60);this.colorize("#e87b22", 10);this.channels({ + red: 8, + blue: 8 + });this.contrast(5);this.gamma(1.2);return this.vignette("55%", 25); + });Caman.Filter.register("crossProcess", function() { + this.exposure(5);this.colorize("#e87b22", 4);this.sepia(20);this.channels({ + blue: 8, + red: 3 + });this.curves('b', [0, 0], [100, 150], [180, 180], [255, 255]);this.contrast(15);this.vibrance(75);return this.gamma(1.6); + });Caman.Filter.register("orangePeel", function() { + this.curves('rgb', [0, 0], [100, 50], [140, 200], [255, 255]);this.vibrance(-30);this.saturation(-30);this.colorize('#ff9000', 30);this.contrast(-5);return this.gamma(1.4); + });Caman.Filter.register("love", function() { + this.brightness(5);this.exposure(8);this.contrast(4);this.colorize('#c42007', 30);this.vibrance(50);return this.gamma(1.3); + });Caman.Filter.register("grungy", function() { + this.gamma(1.5);this.clip(25);this.saturation(-60);this.contrast(5);this.noise(5);return this.vignette("50%", 30); + });Caman.Filter.register("jarques", function() { + this.saturation(-35);this.curves('b', [20, 0], [90, 120], [186, 144], [255, 230]);this.curves('r', [0, 0], [144, 90], [138, 120], [255, 255]);this.curves('g', [10, 0], [115, 105], [148, 100], [255, 248]);this.curves('rgb', [0, 0], [120, 100], [128, 140], [255, 255]);return this.sharpen(20); + });Caman.Filter.register("pinhole", function() { + this.greyscale();this.sepia(10);this.exposure(10);this.contrast(15);return this.vignette("60%", 35); + });Caman.Filter.register("oldBoot", function() { + this.saturation(-20);this.vibrance(-50);this.gamma(1.1);this.sepia(30);this.channels({ + red: -10, + blue: 5 + });this.curves('rgb', [0, 0], [80, 50], [128, 230], [255, 255]);return this.vignette("60%", 30); + });Caman.Filter.register("glowingSun", function(vignette) { + if (vignette == null) { + vignette = true; + } + this.brightness(10);this.newLayer(function() { + this.setBlendingMode("multiply");this.opacity(80);this.copyParent();this.filter.gamma(0.8);this.filter.contrast(50);return this.filter.exposure(10); + });this.newLayer(function() { + this.setBlendingMode("softLight");this.opacity(80);return this.fillColor("#f49600"); + });this.exposure(20);this.gamma(0.8); + if (vignette) { + return this.vignette("45%", 20); + } + });Caman.Filter.register("hazyDays", function() { + this.gamma(1.2);this.newLayer(function() { + this.setBlendingMode("overlay");this.opacity(60);this.copyParent();this.filter.channels({ + red: 5 + });return this.filter.stackBlur(15); + });this.newLayer(function() { + this.setBlendingMode("addition");this.opacity(40);return this.fillColor("#6899ba"); + });this.newLayer(function() { + this.setBlendingMode("multiply");this.opacity(35);this.copyParent();this.filter.brightness(40);this.filter.vibrance(40);this.filter.exposure(30);this.filter.contrast(15);this.filter.curves('r', [0, 40], [128, 128], [128, 128], [255, 215]);this.filter.curves('g', [0, 40], [128, 128], [128, 128], [255, 215]);this.filter.curves('b', [0, 40], [128, 128], [128, 128], [255, 215]);return this.filter.stackBlur(5); + });this.curves('r', [20, 0], [128, 158], [128, 128], [235, 255]);this.curves('g', [20, 0], [128, 128], [128, 128], [235, 255]);this.curves('b', [20, 0], [128, 108], [128, 128], [235, 255]);return this.vignette("45%", 20); + });Caman.Filter.register("herMajesty", function() { + this.brightness(40);this.colorize("#ea1c5d", 10);this.curves('b', [0, 10], [128, 180], [190, 190], [255, 255]);this.newLayer(function() { + this.setBlendingMode('overlay');this.opacity(50);this.copyParent();this.filter.gamma(0.7);return this.newLayer(function() { + this.setBlendingMode('normal');this.opacity(60);return this.fillColor('#ea1c5d'); + }); + });this.newLayer(function() { + this.setBlendingMode('multiply');this.opacity(60);this.copyParent();this.filter.saturation(50);this.filter.hue(90);return this.filter.contrast(10); + });this.gamma(1.4);this.vibrance(-30);this.newLayer(function() { + this.opacity(10);return this.fillColor('#e5f0ff'); + });return this; + });Caman.Filter.register("nostalgia", function() { + this.saturation(20);this.gamma(1.4);this.greyscale();this.contrast(5);this.sepia(100);this.channels({ + red: 8, + blue: 2, + green: 4 + });this.gamma(0.8);this.contrast(5);this.exposure(10);this.newLayer(function() { + this.setBlendingMode('overlay');this.copyParent();this.opacity(55);return this.filter.stackBlur(10); + });return this.vignette("50%", 30); + });Caman.Filter.register("hemingway", function() { + this.greyscale();this.contrast(10);this.gamma(0.9);this.newLayer(function() { + this.setBlendingMode("multiply");this.opacity(40);this.copyParent();this.filter.exposure(15);this.filter.contrast(15);return this.filter.channels({ + green: 10, + red: 5 + }); + });this.sepia(30);this.curves('rgb', [0, 10], [120, 90], [180, 200], [235, 255]);this.channels({ + red: 5, + green: -2 + });return this.exposure(15); + });Caman.Filter.register("concentrate", function() { + this.sharpen(40);this.saturation(-50);this.channels({ + red: 3 + });this.newLayer(function() { + this.setBlendingMode("multiply");this.opacity(80);this.copyParent();this.filter.sharpen(5);this.filter.contrast(50);this.filter.exposure(10);return this.filter.channels({ + blue: 5 + }); + });return this.brightness(10); + });(function() { + var BlurStack; + var mul_table; + var shg_table; + mul_table = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259]; + shg_table = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]; + BlurStack = function() { + this.r = 0; + this.g = 0; + this.b = 0; + this.a = 0;return this.next = null; + };Caman.Plugin.register("stackBlur", function(radius) { + var b_in_sum; + var b_out_sum; + var b_sum; + var div; + var g_in_sum; + var g_out_sum; + var g_sum; + var height; + var heightMinus1; + var i; + var mul_sum; + var p; + var pb; + var pg; + var pixels; + var pr; + var r_in_sum; + var r_out_sum; + var r_sum; + var radiusPlus1; + var rbs; + var shg_sum; + var stack; + var stackEnd; + var stackIn; + var stackOut; + var stackStart; + var sumFactor; + var w4; + var width; + var widthMinus1; + var x; + var y; + var yi; + var yp; + var yw; + var _i; + var _j; + var _k; + var _l; + var _m; + var _n; + var _o; + var _p; + var _q; + if (isNaN(radius) || radius < 1) { + return; + } + radius |= 0; + pixels = this.pixelData; + width = this.dimensions.width; + height = this.dimensions.height; + div = radius + radius + 1; + w4 = width << 2; + widthMinus1 = width - 1; + heightMinus1 = height - 1; + radiusPlus1 = radius + 1; + sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2; + stackStart = new BlurStack(); + stack = stackStart; + for (i = _i = 1; 1 <= div ? _i < div : _i > div; i = 1 <= div ? ++_i : --_i) { + stack = stack.next = new BlurStack(); + if (i === radiusPlus1) { + stackEnd = stack; + } + } + stack.next = stackStart; + stackIn = null; + stackOut = null; + yw = yi = 0; + mul_sum = mul_table[radius]; + shg_sum = shg_table[radius]; + for (y = _j = 0; 0 <= height ? _j < height : _j > height; y = 0 <= height ? ++_j : --_j) { + r_in_sum = g_in_sum = b_in_sum = r_sum = g_sum = b_sum = 0; + r_out_sum = radiusPlus1 * (pr = pixels[yi]); + g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]); + b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]); + r_sum += sumFactor * pr; + g_sum += sumFactor * pg; + b_sum += sumFactor * pb; + stack = stackStart; + for (i = _k = 0; 0 <= radiusPlus1 ? _k < radiusPlus1 : _k > radiusPlus1; i = 0 <= radiusPlus1 ? ++_k : --_k) { + stack.r = pr; + stack.g = pg; + stack.b = pb; + stack = stack.next; + } + for (i = _l = 1; 1 <= radiusPlus1 ? _l < radiusPlus1 : _l > radiusPlus1; i = 1 <= radiusPlus1 ? ++_l : --_l) { + p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2); + r_sum += (stack.r = (pr = pixels[p])) * (rbs = radiusPlus1 - i); + g_sum += (stack.g = (pg = pixels[p + 1])) * rbs; + b_sum += (stack.b = (pb = pixels[p + 2])) * rbs; + r_in_sum += pr; + g_in_sum += pg; + b_in_sum += pb; + stack = stack.next; + } + stackIn = stackStart; + stackOut = stackEnd; + for (x = _m = 0; 0 <= width ? _m < width : _m > width; x = 0 <= width ? ++_m : --_m) { + pixels[yi] = (r_sum * mul_sum) >> shg_sum; + pixels[yi + 1] = (g_sum * mul_sum) >> shg_sum; + pixels[yi + 2] = (b_sum * mul_sum) >> shg_sum; + r_sum -= r_out_sum; + g_sum -= g_out_sum; + b_sum -= b_out_sum; + r_out_sum -= stackIn.r; + g_out_sum -= stackIn.g; + b_out_sum -= stackIn.b; + p = (yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1)) << 2; + r_in_sum += (stackIn.r = pixels[p]); + g_in_sum += (stackIn.g = pixels[p + 1]); + b_in_sum += (stackIn.b = pixels[p + 2]); + r_sum += r_in_sum; + g_sum += g_in_sum; + b_sum += b_in_sum; + stackIn = stackIn.next; + r_out_sum += (pr = stackOut.r); + g_out_sum += (pg = stackOut.g); + b_out_sum += (pb = stackOut.b); + r_in_sum -= pr; + g_in_sum -= pg; + b_in_sum -= pb; + stackOut = stackOut.next; + yi += 4; + } + yw += width; + } + for (x = _n = 0; 0 <= width ? _n < width : _n > width; x = 0 <= width ? ++_n : --_n) { + g_in_sum = b_in_sum = r_in_sum = g_sum = b_sum = r_sum = 0; + yi = x << 2; + r_out_sum = radiusPlus1 * (pr = pixels[yi]); + g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]); + b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]); + r_sum += sumFactor * pr; + g_sum += sumFactor * pg; + b_sum += sumFactor * pb; + stack = stackStart; + for (i = _o = 0; 0 <= radiusPlus1 ? _o < radiusPlus1 : _o > radiusPlus1; i = 0 <= radiusPlus1 ? ++_o : --_o) { + stack.r = pr; + stack.g = pg; + stack.b = pb; + stack = stack.next; + } + yp = width; + for (i = _p = 1; 1 <= radius ? _p <= radius : _p >= radius; i = 1 <= radius ? ++_p : --_p) { + yi = (yp + x) << 2; + r_sum += (stack.r = (pr = pixels[yi])) * (rbs = radiusPlus1 - i); + g_sum += (stack.g = (pg = pixels[yi + 1])) * rbs; + b_sum += (stack.b = (pb = pixels[yi + 2])) * rbs; + r_in_sum += pr; + g_in_sum += pg; + b_in_sum += pb; + stack = stack.next; + if (i < heightMinus1) { + yp += width; + } + } + yi = x; + stackIn = stackStart; + stackOut = stackEnd; + for (y = _q = 0; 0 <= height ? _q < height : _q > height; y = 0 <= height ? ++_q : --_q) { + p = yi << 2; + pixels[p] = (r_sum * mul_sum) >> shg_sum; + pixels[p + 1] = (g_sum * mul_sum) >> shg_sum; + pixels[p + 2] = (b_sum * mul_sum) >> shg_sum; + r_sum -= r_out_sum; + g_sum -= g_out_sum; + b_sum -= b_out_sum; + r_out_sum -= stackIn.r; + g_out_sum -= stackIn.g; + b_out_sum -= stackIn.b; + p = (x + (((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width)) << 2; + r_sum += (r_in_sum += (stackIn.r = pixels[p])); + g_sum += (g_in_sum += (stackIn.g = pixels[p + 1])); + b_sum += (b_in_sum += (stackIn.b = pixels[p + 2])); + stackIn = stackIn.next; + r_out_sum += (pr = stackOut.r); + g_out_sum += (pg = stackOut.g); + b_out_sum += (pb = stackOut.b); + r_in_sum -= pr; + g_in_sum -= pg; + b_in_sum -= pb; + stackOut = stackOut.next; + yi += width; + } + } + return this; + });return Caman.Filter.register("stackBlur", function(radius) { + return this.processPlugin("stackBlur", [radius]); + }); + })();Caman.Filter.register("threshold", function(adjust) { + return this.process("threshold", function(rgba) { + var luminance; + luminance = (0.2126 * rgba.r) + (0.7152 * rgba.g) + (0.0722 * rgba.b); + if (luminance < adjust) { + rgba.r = 0; + rgba.g = 0; + rgba.b = 0; + } else { + rgba.r = 255; + rgba.g = 255; + rgba.b = 255; + } + return rgba; + }); + }); +}).call(this); \ No newline at end of file diff --git a/microscopy/old_microscopy/caman.full.pack.js b/microscopy/old_microscopy/caman.full.pack.js index 70051add..1d4007b2 100755 --- a/microscopy/old_microscopy/caman.full.pack.js +++ b/microscopy/old_microscopy/caman.full.pack.js @@ -1 +1,24 @@ -eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(A(){K $,5o,2i,2Q,F,4O,43,29,2J,65,P,2P,5u,3m,1W,64,2W,2w,1M,7v,2V,1v,fs,4L,8Y,7A={}.ej,8M=[].eh||A(bx){Y(K i=0,l=o.V;iD){u D}u 2k};1v.5X=A(9z,5Y,E){K 5Z,H,1m,L,2G,1p;C(E==M){E={}}L=9z.dU;1p=[];Y(H=0,1m=L.V;H<1m;H++){5Z=L[H];C((E.8v!=M)&&(2G=5Z.8u,8M.1O(E.8v,2G)>=0)){5L}1p.2l(5Y.9Y(5Z.8u,5Z.dO))}u 1p};1v.63=A(V){C(V==M){V=0}C(F.2T||(4t.a0!=M)){u 1S a0(V)}u 1S 6L(V)};u 1v})();C(1x 2m!=="4b"&&2m!==M){7v=2m;43=7d(\'I\');5u=43.5u;65=7d(\'dI\');fs=7d(\'fs\')}W{7v=4t}7v.F=F=(A(){F.8r={aW:"4.1.1",aZ:"4/8/dt"};F.bt=2u;F.2T=1x 2m!=="4b"&&2m!==M;F.bG=!F.2T;F.6i=2Z;F.8d="c4";F.dh=A(){u"dg "+F.8r.aW+", df "+F.8r.aZ};F.6s="";F.ca="cd";F.9d=A(I){C(F.2T){u 2Z}C(1x I==="3P"){I=$(I)}C(!((I!=M)&&(I.5m!=M))){u M}u I.5m(\'1R-3u-2I\')};A F(){K 1u,2s,2I,1r=o;C(1y.V===0){4i"7b 1y";}C(o ct F){o.5E=o.5E.8N(o);o.5W=o.5W.8N(o);1u=1y[0];C(!F.2T){2I=3R(F.9d(1u[0]),10);2s=1x 1u[1]==="A"?1u[1]:1x 1u[2]==="A"?1u[2]:A(){};C(!bA(2I)&&2V.bz(2I)){u 2V.3E(2I,2s)}}o.2I=1v.8z.4Z();o.7X=o.54=M;o.5T={x:0,y:0};o.bw=2u;o.6F=2u;o.5Q=[];o.8G=[];o.8F=[];o.6c=M;o.bq=2u;o.e1=1S 5o(o);o.4E=1S 1M(o);o.bo(A(){1r.bn(1u);u 1r.bm()});u o}W{u 1S F(1y)}}F.R.bo=A(cb){K 8y,1r=o;C(F.2T){u 6T(A(){u cb.1O(1r)},0)}W{C(27.8w==="76"){1W.2t("ba b9");u 6T(A(){u cb.1O(1r)},0)}W{8y=A(){C(27.8w==="76"){1W.2t("ba b9");u cb.1O(1r)}};u 27.b7("cu",8y,2u)}}};F.R.bn=A(1u){K 6y,2k,L,1p;C(1u.V===0){4i"7b 1y b1";}o.3V=M;o.7t=M;o.7u=M;o.2s=A(){};o.aV(1u[0]);C(1u.V===1){u}5n(1x 1u[1]){1X"3P":o.7u=1u[1];4M;1X"A":o.2s=1u[1]}C(1u.V===2){u}o.2s=1u[2];C(1u.V===4){L=1u[4];1p=[];Y(6y 6I L){C(!7A.1O(L,6y))5L;2k=L[6y];1p.2l(o.1E[6y]=2k)}u 1p}};F.R.aV=A(4d){C(F.2T){o.3V=4d;o.7t=\'aT\';u}C(1x 4d==="3D"){o.3V=4d}W{o.3V=$(4d)}C(o.3V==M){4i"cv cy cz 1d aI I Y cJ.";}u o.7t=o.3V.8u.6o()};F.R.bm=A(){5n(o.7t){1X"aT":u o.aq();1X"1F":u o.ap();1X"I":u o.ao()}};F.R.aq=A(){K 1r=o;1W.2t("cM Y 2T");o.1d=1S 5u();o.1d.8a=A(){1W.2t("5u al. ai = "+(1r.4X())+", ae = "+(1r.51()));1r.I=1S 43(1r.4X(),1r.51());u 1r.5E()};o.1d.cW=A(a1){4i a1;};u o.1d.1H=o.3V};F.R.ap=A(){o.1d=o.3V;o.I=27.3l(\'I\');o.1s=o.I.3q(\'2d\');1v.5X(o.1d,o.I,{8v:[\'1H\']});o.1d.83.82(o.I,o.1d);o.7Z();u o.8I()};F.R.ao=A(){o.I=o.3V;o.1s=o.I.3q(\'2d\');C(o.7u!=M){o.1d=27.3l(\'1F\');o.1d.1H=o.7u;o.7Z();u o.8I()}W{u o.5E()}};F.R.7Z=A(){C(o.9V()){1W.2t(o.1d.1H,"->",o.7T());o.9T=2Z;o.1d.1H=o.7T()}C(2P.9S(o.1d)){o.1d.1H=2P.5P(o.1d.1H);u 1W.2t("cY 1d cZ, d4 9C = "+o.1d.1H)}};F.R.8I=A(){C(o.9y()){u o.5W()}W{u o.1d.8a=o.5W}};F.R.9y=A(){C(!o.1d.76){u 2u}C((o.1d.84!=M)&&o.1d.84===0){u 2u}u 2Z};F.R.4X=A(){u o.1d.G||o.1d.84};F.R.51=A(){u o.1d.J||o.1d.dd};F.R.5W=A(){1W.2t("5u al. ai = "+(o.4X())+", ae = "+(o.51()));C(o.9T){o.I.G=o.4X()/o.7P();o.I.J=o.51()/o.7P()}W{o.I.G=o.4X();o.I.J=o.51()}u o.5E()};F.R.5E=A(){K i,1Y,H,1m,L;C(o.1s==M){o.1s=o.I.3q(\'2d\')}o.5g=o.6q=o.G=o.I.G;o.6n=o.6m=o.J=o.I.J;o.bP();C(!o.bM()){o.bF()}C(o.1d!=M){o.1s.6g(o.1d,0,0,o.4X(),o.51(),0,0,o.6q,o.6m)}o.8k();C(F.6i){o.7X=1v.63(o.Q.V);o.54=1v.63(o.Q.V);L=o.Q;Y(i=H=0,1m=L.V;H<1m;i=++H){1Y=L[i];o.7X[i]=1Y;o.54[i]=1Y}}o.1c={G:o.I.G,J:o.I.J};2V.bl(o.2I,o);o.2s.1O(o,o);u o.2s=A(){}};F.R.8k=A(){o.2C=o.1s.4C(0,0,o.I.G,o.I.J);u o.Q=o.2C.1R};F.R.dr=A(){K 1Y,H,1m,L,1p;C(!F.6i){4i"8l 7q";}o.54=1v.63(o.Q.V);L=o.Q;1p=[];Y(H=0,1m=L.V;H<1m;H++){1Y=L[H];1p.2l(o.54.2l(1Y))}u 1p};F.R.bM=A(){u F.9d(o.I)!=M};F.R.bF=A(){C(F.2T||o.I.5m(\'1R-3u-2I\')){u}u o.I.9Y(\'1R-3u-2I\',o.2I)};F.R.8m=A(){u o.I.5m(\'1R-3u-bb-7q\')!==M};F.R.bP=A(){K 3X;C(F.2T||o.8m()){u}3X=o.7P();C(3X!==1){1W.2t("dZ 3X = "+3X);o.bq=2Z;o.6q=o.I.G;o.6m=o.I.J;o.I.G=o.6q*3X;o.I.J=o.6m*3X;o.I.br.G=""+o.6q+"bh";o.I.br.J=""+o.6m+"bh";o.1s.ee(3X,3X);o.G=o.5g=o.I.G;u o.J=o.6n=o.I.J}};F.R.7P=A(){K 8V,44;44=4t.44||1;8V=o.1s.ew||o.1s.eL||o.1s.eN||o.1s.eR||o.1s.eT||1;u 44/8V};F.R.af=A(){u(4t.44!=M)&&4t.44!==1};F.R.9V=A(){C(o.8m()||!o.af()){u 2u}u o.7T()!==M};F.R.7T=A(){C(o.1d==M){u M}u o.1d.5m(\'1R-3u-bb\')};F.R.71=A(9B){K 6X;6X=o.I;o.I=9B;o.1s=o.I.3q(\'2d\');6X.83.82(o.I,6X);o.G=o.I.G;o.J=o.I.J;o.8k();u o.1c={G:o.I.G,J:o.I.J}};F.R.ch=A(2s){K 1r=o;C(2s==M){2s=A(){}}2J.4Y(o,"ce");u o.4E.3E(A(){1r.1s.6V(1r.2C,0,0);u 2s.1O(1r)})};F.R.eZ=A(){K i,1Y,H,1m,L;C(!F.6i){4i"8l 7q";}L=o.c3();Y(i=H=0,1m=L.V;H<1m;i=++H){1Y=L[i];o.Q[i]=1Y}u o.1s.6V(o.2C,0,0)};F.R.f3=A(){K I,2z,i,2C,1Y,Q,H,1m,L;I=27.3l(\'I\');1v.5X(o.I,I);I.G=o.5g;I.J=o.6n;2z=I.3q(\'2d\');2C=2z.4C(0,0,I.G,I.J);Q=2C.1R;L=o.7X;Y(i=H=0,1m=L.V;H<1m;i=++H){1Y=L[i];Q[i]=1Y}2z.6V(2C,0,0);o.5T={x:0,y:0};o.6F=2u;u o.71(I)};F.R.c3=A(){K I,6S,2z,94,98,i,2C,1Y,Q,X,6j,7S,7C,G,H,1j,1m,L,2G,48,9c;C(!F.6i){4i"8l 7q";}X=[];7S=o.5T.x;94=7S+o.G;7C=o.5T.y;98=7C+o.J;C(o.6F){I=27.3l(\'I\');I.G=o.5g;I.J=o.6n;2z=I.3q(\'2d\');2C=2z.4C(0,0,I.G,I.J);Q=2C.1R;L=o.54;Y(i=H=0,1m=L.V;H<1m;i=++H){1Y=L[i];Q[i]=1Y}2z.6V(2C,0,0);6j=27.3l(\'I\');6j.G=o.G;6j.J=o.J;2z=6j.3q(\'2d\');2z.6g(I,0,0,o.5g,o.6n,0,0,o.G,o.J);Q=2z.4C(0,0,o.G,o.J).1R;G=o.G}W{Q=o.54;G=o.5g}Y(i=1j=0,2G=Q.V;1j<2G;i=1j+=4){6S=2W.b0(i,G);C(((7S<=(48=6S.x)&&48<94))&&((7C<=(9c=6S.y)&&9c<98))){X.2l(Q[i],Q[i+1],Q[i+2],Q[i+3])}}u X};F.R.2b=A(1k,7x){o.4E.5h({1o:P.33.9f,1k:1k,7x:7x});u o};F.R.3z=A(1k,N,2X,3x){K i,H,L;C(!2X){2X=0;Y(i=H=0,L=N.V;0<=L?HL;i=0<=L?++H:--H){2X+=N[i]}}o.4E.5h({1o:P.33.9g,1k:1k,N:N,2X:2X,3x:3x||0});u o};F.R.5d=A(4c,1u){o.4E.5h({1o:P.33.2w,4c:4c,1u:1u});u o};F.R.2N=A(2s){K 28;28=1S 3m(o);o.8F.2l(28);o.4E.5h({1o:P.33.9h});2s.1O(28);o.4E.5h({1o:P.33.9i});u o};F.R.aY=A(28){u o.aQ(28)};F.R.aQ=A(28){o.8G.2l(o.6c);o.5Q.2l(o.Q);o.6c=28;u o.Q=28.Q};F.R.aN=A(){o.Q=o.5Q.aC();u o.6c=o.8G.aC()};F.R.ax=A(){u o.6c.9X()};u F})();5o=(A(){A 5o(c){o.c=c}5o.R.fr=A(){K i,3d,6v,H,1j,1q,L;3d={r:{},g:{},b:{}};Y(i=H=0;H<=D;i=++H){3d.r[i]=0;3d.g[i]=0;3d.b[i]=0}Y(i=1j=0,L=o.c.Q.V;1j0)){u}1p=[];Y(H=0,1m=5S.V;H<1m;H++){1F=5S[H];1p.2l(bB=1S 4O(1F,A(){o.aj();u o.3E()}))}u 1p};C(F.bG){(A(){C(27.8w==="76"){u F.9l()}W{u 27.b7("fw",F.9l,2u)}})()}4O=(A(){K 7j;7j="(\\\\w+)\\\\((.*?)\\\\)";A 4O(4e,bD){o.c0=4e.5m(\'1R-3u\');o.3u=F(4e,bD.8N(o))}4O.R.aj=A(){K 1u,1z,6x,9r,9q,m,r,6w,H,1m,L,1p;o.4e=o.3u.I;r=1S c9(7j,\'g\');6w=o.c0.9p(r);C(!(6w.V>0)){u}r=1S c9(7j);1p=[];Y(H=0,1m=6w.V;H<1m;H++){9r=6w[H];L=9r.9p(r),m=L[0],1z=L[1],1u=L[2];9q=1S fu("u A() { o."+1z+"("+1u+"); };");9o{6x=9q();1p.2l(6x.1O(o.3u))}9n(e){1p.2l(1W.2t(e))}}u 1p};4O.R.3E=A(){K 4e;4e=o.4e;u o.3u.ch(A(){u 4e.83.82(o.bY(),4e)})};u 4O})();F.2i=2i=(A(){A 2i(){}2i.9m={};2i.S=A(1k,6x){u o.9m[1k]=6x};2i.3E=A(1k,Z,U){u o.9m[1k](Z,U)};u 2i})();F.2Q=2Q=(A(){A 2Q(){}2Q.4T=A(3T,41,4v,4u){u O.9j(O.1J(4v-3T,2)+O.1J(4u-41,2))};2Q.bQ=A(2c,1f,6u){K 3S;C(6u==M){6u=2u}3S=2c+(O.fp()*(1f-2c));C(6u){u 3S.fd(6u)}W{u O.7k(3S)}};2Q.6r=A(B){u(0.9e*B.r)+(0.fc*B.g)+(0.fa*B.b)};2Q.1P=A(1I,3C,3B,1t,7D,7E){K 9b,9a,7J,7L,6l,6k,1P,99,4N,i,j,5l,6z,t,6f,3T,4v,97,6d,41,4u,96,H,1j,1q,L,2G;6f=1I[0];6d=1I[1];3T=3C[0];41=3C[1];4v=3B[0];4u=3B[1];97=1t[0];96=1t[1];1P={};6l=3R(3*(3T-6f),10);7J=3*(4v-3T)-6l;9b=97-6f-6l-7J;6k=3*(41-6d);7L=3*(4u-41)-6k;9a=96-6d-6k-7L;Y(i=H=0;H7E){4N=7E}1P[99]=4N}C(1P.V<1t[0]+1){Y(i=1j=0,L=1t[0];0<=L?1j<=L:1j>=L;i=0<=L?++1j:--1j){C(1P[i]==M){5l=[i-1,1P[i-1]];Y(j=1q=i,2G=1t[0];i<=2G?1q<=2G:1q>=2G;j=i<=2G?++1q:--1q){C(1P[j]!=M){6z=[j,1P[j]];4M}}1P[i]=5l[1]+((6z[1]-5l[1])/(6z[0]-5l[0]))*(i-5l[0])}}}C(1P[1t[0]]==M){1P[1t[0]]=1P[1t[0]-1]}u 1P};u 2Q})();29=(A(){A 29(){}29.6J=A(4J){K b,g,r;C(4J.f9(0)==="#"){4J=4J.4I(1)}r=3R(4J.4I(0,2),16);g=3R(4J.4I(2,2),16);b=3R(4J.4I(4,2),16);u{r:r,g:g,b:b}};29.f0=A(r,g,b){K d,h,l,1f,2c,s;C(1x r==="3D"){g=r.g;b=r.b;r=r.r}r/=D;g/=D;b/=D;1f=O.1f(r,g,b);2c=O.2c(r,g,b);l=(1f+2c)/2;C(1f===2c){h=s=0}W{d=1f-2c;s=l>0.5?d/(2-1f-2c):d/(1f+2c);h=(A(){5n(1f){1X r:u(g-b)/d+(g1){t-=1}C(t<1/6){u p+(q-p)*6*t}C(t<1/2){u q}C(t<2/3){u p+(q-p)*(2/3-t)*6}u p};29.9U=A(r,g,b){K d,h,1f,2c,s,v;r/=D;g/=D;b/=D;1f=O.1f(r,g,b);2c=O.2c(r,g,b);v=1f;d=1f-2c;s=1f===0?0:d/1f;C(1f===2c){h=0}W{h=(A(){5n(1f){1X r:u(g-b)/d+(g0.91){r=O.1J((r+0.3o)/1.3o,2.4)}W{r/=12.92}C(g>0.91){g=O.1J((g+0.3o)/1.3o,2.4)}W{g/=12.92}C(b>0.91){b=O.1J((b+0.3o)/1.3o,2.4)}W{b/=12.92}x=r*0.eK+g*0.eJ+b*0.eD;y=r*0.bg+g*0.bk+b*0.by;z=r*0.ez+g*0.ey+b*0.ex;u{x:x*1h,y:y*1h,z:z*1h}};29.et=A(x,y,z){K b,g,r;x/=1h;y/=1h;z/=1h;r=(3.es*x)+(-1.er*y)+(-0.eq*z);g=(-0.ep*x)+(1.eo*y)+(0.en*z);b=(0.em*x)+(-0.el*y)+(1.ek*z);C(r>0.8X){r=(1.3o*O.1J(r,0.8W))-0.3o}W{r*=12.92}C(g>0.8X){g=(1.3o*O.1J(g,0.8W))-0.3o}W{g*=12.92}C(b>0.8X){b=(1.3o*O.1J(b,0.8W))-0.3o}W{b*=12.92}u{r:r*D,g:g*D,b:b*D}};29.9v=A(x,y,z){K a,b,l,8U,8T,8S;C(1x x==="3D"){y=x.y;z=x.z;x=x.x}8U=95.9Q;8T=1h.0;8S=8R.9W;x/=8U;y/=8T;z/=8S;C(x>0.8Q){x=O.1J(x,0.8P)}W{x=(7.8O*x)+0.5I}C(y>0.8Q){y=O.1J(y,0.8P)}W{y=(7.8O*y)+0.5I}C(z>0.8Q){z=O.1J(z,0.8P)}W{z=(7.8O*z)+0.5I}l=au*y-16;a=aw*(x-y);b=5J*(y-z);u{l:l,a:a,b:b}};29.ei=A(l,a,b){K x,y,z;C(1x l==="3D"){a=l.a;b=l.b;l=l.l}y=(l+16)/au;x=y+(a/aw);z=y-(b/5J);C(x>0.8L){x=x*x*x}W{x=0.8K*(x-0.5I)}C(y>0.8L){y=y*y*y}W{y=0.8K*(y-0.5I)}C(z>0.8L){z=z*z*z}W{z=0.8K*(z-0.5I)}u{x:x*95.9Q,y:y*1h.0,z:z*8R.9W}};29.eg=A(r,g,b){K 8J;C(1x r==="3D"){g=r.g;b=r.b;r=r.r}8J=o.am(r,g,b);u o.9v(8J)};29.ef=A(l,a,b){};u 29})();2J=(A(){A 2J(){}2J.4K={};2J.b6=["b8","bc","ce","bd","be","56"];2J.4Y=A(3v,1o,1R){K 5R,H,1m,L,1p;C(o.4K[1o]&&o.4K[1o].V){L=o.4K[1o];1p=[];Y(H=0,1m=L.V;H<1m;H++){5R=L[H];C(5R.3v===M||3v.2I===5R.3v.2I){1p.2l(5R.fn.1O(3v,1R))}W{1p.2l(bv 0)}}u 1p}};2J.ed=A(3v,1o,fn){K 7Y,8H;C(1x 3v==="3P"){8H=3v;7Y=1o;3v=M;1o=8H;fn=7Y}C(8M.1O(o.b6,1o)<0){u 2u}C(!o.4K[1o]){o.4K[1o]=[]}o.4K[1o].2l({3v:3v,fn:fn});u 2Z};u 2J})();F.2J=2J;F.P=P=(A(){A P(){}P.33={9f:1,9g:2,9h:3,9i:4,8E:5,2w:6};P.S=A(1k,bE){u F.R[1k]=bE};u P})();F.2P=2P=(A(){A 2P(){}2P.bK=/(?:(?:ec|eb):\\/\\/)((?:\\w+)\\.(?:(?:\\w|\\.)+))/;2P.9S=A(1F){C(1F==M){u 2u}C(o.bO(1F)){u 2u}u o.6K(1F.1H)};2P.bO=A(1F){K L;u(1F.8d!=M)&&((L=1F.8d.6o())===\'c4\'||L===\'bR-ea\')};2P.6K=A(bT){K 6M;6M=bT.9p(o.bK);C(6M){u 6M[1]!==27.e9}W{u 2u}};2P.bZ=A(1H){C(o.6K(1H)){C(!F.6s.V){1W.8C("e8 5Y e6 a c2 1d e5 a e4 c8. 9C: "+1H)}W{C(F.6K(F.6s)){1W.8C("e3 bR a c2 c8 Y e2 cs.");u}u""+F.6s+"?cd="+(9u(1H))}}};2P.5P=A(1H){u""+F.6s+"?"+F.ca+"="+(9u(1H))};2P.e0=A(4V){K 6Y;6Y={dY:\'dX\',dW:\'dV\',dT:\'dS\',dR:\'dQ\'};4V=4V.6o();C(6Y[4V]!=M){4V=6Y[4V]}u"dP/dN."+4V};u 2P})();F.R.dM=A(){C(1x 2m!=="4b"&&2m!==M){u o.a2.5v(o,1y)}W{u o.ag.5v(o,1y)}};F.R.ag=A(1o){K 1d;C(1o==M){1o="ah"}1o=1o.6o();1d=o.8t(1o).dL("1d/"+1o,"1d/dK-dJ");u 27.dH.dG=1d};F.R.a2=A(5q,7h){K 8q;C(7h==M){7h=2Z}9o{8q=fs.dF(5q);C(8q.dE()&&!7h){u 2u}}9n(e){1W.2t("dD dC 5q "+5q)}u fs.dB(5q,o.I.dz(),A(){u 1W.2t("dy dx 5Y "+5q)})};F.R.bY=A(1o){K 1F;1F=27.3l(\'1F\');1F.1H=o.8t(1o);1F.G=o.1c.G;1F.J=o.1c.J;C(4t.44){1F.G/=4t.44;1F.J/=4t.44}u 1F};F.R.8t=A(1o){C(1o==M){1o="ah"}1o=1o.6o();u o.I.dw("1d/"+1o)};3m=(A(){A 3m(c){o.c=c;o.1z=o.c;o.1E={8p:\'8o\',2g:1.0};o.dv=1v.8z.4Z();o.I=1x 2m!=="4b"&&2m!==M?1S 43():27.3l(\'I\');o.I.G=o.c.1c.G;o.I.J=o.c.1c.J;o.1s=o.I.3q(\'2d\');o.1s.du(o.I.G,o.I.J);o.2C=o.1s.4C(0,0,o.I.G,o.I.J);o.Q=o.2C.1R}3m.R.2N=A(cb){u o.c.2N.1O(o.c,cb)};3m.R.3p=A(bf){o.1E.8p=bf;u o};3m.R.2g=A(2g){o.1E.2g=2g/1h;u o};3m.R.3U=A(){K i,2O,H,L;2O=o.c.Q;Y(i=H=0,L=o.c.Q.V;Ho.c.Q.V||2R<0){u{r:0,g:0,b:0,a:0}}u{r:o.c.Q[2R],g:o.c.Q[2R+1],b:o.c.Q[2R+2],a:o.c.Q[2R+3]}};2W.R.do=A(7y,7z,B){K bH;bH=o.T+(o.c.1c.G*4*(7z*-1))+(4*7y);C(2R>o.c.Q.V||2R<0){u}o.c.Q[2R]=B.r;o.c.Q[2R+1]=B.g;o.c.Q[2R+2]=B.b;o.c.Q[2R+3]=B.a;u 2Z};2W.R.dn=A(x,y){K T;T=o.8i(x,y,o.G);u{r:o.c.Q[T],g:o.c.Q[T+1],b:o.c.Q[T+2],a:o.c.Q[T+3]}};2W.R.dm=A(x,y,B){K T;T=o.8i(x,y,o.G);o.c.Q[T]=B.r;o.c.Q[T+1]=B.g;o.c.Q[T+2]=B.b;u o.c.Q[T+3]=B.a};u 2W})();2w=(A(){A 2w(){}2w.8g={};2w.S=A(1k,4c){u o.8g[1k]=4c};2w.3E=A(1s,1k,1u){u o.8g[1k].5v(1s,1u)};u 2w})();F.2w=2w;F.1M=1M=(A(){1M.4G=F.2T?7d(\'dl\').dk().V:4;A 1M(c){K 1r=o;o.c=c;o.46=A(){u 1M.R.46.5v(1r,1y)};o.6e=[];o.52=M}1M.R.5h=A(8f){C(8f==M){u}u o.6e.2l(8f)};1M.R.46=A(){K 28;C(o.6e.V===0){2J.4Y(o,"bd");C(o.8e!=M){o.8e.1O(o.c)}u o}o.26=o.6e.bU();5n(o.26.1o){1X P.33.9h:28=o.c.8F.bU();o.c.aY(28);u o.46();1X P.33.9i:o.c.ax();o.c.aN();u o.46();1X P.33.8E:u o.bV(o.26.28,o.26.1H);1X P.33.2w:u o.bW();dj:u o.bX()}};1M.R.3E=A(2s){o.8e=2s;o.52=1v.63(o.c.Q.V);u o.46()};1M.R.8b=A(fn){K 6p,88,2L,1t,f,i,86,n,1I,H,L,1p,1r=o;o.7N=0;n=o.c.Q.V;88=O.32((n/4)/1M.4G);6p=88*4;86=6p+((n/4)%1M.4G)*4;1p=[];Y(i=H=0,L=1M.4G;0<=L?HL;i=0<=L?++H:--H){1I=i*6p;1t=1I+(i===1M.4G-1?86:6p);C(F.2T){f=65(A(){u fn.1O(1r,i,1I,1t)});2L=f.di();1p.2l(o.56(2L))}W{1p.2l(6T((A(i,1I,1t){u A(){u fn.1O(1r,i,1I,1t)}})(i,1I,1t),0))}}u 1p};1M.R.bX=A(){2J.4Y(o.c,"b8",o.26);C(o.26.1o===P.33.9f){u o.8b(o.c5)}W{u o.8b(o.c6)}};1M.R.bW=A(){1W.2t("de 4c "+o.26.4c);2w.3E(o.c,o.26.4c,o.26.1u);1W.2t("2w "+o.26.4c+" 85!");u o.46()};1M.R.c5=A(2L,1I,1t){K 1R,i,4w,39,H;1W.2t("cc #"+2L+" - P: "+o.26.1k+", dc: "+1I+", db: "+1t);2J.4Y(o.c,"be",{cf:2L,cg:1M.4G,da:1I,d9:1t});1R={r:0,g:0,b:0,a:0};4w=1S 2W(o.c);Y(i=H=1I;H<1t;i=H+=4){4w.T=i;1R.r=o.c.Q[i];1R.g=o.c.Q[i+1];1R.b=o.c.Q[i+2];1R.a=o.c.Q[i+3];39=o.26.7x.1O(4w,1R);C(39.a==M){39.a=1R.a}o.c.Q[i]=1v.3y(39.r);o.c.Q[i+1]=1v.3y(39.g);o.c.Q[i+2]=1v.3y(39.b);o.c.Q[i+3]=1v.3y(39.a)}C(F.2T){u 65["9t"](2L)}W{u o.56(2L)}};1M.R.c6=A(2L,1I,1t){K N,6t,3x,2F,5c,2X,i,j,k,2A,n,1k,1Y,4w,39,H,1j,1q;1k=o.26.1k;3x=o.26.3x;2X=o.26.2X;n=o.c.Q.V;N=o.26.N;6t=O.9j(N.V);2A=[];1W.2t("d8 2A - P: "+o.26.1k);1I=O.1f(1I,o.c.1c.G*4*((6t-1)/2));1t=O.2c(1t,n-(o.c.1c.G*4*((6t-1)/2)));2F=(6t-1)/2;4w=1S 2W(o.c);Y(i=H=1I;H<1t;i=H+=4){4w.T=i;5c=0;Y(j=1j=-2F;-2F<=2F?1j<=2F:1j>=2F;j=-2F<=2F?++1j:--1j){Y(k=1q=2F;2F<=-2F?1q<=-2F:1q>=-2F;k=2F<=-2F?++1q:--1q){1Y=4w.bC(j,k);2A[5c*3]=1Y.r;2A[5c*3+1]=1Y.g;2A[5c*3+2]=1Y.b;5c++}}39=o.3z(N,2A,2X,3x);o.52[i]=1v.3y(39.r);o.52[i+1]=1v.3y(39.g);o.52[i+2]=1v.3y(39.b);o.52[i+3]=o.c.Q[i+3]}C(F.2T){u 65["9t"](2L)}W{u o.56(2L)}};1M.R.56=A(2L){K i,H,L;C(2L>=0){1W.2t("cc #"+2L+" 85! P: "+o.26.1k)}o.7N++;2J.4Y(o.c,"56",{cf:2L,d7:o.7N,cg:1M.4G});C(o.7N===1M.4G){C(o.26.1o===P.33.9g){Y(i=H=0,L=o.c.Q.V;0<=L?HL;i=0<=L?++H:--H){o.c.Q[i]=o.52[i]}}C(2L>=0){1W.2t("P "+o.26.1k+" 85!")}2J.4Y(o.c,"bc",o.26);u o.46()}};1M.R.3z=A(N,2A,2X,3x){K i,2k,H,L;2k={r:0,g:0,b:0};Y(i=H=0,L=N.V;0<=L?HL;i=0<=L?++H:--H){2k.r+=N[i]*2A[i*3];2k.g+=N[i]*2A[i*3+1];2k.b+=N[i]*2A[i*3+2]}2k.r=(2k.r/2X)+3x;2k.g=(2k.g/2X)+3x;2k.b=(2k.b/2X)+3x;u 2k};1M.R.bV=A(28,1H){K 1F,5P,1r=o;1F=27.3l(\'1F\');1F.8a=A(){28.1s.6g(1F,0,0,1r.c.1c.G,1r.c.1c.J);28.2C=28.1s.4C(0,0,1r.c.1c.G,1r.c.1c.J);28.Q=28.2C.1R;1r.c.Q=28.Q;u 1r.46()};5P=2P.bZ(1H);u 1F.1H=5P!=M?5P:1H};u 1M})();F.2V=2V=(A(){A 2V(){}2V.5a={};2V.bz=A(4p){u o.5a[4p]!=M};2V.4Z=A(4p){u o.5a[4p]};2V.bl=A(1k,4d){u o.5a[1k]=4d};2V.3E=A(4p,2s){K 1r=o;6T(A(){u 2s.1O(1r.4Z(4p),1r.4Z(4p))},0);u o.4Z(4p)};2V.d6=A(1k){C(1k==M){1k=2u}C(1k){u 9E o.5a[1k]}W{u o.5a={}}};u 2V})();2i.S("8o",A(Z,U){u{r:Z.r,g:Z.g,b:Z.b}});2i.S("58",A(Z,U){u{r:(Z.r*U.r)/D,g:(Z.g*U.g)/D,b:(Z.b*U.b)/D}});2i.S("d5",A(Z,U){u{r:D-(((D-Z.r)*(D-U.r))/D),g:D-(((D-Z.g)*(D-U.g))/D),b:D-(((D-Z.b)*(D-U.b))/D)}});2i.S("7W",A(Z,U){K 1D;1D={};1D.r=U.r>1e?D-2*(D-Z.r)*(D-U.r)/D:(U.r*Z.r*2)/D;1D.g=U.g>1e?D-2*(D-Z.g)*(D-U.g)/D:(U.g*Z.g*2)/D;1D.b=U.b>1e?D-2*(D-Z.b)*(D-U.b)/D:(U.b*Z.b*2)/D;u 1D});2i.S("d3",A(Z,U){u{r:Z.r-U.r,g:Z.g-U.g,b:Z.b-U.b}});2i.S("9J",A(Z,U){u{r:U.r+Z.r,g:U.g+Z.g,b:U.b+Z.b}});2i.S("d2",A(Z,U){u{r:1e-2*(U.r-1e)*(Z.r-1e)/D,g:1e-2*(U.g-1e)*(Z.g-1e)/D,b:1e-2*(U.b-1e)*(Z.b-1e)/D}});2i.S("9L",A(Z,U){K 1D;1D={};1D.r=U.r>1e?D-((D-U.r)*(D-(Z.r-1e)))/D:(U.r*(Z.r+1e))/D;1D.g=U.g>1e?D-((D-U.g)*(D-(Z.g-1e)))/D:(U.g*(Z.g+1e))/D;1D.b=U.b>1e?D-((D-U.b)*(D-(Z.b-1e)))/D:(U.b*(Z.b+1e))/D;u 1D});2i.S("d1",A(Z,U){u{r:U.r>Z.r?U.r:Z.r,g:U.g>Z.g?U.g:Z.g,b:U.b>Z.b?U.b:Z.b}});2i.S("d0",A(Z,U){u{r:U.r>Z.r?Z.r:U.r,g:U.g>Z.g?Z.g:U.g,b:U.b>Z.b?Z.b:U.b}});P.S("4B",A(){K 34;C(1y.V===1){34=29.6J(1y[0])}W{34={r:1y[0],g:1y[1],b:1y[2]}}u o.2b("4B",A(B){B.r=34.r;B.g=34.g;B.b=34.b;B.a=D;u B})});P.S("3i",A(N){N=O.32(D*(N/1h));u o.2b("3i",A(B){B.r+=N;B.g+=N;B.b+=N;u B})});P.S("3A",A(N){N*=-0.cX;u o.2b("3A",A(B){K 1f;1f=O.1f(B.r,B.g,B.b);C(B.r!==1f){B.r+=(1f-B.r)*N}C(B.g!==1f){B.g+=(1f-B.g)*N}C(B.b!==1f){B.b+=(1f-B.b)*N}u B})});P.S("3L",A(N){N*=-1;u o.2b("3L",A(B){K 1l,4y,1f;1f=O.1f(B.r,B.g,B.b);4y=(B.r+B.g+B.b)/3;1l=((O.4z(1f-4y)*2/D)*N)/1h;C(B.r!==1f){B.r+=(1f-B.r)*1l}C(B.g!==1f){B.g+=(1f-B.g)*1l}C(B.b!==1f){B.b+=(1f-B.b)*1l}u B})});P.S("4A",A(N){u o.2b("4A",A(B){K 4y;4y=2Q.6r(B);B.r=4y;B.g=4y;B.b=4y;u B})});P.S("2h",A(N){N=O.1J((N+1h)/1h,2);u o.2b("2h",A(B){B.r/=D;B.r-=0.5;B.r*=N;B.r+=0.5;B.r*=D;B.g/=D;B.g-=0.5;B.g*=N;B.g+=0.5;B.g*=D;B.b/=D;B.b-=0.5;B.b*=N;B.b+=0.5;B.b*=D;u B})});P.S("81",A(N){u o.2b("81",A(B){K h,4S,2y;4S=29.9U(B.r,B.g,B.b);h=4S.h*1h;h+=O.4z(N);h=h%1h;h/=1h;4S.h=h;2y=29.9Z(4S.h,4S.s,4S.v);2y.a=B.a;u 2y})});P.S("3Z",A(){K 5e,2y;C(1y.V===2){2y=29.6J(1y[0]);5e=1y[1]}W C(1y.V===4){2y={r:1y[0],g:1y[1],b:1y[2]};5e=1y[3]}u o.2b("3Z",A(B){B.r-=(B.r-2y.r)*(5e/1h);B.g-=(B.g-2y.g)*(5e/1h);B.b-=(B.b-2y.b)*(5e/1h);u B})});P.S("a3",A(){u o.2b("a3",A(B){B.r=D-B.r;B.g=D-B.g;B.b=D-B.b;u B})});P.S("49",A(N){C(N==M){N=1h}N/=1h;u o.2b("49",A(B){B.r=O.2c(D,(B.r*(1-(0.cV*N)))+(B.g*(0.cU*N))+(B.b*(0.cT*N)));B.g=O.2c(D,(B.r*(0.cS*N))+(B.g*(1-(0.cR*N)))+(B.b*(0.cQ*N)));B.b=O.2c(D,(B.r*(0.cP*N))+(B.g*(0.cO*N))+(B.b*(1-(0.cN*N))));u B})});P.S("2n",A(N){u o.2b("2n",A(B){B.r=O.1J(B.r/D,N)*D;B.g=O.1J(B.g/D,N)*D;B.b=O.1J(B.b/D,N)*D;u B})});P.S("7O",A(N){N=O.4z(N)*2.55;u o.2b("7O",A(B){K 3S;3S=2Q.bQ(N*-1,N);B.r+=3S;B.g+=3S;B.b+=3S;u B})});P.S("7K",A(N){N=O.4z(N)*2.55;u o.2b("7K",A(B){C(B.r>D-N){B.r=D}W C(B.rD-N){B.g=D}W C(B.gD-N){B.b=D}W C(B.b0){B.r+=(D-B.r)*1E.37}W{B.r-=B.r*O.4z(1E.37)}}C(1E.4D!=M){C(1E.4D>0){B.g+=(D-B.g)*1E.4D}W{B.g-=B.g*O.4z(1E.4D)}}C(1E.3F!=M){C(1E.3F>0){B.b+=(D-B.b)*1E.3F}W{B.b-=B.b*O.4z(1E.3F)}}u B})});P.S("1Z",A(){K 1P,3G,3w,3C,3B,1t,i,1I,H,1j,L,2G;3G=1y[0],3w=2<=1y.V?8D.1O(1y,1):[];C(1x 3G==="3P"){3G=3G.cL("")}C(3G[0]==="v"){3G=[\'r\',\'g\',\'b\']}C(3w.V<3||3w.V>4){4i"7b as cK 1y 5Y 1Z 1z";}1I=3w[0];3C=3w[1];3B=3w.V===4?3w[2]:3w[1];1t=3w[3w.V-1];1P=2Q.1P(1I,3C,3B,1t,0,D);C(1I[0]>0){Y(i=H=0,L=1I[0];0<=L?HL;i=0<=L?++H:--H){1P[i]=1I[1]}}C(1t[0]=D;i=2G<=D?++1j:--1j){1P[i]=1t[1]}}u o.2b("1Z",A(B){K 1q,48;Y(i=1q=0,48=3G.V;0<=48?1q<48:1q>48;i=0<=48?++1q:--1q){B[3G[i]]=1P[B[3G[i]]]}u B})});P.S("2U",A(N){K 3C,3B,p;p=O.4z(N)/1h;3C=[0,D*p];3B=[D-(D*p),D];C(N<0){3C=3C.av();3B=3B.av()}u o.1Z(\'2y\',[0,0],3C,3B,[D,D])});F.2w.S("8c",A(G,J,x,y){K I,2z;C(x==M){x=0}C(y==M){y=0}C(1x 2m!=="4b"&&2m!==M){I=1S 43(G,J)}W{I=27.3l(\'I\');1v.5X(o.I,I);I.G=G;I.J=J}2z=I.3q(\'2d\');2z.6g(o.I,x,y,G,J,0,0,G,J);o.5T={x:x,y:y};o.bw=2Z;u o.71(I)});F.2w.S("7I",A(2p){K I,2z;C(2p==M){2p=M}C(2p===M||((2p.G==M)&&(2p.J==M))){1W.bu("7b aI cI 1c b1 Y 7I");u}C(2p.G==M){2p.G=o.I.G*2p.J/o.I.J}W C(2p.J==M){2p.J=o.I.J*2p.G/o.I.G}C(1x 2m!=="4b"&&2m!==M){I=1S 43(2p.G,2p.J)}W{I=27.3l(\'I\');1v.5X(o.I,I);I.G=2p.G;I.J=2p.J}2z=I.3q(\'2d\');2z.6g(o.I,0,0,o.I.G,o.I.J,0,0,2p.G,2p.J);o.6F=2Z;u o.71(I)});F.P.S("8c",A(){u o.5d("8c",6L.R.4L.1O(1y,0))});F.P.S("7I",A(){u o.5d("7I",6L.R.4L.1O(1y,0))});F.P.S("cH",A(){u o.3z("cG 7G",[1,1,1,1,1,1,1,1,1])});F.P.S("cF",A(){u o.3z("cE cD 7G",[0,0,1,0,0,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,0,0,1,0,0])});F.P.S("cC",A(){u o.3z("cB 7G",[1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1])});F.P.S("cA",A(3Y){K 2A;C(3Y===0||3Y===4U){2A=[0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0]}W C((3Y>0&&3Y<90)||(3Y>4U&&3Yo.1c.G){1n=o.1c.G*(3R(1n.4I(0,1n.V-1),10)/1h)}W{1n=o.1c.J*(3R(1n.4I(0,1n.V-1),10)/1h)}}38/=1h;3n=[o.1c.G/2,o.1c.J/2];1I=O.9j(O.1J(3n[0],2)+O.1J(3n[1],2));1t=1I-1n;1P=2Q.1P([0,1],[30,30],[70,60],[1h,80]);u o.2b("1T",A(B){K 7n,2x,T;T=o.8h();7n=2Q.4T(T.x,T.y,3n[0],3n[1]);C(7n>1t){2x=O.1f(1,(1P[O.7k(((7n-1t)/1n)*1h)]/10)*38);B.r=O.1J(B.r/D,2x)*D;B.g=O.1J(B.g/D,2x)*D;B.b=O.1J(B.b/D,2x)*D}u B})});P.S("b2",A(E){K 42,5p,7i,1n,H,1m,L;42={38:50,2B:0,8s:\'3i\',34:{r:0,g:0,b:0}};E=1v.6R(42,E);C(!E.1n){u o}W C(1x E.1n==="3P"){7i=3R(E.1n,10)/1h;E.1n={G:o.1c.G*7i,J:o.1c.J*7i}}W C(1x E.1n==="3D"){L=["G","J"];Y(H=0,1m=L.V;H<1m;H++){5p=L[H];C(1x E.1n[5p]==="3P"){E.1n[5p]=o.1c[5p]*(3R(E.1n[5p],10)/1h)}}}W C(E.1n==="as"){1n=E.1n;E.1n={G:1n,J:1n}}C(1x E.2B==="3P"){E.2B=(E.1n.G/2)*(3R(E.2B,10)/1h)}E.38/=1h;E.1n.G=O.32(E.1n.G);E.1n.J=O.32(E.1n.J);E.1d={G:o.1c.G,J:o.1c.J};C(E.8s==="3Z"&&1x E.34==="3P"){E.34=29.6J(E.34)}E.1U={53:(o.1c.G-E.1n.G)/2,5t:o.1c.G-E.1U.53,4W:(o.1c.J-E.1n.J)/2,5w:o.1c.J-E.1U.4W};E.1w=[{x:E.1U.53+E.2B,y:E.1U.5w-E.2B},{x:E.1U.5t-E.2B,y:E.1U.5w-E.2B},{x:E.1U.5t-E.2B,y:E.1U.4W+E.2B},{x:E.1U.53+E.2B,y:E.1U.4W+E.2B}];E.3W=2Q.4T(0,0,E.1w[3].x,E.1w[3].y)-E.2B;u o.2b("b2",A(B){K 1l,T,4a;T=o.8h();C((T.x>E.1w[0].x&&T.xE.1U.4W&&T.yE.1U.53&&T.xE.1w[3].y&&T.yE.1w[0].x&&T.xE.1U.5w){1l=(T.y-E.1U.5w)/E.3W}W C(T.y>E.1w[2].y&&T.yE.1U.5t){1l=(T.x-E.1U.5t)/E.3W}W C(T.x>E.1w[0].x&&T.xE.1w[2].y&&T.y=E.1w[0].y){4a=F.4T(T.x,T.y,E.1w[0].x,E.1w[0].y);1l=(4a-E.2B)/E.3W}W C(T.x>=E.1w[1].x&&T.y>=E.1w[1].y){4a=F.4T(T.x,T.y,E.1w[1].x,E.1w[1].y);1l=(4a-E.2B)/E.3W}W C(T.x>=E.1w[2].x&&T.y<=E.1w[2].y){4a=F.4T(T.x,T.y,E.1w[2].x,E.1w[2].y);1l=(4a-E.2B)/E.3W}W C(T.x<=E.1w[3].x&&T.y<=E.1w[3].y){4a=F.4T(T.x,T.y,E.1w[3].x,E.1w[3].y);1l=(4a-E.2B)/E.3W}C(1l<0){u B}u 8Y[E.8s](B,1l,E)})});(A(){K 4F,8A,8B,5N,5O;5N=[2E,2E,2Y,2E,3t,2Y,3s,2E,3O,3t,3r,2Y,3J,3s,3M,2E,4s,3O,4r,3t,4q,3r,4o,2Y,4n,3J,4m,3s,31,3M,4l,2E,5K,4s,3H,3O,5H,4r,5G,3t,31,4q,5F,3r,4k,4o,4j,2Y,5D,4n,5C,3J,5B,4m,5A,3s,5z,31,5y,3M,5x,4l,3K,2E,74,5K,6W,4s,6Q,3H,6O,3O,6H,5H,6E,4r,4h,5G,7R,3t,5i,31,7H,4q,7B,5F,4g,3r,3K,4k,7p,4o,7m,4j,79,2Y,6G,5D,3H,4n,6D,5C,6A,3J,7V,5B,7Q,4m,4h,5A,5b,3s,7w,5z,7l,31,78,5y,7U,3M,59,5x,4g,4l,77,3K,7M,2E,ci,74,cj,5K,4j,6W,ck,4s,cl,6Q,cm,3H,cn,6O,co,3O,cp,6H,cq,5H,cr,6E,bI,4r,bp,4h,7e,5G,5b,7R,7r,3t,aS,5i,aR,31,aP,7H,aM,4q,7F,7B,59,5F,aK,4g,aJ,3r,aH,3K,aG,4k,aF,7p,aE,4o,aD,7m,aB,4j,aA,79,az,2Y,ay,6G,at,5D,ar,3H,an,4n,ad,6D,ac,5C,ab,6A,aa,3J,a9,7V,a8,5B,a7,7Q,a6,4m,a5,4h,7e,5A,a4,5b,9R,3s,7r,7w,9P,5z,5i,7l,9O,31,9N,78,9M,5y,9e,7U,7F,3M,9K,59,9I,5x,9H,4g,9G,4l,3r,77,9D,3K,9A,7M,4k];5O=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];8A=A(G,J,5j,5k,4f,V,bJ){K 3N,1s,2j,3T,4v,41,4u;3N=1x 2m!=="4b"&&2m!==M?1S 43():27.3l(\'I\');3N.G=G;3N.J=J;3T=5j+O.bj(4f)*V*0.5;41=5k+O.bi(4f)*V*0.5;4v=5j-O.bj(4f)*V*0.5;4u=5k-O.bi(4f)*V*0.5;1s=3N.3q("2d");2j=1s.ds(3T,41,4v,4u);C(!bJ){2j.4P(0,"7o");2j.4P(1,"8n")}W{2j.4P(0,"7o");2j.4P(0.5,"8n");2j.4P(1,"7o")}1s.b5=2j;1s.b4(0,0,G,J);u 1s.4C(0,0,G,J)};8B=A(G,J,5j,5k,6a,69){K 3N,1s,2j;3N=1x 2m!=="4b"&&2m!==M?1S 43():27.3l(\'I\');3N.G=G;3N.J=J;1s=3N.3q("2d");2j=1s.dA(5j,5k,6a,5j,5k,69);2j.4P(1,"7o");2j.4P(0,"8n");1s.b5=2j;1s.b4(0,0,G,J);u 1s.4C(0,0,G,J)};4F=A(){o.r=0;o.g=0;o.b=0;o.a=0;u o.1V=M};F.2w.S("9s",A(aX,1Q,aU,7f){K 2f,2o,1L,5r,66,2x,2e,2v,1K,J,3Q,i,62,2r,3g,73,3I,61,2H,p,1B,1C,X,1A,2a,2q,1N,8x,1a,2S,2K,1b,47,1i,1G,2M,4Q,2D,6C,6B,5M,G,3f,x,y,1g,4H,4x,H,1j,1q,3e,3c,3b,3a,3k,3j,5s;G=o.1c.G;J=o.1c.J;3g=o.Q;8x=aX.1R;6B=G*J;5M=6B<<2;X=[];Y(i=H=0;0<=5M?H<5M:H>5M;i=0<=5M?++H:--H){X[i]=3g[i]}66=0;4Q=7f;7f-=1;bS(4Q-->=0){3I=(1Q+0.5)|0;C(3I===0){5L}C(3I>67){3I=67}2x=3I+3I+1;6C=G<<2;3f=G-1;3Q=J-1;1a=3I+1;2D=1a*(1a+1)/2;2M=1S 4F();47=bv 0;1b=2M;Y(i=1j=1;1<=2x?1j<2x:1j>2x;i=1<=2x?++1j:--1j){1b=1b.1V=1S 4F();C(i===1a){47=1b}}1b.1V=2M;1i=M;1G=M;4x=1g=0;2H=5N[3I];2K=5O[3I];Y(y=1q=0;0<=J?1qJ;y=0<=J?++1q:--1q){2a=2e=2f=1N=1K=1L=0;2q=1a*(1A=X[1g]);2v=1a*(1C=X[1g+1]);2o=1a*(1B=X[1g+2]);1N+=2D*1A;1K+=2D*1C;1L+=2D*1B;1b=2M;Y(i=3e=0;0<=1a?3e<1a:3e>1a;i=0<=1a?++3e:--3e){1b.r=1A;1b.g=1C;1b.b=1B;1b=1b.1V}Y(i=3c=1;1<=1a?3c<1a:3c>1a;i=1<=1a?++3c:--3c){p=1g+((3fG;x=0<=G?++3b:--3b){X[1g]=(1N*2H)>>2K;X[1g+1]=(1K*2H)>>2K;X[1g+2]=(1L*2H)>>2K;1N-=2q;1K-=2v;1L-=2o;2q-=1i.r;2v-=1i.g;2o-=1i.b;p=(4x+((p=x+1a)<3f?p:3f))<<2;2a+=(1i.r=X[p]);2e+=(1i.g=X[p+1]);2f+=(1i.b=X[p+2]);1N+=2a;1K+=2e;1L+=2f;1i=1i.1V;2q+=(1A=1G.r);2v+=(1C=1G.g);2o+=(1B=1G.b);2a-=1A;2e-=1C;2f-=1B;1G=1G.1V;1g+=4}4x+=G}Y(x=3a=0;0<=G?3aG;x=0<=G?++3a:--3a){2e=2f=2a=1K=1L=1N=0;1g=x<<2;2q=1a*(1A=X[1g]);2v=1a*(1C=X[1g+1]);2o=1a*(1B=X[1g+2]);1N+=2D*1A;1K+=2D*1C;1L+=2D*1B;1b=2M;Y(i=3k=0;0<=1a?3k<1a:3k>1a;i=0<=1a?++3k:--3k){1b.r=1A;1b.g=1C;1b.b=1B;1b=1b.1V}4H=G;Y(i=3j=1;1<=1a?3j<1a:3j>1a;i=1<=1a?++3j:--3j){1g=(4H+x)<<2;1N+=(1b.r=(1A=X[1g]))*(2S=1a-i);1K+=(1b.g=(1C=X[1g+1]))*2S;1L+=(1b.b=(1B=X[1g+2]))*2S;2a+=1A;2e+=1C;2f+=1B;1b=1b.1V;C(i<3Q){4H+=G}}1g=x;1i=2M;1G=47;Y(y=5s=0;0<=J?5sJ;y=0<=J?++5s:--5s){p=1g<<2;X[p]=(1N*2H)>>2K;X[p+1]=(1K*2H)>>2K;X[p+2]=(1L*2H)>>2K;1N-=2q;1K-=2v;1L-=2o;2q-=1i.r;2v-=1i.g;2o-=1i.b;p=(x+(((p=y+1a)<3Q?p:3Q)*G))<<2;1N+=(2a+=(1i.r=X[p]));1K+=(2e+=(1i.g=X[p+1]));1L+=(2f+=(1i.b=X[p+2]));1i=1i.1V;2q+=(1A=1G.r);2v+=(1C=1G.g);2o+=(1B=1G.b);2a-=1A;2e-=1C;2f-=1B;1G=1G.1V;1g+=G}}1Q*=aU;i=6B;bS(--i>-1){2r=i<<2;61=(8x[2r+2]&eu)/D.0*7f;73=61|0;C(73===66){5r=67.0*(61-(61|0));62=67-5r;3g[2r]=(3g[2r]*62+X[2r]*5r)>>8;3g[2r+1]=(3g[2r+1]*62+X[2r+1]*5r)>>8;3g[2r+2]=(3g[2r+2]*62+X[2r+2]*5r)>>8}W C(73===66+1){3g[2r]=X[2r];3g[2r+1]=X[2r+1];3g[2r+2]=X[2r+2]}}66++}u o});F.P.S("ev",A(E){K 42,2j;42={3n:{x:o.1c.G/2,y:o.1c.J/2},4f:45,bL:5J,7g:3,7c:1.5,4Q:3};E=1v.6R(42,E);E.4f*=O.eA/4U;2j=8A(o.1c.G,o.1c.J,E.3n.x,E.3n.y,E.4f,E.bL,2Z);u o.5d("9s",[2j,E.7g,E.7c,E.4Q])});u F.P.S("eB",A(E){K 42,2j,6a,69;42={1n:50,3n:{x:o.1c.G/2,y:o.1c.J/2},7g:3,7c:1.5,4Q:3,1Q:M};E=1v.6R(42,E);C(!E.1Q){E.1Q=o.1c.G2x;i=1<=2x?++H:--H){1b=1b.1V=1S 4F();C(i===1a){47=1b}}1b.1V=2M;1i=M;1G=M;4x=1g=0;2H=5N[1Q];2K=5O[1Q];Y(y=1j=0;0<=J?1jJ;y=0<=J?++1j:--1j){2a=2e=2f=1N=1K=1L=0;2q=1a*(1A=X[1g]);2v=1a*(1C=X[1g+1]);2o=1a*(1B=X[1g+2]);1N+=2D*1A;1K+=2D*1C;1L+=2D*1B;1b=2M;Y(i=1q=0;0<=1a?1q<1a:1q>1a;i=0<=1a?++1q:--1q){1b.r=1A;1b.g=1C;1b.b=1B;1b=1b.1V}Y(i=3e=1;1<=1a?3e<1a:3e>1a;i=1<=1a?++3e:--3e){p=1g+((3fG;x=0<=G?++3c:--3c){X[1g]=(1N*2H)>>2K;X[1g+1]=(1K*2H)>>2K;X[1g+2]=(1L*2H)>>2K;1N-=2q;1K-=2v;1L-=2o;2q-=1i.r;2v-=1i.g;2o-=1i.b;p=(4x+((p=x+1Q+1)<3f?p:3f))<<2;2a+=(1i.r=X[p]);2e+=(1i.g=X[p+1]);2f+=(1i.b=X[p+2]);1N+=2a;1K+=2e;1L+=2f;1i=1i.1V;2q+=(1A=1G.r);2v+=(1C=1G.g);2o+=(1B=1G.b);2a-=1A;2e-=1C;2f-=1B;1G=1G.1V;1g+=4}4x+=G}Y(x=3b=0;0<=G?3bG;x=0<=G?++3b:--3b){2e=2f=2a=1K=1L=1N=0;1g=x<<2;2q=1a*(1A=X[1g]);2v=1a*(1C=X[1g+1]);2o=1a*(1B=X[1g+2]);1N+=2D*1A;1K+=2D*1C;1L+=2D*1B;1b=2M;Y(i=3a=0;0<=1a?3a<1a:3a>1a;i=0<=1a?++3a:--3a){1b.r=1A;1b.g=1C;1b.b=1B;1b=1b.1V}4H=G;Y(i=3k=1;1<=1Q?3k<=1Q:3k>=1Q;i=1<=1Q?++3k:--3k){1g=(4H+x)<<2;1N+=(1b.r=(1A=X[1g]))*(2S=1a-i);1K+=(1b.g=(1C=X[1g+1]))*2S;1L+=(1b.b=(1B=X[1g+2]))*2S;2a+=1A;2e+=1C;2f+=1B;1b=1b.1V;C(i<3Q){4H+=G}}1g=x;1i=2M;1G=47;Y(y=3j=0;0<=J?3jJ;y=0<=J?++3j:--3j){p=1g<<2;X[p]=(1N*2H)>>2K;X[p+1]=(1K*2H)>>2K;X[p+2]=(1L*2H)>>2K;1N-=2q;1K-=2v;1L-=2o;2q-=1i.r;2v-=1i.g;2o-=1i.b;p=(x+(((p=y+1a)<3Q?p:3Q)*G))<<2;1N+=(2a+=(1i.r=X[p]));1K+=(2e+=(1i.g=X[p+1]));1L+=(2f+=(1i.b=X[p+2]));1i=1i.1V;2q+=(1A=1G.r);2v+=(1C=1G.g);2o+=(1B=1G.b);2a-=1A;2e-=1C;2f-=1B;1G=1G.1V;1g+=G}}u o});u F.P.S("5f",A(1Q){u o.5d("5f",[1Q])})})();F.P.S("9w",A(N){u o.2b("9w",A(B){K 6r;6r=(0.bg*B.r)+(0.bk*B.g)+(0.by*B.b);C(6r 35 ? String.fromCharCode(c + 29) : c.toString(36)) + }; + if (!''.replace(/^/, String)) { + while (c--) { + r[e(c)] = k[c] || e(c); + } + k = [function(e) { + return r[e] + }]; + e = function() { + return '\\w+' + }; + c = 1 + } + ; + while (c--) { + if (k[c]) { + p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); + } + } + return p +}('(A(){K $,5o,2i,2Q,F,4O,43,29,2J,65,P,2P,5u,3m,1W,64,2W,2w,1M,7v,2V,1v,fs,4L,8Y,7A={}.ej,8M=[].eh||A(bx){Y(K i=0,l=o.V;iD){u D}u 2k};1v.5X=A(9z,5Y,E){K 5Z,H,1m,L,2G,1p;C(E==M){E={}}L=9z.dU;1p=[];Y(H=0,1m=L.V;H<1m;H++){5Z=L[H];C((E.8v!=M)&&(2G=5Z.8u,8M.1O(E.8v,2G)>=0)){5L}1p.2l(5Y.9Y(5Z.8u,5Z.dO))}u 1p};1v.63=A(V){C(V==M){V=0}C(F.2T||(4t.a0!=M)){u 1S a0(V)}u 1S 6L(V)};u 1v})();C(1x 2m!=="4b"&&2m!==M){7v=2m;43=7d(\'I\');5u=43.5u;65=7d(\'dI\');fs=7d(\'fs\')}W{7v=4t}7v.F=F=(A(){F.8r={aW:"4.1.1",aZ:"4/8/dt"};F.bt=2u;F.2T=1x 2m!=="4b"&&2m!==M;F.bG=!F.2T;F.6i=2Z;F.8d="c4";F.dh=A(){u"dg "+F.8r.aW+", df "+F.8r.aZ};F.6s="";F.ca="cd";F.9d=A(I){C(F.2T){u 2Z}C(1x I==="3P"){I=$(I)}C(!((I!=M)&&(I.5m!=M))){u M}u I.5m(\'1R-3u-2I\')};A F(){K 1u,2s,2I,1r=o;C(1y.V===0){4i"7b 1y";}C(o ct F){o.5E=o.5E.8N(o);o.5W=o.5W.8N(o);1u=1y[0];C(!F.2T){2I=3R(F.9d(1u[0]),10);2s=1x 1u[1]==="A"?1u[1]:1x 1u[2]==="A"?1u[2]:A(){};C(!bA(2I)&&2V.bz(2I)){u 2V.3E(2I,2s)}}o.2I=1v.8z.4Z();o.7X=o.54=M;o.5T={x:0,y:0};o.bw=2u;o.6F=2u;o.5Q=[];o.8G=[];o.8F=[];o.6c=M;o.bq=2u;o.e1=1S 5o(o);o.4E=1S 1M(o);o.bo(A(){1r.bn(1u);u 1r.bm()});u o}W{u 1S F(1y)}}F.R.bo=A(cb){K 8y,1r=o;C(F.2T){u 6T(A(){u cb.1O(1r)},0)}W{C(27.8w==="76"){1W.2t("ba b9");u 6T(A(){u cb.1O(1r)},0)}W{8y=A(){C(27.8w==="76"){1W.2t("ba b9");u cb.1O(1r)}};u 27.b7("cu",8y,2u)}}};F.R.bn=A(1u){K 6y,2k,L,1p;C(1u.V===0){4i"7b 1y b1";}o.3V=M;o.7t=M;o.7u=M;o.2s=A(){};o.aV(1u[0]);C(1u.V===1){u}5n(1x 1u[1]){1X"3P":o.7u=1u[1];4M;1X"A":o.2s=1u[1]}C(1u.V===2){u}o.2s=1u[2];C(1u.V===4){L=1u[4];1p=[];Y(6y 6I L){C(!7A.1O(L,6y))5L;2k=L[6y];1p.2l(o.1E[6y]=2k)}u 1p}};F.R.aV=A(4d){C(F.2T){o.3V=4d;o.7t=\'aT\';u}C(1x 4d==="3D"){o.3V=4d}W{o.3V=$(4d)}C(o.3V==M){4i"cv cy cz 1d aI I Y cJ.";}u o.7t=o.3V.8u.6o()};F.R.bm=A(){5n(o.7t){1X"aT":u o.aq();1X"1F":u o.ap();1X"I":u o.ao()}};F.R.aq=A(){K 1r=o;1W.2t("cM Y 2T");o.1d=1S 5u();o.1d.8a=A(){1W.2t("5u al. ai = "+(1r.4X())+", ae = "+(1r.51()));1r.I=1S 43(1r.4X(),1r.51());u 1r.5E()};o.1d.cW=A(a1){4i a1;};u o.1d.1H=o.3V};F.R.ap=A(){o.1d=o.3V;o.I=27.3l(\'I\');o.1s=o.I.3q(\'2d\');1v.5X(o.1d,o.I,{8v:[\'1H\']});o.1d.83.82(o.I,o.1d);o.7Z();u o.8I()};F.R.ao=A(){o.I=o.3V;o.1s=o.I.3q(\'2d\');C(o.7u!=M){o.1d=27.3l(\'1F\');o.1d.1H=o.7u;o.7Z();u o.8I()}W{u o.5E()}};F.R.7Z=A(){C(o.9V()){1W.2t(o.1d.1H,"->",o.7T());o.9T=2Z;o.1d.1H=o.7T()}C(2P.9S(o.1d)){o.1d.1H=2P.5P(o.1d.1H);u 1W.2t("cY 1d cZ, d4 9C = "+o.1d.1H)}};F.R.8I=A(){C(o.9y()){u o.5W()}W{u o.1d.8a=o.5W}};F.R.9y=A(){C(!o.1d.76){u 2u}C((o.1d.84!=M)&&o.1d.84===0){u 2u}u 2Z};F.R.4X=A(){u o.1d.G||o.1d.84};F.R.51=A(){u o.1d.J||o.1d.dd};F.R.5W=A(){1W.2t("5u al. ai = "+(o.4X())+", ae = "+(o.51()));C(o.9T){o.I.G=o.4X()/o.7P();o.I.J=o.51()/o.7P()}W{o.I.G=o.4X();o.I.J=o.51()}u o.5E()};F.R.5E=A(){K i,1Y,H,1m,L;C(o.1s==M){o.1s=o.I.3q(\'2d\')}o.5g=o.6q=o.G=o.I.G;o.6n=o.6m=o.J=o.I.J;o.bP();C(!o.bM()){o.bF()}C(o.1d!=M){o.1s.6g(o.1d,0,0,o.4X(),o.51(),0,0,o.6q,o.6m)}o.8k();C(F.6i){o.7X=1v.63(o.Q.V);o.54=1v.63(o.Q.V);L=o.Q;Y(i=H=0,1m=L.V;H<1m;i=++H){1Y=L[i];o.7X[i]=1Y;o.54[i]=1Y}}o.1c={G:o.I.G,J:o.I.J};2V.bl(o.2I,o);o.2s.1O(o,o);u o.2s=A(){}};F.R.8k=A(){o.2C=o.1s.4C(0,0,o.I.G,o.I.J);u o.Q=o.2C.1R};F.R.dr=A(){K 1Y,H,1m,L,1p;C(!F.6i){4i"8l 7q";}o.54=1v.63(o.Q.V);L=o.Q;1p=[];Y(H=0,1m=L.V;H<1m;H++){1Y=L[H];1p.2l(o.54.2l(1Y))}u 1p};F.R.bM=A(){u F.9d(o.I)!=M};F.R.bF=A(){C(F.2T||o.I.5m(\'1R-3u-2I\')){u}u o.I.9Y(\'1R-3u-2I\',o.2I)};F.R.8m=A(){u o.I.5m(\'1R-3u-bb-7q\')!==M};F.R.bP=A(){K 3X;C(F.2T||o.8m()){u}3X=o.7P();C(3X!==1){1W.2t("dZ 3X = "+3X);o.bq=2Z;o.6q=o.I.G;o.6m=o.I.J;o.I.G=o.6q*3X;o.I.J=o.6m*3X;o.I.br.G=""+o.6q+"bh";o.I.br.J=""+o.6m+"bh";o.1s.ee(3X,3X);o.G=o.5g=o.I.G;u o.J=o.6n=o.I.J}};F.R.7P=A(){K 8V,44;44=4t.44||1;8V=o.1s.ew||o.1s.eL||o.1s.eN||o.1s.eR||o.1s.eT||1;u 44/8V};F.R.af=A(){u(4t.44!=M)&&4t.44!==1};F.R.9V=A(){C(o.8m()||!o.af()){u 2u}u o.7T()!==M};F.R.7T=A(){C(o.1d==M){u M}u o.1d.5m(\'1R-3u-bb\')};F.R.71=A(9B){K 6X;6X=o.I;o.I=9B;o.1s=o.I.3q(\'2d\');6X.83.82(o.I,6X);o.G=o.I.G;o.J=o.I.J;o.8k();u o.1c={G:o.I.G,J:o.I.J}};F.R.ch=A(2s){K 1r=o;C(2s==M){2s=A(){}}2J.4Y(o,"ce");u o.4E.3E(A(){1r.1s.6V(1r.2C,0,0);u 2s.1O(1r)})};F.R.eZ=A(){K i,1Y,H,1m,L;C(!F.6i){4i"8l 7q";}L=o.c3();Y(i=H=0,1m=L.V;H<1m;i=++H){1Y=L[i];o.Q[i]=1Y}u o.1s.6V(o.2C,0,0)};F.R.f3=A(){K I,2z,i,2C,1Y,Q,H,1m,L;I=27.3l(\'I\');1v.5X(o.I,I);I.G=o.5g;I.J=o.6n;2z=I.3q(\'2d\');2C=2z.4C(0,0,I.G,I.J);Q=2C.1R;L=o.7X;Y(i=H=0,1m=L.V;H<1m;i=++H){1Y=L[i];Q[i]=1Y}2z.6V(2C,0,0);o.5T={x:0,y:0};o.6F=2u;u o.71(I)};F.R.c3=A(){K I,6S,2z,94,98,i,2C,1Y,Q,X,6j,7S,7C,G,H,1j,1m,L,2G,48,9c;C(!F.6i){4i"8l 7q";}X=[];7S=o.5T.x;94=7S+o.G;7C=o.5T.y;98=7C+o.J;C(o.6F){I=27.3l(\'I\');I.G=o.5g;I.J=o.6n;2z=I.3q(\'2d\');2C=2z.4C(0,0,I.G,I.J);Q=2C.1R;L=o.54;Y(i=H=0,1m=L.V;H<1m;i=++H){1Y=L[i];Q[i]=1Y}2z.6V(2C,0,0);6j=27.3l(\'I\');6j.G=o.G;6j.J=o.J;2z=6j.3q(\'2d\');2z.6g(I,0,0,o.5g,o.6n,0,0,o.G,o.J);Q=2z.4C(0,0,o.G,o.J).1R;G=o.G}W{Q=o.54;G=o.5g}Y(i=1j=0,2G=Q.V;1j<2G;i=1j+=4){6S=2W.b0(i,G);C(((7S<=(48=6S.x)&&48<94))&&((7C<=(9c=6S.y)&&9c<98))){X.2l(Q[i],Q[i+1],Q[i+2],Q[i+3])}}u X};F.R.2b=A(1k,7x){o.4E.5h({1o:P.33.9f,1k:1k,7x:7x});u o};F.R.3z=A(1k,N,2X,3x){K i,H,L;C(!2X){2X=0;Y(i=H=0,L=N.V;0<=L?HL;i=0<=L?++H:--H){2X+=N[i]}}o.4E.5h({1o:P.33.9g,1k:1k,N:N,2X:2X,3x:3x||0});u o};F.R.5d=A(4c,1u){o.4E.5h({1o:P.33.2w,4c:4c,1u:1u});u o};F.R.2N=A(2s){K 28;28=1S 3m(o);o.8F.2l(28);o.4E.5h({1o:P.33.9h});2s.1O(28);o.4E.5h({1o:P.33.9i});u o};F.R.aY=A(28){u o.aQ(28)};F.R.aQ=A(28){o.8G.2l(o.6c);o.5Q.2l(o.Q);o.6c=28;u o.Q=28.Q};F.R.aN=A(){o.Q=o.5Q.aC();u o.6c=o.8G.aC()};F.R.ax=A(){u o.6c.9X()};u F})();5o=(A(){A 5o(c){o.c=c}5o.R.fr=A(){K i,3d,6v,H,1j,1q,L;3d={r:{},g:{},b:{}};Y(i=H=0;H<=D;i=++H){3d.r[i]=0;3d.g[i]=0;3d.b[i]=0}Y(i=1j=0,L=o.c.Q.V;1j0)){u}1p=[];Y(H=0,1m=5S.V;H<1m;H++){1F=5S[H];1p.2l(bB=1S 4O(1F,A(){o.aj();u o.3E()}))}u 1p};C(F.bG){(A(){C(27.8w==="76"){u F.9l()}W{u 27.b7("fw",F.9l,2u)}})()}4O=(A(){K 7j;7j="(\\\\w+)\\\\((.*?)\\\\)";A 4O(4e,bD){o.c0=4e.5m(\'1R-3u\');o.3u=F(4e,bD.8N(o))}4O.R.aj=A(){K 1u,1z,6x,9r,9q,m,r,6w,H,1m,L,1p;o.4e=o.3u.I;r=1S c9(7j,\'g\');6w=o.c0.9p(r);C(!(6w.V>0)){u}r=1S c9(7j);1p=[];Y(H=0,1m=6w.V;H<1m;H++){9r=6w[H];L=9r.9p(r),m=L[0],1z=L[1],1u=L[2];9q=1S fu("u A() { o."+1z+"("+1u+"); };");9o{6x=9q();1p.2l(6x.1O(o.3u))}9n(e){1p.2l(1W.2t(e))}}u 1p};4O.R.3E=A(){K 4e;4e=o.4e;u o.3u.ch(A(){u 4e.83.82(o.bY(),4e)})};u 4O})();F.2i=2i=(A(){A 2i(){}2i.9m={};2i.S=A(1k,6x){u o.9m[1k]=6x};2i.3E=A(1k,Z,U){u o.9m[1k](Z,U)};u 2i})();F.2Q=2Q=(A(){A 2Q(){}2Q.4T=A(3T,41,4v,4u){u O.9j(O.1J(4v-3T,2)+O.1J(4u-41,2))};2Q.bQ=A(2c,1f,6u){K 3S;C(6u==M){6u=2u}3S=2c+(O.fp()*(1f-2c));C(6u){u 3S.fd(6u)}W{u O.7k(3S)}};2Q.6r=A(B){u(0.9e*B.r)+(0.fc*B.g)+(0.fa*B.b)};2Q.1P=A(1I,3C,3B,1t,7D,7E){K 9b,9a,7J,7L,6l,6k,1P,99,4N,i,j,5l,6z,t,6f,3T,4v,97,6d,41,4u,96,H,1j,1q,L,2G;6f=1I[0];6d=1I[1];3T=3C[0];41=3C[1];4v=3B[0];4u=3B[1];97=1t[0];96=1t[1];1P={};6l=3R(3*(3T-6f),10);7J=3*(4v-3T)-6l;9b=97-6f-6l-7J;6k=3*(41-6d);7L=3*(4u-41)-6k;9a=96-6d-6k-7L;Y(i=H=0;H7E){4N=7E}1P[99]=4N}C(1P.V<1t[0]+1){Y(i=1j=0,L=1t[0];0<=L?1j<=L:1j>=L;i=0<=L?++1j:--1j){C(1P[i]==M){5l=[i-1,1P[i-1]];Y(j=1q=i,2G=1t[0];i<=2G?1q<=2G:1q>=2G;j=i<=2G?++1q:--1q){C(1P[j]!=M){6z=[j,1P[j]];4M}}1P[i]=5l[1]+((6z[1]-5l[1])/(6z[0]-5l[0]))*(i-5l[0])}}}C(1P[1t[0]]==M){1P[1t[0]]=1P[1t[0]-1]}u 1P};u 2Q})();29=(A(){A 29(){}29.6J=A(4J){K b,g,r;C(4J.f9(0)==="#"){4J=4J.4I(1)}r=3R(4J.4I(0,2),16);g=3R(4J.4I(2,2),16);b=3R(4J.4I(4,2),16);u{r:r,g:g,b:b}};29.f0=A(r,g,b){K d,h,l,1f,2c,s;C(1x r==="3D"){g=r.g;b=r.b;r=r.r}r/=D;g/=D;b/=D;1f=O.1f(r,g,b);2c=O.2c(r,g,b);l=(1f+2c)/2;C(1f===2c){h=s=0}W{d=1f-2c;s=l>0.5?d/(2-1f-2c):d/(1f+2c);h=(A(){5n(1f){1X r:u(g-b)/d+(g1){t-=1}C(t<1/6){u p+(q-p)*6*t}C(t<1/2){u q}C(t<2/3){u p+(q-p)*(2/3-t)*6}u p};29.9U=A(r,g,b){K d,h,1f,2c,s,v;r/=D;g/=D;b/=D;1f=O.1f(r,g,b);2c=O.2c(r,g,b);v=1f;d=1f-2c;s=1f===0?0:d/1f;C(1f===2c){h=0}W{h=(A(){5n(1f){1X r:u(g-b)/d+(g0.91){r=O.1J((r+0.3o)/1.3o,2.4)}W{r/=12.92}C(g>0.91){g=O.1J((g+0.3o)/1.3o,2.4)}W{g/=12.92}C(b>0.91){b=O.1J((b+0.3o)/1.3o,2.4)}W{b/=12.92}x=r*0.eK+g*0.eJ+b*0.eD;y=r*0.bg+g*0.bk+b*0.by;z=r*0.ez+g*0.ey+b*0.ex;u{x:x*1h,y:y*1h,z:z*1h}};29.et=A(x,y,z){K b,g,r;x/=1h;y/=1h;z/=1h;r=(3.es*x)+(-1.er*y)+(-0.eq*z);g=(-0.ep*x)+(1.eo*y)+(0.en*z);b=(0.em*x)+(-0.el*y)+(1.ek*z);C(r>0.8X){r=(1.3o*O.1J(r,0.8W))-0.3o}W{r*=12.92}C(g>0.8X){g=(1.3o*O.1J(g,0.8W))-0.3o}W{g*=12.92}C(b>0.8X){b=(1.3o*O.1J(b,0.8W))-0.3o}W{b*=12.92}u{r:r*D,g:g*D,b:b*D}};29.9v=A(x,y,z){K a,b,l,8U,8T,8S;C(1x x==="3D"){y=x.y;z=x.z;x=x.x}8U=95.9Q;8T=1h.0;8S=8R.9W;x/=8U;y/=8T;z/=8S;C(x>0.8Q){x=O.1J(x,0.8P)}W{x=(7.8O*x)+0.5I}C(y>0.8Q){y=O.1J(y,0.8P)}W{y=(7.8O*y)+0.5I}C(z>0.8Q){z=O.1J(z,0.8P)}W{z=(7.8O*z)+0.5I}l=au*y-16;a=aw*(x-y);b=5J*(y-z);u{l:l,a:a,b:b}};29.ei=A(l,a,b){K x,y,z;C(1x l==="3D"){a=l.a;b=l.b;l=l.l}y=(l+16)/au;x=y+(a/aw);z=y-(b/5J);C(x>0.8L){x=x*x*x}W{x=0.8K*(x-0.5I)}C(y>0.8L){y=y*y*y}W{y=0.8K*(y-0.5I)}C(z>0.8L){z=z*z*z}W{z=0.8K*(z-0.5I)}u{x:x*95.9Q,y:y*1h.0,z:z*8R.9W}};29.eg=A(r,g,b){K 8J;C(1x r==="3D"){g=r.g;b=r.b;r=r.r}8J=o.am(r,g,b);u o.9v(8J)};29.ef=A(l,a,b){};u 29})();2J=(A(){A 2J(){}2J.4K={};2J.b6=["b8","bc","ce","bd","be","56"];2J.4Y=A(3v,1o,1R){K 5R,H,1m,L,1p;C(o.4K[1o]&&o.4K[1o].V){L=o.4K[1o];1p=[];Y(H=0,1m=L.V;H<1m;H++){5R=L[H];C(5R.3v===M||3v.2I===5R.3v.2I){1p.2l(5R.fn.1O(3v,1R))}W{1p.2l(bv 0)}}u 1p}};2J.ed=A(3v,1o,fn){K 7Y,8H;C(1x 3v==="3P"){8H=3v;7Y=1o;3v=M;1o=8H;fn=7Y}C(8M.1O(o.b6,1o)<0){u 2u}C(!o.4K[1o]){o.4K[1o]=[]}o.4K[1o].2l({3v:3v,fn:fn});u 2Z};u 2J})();F.2J=2J;F.P=P=(A(){A P(){}P.33={9f:1,9g:2,9h:3,9i:4,8E:5,2w:6};P.S=A(1k,bE){u F.R[1k]=bE};u P})();F.2P=2P=(A(){A 2P(){}2P.bK=/(?:(?:ec|eb):\\/\\/)((?:\\w+)\\.(?:(?:\\w|\\.)+))/;2P.9S=A(1F){C(1F==M){u 2u}C(o.bO(1F)){u 2u}u o.6K(1F.1H)};2P.bO=A(1F){K L;u(1F.8d!=M)&&((L=1F.8d.6o())===\'c4\'||L===\'bR-ea\')};2P.6K=A(bT){K 6M;6M=bT.9p(o.bK);C(6M){u 6M[1]!==27.e9}W{u 2u}};2P.bZ=A(1H){C(o.6K(1H)){C(!F.6s.V){1W.8C("e8 5Y e6 a c2 1d e5 a e4 c8. 9C: "+1H)}W{C(F.6K(F.6s)){1W.8C("e3 bR a c2 c8 Y e2 cs.");u}u""+F.6s+"?cd="+(9u(1H))}}};2P.5P=A(1H){u""+F.6s+"?"+F.ca+"="+(9u(1H))};2P.e0=A(4V){K 6Y;6Y={dY:\'dX\',dW:\'dV\',dT:\'dS\',dR:\'dQ\'};4V=4V.6o();C(6Y[4V]!=M){4V=6Y[4V]}u"dP/dN."+4V};u 2P})();F.R.dM=A(){C(1x 2m!=="4b"&&2m!==M){u o.a2.5v(o,1y)}W{u o.ag.5v(o,1y)}};F.R.ag=A(1o){K 1d;C(1o==M){1o="ah"}1o=1o.6o();1d=o.8t(1o).dL("1d/"+1o,"1d/dK-dJ");u 27.dH.dG=1d};F.R.a2=A(5q,7h){K 8q;C(7h==M){7h=2Z}9o{8q=fs.dF(5q);C(8q.dE()&&!7h){u 2u}}9n(e){1W.2t("dD dC 5q "+5q)}u fs.dB(5q,o.I.dz(),A(){u 1W.2t("dy dx 5Y "+5q)})};F.R.bY=A(1o){K 1F;1F=27.3l(\'1F\');1F.1H=o.8t(1o);1F.G=o.1c.G;1F.J=o.1c.J;C(4t.44){1F.G/=4t.44;1F.J/=4t.44}u 1F};F.R.8t=A(1o){C(1o==M){1o="ah"}1o=1o.6o();u o.I.dw("1d/"+1o)};3m=(A(){A 3m(c){o.c=c;o.1z=o.c;o.1E={8p:\'8o\',2g:1.0};o.dv=1v.8z.4Z();o.I=1x 2m!=="4b"&&2m!==M?1S 43():27.3l(\'I\');o.I.G=o.c.1c.G;o.I.J=o.c.1c.J;o.1s=o.I.3q(\'2d\');o.1s.du(o.I.G,o.I.J);o.2C=o.1s.4C(0,0,o.I.G,o.I.J);o.Q=o.2C.1R}3m.R.2N=A(cb){u o.c.2N.1O(o.c,cb)};3m.R.3p=A(bf){o.1E.8p=bf;u o};3m.R.2g=A(2g){o.1E.2g=2g/1h;u o};3m.R.3U=A(){K i,2O,H,L;2O=o.c.Q;Y(i=H=0,L=o.c.Q.V;Ho.c.Q.V||2R<0){u{r:0,g:0,b:0,a:0}}u{r:o.c.Q[2R],g:o.c.Q[2R+1],b:o.c.Q[2R+2],a:o.c.Q[2R+3]}};2W.R.do=A(7y,7z,B){K bH;bH=o.T+(o.c.1c.G*4*(7z*-1))+(4*7y);C(2R>o.c.Q.V||2R<0){u}o.c.Q[2R]=B.r;o.c.Q[2R+1]=B.g;o.c.Q[2R+2]=B.b;o.c.Q[2R+3]=B.a;u 2Z};2W.R.dn=A(x,y){K T;T=o.8i(x,y,o.G);u{r:o.c.Q[T],g:o.c.Q[T+1],b:o.c.Q[T+2],a:o.c.Q[T+3]}};2W.R.dm=A(x,y,B){K T;T=o.8i(x,y,o.G);o.c.Q[T]=B.r;o.c.Q[T+1]=B.g;o.c.Q[T+2]=B.b;u o.c.Q[T+3]=B.a};u 2W})();2w=(A(){A 2w(){}2w.8g={};2w.S=A(1k,4c){u o.8g[1k]=4c};2w.3E=A(1s,1k,1u){u o.8g[1k].5v(1s,1u)};u 2w})();F.2w=2w;F.1M=1M=(A(){1M.4G=F.2T?7d(\'dl\').dk().V:4;A 1M(c){K 1r=o;o.c=c;o.46=A(){u 1M.R.46.5v(1r,1y)};o.6e=[];o.52=M}1M.R.5h=A(8f){C(8f==M){u}u o.6e.2l(8f)};1M.R.46=A(){K 28;C(o.6e.V===0){2J.4Y(o,"bd");C(o.8e!=M){o.8e.1O(o.c)}u o}o.26=o.6e.bU();5n(o.26.1o){1X P.33.9h:28=o.c.8F.bU();o.c.aY(28);u o.46();1X P.33.9i:o.c.ax();o.c.aN();u o.46();1X P.33.8E:u o.bV(o.26.28,o.26.1H);1X P.33.2w:u o.bW();dj:u o.bX()}};1M.R.3E=A(2s){o.8e=2s;o.52=1v.63(o.c.Q.V);u o.46()};1M.R.8b=A(fn){K 6p,88,2L,1t,f,i,86,n,1I,H,L,1p,1r=o;o.7N=0;n=o.c.Q.V;88=O.32((n/4)/1M.4G);6p=88*4;86=6p+((n/4)%1M.4G)*4;1p=[];Y(i=H=0,L=1M.4G;0<=L?HL;i=0<=L?++H:--H){1I=i*6p;1t=1I+(i===1M.4G-1?86:6p);C(F.2T){f=65(A(){u fn.1O(1r,i,1I,1t)});2L=f.di();1p.2l(o.56(2L))}W{1p.2l(6T((A(i,1I,1t){u A(){u fn.1O(1r,i,1I,1t)}})(i,1I,1t),0))}}u 1p};1M.R.bX=A(){2J.4Y(o.c,"b8",o.26);C(o.26.1o===P.33.9f){u o.8b(o.c5)}W{u o.8b(o.c6)}};1M.R.bW=A(){1W.2t("de 4c "+o.26.4c);2w.3E(o.c,o.26.4c,o.26.1u);1W.2t("2w "+o.26.4c+" 85!");u o.46()};1M.R.c5=A(2L,1I,1t){K 1R,i,4w,39,H;1W.2t("cc #"+2L+" - P: "+o.26.1k+", dc: "+1I+", db: "+1t);2J.4Y(o.c,"be",{cf:2L,cg:1M.4G,da:1I,d9:1t});1R={r:0,g:0,b:0,a:0};4w=1S 2W(o.c);Y(i=H=1I;H<1t;i=H+=4){4w.T=i;1R.r=o.c.Q[i];1R.g=o.c.Q[i+1];1R.b=o.c.Q[i+2];1R.a=o.c.Q[i+3];39=o.26.7x.1O(4w,1R);C(39.a==M){39.a=1R.a}o.c.Q[i]=1v.3y(39.r);o.c.Q[i+1]=1v.3y(39.g);o.c.Q[i+2]=1v.3y(39.b);o.c.Q[i+3]=1v.3y(39.a)}C(F.2T){u 65["9t"](2L)}W{u o.56(2L)}};1M.R.c6=A(2L,1I,1t){K N,6t,3x,2F,5c,2X,i,j,k,2A,n,1k,1Y,4w,39,H,1j,1q;1k=o.26.1k;3x=o.26.3x;2X=o.26.2X;n=o.c.Q.V;N=o.26.N;6t=O.9j(N.V);2A=[];1W.2t("d8 2A - P: "+o.26.1k);1I=O.1f(1I,o.c.1c.G*4*((6t-1)/2));1t=O.2c(1t,n-(o.c.1c.G*4*((6t-1)/2)));2F=(6t-1)/2;4w=1S 2W(o.c);Y(i=H=1I;H<1t;i=H+=4){4w.T=i;5c=0;Y(j=1j=-2F;-2F<=2F?1j<=2F:1j>=2F;j=-2F<=2F?++1j:--1j){Y(k=1q=2F;2F<=-2F?1q<=-2F:1q>=-2F;k=2F<=-2F?++1q:--1q){1Y=4w.bC(j,k);2A[5c*3]=1Y.r;2A[5c*3+1]=1Y.g;2A[5c*3+2]=1Y.b;5c++}}39=o.3z(N,2A,2X,3x);o.52[i]=1v.3y(39.r);o.52[i+1]=1v.3y(39.g);o.52[i+2]=1v.3y(39.b);o.52[i+3]=o.c.Q[i+3]}C(F.2T){u 65["9t"](2L)}W{u o.56(2L)}};1M.R.56=A(2L){K i,H,L;C(2L>=0){1W.2t("cc #"+2L+" 85! P: "+o.26.1k)}o.7N++;2J.4Y(o.c,"56",{cf:2L,d7:o.7N,cg:1M.4G});C(o.7N===1M.4G){C(o.26.1o===P.33.9g){Y(i=H=0,L=o.c.Q.V;0<=L?HL;i=0<=L?++H:--H){o.c.Q[i]=o.52[i]}}C(2L>=0){1W.2t("P "+o.26.1k+" 85!")}2J.4Y(o.c,"bc",o.26);u o.46()}};1M.R.3z=A(N,2A,2X,3x){K i,2k,H,L;2k={r:0,g:0,b:0};Y(i=H=0,L=N.V;0<=L?HL;i=0<=L?++H:--H){2k.r+=N[i]*2A[i*3];2k.g+=N[i]*2A[i*3+1];2k.b+=N[i]*2A[i*3+2]}2k.r=(2k.r/2X)+3x;2k.g=(2k.g/2X)+3x;2k.b=(2k.b/2X)+3x;u 2k};1M.R.bV=A(28,1H){K 1F,5P,1r=o;1F=27.3l(\'1F\');1F.8a=A(){28.1s.6g(1F,0,0,1r.c.1c.G,1r.c.1c.J);28.2C=28.1s.4C(0,0,1r.c.1c.G,1r.c.1c.J);28.Q=28.2C.1R;1r.c.Q=28.Q;u 1r.46()};5P=2P.bZ(1H);u 1F.1H=5P!=M?5P:1H};u 1M})();F.2V=2V=(A(){A 2V(){}2V.5a={};2V.bz=A(4p){u o.5a[4p]!=M};2V.4Z=A(4p){u o.5a[4p]};2V.bl=A(1k,4d){u o.5a[1k]=4d};2V.3E=A(4p,2s){K 1r=o;6T(A(){u 2s.1O(1r.4Z(4p),1r.4Z(4p))},0);u o.4Z(4p)};2V.d6=A(1k){C(1k==M){1k=2u}C(1k){u 9E o.5a[1k]}W{u o.5a={}}};u 2V})();2i.S("8o",A(Z,U){u{r:Z.r,g:Z.g,b:Z.b}});2i.S("58",A(Z,U){u{r:(Z.r*U.r)/D,g:(Z.g*U.g)/D,b:(Z.b*U.b)/D}});2i.S("d5",A(Z,U){u{r:D-(((D-Z.r)*(D-U.r))/D),g:D-(((D-Z.g)*(D-U.g))/D),b:D-(((D-Z.b)*(D-U.b))/D)}});2i.S("7W",A(Z,U){K 1D;1D={};1D.r=U.r>1e?D-2*(D-Z.r)*(D-U.r)/D:(U.r*Z.r*2)/D;1D.g=U.g>1e?D-2*(D-Z.g)*(D-U.g)/D:(U.g*Z.g*2)/D;1D.b=U.b>1e?D-2*(D-Z.b)*(D-U.b)/D:(U.b*Z.b*2)/D;u 1D});2i.S("d3",A(Z,U){u{r:Z.r-U.r,g:Z.g-U.g,b:Z.b-U.b}});2i.S("9J",A(Z,U){u{r:U.r+Z.r,g:U.g+Z.g,b:U.b+Z.b}});2i.S("d2",A(Z,U){u{r:1e-2*(U.r-1e)*(Z.r-1e)/D,g:1e-2*(U.g-1e)*(Z.g-1e)/D,b:1e-2*(U.b-1e)*(Z.b-1e)/D}});2i.S("9L",A(Z,U){K 1D;1D={};1D.r=U.r>1e?D-((D-U.r)*(D-(Z.r-1e)))/D:(U.r*(Z.r+1e))/D;1D.g=U.g>1e?D-((D-U.g)*(D-(Z.g-1e)))/D:(U.g*(Z.g+1e))/D;1D.b=U.b>1e?D-((D-U.b)*(D-(Z.b-1e)))/D:(U.b*(Z.b+1e))/D;u 1D});2i.S("d1",A(Z,U){u{r:U.r>Z.r?U.r:Z.r,g:U.g>Z.g?U.g:Z.g,b:U.b>Z.b?U.b:Z.b}});2i.S("d0",A(Z,U){u{r:U.r>Z.r?Z.r:U.r,g:U.g>Z.g?Z.g:U.g,b:U.b>Z.b?Z.b:U.b}});P.S("4B",A(){K 34;C(1y.V===1){34=29.6J(1y[0])}W{34={r:1y[0],g:1y[1],b:1y[2]}}u o.2b("4B",A(B){B.r=34.r;B.g=34.g;B.b=34.b;B.a=D;u B})});P.S("3i",A(N){N=O.32(D*(N/1h));u o.2b("3i",A(B){B.r+=N;B.g+=N;B.b+=N;u B})});P.S("3A",A(N){N*=-0.cX;u o.2b("3A",A(B){K 1f;1f=O.1f(B.r,B.g,B.b);C(B.r!==1f){B.r+=(1f-B.r)*N}C(B.g!==1f){B.g+=(1f-B.g)*N}C(B.b!==1f){B.b+=(1f-B.b)*N}u B})});P.S("3L",A(N){N*=-1;u o.2b("3L",A(B){K 1l,4y,1f;1f=O.1f(B.r,B.g,B.b);4y=(B.r+B.g+B.b)/3;1l=((O.4z(1f-4y)*2/D)*N)/1h;C(B.r!==1f){B.r+=(1f-B.r)*1l}C(B.g!==1f){B.g+=(1f-B.g)*1l}C(B.b!==1f){B.b+=(1f-B.b)*1l}u B})});P.S("4A",A(N){u o.2b("4A",A(B){K 4y;4y=2Q.6r(B);B.r=4y;B.g=4y;B.b=4y;u B})});P.S("2h",A(N){N=O.1J((N+1h)/1h,2);u o.2b("2h",A(B){B.r/=D;B.r-=0.5;B.r*=N;B.r+=0.5;B.r*=D;B.g/=D;B.g-=0.5;B.g*=N;B.g+=0.5;B.g*=D;B.b/=D;B.b-=0.5;B.b*=N;B.b+=0.5;B.b*=D;u B})});P.S("81",A(N){u o.2b("81",A(B){K h,4S,2y;4S=29.9U(B.r,B.g,B.b);h=4S.h*1h;h+=O.4z(N);h=h%1h;h/=1h;4S.h=h;2y=29.9Z(4S.h,4S.s,4S.v);2y.a=B.a;u 2y})});P.S("3Z",A(){K 5e,2y;C(1y.V===2){2y=29.6J(1y[0]);5e=1y[1]}W C(1y.V===4){2y={r:1y[0],g:1y[1],b:1y[2]};5e=1y[3]}u o.2b("3Z",A(B){B.r-=(B.r-2y.r)*(5e/1h);B.g-=(B.g-2y.g)*(5e/1h);B.b-=(B.b-2y.b)*(5e/1h);u B})});P.S("a3",A(){u o.2b("a3",A(B){B.r=D-B.r;B.g=D-B.g;B.b=D-B.b;u B})});P.S("49",A(N){C(N==M){N=1h}N/=1h;u o.2b("49",A(B){B.r=O.2c(D,(B.r*(1-(0.cV*N)))+(B.g*(0.cU*N))+(B.b*(0.cT*N)));B.g=O.2c(D,(B.r*(0.cS*N))+(B.g*(1-(0.cR*N)))+(B.b*(0.cQ*N)));B.b=O.2c(D,(B.r*(0.cP*N))+(B.g*(0.cO*N))+(B.b*(1-(0.cN*N))));u B})});P.S("2n",A(N){u o.2b("2n",A(B){B.r=O.1J(B.r/D,N)*D;B.g=O.1J(B.g/D,N)*D;B.b=O.1J(B.b/D,N)*D;u B})});P.S("7O",A(N){N=O.4z(N)*2.55;u o.2b("7O",A(B){K 3S;3S=2Q.bQ(N*-1,N);B.r+=3S;B.g+=3S;B.b+=3S;u B})});P.S("7K",A(N){N=O.4z(N)*2.55;u o.2b("7K",A(B){C(B.r>D-N){B.r=D}W C(B.rD-N){B.g=D}W C(B.gD-N){B.b=D}W C(B.b0){B.r+=(D-B.r)*1E.37}W{B.r-=B.r*O.4z(1E.37)}}C(1E.4D!=M){C(1E.4D>0){B.g+=(D-B.g)*1E.4D}W{B.g-=B.g*O.4z(1E.4D)}}C(1E.3F!=M){C(1E.3F>0){B.b+=(D-B.b)*1E.3F}W{B.b-=B.b*O.4z(1E.3F)}}u B})});P.S("1Z",A(){K 1P,3G,3w,3C,3B,1t,i,1I,H,1j,L,2G;3G=1y[0],3w=2<=1y.V?8D.1O(1y,1):[];C(1x 3G==="3P"){3G=3G.cL("")}C(3G[0]==="v"){3G=[\'r\',\'g\',\'b\']}C(3w.V<3||3w.V>4){4i"7b as cK 1y 5Y 1Z 1z";}1I=3w[0];3C=3w[1];3B=3w.V===4?3w[2]:3w[1];1t=3w[3w.V-1];1P=2Q.1P(1I,3C,3B,1t,0,D);C(1I[0]>0){Y(i=H=0,L=1I[0];0<=L?HL;i=0<=L?++H:--H){1P[i]=1I[1]}}C(1t[0]=D;i=2G<=D?++1j:--1j){1P[i]=1t[1]}}u o.2b("1Z",A(B){K 1q,48;Y(i=1q=0,48=3G.V;0<=48?1q<48:1q>48;i=0<=48?++1q:--1q){B[3G[i]]=1P[B[3G[i]]]}u B})});P.S("2U",A(N){K 3C,3B,p;p=O.4z(N)/1h;3C=[0,D*p];3B=[D-(D*p),D];C(N<0){3C=3C.av();3B=3B.av()}u o.1Z(\'2y\',[0,0],3C,3B,[D,D])});F.2w.S("8c",A(G,J,x,y){K I,2z;C(x==M){x=0}C(y==M){y=0}C(1x 2m!=="4b"&&2m!==M){I=1S 43(G,J)}W{I=27.3l(\'I\');1v.5X(o.I,I);I.G=G;I.J=J}2z=I.3q(\'2d\');2z.6g(o.I,x,y,G,J,0,0,G,J);o.5T={x:x,y:y};o.bw=2Z;u o.71(I)});F.2w.S("7I",A(2p){K I,2z;C(2p==M){2p=M}C(2p===M||((2p.G==M)&&(2p.J==M))){1W.bu("7b aI cI 1c b1 Y 7I");u}C(2p.G==M){2p.G=o.I.G*2p.J/o.I.J}W C(2p.J==M){2p.J=o.I.J*2p.G/o.I.G}C(1x 2m!=="4b"&&2m!==M){I=1S 43(2p.G,2p.J)}W{I=27.3l(\'I\');1v.5X(o.I,I);I.G=2p.G;I.J=2p.J}2z=I.3q(\'2d\');2z.6g(o.I,0,0,o.I.G,o.I.J,0,0,2p.G,2p.J);o.6F=2Z;u o.71(I)});F.P.S("8c",A(){u o.5d("8c",6L.R.4L.1O(1y,0))});F.P.S("7I",A(){u o.5d("7I",6L.R.4L.1O(1y,0))});F.P.S("cH",A(){u o.3z("cG 7G",[1,1,1,1,1,1,1,1,1])});F.P.S("cF",A(){u o.3z("cE cD 7G",[0,0,1,0,0,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,0,0,1,0,0])});F.P.S("cC",A(){u o.3z("cB 7G",[1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1])});F.P.S("cA",A(3Y){K 2A;C(3Y===0||3Y===4U){2A=[0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0]}W C((3Y>0&&3Y<90)||(3Y>4U&&3Yo.1c.G){1n=o.1c.G*(3R(1n.4I(0,1n.V-1),10)/1h)}W{1n=o.1c.J*(3R(1n.4I(0,1n.V-1),10)/1h)}}38/=1h;3n=[o.1c.G/2,o.1c.J/2];1I=O.9j(O.1J(3n[0],2)+O.1J(3n[1],2));1t=1I-1n;1P=2Q.1P([0,1],[30,30],[70,60],[1h,80]);u o.2b("1T",A(B){K 7n,2x,T;T=o.8h();7n=2Q.4T(T.x,T.y,3n[0],3n[1]);C(7n>1t){2x=O.1f(1,(1P[O.7k(((7n-1t)/1n)*1h)]/10)*38);B.r=O.1J(B.r/D,2x)*D;B.g=O.1J(B.g/D,2x)*D;B.b=O.1J(B.b/D,2x)*D}u B})});P.S("b2",A(E){K 42,5p,7i,1n,H,1m,L;42={38:50,2B:0,8s:\'3i\',34:{r:0,g:0,b:0}};E=1v.6R(42,E);C(!E.1n){u o}W C(1x E.1n==="3P"){7i=3R(E.1n,10)/1h;E.1n={G:o.1c.G*7i,J:o.1c.J*7i}}W C(1x E.1n==="3D"){L=["G","J"];Y(H=0,1m=L.V;H<1m;H++){5p=L[H];C(1x E.1n[5p]==="3P"){E.1n[5p]=o.1c[5p]*(3R(E.1n[5p],10)/1h)}}}W C(E.1n==="as"){1n=E.1n;E.1n={G:1n,J:1n}}C(1x E.2B==="3P"){E.2B=(E.1n.G/2)*(3R(E.2B,10)/1h)}E.38/=1h;E.1n.G=O.32(E.1n.G);E.1n.J=O.32(E.1n.J);E.1d={G:o.1c.G,J:o.1c.J};C(E.8s==="3Z"&&1x E.34==="3P"){E.34=29.6J(E.34)}E.1U={53:(o.1c.G-E.1n.G)/2,5t:o.1c.G-E.1U.53,4W:(o.1c.J-E.1n.J)/2,5w:o.1c.J-E.1U.4W};E.1w=[{x:E.1U.53+E.2B,y:E.1U.5w-E.2B},{x:E.1U.5t-E.2B,y:E.1U.5w-E.2B},{x:E.1U.5t-E.2B,y:E.1U.4W+E.2B},{x:E.1U.53+E.2B,y:E.1U.4W+E.2B}];E.3W=2Q.4T(0,0,E.1w[3].x,E.1w[3].y)-E.2B;u o.2b("b2",A(B){K 1l,T,4a;T=o.8h();C((T.x>E.1w[0].x&&T.xE.1U.4W&&T.yE.1U.53&&T.xE.1w[3].y&&T.yE.1w[0].x&&T.xE.1U.5w){1l=(T.y-E.1U.5w)/E.3W}W C(T.y>E.1w[2].y&&T.yE.1U.5t){1l=(T.x-E.1U.5t)/E.3W}W C(T.x>E.1w[0].x&&T.xE.1w[2].y&&T.y=E.1w[0].y){4a=F.4T(T.x,T.y,E.1w[0].x,E.1w[0].y);1l=(4a-E.2B)/E.3W}W C(T.x>=E.1w[1].x&&T.y>=E.1w[1].y){4a=F.4T(T.x,T.y,E.1w[1].x,E.1w[1].y);1l=(4a-E.2B)/E.3W}W C(T.x>=E.1w[2].x&&T.y<=E.1w[2].y){4a=F.4T(T.x,T.y,E.1w[2].x,E.1w[2].y);1l=(4a-E.2B)/E.3W}W C(T.x<=E.1w[3].x&&T.y<=E.1w[3].y){4a=F.4T(T.x,T.y,E.1w[3].x,E.1w[3].y);1l=(4a-E.2B)/E.3W}C(1l<0){u B}u 8Y[E.8s](B,1l,E)})});(A(){K 4F,8A,8B,5N,5O;5N=[2E,2E,2Y,2E,3t,2Y,3s,2E,3O,3t,3r,2Y,3J,3s,3M,2E,4s,3O,4r,3t,4q,3r,4o,2Y,4n,3J,4m,3s,31,3M,4l,2E,5K,4s,3H,3O,5H,4r,5G,3t,31,4q,5F,3r,4k,4o,4j,2Y,5D,4n,5C,3J,5B,4m,5A,3s,5z,31,5y,3M,5x,4l,3K,2E,74,5K,6W,4s,6Q,3H,6O,3O,6H,5H,6E,4r,4h,5G,7R,3t,5i,31,7H,4q,7B,5F,4g,3r,3K,4k,7p,4o,7m,4j,79,2Y,6G,5D,3H,4n,6D,5C,6A,3J,7V,5B,7Q,4m,4h,5A,5b,3s,7w,5z,7l,31,78,5y,7U,3M,59,5x,4g,4l,77,3K,7M,2E,ci,74,cj,5K,4j,6W,ck,4s,cl,6Q,cm,3H,cn,6O,co,3O,cp,6H,cq,5H,cr,6E,bI,4r,bp,4h,7e,5G,5b,7R,7r,3t,aS,5i,aR,31,aP,7H,aM,4q,7F,7B,59,5F,aK,4g,aJ,3r,aH,3K,aG,4k,aF,7p,aE,4o,aD,7m,aB,4j,aA,79,az,2Y,ay,6G,at,5D,ar,3H,an,4n,ad,6D,ac,5C,ab,6A,aa,3J,a9,7V,a8,5B,a7,7Q,a6,4m,a5,4h,7e,5A,a4,5b,9R,3s,7r,7w,9P,5z,5i,7l,9O,31,9N,78,9M,5y,9e,7U,7F,3M,9K,59,9I,5x,9H,4g,9G,4l,3r,77,9D,3K,9A,7M,4k];5O=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];8A=A(G,J,5j,5k,4f,V,bJ){K 3N,1s,2j,3T,4v,41,4u;3N=1x 2m!=="4b"&&2m!==M?1S 43():27.3l(\'I\');3N.G=G;3N.J=J;3T=5j+O.bj(4f)*V*0.5;41=5k+O.bi(4f)*V*0.5;4v=5j-O.bj(4f)*V*0.5;4u=5k-O.bi(4f)*V*0.5;1s=3N.3q("2d");2j=1s.ds(3T,41,4v,4u);C(!bJ){2j.4P(0,"7o");2j.4P(1,"8n")}W{2j.4P(0,"7o");2j.4P(0.5,"8n");2j.4P(1,"7o")}1s.b5=2j;1s.b4(0,0,G,J);u 1s.4C(0,0,G,J)};8B=A(G,J,5j,5k,6a,69){K 3N,1s,2j;3N=1x 2m!=="4b"&&2m!==M?1S 43():27.3l(\'I\');3N.G=G;3N.J=J;1s=3N.3q("2d");2j=1s.dA(5j,5k,6a,5j,5k,69);2j.4P(1,"7o");2j.4P(0,"8n");1s.b5=2j;1s.b4(0,0,G,J);u 1s.4C(0,0,G,J)};4F=A(){o.r=0;o.g=0;o.b=0;o.a=0;u o.1V=M};F.2w.S("9s",A(aX,1Q,aU,7f){K 2f,2o,1L,5r,66,2x,2e,2v,1K,J,3Q,i,62,2r,3g,73,3I,61,2H,p,1B,1C,X,1A,2a,2q,1N,8x,1a,2S,2K,1b,47,1i,1G,2M,4Q,2D,6C,6B,5M,G,3f,x,y,1g,4H,4x,H,1j,1q,3e,3c,3b,3a,3k,3j,5s;G=o.1c.G;J=o.1c.J;3g=o.Q;8x=aX.1R;6B=G*J;5M=6B<<2;X=[];Y(i=H=0;0<=5M?H<5M:H>5M;i=0<=5M?++H:--H){X[i]=3g[i]}66=0;4Q=7f;7f-=1;bS(4Q-->=0){3I=(1Q+0.5)|0;C(3I===0){5L}C(3I>67){3I=67}2x=3I+3I+1;6C=G<<2;3f=G-1;3Q=J-1;1a=3I+1;2D=1a*(1a+1)/2;2M=1S 4F();47=bv 0;1b=2M;Y(i=1j=1;1<=2x?1j<2x:1j>2x;i=1<=2x?++1j:--1j){1b=1b.1V=1S 4F();C(i===1a){47=1b}}1b.1V=2M;1i=M;1G=M;4x=1g=0;2H=5N[3I];2K=5O[3I];Y(y=1q=0;0<=J?1qJ;y=0<=J?++1q:--1q){2a=2e=2f=1N=1K=1L=0;2q=1a*(1A=X[1g]);2v=1a*(1C=X[1g+1]);2o=1a*(1B=X[1g+2]);1N+=2D*1A;1K+=2D*1C;1L+=2D*1B;1b=2M;Y(i=3e=0;0<=1a?3e<1a:3e>1a;i=0<=1a?++3e:--3e){1b.r=1A;1b.g=1C;1b.b=1B;1b=1b.1V}Y(i=3c=1;1<=1a?3c<1a:3c>1a;i=1<=1a?++3c:--3c){p=1g+((3fG;x=0<=G?++3b:--3b){X[1g]=(1N*2H)>>2K;X[1g+1]=(1K*2H)>>2K;X[1g+2]=(1L*2H)>>2K;1N-=2q;1K-=2v;1L-=2o;2q-=1i.r;2v-=1i.g;2o-=1i.b;p=(4x+((p=x+1a)<3f?p:3f))<<2;2a+=(1i.r=X[p]);2e+=(1i.g=X[p+1]);2f+=(1i.b=X[p+2]);1N+=2a;1K+=2e;1L+=2f;1i=1i.1V;2q+=(1A=1G.r);2v+=(1C=1G.g);2o+=(1B=1G.b);2a-=1A;2e-=1C;2f-=1B;1G=1G.1V;1g+=4}4x+=G}Y(x=3a=0;0<=G?3aG;x=0<=G?++3a:--3a){2e=2f=2a=1K=1L=1N=0;1g=x<<2;2q=1a*(1A=X[1g]);2v=1a*(1C=X[1g+1]);2o=1a*(1B=X[1g+2]);1N+=2D*1A;1K+=2D*1C;1L+=2D*1B;1b=2M;Y(i=3k=0;0<=1a?3k<1a:3k>1a;i=0<=1a?++3k:--3k){1b.r=1A;1b.g=1C;1b.b=1B;1b=1b.1V}4H=G;Y(i=3j=1;1<=1a?3j<1a:3j>1a;i=1<=1a?++3j:--3j){1g=(4H+x)<<2;1N+=(1b.r=(1A=X[1g]))*(2S=1a-i);1K+=(1b.g=(1C=X[1g+1]))*2S;1L+=(1b.b=(1B=X[1g+2]))*2S;2a+=1A;2e+=1C;2f+=1B;1b=1b.1V;C(i<3Q){4H+=G}}1g=x;1i=2M;1G=47;Y(y=5s=0;0<=J?5sJ;y=0<=J?++5s:--5s){p=1g<<2;X[p]=(1N*2H)>>2K;X[p+1]=(1K*2H)>>2K;X[p+2]=(1L*2H)>>2K;1N-=2q;1K-=2v;1L-=2o;2q-=1i.r;2v-=1i.g;2o-=1i.b;p=(x+(((p=y+1a)<3Q?p:3Q)*G))<<2;1N+=(2a+=(1i.r=X[p]));1K+=(2e+=(1i.g=X[p+1]));1L+=(2f+=(1i.b=X[p+2]));1i=1i.1V;2q+=(1A=1G.r);2v+=(1C=1G.g);2o+=(1B=1G.b);2a-=1A;2e-=1C;2f-=1B;1G=1G.1V;1g+=G}}1Q*=aU;i=6B;bS(--i>-1){2r=i<<2;61=(8x[2r+2]&eu)/D.0*7f;73=61|0;C(73===66){5r=67.0*(61-(61|0));62=67-5r;3g[2r]=(3g[2r]*62+X[2r]*5r)>>8;3g[2r+1]=(3g[2r+1]*62+X[2r+1]*5r)>>8;3g[2r+2]=(3g[2r+2]*62+X[2r+2]*5r)>>8}W C(73===66+1){3g[2r]=X[2r];3g[2r+1]=X[2r+1];3g[2r+2]=X[2r+2]}}66++}u o});F.P.S("ev",A(E){K 42,2j;42={3n:{x:o.1c.G/2,y:o.1c.J/2},4f:45,bL:5J,7g:3,7c:1.5,4Q:3};E=1v.6R(42,E);E.4f*=O.eA/4U;2j=8A(o.1c.G,o.1c.J,E.3n.x,E.3n.y,E.4f,E.bL,2Z);u o.5d("9s",[2j,E.7g,E.7c,E.4Q])});u F.P.S("eB",A(E){K 42,2j,6a,69;42={1n:50,3n:{x:o.1c.G/2,y:o.1c.J/2},7g:3,7c:1.5,4Q:3,1Q:M};E=1v.6R(42,E);C(!E.1Q){E.1Q=o.1c.G2x;i=1<=2x?++H:--H){1b=1b.1V=1S 4F();C(i===1a){47=1b}}1b.1V=2M;1i=M;1G=M;4x=1g=0;2H=5N[1Q];2K=5O[1Q];Y(y=1j=0;0<=J?1jJ;y=0<=J?++1j:--1j){2a=2e=2f=1N=1K=1L=0;2q=1a*(1A=X[1g]);2v=1a*(1C=X[1g+1]);2o=1a*(1B=X[1g+2]);1N+=2D*1A;1K+=2D*1C;1L+=2D*1B;1b=2M;Y(i=1q=0;0<=1a?1q<1a:1q>1a;i=0<=1a?++1q:--1q){1b.r=1A;1b.g=1C;1b.b=1B;1b=1b.1V}Y(i=3e=1;1<=1a?3e<1a:3e>1a;i=1<=1a?++3e:--3e){p=1g+((3fG;x=0<=G?++3c:--3c){X[1g]=(1N*2H)>>2K;X[1g+1]=(1K*2H)>>2K;X[1g+2]=(1L*2H)>>2K;1N-=2q;1K-=2v;1L-=2o;2q-=1i.r;2v-=1i.g;2o-=1i.b;p=(4x+((p=x+1Q+1)<3f?p:3f))<<2;2a+=(1i.r=X[p]);2e+=(1i.g=X[p+1]);2f+=(1i.b=X[p+2]);1N+=2a;1K+=2e;1L+=2f;1i=1i.1V;2q+=(1A=1G.r);2v+=(1C=1G.g);2o+=(1B=1G.b);2a-=1A;2e-=1C;2f-=1B;1G=1G.1V;1g+=4}4x+=G}Y(x=3b=0;0<=G?3bG;x=0<=G?++3b:--3b){2e=2f=2a=1K=1L=1N=0;1g=x<<2;2q=1a*(1A=X[1g]);2v=1a*(1C=X[1g+1]);2o=1a*(1B=X[1g+2]);1N+=2D*1A;1K+=2D*1C;1L+=2D*1B;1b=2M;Y(i=3a=0;0<=1a?3a<1a:3a>1a;i=0<=1a?++3a:--3a){1b.r=1A;1b.g=1C;1b.b=1B;1b=1b.1V}4H=G;Y(i=3k=1;1<=1Q?3k<=1Q:3k>=1Q;i=1<=1Q?++3k:--3k){1g=(4H+x)<<2;1N+=(1b.r=(1A=X[1g]))*(2S=1a-i);1K+=(1b.g=(1C=X[1g+1]))*2S;1L+=(1b.b=(1B=X[1g+2]))*2S;2a+=1A;2e+=1C;2f+=1B;1b=1b.1V;C(i<3Q){4H+=G}}1g=x;1i=2M;1G=47;Y(y=3j=0;0<=J?3jJ;y=0<=J?++3j:--3j){p=1g<<2;X[p]=(1N*2H)>>2K;X[p+1]=(1K*2H)>>2K;X[p+2]=(1L*2H)>>2K;1N-=2q;1K-=2v;1L-=2o;2q-=1i.r;2v-=1i.g;2o-=1i.b;p=(x+(((p=y+1a)<3Q?p:3Q)*G))<<2;1N+=(2a+=(1i.r=X[p]));1K+=(2e+=(1i.g=X[p+1]));1L+=(2f+=(1i.b=X[p+2]));1i=1i.1V;2q+=(1A=1G.r);2v+=(1C=1G.g);2o+=(1B=1G.b);2a-=1A;2e-=1C;2f-=1B;1G=1G.1V;1g+=G}}u o});u F.P.S("5f",A(1Q){u o.5d("5f",[1Q])})})();F.P.S("9w",A(N){u o.2b("9w",A(B){K 6r;6r=(0.bg*B.r)+(0.bk*B.g)+(0.by*B.b);C(6r _ref; i = 0 <= _ref ? ++_i : --_i) { @@ -658,7 +751,13 @@ } Analyze.prototype.calculateLevels = function() { - var i, levels, numPixels, _i, _j, _k, _ref; + var i; + var levels; + var numPixels; + var _i; + var _j; + var _k; + var _ref; levels = { r: {}, g: {}, @@ -671,8 +770,8 @@ } for (i = _j = 0, _ref = this.c.pixelData.length; _j < _ref; i = _j += 4) { levels.r[this.c.pixelData[i]]++; - levels.g[this.c.pixelData[i + 1]]++; - levels.b[this.c.pixelData[i + 2]]++; + levels.g[this.c.pixelData[i+1]]++; + levels.b[this.c.pixelData[i+2]]++; } numPixels = this.c.pixelData.length / 4; for (i = _k = 0; _k <= 255; i = ++_k) { @@ -688,7 +787,12 @@ })(); Caman.DOMUpdated = function() { - var img, imgs, parser, _i, _len, _results; + var img; + var imgs; + var parser; + var _i; + var _len; + var _results; imgs = document.querySelectorAll("img[data-caman]"); if (!(imgs.length > 0)) { return; @@ -725,7 +829,18 @@ } CamanParser.prototype.parse = function() { - var args, filter, func, inst, instFunc, m, r, unparsedInstructions, _i, _len, _ref, _results; + var args; + var filter; + var func; + var inst; + var instFunc; + var m; + var r; + var unparsedInstructions; + var _i; + var _len; + var _ref; + var _results; this.ele = this.caman.canvas; r = new RegExp(INST_REGEX, 'g'); unparsedInstructions = this.dataStr.match(r); @@ -741,7 +856,7 @@ try { func = instFunc(); _results.push(func.call(this.caman)); - } catch (e) { + } catch ( e ) { _results.push(Log.debug(e)); } } @@ -762,7 +877,8 @@ Caman.Blender = Blender = (function() { - function Blender() {} + function Blender() { + } Blender.blenders = {}; @@ -780,7 +896,8 @@ Caman.Calculate = Calculate = (function() { - function Calculate() {} + function Calculate() { + } Calculate.distance = function(x1, y1, x2, y2) { return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); @@ -804,7 +921,33 @@ }; Calculate.bezier = function(start, ctrl1, ctrl2, end, lowBound, highBound) { - var Ax, Ay, Bx, By, Cx, Cy, bezier, curveX, curveY, i, j, leftCoord, rightCoord, t, x0, x1, x2, x3, y0, y1, y2, y3, _i, _j, _k, _ref, _ref1; + var Ax; + var Ay; + var Bx; + var By; + var Cx; + var Cy; + var bezier; + var curveX; + var curveY; + var i; + var j; + var leftCoord; + var rightCoord; + var t; + var x0; + var x1; + var x2; + var x3; + var y0; + var y1; + var y2; + var y3; + var _i; + var _j; + var _k; + var _ref; + var _ref1; x0 = start[0]; y0 = start[1]; x1 = ctrl1[0]; @@ -857,10 +1000,13 @@ Convert = (function() { - function Convert() {} + function Convert() { + } Convert.hexToRGB = function(hex) { - var b, g, r; + var b; + var g; + var r; if (hex.charAt(0) === "#") { hex = hex.substr(1); } @@ -875,7 +1021,12 @@ }; Convert.rgbToHSL = function(r, g, b) { - var d, h, l, max, min, s; + var d; + var h; + var l; + var max; + var min; + var s; if (typeof r === "object") { g = r.g; b = r.b; @@ -912,7 +1063,11 @@ }; Convert.hslToRGB = function(h, s, l) { - var b, g, p, q, r; + var b; + var g; + var p; + var q; + var r; if (typeof h === "object") { s = h.s; l = h.l; @@ -954,7 +1109,12 @@ }; Convert.rgbToHSV = function(r, g, b) { - var d, h, max, min, s, v; + var d; + var h; + var max; + var min; + var s; + var v; r /= 255; g /= 255; b /= 255; @@ -986,7 +1146,14 @@ }; Convert.hsvToRGB = function(h, s, v) { - var b, f, g, i, p, q, r, t; + var b; + var f; + var g; + var i; + var p; + var q; + var r; + var t; i = Math.floor(h * 6); f = h * 6 - i; p = v * (1 - s); @@ -1031,7 +1198,9 @@ }; Convert.rgbToXYZ = function(r, g, b) { - var x, y, z; + var x; + var y; + var z; r /= 255; g /= 255; b /= 255; @@ -1061,7 +1230,9 @@ }; Convert.xyzToRGB = function(x, y, z) { - var b, g, r; + var b; + var g; + var r; x /= 100; y /= 100; z /= 100; @@ -1091,7 +1262,12 @@ }; Convert.xyzToLab = function(x, y, z) { - var a, b, l, whiteX, whiteY, whiteZ; + var a; + var b; + var l; + var whiteX; + var whiteY; + var whiteZ; if (typeof x === "object") { y = x.y; z = x.z; @@ -1129,7 +1305,9 @@ }; Convert.labToXYZ = function(l, a, b) { - var x, y, z; + var x; + var y; + var z; if (typeof l === "object") { a = l.a; b = l.b; @@ -1179,14 +1357,19 @@ Event = (function() { - function Event() {} + function Event() { + } Event.events = {}; Event.types = ["processStart", "processComplete", "renderStart", "renderFinished", "blockStarted", "blockFinished"]; Event.trigger = function(target, type, data) { - var event, _i, _len, _ref, _results; + var event; + var _i; + var _len; + var _ref; + var _results; if (this.events[type] && this.events[type].length) { _ref = this.events[type]; _results = []; @@ -1203,7 +1386,8 @@ }; Event.listen = function(target, type, fn) { - var _fn, _type; + var _fn; + var _type; if (typeof target === "string") { _type = target; _fn = type; @@ -1232,7 +1416,8 @@ Caman.Filter = Filter = (function() { - function Filter() {} + function Filter() { + } Filter.Type = { Single: 1, @@ -1253,7 +1438,8 @@ Caman.IO = IO = (function() { - function IO() {} + function IO() { + } IO.domainRegex = /(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/; @@ -1347,7 +1533,7 @@ if (stats.isFile() && !overwrite) { return false; } - } catch (e) { + } catch ( e ) { Log.debug("Creating output file " + file); } return fs.writeFile(file, this.canvas.toBuffer(), function() { @@ -1410,7 +1596,10 @@ }; Layer.prototype.copyParent = function() { - var i, parentData, _i, _ref; + var i; + var parentData; + var _i; + var _ref; parentData = this.c.pixelData; for (i = _i = 0, _ref = this.c.pixelData.length; _i < _ref; i = _i += 4) { this.pixelData[i] = parentData[i]; @@ -1443,7 +1632,15 @@ }; Layer.prototype.applyToParent = function() { - var i, layerData, parentData, result, rgbaLayer, rgbaParent, _i, _ref, _results; + var i; + var layerData; + var parentData; + var result; + var rgbaLayer; + var rgbaParent; + var _i; + var _ref; + var _results; parentData = this.c.pixelStack[this.c.pixelStack.length - 1]; layerData = this.c.pixelData; _results = []; @@ -1481,7 +1678,10 @@ Logger = (function() { function Logger() { - var name, _i, _len, _ref; + var name; + var _i; + var _len; + var _ref; _ref = ['log', 'info', 'warn', 'error']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { name = _ref[_i]; @@ -1494,7 +1694,7 @@ } try { return console[name].apply(console, args); - } catch (e) { + } catch ( e ) { return console[name](args); } }; @@ -1516,7 +1716,8 @@ }; PixelInfo.locationToCoordinates = function(loc, width) { - var x, y; + var x; + var y; y = Math.floor(loc / (width * 4)); x = (loc % (width * 4)) / 4; return { @@ -1531,7 +1732,8 @@ } PixelInfo.prototype.locationXY = function() { - var x, y; + var x; + var y; y = this.c.dimensions.height - Math.floor(this.loc / (this.c.dimensions.width * 4)); x = (this.loc % (this.c.dimensions.width * 4)) / 4; return { @@ -1598,7 +1800,8 @@ Plugin = (function() { - function Plugin() {} + function Plugin() { + } Plugin.plugins = {}; @@ -1672,8 +1875,19 @@ }; Renderer.prototype.eachBlock = function(fn) { - var blockN, blockPixelLength, bnum, end, f, i, lastBlockN, n, start, _i, _ref, _results, - _this = this; + var blockN; + var blockPixelLength; + var bnum; + var end; + var f; + var i; + var lastBlockN; + var n; + var start; + var _i; + var _ref; + var _results; + var _this = this; this.blocksDone = 0; n = this.c.pixelData.length; blockPixelLength = Math.floor((n / 4) / Renderer.Blocks); @@ -1717,7 +1931,11 @@ }; Renderer.prototype.renderBlock = function(bnum, start, end) { - var data, i, pixelInfo, res, _i; + var data; + var i; + var pixelInfo; + var res; + var _i; Log.debug("Block #" + bnum + " - Filter: " + this.currentJob.name + ", Start: " + start + ", End: " + end); Event.trigger(this.c, "blockStarted", { blockNum: bnum, @@ -1755,7 +1973,24 @@ }; Renderer.prototype.renderKernel = function(bnum, start, end) { - var adjust, adjustSize, bias, builder, builderIndex, divisor, i, j, k, kernel, n, name, pixel, pixelInfo, res, _i, _j, _k; + var adjust; + var adjustSize; + var bias; + var builder; + var builderIndex; + var divisor; + var i; + var j; + var k; + var kernel; + var n; + var name; + var pixel; + var pixelInfo; + var res; + var _i; + var _j; + var _k; name = this.currentJob.name; bias = this.currentJob.bias; divisor = this.currentJob.divisor; @@ -1794,7 +2029,9 @@ }; Renderer.prototype.blockFinished = function(bnum) { - var i, _i, _ref; + var i; + var _i; + var _ref; if (bnum >= 0) { Log.debug("Block #" + bnum + " finished! Filter: " + this.currentJob.name); } @@ -1819,7 +2056,10 @@ }; Renderer.prototype.processKernel = function(adjust, kernel, divisor, bias) { - var i, val, _i, _ref; + var i; + var val; + var _i; + var _ref; val = { r: 0, g: 0, @@ -1837,8 +2077,9 @@ }; Renderer.prototype.loadOverlay = function(layer, src) { - var img, proxyUrl, - _this = this; + var img; + var proxyUrl; + var _this = this; img = document.createElement('img'); img.onload = function() { layer.context.drawImage(img, 0, 0, _this.c.dimensions.width, _this.c.dimensions.height); @@ -1857,7 +2098,8 @@ Caman.Store = Store = (function() { - function Store() {} + function Store() { + } Store.items = {}; @@ -2029,7 +2271,9 @@ Filter.register("vibrance", function(adjust) { adjust *= -1; return this.process("vibrance", function(rgba) { - var amt, avg, max; + var amt; + var avg; + var max; max = Math.max(rgba.r, rgba.g, rgba.b); avg = (rgba.r + rgba.g + rgba.b) / 3; amt = ((Math.abs(max - avg) * 2 / 255) * adjust) / 100; @@ -2081,7 +2325,9 @@ Filter.register("hue", function(adjust) { return this.process("hue", function(rgba) { - var h, hsv, rgb; + var h; + var hsv; + var rgb; hsv = Convert.rgbToHSV(rgba.r, rgba.g, rgba.b); h = hsv.h * 100; h += Math.abs(adjust); @@ -2095,7 +2341,8 @@ }); Filter.register("colorize", function() { - var level, rgb; + var level; + var rgb; if (arguments.length === 2) { rgb = Convert.hexToRGB(arguments[0]); level = arguments[1]; @@ -2181,12 +2428,15 @@ }); Filter.register("channels", function(options) { - var chan, value; + var chan; + var value; if (typeof options !== "object") { return this; } for (chan in options) { - if (!__hasProp.call(options, chan)) continue; + if (!__hasProp.call(options, chan)) { + continue; + } value = options[chan]; if (value === 0) { delete options[chan]; @@ -2224,7 +2474,18 @@ }); Filter.register("curves", function() { - var bezier, chans, cps, ctrl1, ctrl2, end, i, start, _i, _j, _ref, _ref1; + var bezier; + var chans; + var cps; + var ctrl1; + var ctrl2; + var end; + var i; + var start; + var _i; + var _j; + var _ref; + var _ref1; chans = arguments[0], cps = 2 <= arguments.length ? __slice.call(arguments, 1) : []; if (typeof chans === "string") { chans = chans.split(""); @@ -2251,7 +2512,8 @@ } } return this.process("curves", function(rgba) { - var _k, _ref2; + var _k; + var _ref2; for (i = _k = 0, _ref2 = chans.length; 0 <= _ref2 ? _k < _ref2 : _k > _ref2; i = 0 <= _ref2 ? ++_k : --_k) { rgba[chans[i]] = bezier[rgba[chans[i]]]; } @@ -2260,7 +2522,9 @@ }); Filter.register("exposure", function(adjust) { - var ctrl1, ctrl2, p; + var ctrl1; + var ctrl2; + var p; p = Math.abs(adjust) / 100; ctrl1 = [0, 255 * p]; ctrl2 = [255 - (255 * p), 255]; @@ -2272,7 +2536,8 @@ }); Caman.Plugin.register("crop", function(width, height, x, y) { - var canvas, ctx; + var canvas; + var ctx; if (x == null) { x = 0; } @@ -2298,7 +2563,8 @@ }); Caman.Plugin.register("resize", function(newDims) { - var canvas, ctx; + var canvas; + var ctx; if (newDims == null) { newDims = null; } diff --git a/microscopy/old_microscopy/caman.min.js b/microscopy/old_microscopy/caman.min.js index 1328b81b..fbec5275 100755 --- a/microscopy/old_microscopy/caman.min.js +++ b/microscopy/old_microscopy/caman.min.js @@ -1,174 +1,2178 @@ -(function(){var $,Analyze,Blender,Calculate,Caman,CamanParser,Canvas,Convert,Event,Fiber,Filter,IO,Image,Layer,Log,Logger,PixelInfo,Plugin,Renderer,Root,Store,Util,fs,slice,__hasProp={}.hasOwnProperty,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i255){return 255;} -return val;};Util.copyAttributes=function(from,to,opts){var attr,_i,_len,_ref,_ref1,_results;if(opts==null){opts={};} -_ref=from.attributes;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){attr=_ref[_i];if((opts.except!=null)&&(_ref1=attr.nodeName,__indexOf.call(opts.except,_ref1)>=0)){continue;} -_results.push(to.setAttribute(attr.nodeName,attr.nodeValue));} -return _results;};Util.dataArray=function(length){if(length==null){length=0;} -if(Caman.NodeJS||(window.Uint8Array!=null)){return new Uint8Array(length);} -return new Array(length);};return Util;})();if(typeof exports!=="undefined"&&exports!==null){Root=exports;Canvas=require('canvas');Image=Canvas.Image;Fiber=require('fibers');fs=require('fs');}else{Root=window;} -Root.Caman=Caman=(function(){Caman.version={release:"4.1.1",date:"4/8/2013"};Caman.DEBUG=false;Caman.NodeJS=typeof exports!=="undefined"&&exports!==null;Caman.autoload=!Caman.NodeJS;Caman.allowRevert=true;Caman.crossOrigin="anonymous";Caman.toString=function(){return"Version "+Caman.version.release+", Released "+Caman.version.date;};Caman.remoteProxy="";Caman.proxyParam="camanProxyUrl";Caman.getAttrId=function(canvas){if(Caman.NodeJS){return true;} -if(typeof canvas==="string"){canvas=$(canvas);} -if(!((canvas!=null)&&(canvas.getAttribute!=null))){return null;} -return canvas.getAttribute('data-caman-id');};function Caman(){var args,callback,id,_this=this;if(arguments.length===0){throw"Invalid arguments";} -if(this instanceof Caman){this.finishInit=this.finishInit.bind(this);this.imageLoaded=this.imageLoaded.bind(this);args=arguments[0];if(!Caman.NodeJS){id=parseInt(Caman.getAttrId(args[0]),10);callback=typeof args[1]==="function"?args[1]:typeof args[2]==="function"?args[2]:function(){};if(!isNaN(id)&&Store.has(id)){return Store.execute(id,callback);}} -this.id=Util.uniqid.get();this.initializedPixelData=this.originalPixelData=null;this.cropCoordinates={x:0,y:0};this.cropped=false;this.resized=false;this.pixelStack=[];this.layerStack=[];this.canvasQueue=[];this.currentLayer=null;this.scaled=false;this.analyze=new Analyze(this);this.renderer=new Renderer(this);this.domIsLoaded(function(){_this.parseArguments(args);return _this.setup();});return this;}else{return new Caman(arguments);}} -Caman.prototype.domIsLoaded=function(cb){var listener,_this=this;if(Caman.NodeJS){return setTimeout(function(){return cb.call(_this);},0);}else{if(document.readyState==="complete"){Log.debug("DOM initialized");return setTimeout(function(){return cb.call(_this);},0);}else{listener=function(){if(document.readyState==="complete"){Log.debug("DOM initialized");return cb.call(_this);}};return document.addEventListener("readystatechange",listener,false);}}};Caman.prototype.parseArguments=function(args){var key,val,_ref,_results;if(args.length===0){throw"Invalid arguments given";} -this.initObj=null;this.initType=null;this.imageUrl=null;this.callback=function(){};this.setInitObject(args[0]);if(args.length===1){return;} -switch(typeof args[1]){case"string":this.imageUrl=args[1];break;case"function":this.callback=args[1];} -if(args.length===2){return;} -this.callback=args[2];if(args.length===4){_ref=args[4];_results=[];for(key in _ref){if(!__hasProp.call(_ref,key))continue;val=_ref[key];_results.push(this.options[key]=val);} -return _results;}};Caman.prototype.setInitObject=function(obj){if(Caman.NodeJS){this.initObj=obj;this.initType='node';return;} -if(typeof obj==="object"){this.initObj=obj;}else{this.initObj=$(obj);} -if(this.initObj==null){throw"Could not find image or canvas for initialization.";} -return this.initType=this.initObj.nodeName.toLowerCase();};Caman.prototype.setup=function(){switch(this.initType){case"node":return this.initNode();case"img":return this.initImage();case"canvas":return this.initCanvas();}};Caman.prototype.initNode=function(){var _this=this;Log.debug("Initializing for NodeJS");this.image=new Image();this.image.onload=function(){Log.debug("Image loaded. Width = "+(_this.imageWidth())+", Height = "+(_this.imageHeight()));_this.canvas=new Canvas(_this.imageWidth(),_this.imageHeight());return _this.finishInit();};this.image.onerror=function(err){throw err;};return this.image.src=this.initObj;};Caman.prototype.initImage=function(){this.image=this.initObj;this.canvas=document.createElement('canvas');this.context=this.canvas.getContext('2d');Util.copyAttributes(this.image,this.canvas,{except:['src']});this.image.parentNode.replaceChild(this.canvas,this.image);this.imageAdjustments();return this.waitForImageLoaded();};Caman.prototype.initCanvas=function(){this.canvas=this.initObj;this.context=this.canvas.getContext('2d');if(this.imageUrl!=null){this.image=document.createElement('img');this.image.src=this.imageUrl;this.imageAdjustments();return this.waitForImageLoaded();}else{return this.finishInit();}};Caman.prototype.imageAdjustments=function(){if(this.needsHiDPISwap()){Log.debug(this.image.src,"->",this.hiDPIReplacement());this.swapped=true;this.image.src=this.hiDPIReplacement();} -if(IO.isRemote(this.image)){this.image.src=IO.proxyUrl(this.image.src);return Log.debug("Remote image detected, using URL = "+this.image.src);}};Caman.prototype.waitForImageLoaded=function(){if(this.isImageLoaded()){return this.imageLoaded();}else{return this.image.onload=this.imageLoaded;}};Caman.prototype.isImageLoaded=function(){if(!this.image.complete){return false;} -if((this.image.naturalWidth!=null)&&this.image.naturalWidth===0){return false;} -return true;};Caman.prototype.imageWidth=function(){return this.image.width||this.image.naturalWidth;};Caman.prototype.imageHeight=function(){return this.image.height||this.image.naturalHeight;};Caman.prototype.imageLoaded=function(){Log.debug("Image loaded. Width = "+(this.imageWidth())+", Height = "+(this.imageHeight()));if(this.swapped){this.canvas.width=this.imageWidth()/this.hiDPIRatio();this.canvas.height=this.imageHeight()/this.hiDPIRatio();}else{this.canvas.width=this.imageWidth();this.canvas.height=this.imageHeight();} -return this.finishInit();};Caman.prototype.finishInit=function(){var i,pixel,_i,_len,_ref;if(this.context==null){this.context=this.canvas.getContext('2d');} -this.originalWidth=this.preScaledWidth=this.width=this.canvas.width;this.originalHeight=this.preScaledHeight=this.height=this.canvas.height;this.hiDPIAdjustments();if(!this.hasId()){this.assignId();} -if(this.image!=null){this.context.drawImage(this.image,0,0,this.imageWidth(),this.imageHeight(),0,0,this.preScaledWidth,this.preScaledHeight);} -this.reloadCanvasData();if(Caman.allowRevert){this.initializedPixelData=Util.dataArray(this.pixelData.length);this.originalPixelData=Util.dataArray(this.pixelData.length);_ref=this.pixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];this.initializedPixelData[i]=pixel;this.originalPixelData[i]=pixel;}} -this.dimensions={width:this.canvas.width,height:this.canvas.height};Store.put(this.id,this);this.callback.call(this,this);return this.callback=function(){};};Caman.prototype.reloadCanvasData=function(){this.imageData=this.context.getImageData(0,0,this.canvas.width,this.canvas.height);return this.pixelData=this.imageData.data;};Caman.prototype.resetOriginalPixelData=function(){var pixel,_i,_len,_ref,_results;if(!Caman.allowRevert){throw"Revert disabled";} -this.originalPixelData=Util.dataArray(this.pixelData.length);_ref=this.pixelData;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){pixel=_ref[_i];_results.push(this.originalPixelData.push(pixel));} -return _results;};Caman.prototype.hasId=function(){return Caman.getAttrId(this.canvas)!=null;};Caman.prototype.assignId=function(){if(Caman.NodeJS||this.canvas.getAttribute('data-caman-id')){return;} -return this.canvas.setAttribute('data-caman-id',this.id);};Caman.prototype.hiDPIDisabled=function(){return this.canvas.getAttribute('data-caman-hidpi-disabled')!==null;};Caman.prototype.hiDPIAdjustments=function(){var ratio;if(Caman.NodeJS||this.hiDPIDisabled()){return;} -ratio=this.hiDPIRatio();if(ratio!==1){Log.debug("HiDPI ratio = "+ratio);this.scaled=true;this.preScaledWidth=this.canvas.width;this.preScaledHeight=this.canvas.height;this.canvas.width=this.preScaledWidth*ratio;this.canvas.height=this.preScaledHeight*ratio;this.canvas.style.width=""+this.preScaledWidth+"px";this.canvas.style.height=""+this.preScaledHeight+"px";this.context.scale(ratio,ratio);this.width=this.originalWidth=this.canvas.width;return this.height=this.originalHeight=this.canvas.height;}};Caman.prototype.hiDPIRatio=function(){var backingStoreRatio,devicePixelRatio;devicePixelRatio=window.devicePixelRatio||1;backingStoreRatio=this.context.webkitBackingStorePixelRatio||this.context.mozBackingStorePixelRatio||this.context.msBackingStorePixelRatio||this.context.oBackingStorePixelRatio||this.context.backingStorePixelRatio||1;return devicePixelRatio/backingStoreRatio;};Caman.prototype.hiDPICapable=function(){return(window.devicePixelRatio!=null)&&window.devicePixelRatio!==1;};Caman.prototype.needsHiDPISwap=function(){if(this.hiDPIDisabled()||!this.hiDPICapable()){return false;} -return this.hiDPIReplacement()!==null;};Caman.prototype.hiDPIReplacement=function(){if(this.image==null){return null;} -return this.image.getAttribute('data-caman-hidpi');};Caman.prototype.replaceCanvas=function(newCanvas){var oldCanvas;oldCanvas=this.canvas;this.canvas=newCanvas;this.context=this.canvas.getContext('2d');oldCanvas.parentNode.replaceChild(this.canvas,oldCanvas);this.width=this.canvas.width;this.height=this.canvas.height;this.reloadCanvasData();return this.dimensions={width:this.canvas.width,height:this.canvas.height};};Caman.prototype.render=function(callback){var _this=this;if(callback==null){callback=function(){};} -Event.trigger(this,"renderStart");return this.renderer.execute(function(){_this.context.putImageData(_this.imageData,0,0);return callback.call(_this);});};Caman.prototype.revert=function(){var i,pixel,_i,_len,_ref;if(!Caman.allowRevert){throw"Revert disabled";} -_ref=this.originalVisiblePixels();for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];this.pixelData[i]=pixel;} -return this.context.putImageData(this.imageData,0,0);};Caman.prototype.reset=function(){var canvas,ctx,i,imageData,pixel,pixelData,_i,_len,_ref;canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=this.originalWidth;canvas.height=this.originalHeight;ctx=canvas.getContext('2d');imageData=ctx.getImageData(0,0,canvas.width,canvas.height);pixelData=imageData.data;_ref=this.initializedPixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];pixelData[i]=pixel;} -ctx.putImageData(imageData,0,0);this.cropCoordinates={x:0,y:0};this.resized=false;return this.replaceCanvas(canvas);};Caman.prototype.originalVisiblePixels=function(){var canvas,coord,ctx,endX,endY,i,imageData,pixel,pixelData,pixels,scaledCanvas,startX,startY,width,_i,_j,_len,_ref,_ref1,_ref2,_ref3;if(!Caman.allowRevert){throw"Revert disabled";} -pixels=[];startX=this.cropCoordinates.x;endX=startX+this.width;startY=this.cropCoordinates.y;endY=startY+this.height;if(this.resized){canvas=document.createElement('canvas');canvas.width=this.originalWidth;canvas.height=this.originalHeight;ctx=canvas.getContext('2d');imageData=ctx.getImageData(0,0,canvas.width,canvas.height);pixelData=imageData.data;_ref=this.originalPixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];pixelData[i]=pixel;} -ctx.putImageData(imageData,0,0);scaledCanvas=document.createElement('canvas');scaledCanvas.width=this.width;scaledCanvas.height=this.height;ctx=scaledCanvas.getContext('2d');ctx.drawImage(canvas,0,0,this.originalWidth,this.originalHeight,0,0,this.width,this.height);pixelData=ctx.getImageData(0,0,this.width,this.height).data;width=this.width;}else{pixelData=this.originalPixelData;width=this.originalWidth;} -for(i=_j=0,_ref1=pixelData.length;_j<_ref1;i=_j+=4){coord=PixelInfo.locationToCoordinates(i,width);if(((startX<=(_ref2=coord.x)&&_ref2_ref;i=0<=_ref?++_i:--_i){divisor+=adjust[i];}} -this.renderer.add({type:Filter.Type.Kernel,name:name,adjust:adjust,divisor:divisor,bias:bias||0});return this;};Caman.prototype.processPlugin=function(plugin,args){this.renderer.add({type:Filter.Type.Plugin,plugin:plugin,args:args});return this;};Caman.prototype.newLayer=function(callback){var layer;layer=new Layer(this);this.canvasQueue.push(layer);this.renderer.add({type:Filter.Type.LayerDequeue});callback.call(layer);this.renderer.add({type:Filter.Type.LayerFinished});return this;};Caman.prototype.executeLayer=function(layer){return this.pushContext(layer);};Caman.prototype.pushContext=function(layer){this.layerStack.push(this.currentLayer);this.pixelStack.push(this.pixelData);this.currentLayer=layer;return this.pixelData=layer.pixelData;};Caman.prototype.popContext=function(){this.pixelData=this.pixelStack.pop();return this.currentLayer=this.layerStack.pop();};Caman.prototype.applyCurrentLayer=function(){return this.currentLayer.applyToParent();};return Caman;})();Analyze=(function(){function Analyze(c){this.c=c;} -Analyze.prototype.calculateLevels=function(){var i,levels,numPixels,_i,_j,_k,_ref;levels={r:{},g:{},b:{}};for(i=_i=0;_i<=255;i=++_i){levels.r[i]=0;levels.g[i]=0;levels.b[i]=0;} -for(i=_j=0,_ref=this.c.pixelData.length;_j<_ref;i=_j+=4){levels.r[this.c.pixelData[i]]++;levels.g[this.c.pixelData[i+1]]++;levels.b[this.c.pixelData[i+2]]++;} -numPixels=this.c.pixelData.length/4;for(i=_k=0;_k<=255;i=++_k){levels.r[i]/=numPixels;levels.g[i]/=numPixels;levels.b[i]/=numPixels;} -return levels;};return Analyze;})();Caman.DOMUpdated=function(){var img,imgs,parser,_i,_len,_results;imgs=document.querySelectorAll("img[data-caman]");if(!(imgs.length>0)){return;} -_results=[];for(_i=0,_len=imgs.length;_i<_len;_i++){img=imgs[_i];_results.push(parser=new CamanParser(img,function(){this.parse();return this.execute();}));} -return _results;};if(Caman.autoload){(function(){if(document.readyState==="complete"){return Caman.DOMUpdated();}else{return document.addEventListener("DOMContentLoaded",Caman.DOMUpdated,false);}})();} -CamanParser=(function(){var INST_REGEX;INST_REGEX="(\\w+)\\((.*?)\\)";function CamanParser(ele,ready){this.dataStr=ele.getAttribute('data-caman');this.caman=Caman(ele,ready.bind(this));} -CamanParser.prototype.parse=function(){var args,filter,func,inst,instFunc,m,r,unparsedInstructions,_i,_len,_ref,_results;this.ele=this.caman.canvas;r=new RegExp(INST_REGEX,'g');unparsedInstructions=this.dataStr.match(r);if(!(unparsedInstructions.length>0)){return;} -r=new RegExp(INST_REGEX);_results=[];for(_i=0,_len=unparsedInstructions.length;_i<_len;_i++){inst=unparsedInstructions[_i];_ref=inst.match(r),m=_ref[0],filter=_ref[1],args=_ref[2];instFunc=new Function("return function() { this."+filter+"("+args+"); };");try{func=instFunc();_results.push(func.call(this.caman));}catch(e){_results.push(Log.debug(e));}} -return _results;};CamanParser.prototype.execute=function(){var ele;ele=this.ele;return this.caman.render(function(){return ele.parentNode.replaceChild(this.toImage(),ele);});};return CamanParser;})();Caman.Blender=Blender=(function(){function Blender(){} -Blender.blenders={};Blender.register=function(name,func){return this.blenders[name]=func;};Blender.execute=function(name,rgbaLayer,rgbaParent){return this.blenders[name](rgbaLayer,rgbaParent);};return Blender;})();Caman.Calculate=Calculate=(function(){function Calculate(){} -Calculate.distance=function(x1,y1,x2,y2){return Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));};Calculate.randomRange=function(min,max,getFloat){var rand;if(getFloat==null){getFloat=false;} -rand=min+(Math.random()*(max-min));if(getFloat){return rand.toFixed(getFloat);}else{return Math.round(rand);}};Calculate.luminance=function(rgba){return(0.299*rgba.r)+(0.587*rgba.g)+(0.114*rgba.b);};Calculate.bezier=function(start,ctrl1,ctrl2,end,lowBound,highBound){var Ax,Ay,Bx,By,Cx,Cy,bezier,curveX,curveY,i,j,leftCoord,rightCoord,t,x0,x1,x2,x3,y0,y1,y2,y3,_i,_j,_k,_ref,_ref1;x0=start[0];y0=start[1];x1=ctrl1[0];y1=ctrl1[1];x2=ctrl2[0];y2=ctrl2[1];x3=end[0];y3=end[1];bezier={};Cx=parseInt(3*(x1-x0),10);Bx=3*(x2-x1)-Cx;Ax=x3-x0-Cx-Bx;Cy=3*(y1-y0);By=3*(y2-y1)-Cy;Ay=y3-y0-Cy-By;for(i=_i=0;_i<1000;i=++_i){t=i/1000;curveX=Math.round((Ax*Math.pow(t,3))+(Bx*Math.pow(t,2))+(Cx*t)+x0);curveY=Math.round((Ay*Math.pow(t,3))+(By*Math.pow(t,2))+(Cy*t)+y0);if(lowBound&&curveYhighBound){curveY=highBound;} -bezier[curveX]=curveY;} -if(bezier.length=_ref;i=0<=_ref?++_j:--_j){if(bezier[i]==null){leftCoord=[i-1,bezier[i-1]];for(j=_k=i,_ref1=end[0];i<=_ref1?_k<=_ref1:_k>=_ref1;j=i<=_ref1?++_k:--_k){if(bezier[j]!=null){rightCoord=[j,bezier[j]];break;}} -bezier[i]=leftCoord[1]+((rightCoord[1]-leftCoord[1])/(rightCoord[0]-leftCoord[0]))*(i-leftCoord[0]);}}} -if(bezier[end[0]]==null){bezier[end[0]]=bezier[end[0]-1];} -return bezier;};return Calculate;})();Convert=(function(){function Convert(){} -Convert.hexToRGB=function(hex){var b,g,r;if(hex.charAt(0)==="#"){hex=hex.substr(1);} -r=parseInt(hex.substr(0,2),16);g=parseInt(hex.substr(2,2),16);b=parseInt(hex.substr(4,2),16);return{r:r,g:g,b:b};};Convert.rgbToHSL=function(r,g,b){var d,h,l,max,min,s;if(typeof r==="object"){g=r.g;b=r.b;r=r.r;} -r/=255;g/=255;b/=255;max=Math.max(r,g,b);min=Math.min(r,g,b);l=(max+min)/2;if(max===min){h=s=0;}else{d=max-min;s=l>0.5?d/(2-max-min):d/(max+min);h=(function(){switch(max){case r:return(g-b)/d+(g1){t-=1;} -if(t<1/6){return p+(q-p)*6*t;} -if(t<1/2){return q;} -if(t<2/3){return p+(q-p)*(2/3-t)*6;} -return p;};Convert.rgbToHSV=function(r,g,b){var d,h,max,min,s,v;r/=255;g/=255;b/=255;max=Math.max(r,g,b);min=Math.min(r,g,b);v=max;d=max-min;s=max===0?0:d/max;if(max===min){h=0;}else{h=(function(){switch(max){case r:return(g-b)/d+(g0.04045){r=Math.pow((r+0.055)/1.055,2.4);}else{r/=12.92;} -if(g>0.04045){g=Math.pow((g+0.055)/1.055,2.4);}else{g/=12.92;} -if(b>0.04045){b=Math.pow((b+0.055)/1.055,2.4);}else{b/=12.92;} -x=r*0.4124+g*0.3576+b*0.1805;y=r*0.2126+g*0.7152+b*0.0722;z=r*0.0193+g*0.1192+b*0.9505;return{x:x*100,y:y*100,z:z*100};};Convert.xyzToRGB=function(x,y,z){var b,g,r;x/=100;y/=100;z/=100;r=(3.2406*x)+(-1.5372*y)+(-0.4986*z);g=(-0.9689*x)+(1.8758*y)+(0.0415*z);b=(0.0557*x)+(-0.2040*y)+(1.0570*z);if(r>0.0031308){r=(1.055*Math.pow(r,0.4166666667))-0.055;}else{r*=12.92;} -if(g>0.0031308){g=(1.055*Math.pow(g,0.4166666667))-0.055;}else{g*=12.92;} -if(b>0.0031308){b=(1.055*Math.pow(b,0.4166666667))-0.055;}else{b*=12.92;} -return{r:r*255,g:g*255,b:b*255};};Convert.xyzToLab=function(x,y,z){var a,b,l,whiteX,whiteY,whiteZ;if(typeof x==="object"){y=x.y;z=x.z;x=x.x;} -whiteX=95.047;whiteY=100.0;whiteZ=108.883;x/=whiteX;y/=whiteY;z/=whiteZ;if(x>0.008856451679){x=Math.pow(x,0.3333333333);}else{x=(7.787037037*x)+0.1379310345;} -if(y>0.008856451679){y=Math.pow(y,0.3333333333);}else{y=(7.787037037*y)+0.1379310345;} -if(z>0.008856451679){z=Math.pow(z,0.3333333333);}else{z=(7.787037037*z)+0.1379310345;} -l=116*y-16;a=500*(x-y);b=200*(y-z);return{l:l,a:a,b:b};};Convert.labToXYZ=function(l,a,b){var x,y,z;if(typeof l==="object"){a=l.a;b=l.b;l=l.l;} -y=(l+16)/116;x=y+(a/500);z=y-(b/200);if(x>0.2068965517){x=x*x*x;}else{x=0.1284185493*(x-0.1379310345);} -if(y>0.2068965517){y=y*y*y;}else{y=0.1284185493*(y-0.1379310345);} -if(z>0.2068965517){z=z*z*z;}else{z=0.1284185493*(z-0.1379310345);} -return{x:x*95.047,y:y*100.0,z:z*108.883};};Convert.rgbToLab=function(r,g,b){var xyz;if(typeof r==="object"){g=r.g;b=r.b;r=r.r;} -xyz=this.rgbToXYZ(r,g,b);return this.xyzToLab(xyz);};Convert.labToRGB=function(l,a,b){};return Convert;})();Event=(function(){function Event(){} -Event.events={};Event.types=["processStart","processComplete","renderStart","renderFinished","blockStarted","blockFinished"];Event.trigger=function(target,type,data){var event,_i,_len,_ref,_results;if(this.events[type]&&this.events[type].length){_ref=this.events[type];_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){event=_ref[_i];if(event.target===null||target.id===event.target.id){_results.push(event.fn.call(target,data));}else{_results.push(void 0);}} -return _results;}};Event.listen=function(target,type,fn){var _fn,_type;if(typeof target==="string"){_type=target;_fn=type;target=null;type=_type;fn=_fn;} -if(__indexOf.call(this.types,type)<0){return false;} -if(!this.events[type]){this.events[type]=[];} -this.events[type].push({target:target,fn:fn});return true;};return Event;})();Caman.Event=Event;Caman.Filter=Filter=(function(){function Filter(){} -Filter.Type={Single:1,Kernel:2,LayerDequeue:3,LayerFinished:4,LoadOverlay:5,Plugin:6};Filter.register=function(name,filterFunc){return Caman.prototype[name]=filterFunc;};return Filter;})();Caman.IO=IO=(function(){function IO(){} -IO.domainRegex=/(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/;IO.isRemote=function(img){if(img==null){return false;} -if(this.corsEnabled(img)){return false;} -return this.isURLRemote(img.src);};IO.corsEnabled=function(img){var _ref;return(img.crossOrigin!=null)&&((_ref=img.crossOrigin.toLowerCase())==='anonymous'||_ref==='use-credentials');};IO.isURLRemote=function(url){var matches;matches=url.match(this.domainRegex);if(matches){return matches[1]!==document.domain;}else{return false;}};IO.remoteCheck=function(src){if(this.isURLRemote(src)){if(!Caman.remoteProxy.length){Log.info("Attempting to load a remote image without a configured proxy. URL: "+src);}else{if(Caman.isURLRemote(Caman.remoteProxy)){Log.info("Cannot use a remote proxy for loading images.");return;} -return""+Caman.remoteProxy+"?camanProxyUrl="+(encodeURIComponent(src));}}};IO.proxyUrl=function(src){return""+Caman.remoteProxy+"?"+Caman.proxyParam+"="+(encodeURIComponent(src));};IO.useProxy=function(lang){var langToExt;langToExt={ruby:'rb',python:'py',perl:'pl',javascript:'js'};lang=lang.toLowerCase();if(langToExt[lang]!=null){lang=langToExt[lang];} -return"proxies/caman_proxy."+lang;};return IO;})();Caman.prototype.save=function(){if(typeof exports!=="undefined"&&exports!==null){return this.nodeSave.apply(this,arguments);}else{return this.browserSave.apply(this,arguments);}};Caman.prototype.browserSave=function(type){var image;if(type==null){type="png";} -type=type.toLowerCase();image=this.toBase64(type).replace("image/"+type,"image/octet-stream");return document.location.href=image;};Caman.prototype.nodeSave=function(file,overwrite){var stats;if(overwrite==null){overwrite=true;} -try{stats=fs.statSync(file);if(stats.isFile()&&!overwrite){return false;}}catch(e){Log.debug("Creating output file "+file);} -return fs.writeFile(file,this.canvas.toBuffer(),function(){return Log.debug("Finished writing to "+file);});};Caman.prototype.toImage=function(type){var img;img=document.createElement('img');img.src=this.toBase64(type);img.width=this.dimensions.width;img.height=this.dimensions.height;if(window.devicePixelRatio){img.width/=window.devicePixelRatio;img.height/=window.devicePixelRatio;} -return img;};Caman.prototype.toBase64=function(type){if(type==null){type="png";} -type=type.toLowerCase();return this.canvas.toDataURL("image/"+type);};Layer=(function(){function Layer(c){this.c=c;this.filter=this.c;this.options={blendingMode:'normal',opacity:1.0};this.layerID=Util.uniqid.get();this.canvas=typeof exports!=="undefined"&&exports!==null?new Canvas():document.createElement('canvas');this.canvas.width=this.c.dimensions.width;this.canvas.height=this.c.dimensions.height;this.context=this.canvas.getContext('2d');this.context.createImageData(this.canvas.width,this.canvas.height);this.imageData=this.context.getImageData(0,0,this.canvas.width,this.canvas.height);this.pixelData=this.imageData.data;} -Layer.prototype.newLayer=function(cb){return this.c.newLayer.call(this.c,cb);};Layer.prototype.setBlendingMode=function(mode){this.options.blendingMode=mode;return this;};Layer.prototype.opacity=function(opacity){this.options.opacity=opacity/100;return this;};Layer.prototype.copyParent=function(){var i,parentData,_i,_ref;parentData=this.c.pixelData;for(i=_i=0,_ref=this.c.pixelData.length;_i<_ref;i=_i+=4){this.pixelData[i]=parentData[i];this.pixelData[i+1]=parentData[i+1];this.pixelData[i+2]=parentData[i+2];this.pixelData[i+3]=parentData[i+3];} -return this;};Layer.prototype.fillColor=function(){return this.c.fillColor.apply(this.c,arguments);};Layer.prototype.overlayImage=function(image){if(typeof image==="object"){image=image.src;}else if(typeof image==="string"&&image[0]==="#"){image=$(image).src;} -if(!image){return this;} -this.c.renderer.renderQueue.push({type:Filter.Type.LoadOverlay,src:image,layer:this});return this;};Layer.prototype.applyToParent=function(){var i,layerData,parentData,result,rgbaLayer,rgbaParent,_i,_ref,_results;parentData=this.c.pixelStack[this.c.pixelStack.length-1];layerData=this.c.pixelData;_results=[];for(i=_i=0,_ref=layerData.length;_i<_ref;i=_i+=4){rgbaParent={r:parentData[i],g:parentData[i+1],b:parentData[i+2],a:parentData[i+3]};rgbaLayer={r:layerData[i],g:layerData[i+1],b:layerData[i+2],a:layerData[i+3]};result=Blender.execute(this.options.blendingMode,rgbaLayer,rgbaParent);result.r=Util.clampRGB(result.r);result.g=Util.clampRGB(result.g);result.b=Util.clampRGB(result.b);if(result.a==null){result.a=rgbaLayer.a;} -parentData[i]=rgbaParent.r-((rgbaParent.r-result.r)*(this.options.opacity*(result.a/255)));parentData[i+1]=rgbaParent.g-((rgbaParent.g-result.g)*(this.options.opacity*(result.a/255)));_results.push(parentData[i+2]=rgbaParent.b-((rgbaParent.b-result.b)*(this.options.opacity*(result.a/255))));} -return _results;};return Layer;})();Logger=(function(){function Logger(){var name,_i,_len,_ref;_ref=['log','info','warn','error'];for(_i=0,_len=_ref.length;_i<_len;_i++){name=_ref[_i];this[name]=(function(name){return function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];if(!Caman.DEBUG){return;} -try{return console[name].apply(console,args);}catch(e){return console[name](args);}};})(name);} -this.debug=this.log;} -return Logger;})();Log=new Logger();PixelInfo=(function(){PixelInfo.coordinatesToLocation=function(x,y,width){return(y*width+x)*4;};PixelInfo.locationToCoordinates=function(loc,width){var x,y;y=Math.floor(loc/(width*4));x=(loc%(width*4))/4;return{x:x,y:y};};function PixelInfo(c){this.c=c;this.loc=0;} -PixelInfo.prototype.locationXY=function(){var x,y;y=this.c.dimensions.height-Math.floor(this.loc/(this.c.dimensions.width*4));x=(this.loc%(this.c.dimensions.width*4))/4;return{x:x,y:y};};PixelInfo.prototype.getPixelRelative=function(horiz,vert){var newLoc;newLoc=this.loc+(this.c.dimensions.width*4*(vert*-1))+(4*horiz);if(newLoc>this.c.pixelData.length||newLoc<0){return{r:0,g:0,b:0,a:0};} -return{r:this.c.pixelData[newLoc],g:this.c.pixelData[newLoc+1],b:this.c.pixelData[newLoc+2],a:this.c.pixelData[newLoc+3]};};PixelInfo.prototype.putPixelRelative=function(horiz,vert,rgba){var nowLoc;nowLoc=this.loc+(this.c.dimensions.width*4*(vert*-1))+(4*horiz);if(newLoc>this.c.pixelData.length||newLoc<0){return;} -this.c.pixelData[newLoc]=rgba.r;this.c.pixelData[newLoc+1]=rgba.g;this.c.pixelData[newLoc+2]=rgba.b;this.c.pixelData[newLoc+3]=rgba.a;return true;};PixelInfo.prototype.getPixel=function(x,y){var loc;loc=this.coordinatesToLocation(x,y,this.width);return{r:this.c.pixelData[loc],g:this.c.pixelData[loc+1],b:this.c.pixelData[loc+2],a:this.c.pixelData[loc+3]};};PixelInfo.prototype.putPixel=function(x,y,rgba){var loc;loc=this.coordinatesToLocation(x,y,this.width);this.c.pixelData[loc]=rgba.r;this.c.pixelData[loc+1]=rgba.g;this.c.pixelData[loc+2]=rgba.b;return this.c.pixelData[loc+3]=rgba.a;};return PixelInfo;})();Plugin=(function(){function Plugin(){} -Plugin.plugins={};Plugin.register=function(name,plugin){return this.plugins[name]=plugin;};Plugin.execute=function(context,name,args){return this.plugins[name].apply(context,args);};return Plugin;})();Caman.Plugin=Plugin;Caman.Renderer=Renderer=(function(){Renderer.Blocks=Caman.NodeJS?require('os').cpus().length:4;function Renderer(c){var _this=this;this.c=c;this.processNext=function(){return Renderer.prototype.processNext.apply(_this,arguments);};this.renderQueue=[];this.modPixelData=null;} -Renderer.prototype.add=function(job){if(job==null){return;} -return this.renderQueue.push(job);};Renderer.prototype.processNext=function(){var layer;if(this.renderQueue.length===0){Event.trigger(this,"renderFinished");if(this.finishedFn!=null){this.finishedFn.call(this.c);} -return this;} -this.currentJob=this.renderQueue.shift();switch(this.currentJob.type){case Filter.Type.LayerDequeue:layer=this.c.canvasQueue.shift();this.c.executeLayer(layer);return this.processNext();case Filter.Type.LayerFinished:this.c.applyCurrentLayer();this.c.popContext();return this.processNext();case Filter.Type.LoadOverlay:return this.loadOverlay(this.currentJob.layer,this.currentJob.src);case Filter.Type.Plugin:return this.executePlugin();default:return this.executeFilter();}};Renderer.prototype.execute=function(callback){this.finishedFn=callback;this.modPixelData=Util.dataArray(this.c.pixelData.length);return this.processNext();};Renderer.prototype.eachBlock=function(fn){var blockN,blockPixelLength,bnum,end,f,i,lastBlockN,n,start,_i,_ref,_results,_this=this;this.blocksDone=0;n=this.c.pixelData.length;blockPixelLength=Math.floor((n/4)/Renderer.Blocks);blockN=blockPixelLength*4;lastBlockN=blockN+((n/4)%Renderer.Blocks)*4;_results=[];for(i=_i=0,_ref=Renderer.Blocks;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){start=i*blockN;end=start+(i===Renderer.Blocks-1?lastBlockN:blockN);if(Caman.NodeJS){f=Fiber(function(){return fn.call(_this,i,start,end);});bnum=f.run();_results.push(this.blockFinished(bnum));}else{_results.push(setTimeout((function(i,start,end){return function(){return fn.call(_this,i,start,end);};})(i,start,end),0));}} -return _results;};Renderer.prototype.executeFilter=function(){Event.trigger(this.c,"processStart",this.currentJob);if(this.currentJob.type===Filter.Type.Single){return this.eachBlock(this.renderBlock);}else{return this.eachBlock(this.renderKernel);}};Renderer.prototype.executePlugin=function(){Log.debug("Executing plugin "+this.currentJob.plugin);Plugin.execute(this.c,this.currentJob.plugin,this.currentJob.args);Log.debug("Plugin "+this.currentJob.plugin+" finished!");return this.processNext();};Renderer.prototype.renderBlock=function(bnum,start,end){var data,i,pixelInfo,res,_i;Log.debug("Block #"+bnum+" - Filter: "+this.currentJob.name+", Start: "+start+", End: "+end);Event.trigger(this.c,"blockStarted",{blockNum:bnum,totalBlocks:Renderer.Blocks,startPixel:start,endPixel:end});data={r:0,g:0,b:0,a:0};pixelInfo=new PixelInfo(this.c);for(i=_i=start;_i=builder;j=-builder<=builder?++_j:--_j){for(k=_k=builder;builder<=-builder?_k<=-builder:_k>=-builder;k=builder<=-builder?++_k:--_k){pixel=pixelInfo.getPixelRelative(j,k);kernel[builderIndex*3]=pixel.r;kernel[builderIndex*3+1]=pixel.g;kernel[builderIndex*3+2]=pixel.b;builderIndex++;}} -res=this.processKernel(adjust,kernel,divisor,bias);this.modPixelData[i]=Util.clampRGB(res.r);this.modPixelData[i+1]=Util.clampRGB(res.g);this.modPixelData[i+2]=Util.clampRGB(res.b);this.modPixelData[i+3]=this.c.pixelData[i+3];} -if(Caman.NodeJS){return Fiber["yield"](bnum);}else{return this.blockFinished(bnum);}};Renderer.prototype.blockFinished=function(bnum){var i,_i,_ref;if(bnum>=0){Log.debug("Block #"+bnum+" finished! Filter: "+this.currentJob.name);} -this.blocksDone++;Event.trigger(this.c,"blockFinished",{blockNum:bnum,blocksFinished:this.blocksDone,totalBlocks:Renderer.Blocks});if(this.blocksDone===Renderer.Blocks){if(this.currentJob.type===Filter.Type.Kernel){for(i=_i=0,_ref=this.c.pixelData.length;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){this.c.pixelData[i]=this.modPixelData[i];}} -if(bnum>=0){Log.debug("Filter "+this.currentJob.name+" finished!");} -Event.trigger(this.c,"processComplete",this.currentJob);return this.processNext();}};Renderer.prototype.processKernel=function(adjust,kernel,divisor,bias){var i,val,_i,_ref;val={r:0,g:0,b:0};for(i=_i=0,_ref=adjust.length;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){val.r+=adjust[i]*kernel[i*3];val.g+=adjust[i]*kernel[i*3+1];val.b+=adjust[i]*kernel[i*3+2];} -val.r=(val.r/divisor)+bias;val.g=(val.g/divisor)+bias;val.b=(val.b/divisor)+bias;return val;};Renderer.prototype.loadOverlay=function(layer,src){var img,proxyUrl,_this=this;img=document.createElement('img');img.onload=function(){layer.context.drawImage(img,0,0,_this.c.dimensions.width,_this.c.dimensions.height);layer.imageData=layer.context.getImageData(0,0,_this.c.dimensions.width,_this.c.dimensions.height);layer.pixelData=layer.imageData.data;_this.c.pixelData=layer.pixelData;return _this.processNext();};proxyUrl=IO.remoteCheck(src);return img.src=proxyUrl!=null?proxyUrl:src;};return Renderer;})();Caman.Store=Store=(function(){function Store(){} -Store.items={};Store.has=function(search){return this.items[search]!=null;};Store.get=function(search){return this.items[search];};Store.put=function(name,obj){return this.items[name]=obj;};Store.execute=function(search,callback){var _this=this;setTimeout(function(){return callback.call(_this.get(search),_this.get(search));},0);return this.get(search);};Store.flush=function(name){if(name==null){name=false;} -if(name){return delete this.items[name];}else{return this.items={};}};return Store;})();Blender.register("normal",function(rgbaLayer,rgbaParent){return{r:rgbaLayer.r,g:rgbaLayer.g,b:rgbaLayer.b};});Blender.register("multiply",function(rgbaLayer,rgbaParent){return{r:(rgbaLayer.r*rgbaParent.r)/255,g:(rgbaLayer.g*rgbaParent.g)/255,b:(rgbaLayer.b*rgbaParent.b)/255};});Blender.register("screen",function(rgbaLayer,rgbaParent){return{r:255-(((255-rgbaLayer.r)*(255-rgbaParent.r))/255),g:255-(((255-rgbaLayer.g)*(255-rgbaParent.g))/255),b:255-(((255-rgbaLayer.b)*(255-rgbaParent.b))/255)};});Blender.register("overlay",function(rgbaLayer,rgbaParent){var result;result={};result.r=rgbaParent.r>128?255-2*(255-rgbaLayer.r)*(255-rgbaParent.r)/255:(rgbaParent.r*rgbaLayer.r*2)/255;result.g=rgbaParent.g>128?255-2*(255-rgbaLayer.g)*(255-rgbaParent.g)/255:(rgbaParent.g*rgbaLayer.g*2)/255;result.b=rgbaParent.b>128?255-2*(255-rgbaLayer.b)*(255-rgbaParent.b)/255:(rgbaParent.b*rgbaLayer.b*2)/255;return result;});Blender.register("difference",function(rgbaLayer,rgbaParent){return{r:rgbaLayer.r-rgbaParent.r,g:rgbaLayer.g-rgbaParent.g,b:rgbaLayer.b-rgbaParent.b};});Blender.register("addition",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r+rgbaLayer.r,g:rgbaParent.g+rgbaLayer.g,b:rgbaParent.b+rgbaLayer.b};});Blender.register("exclusion",function(rgbaLayer,rgbaParent){return{r:128-2*(rgbaParent.r-128)*(rgbaLayer.r-128)/255,g:128-2*(rgbaParent.g-128)*(rgbaLayer.g-128)/255,b:128-2*(rgbaParent.b-128)*(rgbaLayer.b-128)/255};});Blender.register("softLight",function(rgbaLayer,rgbaParent){var result;result={};result.r=rgbaParent.r>128?255-((255-rgbaParent.r)*(255-(rgbaLayer.r-128)))/255:(rgbaParent.r*(rgbaLayer.r+128))/255;result.g=rgbaParent.g>128?255-((255-rgbaParent.g)*(255-(rgbaLayer.g-128)))/255:(rgbaParent.g*(rgbaLayer.g+128))/255;result.b=rgbaParent.b>128?255-((255-rgbaParent.b)*(255-(rgbaLayer.b-128)))/255:(rgbaParent.b*(rgbaLayer.b+128))/255;return result;});Blender.register("lighten",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r>rgbaLayer.r?rgbaParent.r:rgbaLayer.r,g:rgbaParent.g>rgbaLayer.g?rgbaParent.g:rgbaLayer.g,b:rgbaParent.b>rgbaLayer.b?rgbaParent.b:rgbaLayer.b};});Blender.register("darken",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r>rgbaLayer.r?rgbaLayer.r:rgbaParent.r,g:rgbaParent.g>rgbaLayer.g?rgbaLayer.g:rgbaParent.g,b:rgbaParent.b>rgbaLayer.b?rgbaLayer.b:rgbaParent.b};});Filter.register("fillColor",function(){var color;if(arguments.length===1){color=Convert.hexToRGB(arguments[0]);}else{color={r:arguments[0],g:arguments[1],b:arguments[2]};} -return this.process("fillColor",function(rgba){rgba.r=color.r;rgba.g=color.g;rgba.b=color.b;rgba.a=255;return rgba;});});Filter.register("brightness",function(adjust){adjust=Math.floor(255*(adjust/100));return this.process("brightness",function(rgba){rgba.r+=adjust;rgba.g+=adjust;rgba.b+=adjust;return rgba;});});Filter.register("saturation",function(adjust){adjust*=-0.01;return this.process("saturation",function(rgba){var max;max=Math.max(rgba.r,rgba.g,rgba.b);if(rgba.r!==max){rgba.r+=(max-rgba.r)*adjust;} -if(rgba.g!==max){rgba.g+=(max-rgba.g)*adjust;} -if(rgba.b!==max){rgba.b+=(max-rgba.b)*adjust;} -return rgba;});});Filter.register("vibrance",function(adjust){adjust*=-1;return this.process("vibrance",function(rgba){var amt,avg,max;max=Math.max(rgba.r,rgba.g,rgba.b);avg=(rgba.r+rgba.g+rgba.b)/3;amt=((Math.abs(max-avg)*2/255)*adjust)/100;if(rgba.r!==max){rgba.r+=(max-rgba.r)*amt;} -if(rgba.g!==max){rgba.g+=(max-rgba.g)*amt;} -if(rgba.b!==max){rgba.b+=(max-rgba.b)*amt;} -return rgba;});});Filter.register("greyscale",function(adjust){return this.process("greyscale",function(rgba){var avg;avg=Calculate.luminance(rgba);rgba.r=avg;rgba.g=avg;rgba.b=avg;return rgba;});});Filter.register("contrast",function(adjust){adjust=Math.pow((adjust+100)/100,2);return this.process("contrast",function(rgba){rgba.r/=255;rgba.r-=0.5;rgba.r*=adjust;rgba.r+=0.5;rgba.r*=255;rgba.g/=255;rgba.g-=0.5;rgba.g*=adjust;rgba.g+=0.5;rgba.g*=255;rgba.b/=255;rgba.b-=0.5;rgba.b*=adjust;rgba.b+=0.5;rgba.b*=255;return rgba;});});Filter.register("hue",function(adjust){return this.process("hue",function(rgba){var h,hsv,rgb;hsv=Convert.rgbToHSV(rgba.r,rgba.g,rgba.b);h=hsv.h*100;h+=Math.abs(adjust);h=h%100;h/=100;hsv.h=h;rgb=Convert.hsvToRGB(hsv.h,hsv.s,hsv.v);rgb.a=rgba.a;return rgb;});});Filter.register("colorize",function(){var level,rgb;if(arguments.length===2){rgb=Convert.hexToRGB(arguments[0]);level=arguments[1];}else if(arguments.length===4){rgb={r:arguments[0],g:arguments[1],b:arguments[2]};level=arguments[3];} -return this.process("colorize",function(rgba){rgba.r-=(rgba.r-rgb.r)*(level/100);rgba.g-=(rgba.g-rgb.g)*(level/100);rgba.b-=(rgba.b-rgb.b)*(level/100);return rgba;});});Filter.register("invert",function(){return this.process("invert",function(rgba){rgba.r=255-rgba.r;rgba.g=255-rgba.g;rgba.b=255-rgba.b;return rgba;});});Filter.register("sepia",function(adjust){if(adjust==null){adjust=100;} -adjust/=100;return this.process("sepia",function(rgba){rgba.r=Math.min(255,(rgba.r*(1-(0.607*adjust)))+(rgba.g*(0.769*adjust))+(rgba.b*(0.189*adjust)));rgba.g=Math.min(255,(rgba.r*(0.349*adjust))+(rgba.g*(1-(0.314*adjust)))+(rgba.b*(0.168*adjust)));rgba.b=Math.min(255,(rgba.r*(0.272*adjust))+(rgba.g*(0.534*adjust))+(rgba.b*(1-(0.869*adjust))));return rgba;});});Filter.register("gamma",function(adjust){return this.process("gamma",function(rgba){rgba.r=Math.pow(rgba.r/255,adjust)*255;rgba.g=Math.pow(rgba.g/255,adjust)*255;rgba.b=Math.pow(rgba.b/255,adjust)*255;return rgba;});});Filter.register("noise",function(adjust){adjust=Math.abs(adjust)*2.55;return this.process("noise",function(rgba){var rand;rand=Calculate.randomRange(adjust*-1,adjust);rgba.r+=rand;rgba.g+=rand;rgba.b+=rand;return rgba;});});Filter.register("clip",function(adjust){adjust=Math.abs(adjust)*2.55;return this.process("clip",function(rgba){if(rgba.r>255-adjust){rgba.r=255;}else if(rgba.r255-adjust){rgba.g=255;}else if(rgba.g255-adjust){rgba.b=255;}else if(rgba.b0){rgba.r+=(255-rgba.r)*options.red;}else{rgba.r-=rgba.r*Math.abs(options.red);}} -if(options.green!=null){if(options.green>0){rgba.g+=(255-rgba.g)*options.green;}else{rgba.g-=rgba.g*Math.abs(options.green);}} -if(options.blue!=null){if(options.blue>0){rgba.b+=(255-rgba.b)*options.blue;}else{rgba.b-=rgba.b*Math.abs(options.blue);}} -return rgba;});});Filter.register("curves",function(){var bezier,chans,cps,ctrl1,ctrl2,end,i,start,_i,_j,_ref,_ref1;chans=arguments[0],cps=2<=arguments.length?__slice.call(arguments,1):[];if(typeof chans==="string"){chans=chans.split("");} -if(chans[0]==="v"){chans=['r','g','b'];} -if(cps.length<3||cps.length>4){throw"Invalid number of arguments to curves filter";} -start=cps[0];ctrl1=cps[1];ctrl2=cps.length===4?cps[2]:cps[1];end=cps[cps.length-1];bezier=Calculate.bezier(start,ctrl1,ctrl2,end,0,255);if(start[0]>0){for(i=_i=0,_ref=start[0];0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){bezier[i]=start[1];}} -if(end[0]<255){for(i=_j=_ref1=end[0];_ref1<=255?_j<=255:_j>=255;i=_ref1<=255?++_j:--_j){bezier[i]=end[1];}} -return this.process("curves",function(rgba){var _k,_ref2;for(i=_k=0,_ref2=chans.length;0<=_ref2?_k<_ref2:_k>_ref2;i=0<=_ref2?++_k:--_k){rgba[chans[i]]=bezier[rgba[chans[i]]];} -return rgba;});});Filter.register("exposure",function(adjust){var ctrl1,ctrl2,p;p=Math.abs(adjust)/100;ctrl1=[0,255*p];ctrl2=[255-(255*p),255];if(adjust<0){ctrl1=ctrl1.reverse();ctrl2=ctrl2.reverse();} -return this.curves('rgb',[0,0],ctrl1,ctrl2,[255,255]);});Caman.Plugin.register("crop",function(width,height,x,y){var canvas,ctx;if(x==null){x=0;} -if(y==null){y=0;} -if(typeof exports!=="undefined"&&exports!==null){canvas=new Canvas(width,height);}else{canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=width;canvas.height=height;} -ctx=canvas.getContext('2d');ctx.drawImage(this.canvas,x,y,width,height,0,0,width,height);this.cropCoordinates={x:x,y:y};this.cropped=true;return this.replaceCanvas(canvas);});Caman.Plugin.register("resize",function(newDims){var canvas,ctx;if(newDims==null){newDims=null;} -if(newDims===null||((newDims.width==null)&&(newDims.height==null))){Log.error("Invalid or missing dimensions given for resize");return;} -if(newDims.width==null){newDims.width=this.canvas.width*newDims.height/this.canvas.height;}else if(newDims.height==null){newDims.height=this.canvas.height*newDims.width/this.canvas.width;} -if(typeof exports!=="undefined"&&exports!==null){canvas=new Canvas(newDims.width,newDims.height);}else{canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=newDims.width;canvas.height=newDims.height;} -ctx=canvas.getContext('2d');ctx.drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,newDims.width,newDims.height);this.resized=true;return this.replaceCanvas(canvas);});Caman.Filter.register("crop",function(){return this.processPlugin("crop",Array.prototype.slice.call(arguments,0));});Caman.Filter.register("resize",function(){return this.processPlugin("resize",Array.prototype.slice.call(arguments,0));});}).call(this); \ No newline at end of file +(function() { + var $; + var Analyze; + var Blender; + var Calculate; + var Caman; + var CamanParser; + var Canvas; + var Convert; + var Event; + var Fiber; + var Filter; + var IO; + var Image; + var Layer; + var Log; + var Logger; + var PixelInfo; + var Plugin; + var Renderer; + var Root; + var Store; + var Util; + var fs; + var slice; + var __hasProp = {}.hasOwnProperty; + var __indexOf = [].indexOf || function(item) { + for (var i = 0, l = this.length; i < l; i++) { + if (i in this && this[i] === item) { + return i; + } + } + return -1; + }; + var __slice = [].slice; + var _this = this; + slice = Array.prototype.slice; + $ = function(sel, root) { + if (root == null) { + root = document; + } + if (typeof sel === "object" || (typeof exports !== "undefined" && exports !== null)) { + return sel; + } + return root.querySelector(sel); + }; + Util = (function() { + function Util() { + } + Util.uniqid = (function() { + var id; + id = 0;return { + get: function() { + return id++; + } + }; + })(); + Util.extend = function(obj) { + var copy; + var dest; + var prop; + var src; + var _i; + var _len; + dest = obj; + src = slice.call(arguments, 1); + for (_i = 0, _len = src.length; _i < _len; _i++) { + copy = src[_i]; + for (prop in copy) { + if (!__hasProp.call(copy, prop)) { + continue; + } + dest[prop] = copy[prop]; + } + } + return dest; + }; + Util.clampRGB = function(val) { + if (val < 0) { + return 0; + } + if (val > 255) { + return 255; + } + return val; + }; + Util.copyAttributes = function(from, to, opts) { + var attr; + var _i; + var _len; + var _ref; + var _ref1; + var _results; + if (opts == null) { + opts = {}; + } + _ref = from.attributes; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + attr = _ref[_i]; + if ((opts.except != null) && (_ref1 = attr.nodeName, __indexOf.call(opts.except, _ref1) >= 0)) { + continue; + } + _results.push(to.setAttribute(attr.nodeName, attr.nodeValue)); + } + return _results; + }; + Util.dataArray = function(length) { + if (length == null) { + length = 0; + } + if (Caman.NodeJS || (window.Uint8Array != null)) { + return new Uint8Array(length); + } + return new Array(length); + };return Util; + })(); + if (typeof exports !== "undefined" && exports !== null) { + Root = exports; + Canvas = require('canvas'); + Image = Canvas.Image; + Fiber = require('fibers'); + fs = require('fs'); + } else { + Root = window; + } + Root.Caman = Caman = (function() { + Caman.version = { + release: "4.1.1", + date: "4/8/2013" + }; + Caman.DEBUG = false; + Caman.NodeJS = typeof exports !== "undefined" && exports !== null; + Caman.autoload = !Caman.NodeJS; + Caman.allowRevert = true; + Caman.crossOrigin = "anonymous"; + Caman.toString = function() { + return "Version " + Caman.version.release + ", Released " + Caman.version.date; + }; + Caman.remoteProxy = ""; + Caman.proxyParam = "camanProxyUrl"; + Caman.getAttrId = function(canvas) { + if (Caman.NodeJS) { + return true; + } + if (typeof canvas === "string") { + canvas = $(canvas); + } + if (!((canvas != null) && (canvas.getAttribute != null))) { + return null; + } + return canvas.getAttribute('data-caman-id'); + }; + function Caman() { + var args; + var callback; + var id; + var _this = this; + if (arguments.length === 0) { + throw "Invalid arguments"; + } + if (this instanceof Caman) { + this.finishInit = this.finishInit.bind(this); + this.imageLoaded = this.imageLoaded.bind(this); + args = arguments[0]; + if (!Caman.NodeJS) { + id = parseInt(Caman.getAttrId(args[0]), 10); + callback = typeof args[1] === "function" ? args[1] : typeof args[2] === "function" ? args[2] : function() {}; + if (!isNaN(id) && Store.has(id)) { + return Store.execute(id, callback); + } + } + this.id = Util.uniqid.get(); + this.initializedPixelData = this.originalPixelData = null; + this.cropCoordinates = { + x: 0, + y: 0 + }; + this.cropped = false; + this.resized = false; + this.pixelStack = []; + this.layerStack = []; + this.canvasQueue = []; + this.currentLayer = null; + this.scaled = false; + this.analyze = new Analyze(this); + this.renderer = new Renderer(this);this.domIsLoaded(function() { + _this.parseArguments(args);return _this.setup(); + });return this; + } else { + return new Caman(arguments); + } + } + Caman.prototype.domIsLoaded = function(cb) { + var listener; + var _this = this; + if (Caman.NodeJS) { + return setTimeout(function() { + return cb.call(_this); + }, 0); + } else { + if (document.readyState === "complete") { + Log.debug("DOM initialized");return setTimeout(function() { + return cb.call(_this); + }, 0); + } else { + listener = function() { + if (document.readyState === "complete") { + Log.debug("DOM initialized");return cb.call(_this); + } + };return document.addEventListener("readystatechange", listener, false); + } + } + }; + Caman.prototype.parseArguments = function(args) { + var key; + var val; + var _ref; + var _results; + if (args.length === 0) { + throw "Invalid arguments given"; + } + this.initObj = null; + this.initType = null; + this.imageUrl = null; + this.callback = function() {};this.setInitObject(args[0]); + if (args.length === 1) { + return; + } + switch (typeof args[1]) { + case "string": + this.imageUrl = args[1]; + break;case "function": + this.callback = args[1]; + } + if (args.length === 2) { + return; + } + this.callback = args[2]; + if (args.length === 4) { + _ref = args[4]; + _results = []; + for (key in _ref) { + if (!__hasProp.call(_ref, key)) { + continue; + } + val = _ref[key];_results.push(this.options[key] = val); + } + return _results; + } + }; + Caman.prototype.setInitObject = function(obj) { + if (Caman.NodeJS) { + this.initObj = obj; + this.initType = 'node';return; + } + if (typeof obj === "object") { + this.initObj = obj; + } else { + this.initObj = $(obj); + } + if (this.initObj == null) { + throw "Could not find image or canvas for initialization."; + } + return this.initType = this.initObj.nodeName.toLowerCase(); + }; + Caman.prototype.setup = function() { + switch (this.initType) { + case "node": + return this.initNode();case "img": + return this.initImage();case "canvas": + return this.initCanvas(); + } + }; + Caman.prototype.initNode = function() { + var _this = this; + Log.debug("Initializing for NodeJS"); + this.image = new Image(); + this.image.onload = function() { + Log.debug("Image loaded. Width = " + (_this.imageWidth()) + ", Height = " + (_this.imageHeight())); + _this.canvas = new Canvas(_this.imageWidth(), _this.imageHeight());return _this.finishInit(); + }; + this.image.onerror = function(err) { + throw err; + };return this.image.src = this.initObj; + }; + Caman.prototype.initImage = function() { + this.image = this.initObj; + this.canvas = document.createElement('canvas'); + this.context = this.canvas.getContext('2d');Util.copyAttributes(this.image, this.canvas, { + except: ['src'] + });this.image.parentNode.replaceChild(this.canvas, this.image);this.imageAdjustments();return this.waitForImageLoaded(); + }; + Caman.prototype.initCanvas = function() { + this.canvas = this.initObj; + this.context = this.canvas.getContext('2d'); + if (this.imageUrl != null) { + this.image = document.createElement('img'); + this.image.src = this.imageUrl;this.imageAdjustments();return this.waitForImageLoaded(); + } else { + return this.finishInit(); + } + }; + Caman.prototype.imageAdjustments = function() { + if (this.needsHiDPISwap()) { + Log.debug(this.image.src, "->", this.hiDPIReplacement()); + this.swapped = true; + this.image.src = this.hiDPIReplacement(); + } + if (IO.isRemote(this.image)) { + this.image.src = IO.proxyUrl(this.image.src);return Log.debug("Remote image detected, using URL = " + this.image.src); + } + }; + Caman.prototype.waitForImageLoaded = function() { + if (this.isImageLoaded()) { + return this.imageLoaded(); + } else { + return this.image.onload = this.imageLoaded; + } + }; + Caman.prototype.isImageLoaded = function() { + if (!this.image.complete) { + return false; + } + if ((this.image.naturalWidth != null) && this.image.naturalWidth === 0) { + return false; + } + return true; + }; + Caman.prototype.imageWidth = function() { + return this.image.width || this.image.naturalWidth; + }; + Caman.prototype.imageHeight = function() { + return this.image.height || this.image.naturalHeight; + }; + Caman.prototype.imageLoaded = function() { + Log.debug("Image loaded. Width = " + (this.imageWidth()) + ", Height = " + (this.imageHeight())); + if (this.swapped) { + this.canvas.width = this.imageWidth() / this.hiDPIRatio(); + this.canvas.height = this.imageHeight() / this.hiDPIRatio(); + } else { + this.canvas.width = this.imageWidth(); + this.canvas.height = this.imageHeight(); + } + return this.finishInit(); + }; + Caman.prototype.finishInit = function() { + var i; + var pixel; + var _i; + var _len; + var _ref; + if (this.context == null) { + this.context = this.canvas.getContext('2d'); + } + this.originalWidth = this.preScaledWidth = this.width = this.canvas.width; + this.originalHeight = this.preScaledHeight = this.height = this.canvas.height;this.hiDPIAdjustments(); + if (!this.hasId()) { + this.assignId(); + } + if (this.image != null) { + this.context.drawImage(this.image, 0, 0, this.imageWidth(), this.imageHeight(), 0, 0, this.preScaledWidth, this.preScaledHeight); + } + this.reloadCanvasData(); + if (Caman.allowRevert) { + this.initializedPixelData = Util.dataArray(this.pixelData.length); + this.originalPixelData = Util.dataArray(this.pixelData.length); + _ref = this.pixelData; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + pixel = _ref[i]; + this.initializedPixelData[i] = pixel; + this.originalPixelData[i] = pixel; + } + } + this.dimensions = { + width: this.canvas.width, + height: this.canvas.height + };Store.put(this.id, this);this.callback.call(this, this);return this.callback = function() {}; + }; + Caman.prototype.reloadCanvasData = function() { + this.imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height);return this.pixelData = this.imageData.data; + }; + Caman.prototype.resetOriginalPixelData = function() { + var pixel; + var _i; + var _len; + var _ref; + var _results; + if (!Caman.allowRevert) { + throw "Revert disabled"; + } + this.originalPixelData = Util.dataArray(this.pixelData.length); + _ref = this.pixelData; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + pixel = _ref[_i];_results.push(this.originalPixelData.push(pixel)); + } + return _results; + }; + Caman.prototype.hasId = function() { + return Caman.getAttrId(this.canvas) != null; + }; + Caman.prototype.assignId = function() { + if (Caman.NodeJS || this.canvas.getAttribute('data-caman-id')) { + return; + } + return this.canvas.setAttribute('data-caman-id', this.id); + }; + Caman.prototype.hiDPIDisabled = function() { + return this.canvas.getAttribute('data-caman-hidpi-disabled') !== null; + }; + Caman.prototype.hiDPIAdjustments = function() { + var ratio; + if (Caman.NodeJS || this.hiDPIDisabled()) { + return; + } + ratio = this.hiDPIRatio(); + if (ratio !== 1) { + Log.debug("HiDPI ratio = " + ratio); + this.scaled = true; + this.preScaledWidth = this.canvas.width; + this.preScaledHeight = this.canvas.height; + this.canvas.width = this.preScaledWidth * ratio; + this.canvas.height = this.preScaledHeight * ratio; + this.canvas.style.width = "" + this.preScaledWidth + "px"; + this.canvas.style.height = "" + this.preScaledHeight + "px";this.context.scale(ratio, ratio); + this.width = this.originalWidth = this.canvas.width;return this.height = this.originalHeight = this.canvas.height; + } + }; + Caman.prototype.hiDPIRatio = function() { + var backingStoreRatio; + var devicePixelRatio; + devicePixelRatio = window.devicePixelRatio || 1; + backingStoreRatio = this.context.webkitBackingStorePixelRatio || this.context.mozBackingStorePixelRatio || this.context.msBackingStorePixelRatio || this.context.oBackingStorePixelRatio || this.context.backingStorePixelRatio || 1;return devicePixelRatio / backingStoreRatio; + }; + Caman.prototype.hiDPICapable = function() { + return (window.devicePixelRatio != null) && window.devicePixelRatio !== 1; + }; + Caman.prototype.needsHiDPISwap = function() { + if (this.hiDPIDisabled() || !this.hiDPICapable()) { + return false; + } + return this.hiDPIReplacement() !== null; + }; + Caman.prototype.hiDPIReplacement = function() { + if (this.image == null) { + return null; + } + return this.image.getAttribute('data-caman-hidpi'); + }; + Caman.prototype.replaceCanvas = function(newCanvas) { + var oldCanvas; + oldCanvas = this.canvas; + this.canvas = newCanvas; + this.context = this.canvas.getContext('2d');oldCanvas.parentNode.replaceChild(this.canvas, oldCanvas); + this.width = this.canvas.width; + this.height = this.canvas.height;this.reloadCanvasData();return this.dimensions = { + width: this.canvas.width, + height: this.canvas.height + }; + }; + Caman.prototype.render = function(callback) { + var _this = this; + if (callback == null) { + callback = function() {}; + } + Event.trigger(this, "renderStart");return this.renderer.execute(function() { + _this.context.putImageData(_this.imageData, 0, 0);return callback.call(_this); + }); + }; + Caman.prototype.revert = function() { + var i; + var pixel; + var _i; + var _len; + var _ref; + if (!Caman.allowRevert) { + throw "Revert disabled"; + } + _ref = this.originalVisiblePixels(); + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + pixel = _ref[i]; + this.pixelData[i] = pixel; + } + return this.context.putImageData(this.imageData, 0, 0); + }; + Caman.prototype.reset = function() { + var canvas; + var ctx; + var i; + var imageData; + var pixel; + var pixelData; + var _i; + var _len; + var _ref; + canvas = document.createElement('canvas');Util.copyAttributes(this.canvas, canvas); + canvas.width = this.originalWidth; + canvas.height = this.originalHeight; + ctx = canvas.getContext('2d'); + imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); + pixelData = imageData.data; + _ref = this.initializedPixelData; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + pixel = _ref[i]; + pixelData[i] = pixel; + } + ctx.putImageData(imageData, 0, 0); + this.cropCoordinates = { + x: 0, + y: 0 + }; + this.resized = false;return this.replaceCanvas(canvas); + }; + Caman.prototype.originalVisiblePixels = function() { + var canvas; + var coord; + var ctx; + var endX; + var endY; + var i; + var imageData; + var pixel; + var pixelData; + var pixels; + var scaledCanvas; + var startX; + var startY; + var width; + var _i; + var _j; + var _len; + var _ref; + var _ref1; + var _ref2; + var _ref3; + if (!Caman.allowRevert) { + throw "Revert disabled"; + } + pixels = []; + startX = this.cropCoordinates.x; + endX = startX + this.width; + startY = this.cropCoordinates.y; + endY = startY + this.height; + if (this.resized) { + canvas = document.createElement('canvas'); + canvas.width = this.originalWidth; + canvas.height = this.originalHeight; + ctx = canvas.getContext('2d'); + imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); + pixelData = imageData.data; + _ref = this.originalPixelData; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + pixel = _ref[i]; + pixelData[i] = pixel; + } + ctx.putImageData(imageData, 0, 0); + scaledCanvas = document.createElement('canvas'); + scaledCanvas.width = this.width; + scaledCanvas.height = this.height; + ctx = scaledCanvas.getContext('2d');ctx.drawImage(canvas, 0, 0, this.originalWidth, this.originalHeight, 0, 0, this.width, this.height); + pixelData = ctx.getImageData(0, 0, this.width, this.height).data; + width = this.width; + } else { + pixelData = this.originalPixelData; + width = this.originalWidth; + } + for (i = _j = 0, _ref1 = pixelData.length; _j < _ref1; i = _j += 4) { + coord = PixelInfo.locationToCoordinates(i, width); + if (((startX <= (_ref2 = coord.x) && _ref2 < endX)) && ((startY <= (_ref3 = coord.y) && _ref3 < endY))) { + pixels.push(pixelData[i], pixelData[i + 1], pixelData[i + 2], pixelData[i + 3]); + } + } + return pixels; + }; + Caman.prototype.process = function(name, processFn) { + this.renderer.add({ + type: Filter.Type.Single, + name: name, + processFn: processFn + });return this; + }; + Caman.prototype.processKernel = function(name, adjust, divisor, bias) { + var i; + var _i; + var _ref; + if (!divisor) { + divisor = 0; + for (i = _i = 0, _ref = adjust.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + divisor += adjust[i]; + } + } + this.renderer.add({ + type: Filter.Type.Kernel, + name: name, + adjust: adjust, + divisor: divisor, + bias: bias || 0 + });return this; + }; + Caman.prototype.processPlugin = function(plugin, args) { + this.renderer.add({ + type: Filter.Type.Plugin, + plugin: plugin, + args: args + });return this; + }; + Caman.prototype.newLayer = function(callback) { + var layer; + layer = new Layer(this);this.canvasQueue.push(layer);this.renderer.add({ + type: Filter.Type.LayerDequeue + });callback.call(layer);this.renderer.add({ + type: Filter.Type.LayerFinished + });return this; + }; + Caman.prototype.executeLayer = function(layer) { + return this.pushContext(layer); + }; + Caman.prototype.pushContext = function(layer) { + this.layerStack.push(this.currentLayer);this.pixelStack.push(this.pixelData); + this.currentLayer = layer;return this.pixelData = layer.pixelData; + }; + Caman.prototype.popContext = function() { + this.pixelData = this.pixelStack.pop();return this.currentLayer = this.layerStack.pop(); + }; + Caman.prototype.applyCurrentLayer = function() { + return this.currentLayer.applyToParent(); + };return Caman; + })(); + Analyze = (function() { + function Analyze(c) { + this.c = c; + } + Analyze.prototype.calculateLevels = function() { + var i; + var levels; + var numPixels; + var _i; + var _j; + var _k; + var _ref; + levels = { + r: {}, + g: {}, + b: {} + }; + for (i = _i = 0; _i <= 255; i = ++_i) { + levels.r[i] = 0; + levels.g[i] = 0; + levels.b[i] = 0; + } + for (i = _j = 0, _ref = this.c.pixelData.length; _j < _ref; i = _j += 4) { + levels.r[this.c.pixelData[i]]++;levels.g[this.c.pixelData[i+1]]++;levels.b[this.c.pixelData[i+2]]++; + } + numPixels = this.c.pixelData.length / 4; + for (i = _k = 0; _k <= 255; i = ++_k) { + levels.r[i] /= numPixels; + levels.g[i] /= numPixels; + levels.b[i] /= numPixels; + } + return levels; + };return Analyze; + })(); + Caman.DOMUpdated = function() { + var img; + var imgs; + var parser; + var _i; + var _len; + var _results; + imgs = document.querySelectorAll("img[data-caman]"); + if (!(imgs.length > 0)) { + return; + } + _results = []; + for (_i = 0, _len = imgs.length; _i < _len; _i++) { + img = imgs[_i];_results.push(parser = new CamanParser(img, function() { + this.parse();return this.execute(); + })); + } + return _results; + }; + if (Caman.autoload) { + (function() { + if (document.readyState === "complete") { + return Caman.DOMUpdated(); + } else { + return document.addEventListener("DOMContentLoaded", Caman.DOMUpdated, false); + } + })(); + } + CamanParser = (function() { + var INST_REGEX; + INST_REGEX = "(\\w+)\\((.*?)\\)"; + function CamanParser(ele, ready) { + this.dataStr = ele.getAttribute('data-caman'); + this.caman = Caman(ele, ready.bind(this)); + } + CamanParser.prototype.parse = function() { + var args; + var filter; + var func; + var inst; + var instFunc; + var m; + var r; + var unparsedInstructions; + var _i; + var _len; + var _ref; + var _results; + this.ele = this.caman.canvas; + r = new RegExp(INST_REGEX, 'g'); + unparsedInstructions = this.dataStr.match(r); + if (!(unparsedInstructions.length > 0)) { + return; + } + r = new RegExp(INST_REGEX); + _results = []; + for (_i = 0, _len = unparsedInstructions.length; _i < _len; _i++) { + inst = unparsedInstructions[_i];_ref = inst.match(r), m = _ref[0], filter = _ref[1], args = _ref[2]; + instFunc = new Function("return function() { this." + filter + "(" + args + "); };");try { + func = instFunc();_results.push(func.call(this.caman)); + } catch ( e ) { + _results.push(Log.debug(e)); + } + } + return _results; + }; + CamanParser.prototype.execute = function() { + var ele; + ele = this.ele;return this.caman.render(function() { + return ele.parentNode.replaceChild(this.toImage(), ele); + }); + };return CamanParser; + })(); + Caman.Blender = Blender = (function() { + function Blender() { + } + Blender.blenders = {}; + Blender.register = function(name, func) { + return this.blenders[name] = func; + }; + Blender.execute = function(name, rgbaLayer, rgbaParent) { + return this.blenders[name](rgbaLayer, rgbaParent); + };return Blender; + })(); + Caman.Calculate = Calculate = (function() { + function Calculate() { + } + Calculate.distance = function(x1, y1, x2, y2) { + return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); + }; + Calculate.randomRange = function(min, max, getFloat) { + var rand; + if (getFloat == null) { + getFloat = false; + } + rand = min + (Math.random() * (max - min)); + if (getFloat) { + return rand.toFixed(getFloat); + } else { + return Math.round(rand); + } + }; + Calculate.luminance = function(rgba) { + return (0.299 * rgba.r) + (0.587 * rgba.g) + (0.114 * rgba.b); + }; + Calculate.bezier = function(start, ctrl1, ctrl2, end, lowBound, highBound) { + var Ax; + var Ay; + var Bx; + var By; + var Cx; + var Cy; + var bezier; + var curveX; + var curveY; + var i; + var j; + var leftCoord; + var rightCoord; + var t; + var x0; + var x1; + var x2; + var x3; + var y0; + var y1; + var y2; + var y3; + var _i; + var _j; + var _k; + var _ref; + var _ref1; + x0 = start[0]; + y0 = start[1]; + x1 = ctrl1[0]; + y1 = ctrl1[1]; + x2 = ctrl2[0]; + y2 = ctrl2[1]; + x3 = end[0]; + y3 = end[1]; + bezier = {}; + Cx = parseInt(3 * (x1 - x0), 10); + Bx = 3 * (x2 - x1) - Cx; + Ax = x3 - x0 - Cx - Bx; + Cy = 3 * (y1 - y0); + By = 3 * (y2 - y1) - Cy; + Ay = y3 - y0 - Cy - By; + for (i = _i = 0; _i < 1000; i = ++_i) { + t = i / 1000; + curveX = Math.round((Ax * Math.pow(t, 3)) + (Bx * Math.pow(t, 2)) + (Cx * t) + x0); + curveY = Math.round((Ay * Math.pow(t, 3)) + (By * Math.pow(t, 2)) + (Cy * t) + y0); + if (lowBound && curveY < lowBound) { + curveY = lowBound; + } else if (highBound && curveY > highBound) { + curveY = highBound; + } + bezier[curveX] = curveY; + } + if (bezier.length < end[0] + 1) { + for (i = _j = 0, _ref = end[0]; 0 <= _ref ? _j <= _ref : _j >= _ref; i = 0 <= _ref ? ++_j : --_j) { + if (bezier[i] == null) { + leftCoord = [i - 1, bezier[i - 1]]; + for (j = _k = i, _ref1 = end[0]; i <= _ref1 ? _k <= _ref1 : _k >= _ref1; j = i <= _ref1 ? ++_k : --_k) { + if (bezier[j] != null) { + rightCoord = [j, bezier[j]];break; + } + } + bezier[i] = leftCoord[1] + ((rightCoord[1] - leftCoord[1]) / (rightCoord[0] - leftCoord[0])) * (i - leftCoord[0]); + } + } + } + if (bezier[end[0]] == null) { + bezier[end[0]] = bezier[end[0] - 1]; + } + return bezier; + };return Calculate; + })(); + Convert = (function() { + function Convert() { + } + Convert.hexToRGB = function(hex) { + var b; + var g; + var r; + if (hex.charAt(0) === "#") { + hex = hex.substr(1); + } + r = parseInt(hex.substr(0, 2), 16); + g = parseInt(hex.substr(2, 2), 16); + b = parseInt(hex.substr(4, 2), 16);return { + r: r, + g: g, + b: b + }; + }; + Convert.rgbToHSL = function(r, g, b) { + var d; + var h; + var l; + var max; + var min; + var s; + if (typeof r === "object") { + g = r.g; + b = r.b; + r = r.r; + } + r /= 255; + g /= 255; + b /= 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = (function() { + switch (max) { + case r: + return (g - b) / d + (g < b ? 6 : 0);case g: + return (b - r) / d + 2;case b: + return (r - g) / d + 4; + } + })(); + h /= 6; + } + return { + h: h, + s: s, + l: l + }; + }; + Convert.hslToRGB = function(h, s, l) { + var b; + var g; + var p; + var q; + var r; + if (typeof h === "object") { + s = h.s; + l = h.l; + h = h.h; + } + if (s === 0) { + r = g = b = l; + } else { + q = l < 0.5 ? l * (1 + s) : l + s - l * s; + p = 2 * l - q; + r = this.hueToRGB(p, q, h + 1 / 3); + g = this.hueToRGB(p, q, h); + b = this.hueToRGB(p, q, h - 1 / 3); + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + }; + Convert.hueToRGB = function(p, q, t) { + if (t < 0) { + t += 1; + } + if (t > 1) { + t -= 1; + } + if (t < 1 / 6) { + return p + (q - p) * 6 * t; + } + if (t < 1 / 2) { + return q; + } + if (t < 2 / 3) { + return p + (q - p) * (2 / 3 - t) * 6; + } + return p; + }; + Convert.rgbToHSV = function(r, g, b) { + var d; + var h; + var max; + var min; + var s; + var v; + r /= 255; + g /= 255; + b /= 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + v = max; + d = max - min; + s = max === 0 ? 0 : d / max; + if (max === min) { + h = 0; + } else { + h = (function() { + switch (max) { + case r: + return (g - b) / d + (g < b ? 6 : 0);case g: + return (b - r) / d + 2;case b: + return (r - g) / d + 4; + } + })(); + h /= 6; + } + return { + h: h, + s: s, + v: v + }; + }; + Convert.hsvToRGB = function(h, s, v) { + var b; + var f; + var g; + var i; + var p; + var q; + var r; + var t; + i = Math.floor(h * 6); + f = h * 6 - i; + p = v * (1 - s); + q = v * (1 - f * s); + t = v * (1 - (1 - f) * s);switch (i % 6) { + case 0: + r = v;g = t;b = p; + break;case 1: + r = q;g = v;b = p; + break;case 2: + r = p;g = v;b = t; + break;case 3: + r = p;g = q;b = v; + break;case 4: + r = t;g = p;b = v; + break;case 5: + r = v;g = p;b = q; + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + }; + Convert.rgbToXYZ = function(r, g, b) { + var x; + var y; + var z; + r /= 255; + g /= 255; + b /= 255; + if (r > 0.04045) { + r = Math.pow((r + 0.055) / 1.055, 2.4); + } else { + r /= 12.92; + } + if (g > 0.04045) { + g = Math.pow((g + 0.055) / 1.055, 2.4); + } else { + g /= 12.92; + } + if (b > 0.04045) { + b = Math.pow((b + 0.055) / 1.055, 2.4); + } else { + b /= 12.92; + } + x = r * 0.4124 + g * 0.3576 + b * 0.1805; + y = r * 0.2126 + g * 0.7152 + b * 0.0722; + z = r * 0.0193 + g * 0.1192 + b * 0.9505;return { + x: x * 100, + y: y * 100, + z: z * 100 + }; + }; + Convert.xyzToRGB = function(x, y, z) { + var b; + var g; + var r; + x /= 100; + y /= 100; + z /= 100; + r = (3.2406 * x) + (-1.5372 * y) + (-0.4986 * z); + g = (-0.9689 * x) + (1.8758 * y) + (0.0415 * z); + b = (0.0557 * x) + (-0.2040 * y) + (1.0570 * z); + if (r > 0.0031308) { + r = (1.055 * Math.pow(r, 0.4166666667)) - 0.055; + } else { + r *= 12.92; + } + if (g > 0.0031308) { + g = (1.055 * Math.pow(g, 0.4166666667)) - 0.055; + } else { + g *= 12.92; + } + if (b > 0.0031308) { + b = (1.055 * Math.pow(b, 0.4166666667)) - 0.055; + } else { + b *= 12.92; + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + }; + Convert.xyzToLab = function(x, y, z) { + var a; + var b; + var l; + var whiteX; + var whiteY; + var whiteZ; + if (typeof x === "object") { + y = x.y; + z = x.z; + x = x.x; + } + whiteX = 95.047; + whiteY = 100.0; + whiteZ = 108.883; + x /= whiteX; + y /= whiteY; + z /= whiteZ; + if (x > 0.008856451679) { + x = Math.pow(x, 0.3333333333); + } else { + x = (7.787037037 * x) + 0.1379310345; + } + if (y > 0.008856451679) { + y = Math.pow(y, 0.3333333333); + } else { + y = (7.787037037 * y) + 0.1379310345; + } + if (z > 0.008856451679) { + z = Math.pow(z, 0.3333333333); + } else { + z = (7.787037037 * z) + 0.1379310345; + } + l = 116 * y - 16; + a = 500 * (x - y); + b = 200 * (y - z);return { + l: l, + a: a, + b: b + }; + }; + Convert.labToXYZ = function(l, a, b) { + var x; + var y; + var z; + if (typeof l === "object") { + a = l.a; + b = l.b; + l = l.l; + } + y = (l + 16) / 116; + x = y + (a / 500); + z = y - (b / 200); + if (x > 0.2068965517) { + x = x * x * x; + } else { + x = 0.1284185493 * (x - 0.1379310345); + } + if (y > 0.2068965517) { + y = y * y * y; + } else { + y = 0.1284185493 * (y - 0.1379310345); + } + if (z > 0.2068965517) { + z = z * z * z; + } else { + z = 0.1284185493 * (z - 0.1379310345); + } + return { + x: x * 95.047, + y: y * 100.0, + z: z * 108.883 + }; + }; + Convert.rgbToLab = function(r, g, b) { + var xyz; + if (typeof r === "object") { + g = r.g; + b = r.b; + r = r.r; + } + xyz = this.rgbToXYZ(r, g, b);return this.xyzToLab(xyz); + }; + Convert.labToRGB = function(l, a, b) {};return Convert; + })(); + Event = (function() { + function Event() { + } + Event.events = {}; + Event.types = ["processStart", "processComplete", "renderStart", "renderFinished", "blockStarted", "blockFinished"]; + Event.trigger = function(target, type, data) { + var event; + var _i; + var _len; + var _ref; + var _results; + if (this.events[type] && this.events[type].length) { + _ref = this.events[type]; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + event = _ref[_i]; + if (event.target === null || target.id === event.target.id) { + _results.push(event.fn.call(target, data)); + } else { + _results.push(void 0); + } + } + return _results; + } + }; + Event.listen = function(target, type, fn) { + var _fn; + var _type; + if (typeof target === "string") { + _type = target; + _fn = type; + target = null; + type = _type; + fn = _fn; + } + if (__indexOf.call(this.types, type) < 0) { + return false; + } + if (!this.events[type]) { + this.events[type] = []; + } + this.events[type].push({ + target: target, + fn: fn + });return true; + };return Event; + })(); + Caman.Event = Event; + Caman.Filter = Filter = (function() { + function Filter() { + } + Filter.Type = { + Single: 1, + Kernel: 2, + LayerDequeue: 3, + LayerFinished: 4, + LoadOverlay: 5, + Plugin: 6 + }; + Filter.register = function(name, filterFunc) { + return Caman.prototype[name] = filterFunc; + };return Filter; + })(); + Caman.IO = IO = (function() { + function IO() { + } + IO.domainRegex = /(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/; + IO.isRemote = function(img) { + if (img == null) { + return false; + } + if (this.corsEnabled(img)) { + return false; + } + return this.isURLRemote(img.src); + }; + IO.corsEnabled = function(img) { + var _ref; + return (img.crossOrigin != null) && ((_ref = img.crossOrigin.toLowerCase()) === 'anonymous' || _ref === 'use-credentials'); + }; + IO.isURLRemote = function(url) { + var matches; + matches = url.match(this.domainRegex); + if (matches) { + return matches[1] !== document.domain; + } else { + return false; + } + }; + IO.remoteCheck = function(src) { + if (this.isURLRemote(src)) { + if (!Caman.remoteProxy.length) { + Log.info("Attempting to load a remote image without a configured proxy. URL: " + src); + } else { + if (Caman.isURLRemote(Caman.remoteProxy)) { + Log.info("Cannot use a remote proxy for loading images.");return; + } + return "" + Caman.remoteProxy + "?camanProxyUrl=" + (encodeURIComponent(src)); + } + } + }; + IO.proxyUrl = function(src) { + return "" + Caman.remoteProxy + "?" + Caman.proxyParam + "=" + (encodeURIComponent(src)); + }; + IO.useProxy = function(lang) { + var langToExt; + langToExt = { + ruby: 'rb', + python: 'py', + perl: 'pl', + javascript: 'js' + }; + lang = lang.toLowerCase(); + if (langToExt[lang] != null) { + lang = langToExt[lang]; + } + return "proxies/caman_proxy." + lang; + };return IO; + })(); + Caman.prototype.save = function() { + if (typeof exports !== "undefined" && exports !== null) { + return this.nodeSave.apply(this, arguments); + } else { + return this.browserSave.apply(this, arguments); + } + }; + Caman.prototype.browserSave = function(type) { + var image; + if (type == null) { + type = "png"; + } + type = type.toLowerCase(); + image = this.toBase64(type).replace("image/" + type, "image/octet-stream");return document.location.href = image; + }; + Caman.prototype.nodeSave = function(file, overwrite) { + var stats; + if (overwrite == null) { + overwrite = true; + } + try { + stats = fs.statSync(file); + if (stats.isFile() && !overwrite) { + return false; + } + } catch ( e ) { + Log.debug("Creating output file " + file); + } + return fs.writeFile(file, this.canvas.toBuffer(), function() { + return Log.debug("Finished writing to " + file); + }); + }; + Caman.prototype.toImage = function(type) { + var img; + img = document.createElement('img'); + img.src = this.toBase64(type); + img.width = this.dimensions.width; + img.height = this.dimensions.height; + if (window.devicePixelRatio) { + img.width /= window.devicePixelRatio; + img.height /= window.devicePixelRatio; + } + return img; + }; + Caman.prototype.toBase64 = function(type) { + if (type == null) { + type = "png"; + } + type = type.toLowerCase();return this.canvas.toDataURL("image/" + type); + }; + Layer = (function() { + function Layer(c) { + this.c = c; + this.filter = this.c; + this.options = { + blendingMode: 'normal', + opacity: 1.0 + }; + this.layerID = Util.uniqid.get(); + this.canvas = typeof exports !== "undefined" && exports !== null ? new Canvas() : document.createElement('canvas'); + this.canvas.width = this.c.dimensions.width; + this.canvas.height = this.c.dimensions.height; + this.context = this.canvas.getContext('2d');this.context.createImageData(this.canvas.width, this.canvas.height); + this.imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height); + this.pixelData = this.imageData.data; + } + Layer.prototype.newLayer = function(cb) { + return this.c.newLayer.call(this.c, cb); + }; + Layer.prototype.setBlendingMode = function(mode) { + this.options.blendingMode = mode;return this; + }; + Layer.prototype.opacity = function(opacity) { + this.options.opacity = opacity / 100;return this; + }; + Layer.prototype.copyParent = function() { + var i; + var parentData; + var _i; + var _ref; + parentData = this.c.pixelData; + for (i = _i = 0, _ref = this.c.pixelData.length; _i < _ref; i = _i += 4) { + this.pixelData[i] = parentData[i]; + this.pixelData[i + 1] = parentData[i + 1]; + this.pixelData[i + 2] = parentData[i + 2]; + this.pixelData[i + 3] = parentData[i + 3]; + } + return this; + }; + Layer.prototype.fillColor = function() { + return this.c.fillColor.apply(this.c, arguments); + }; + Layer.prototype.overlayImage = function(image) { + if (typeof image === "object") { + image = image.src; + } else if (typeof image === "string" && image[0] === "#") { + image = $(image).src; + } + if (!image) { + return this; + } + this.c.renderer.renderQueue.push({ + type: Filter.Type.LoadOverlay, + src: image, + layer: this + });return this; + }; + Layer.prototype.applyToParent = function() { + var i; + var layerData; + var parentData; + var result; + var rgbaLayer; + var rgbaParent; + var _i; + var _ref; + var _results; + parentData = this.c.pixelStack[this.c.pixelStack.length - 1]; + layerData = this.c.pixelData; + _results = []; + for (i = _i = 0, _ref = layerData.length; _i < _ref; i = _i += 4) { + rgbaParent = { + r: parentData[i], + g: parentData[i + 1], + b: parentData[i + 2], + a: parentData[i + 3] + }; + rgbaLayer = { + r: layerData[i], + g: layerData[i + 1], + b: layerData[i + 2], + a: layerData[i + 3] + }; + result = Blender.execute(this.options.blendingMode, rgbaLayer, rgbaParent); + result.r = Util.clampRGB(result.r); + result.g = Util.clampRGB(result.g); + result.b = Util.clampRGB(result.b); + if (result.a == null) { + result.a = rgbaLayer.a; + } + parentData[i] = rgbaParent.r - ((rgbaParent.r - result.r) * (this.options.opacity * (result.a / 255))); + parentData[i + 1] = rgbaParent.g - ((rgbaParent.g - result.g) * (this.options.opacity * (result.a / 255)));_results.push(parentData[i + 2] = rgbaParent.b - ((rgbaParent.b - result.b) * (this.options.opacity * (result.a / 255)))); + } + return _results; + };return Layer; + })(); + Logger = (function() { + function Logger() { + var name; + var _i; + var _len; + var _ref; + _ref = ['log', 'info', 'warn', 'error']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + name = _ref[_i]; + this[name] = (function(name) { + return function() { + var args; + args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + if (!Caman.DEBUG) { + return; + } + try { + return console[name].apply(console, args); + } catch ( e ) { + return console[name](args); + } + }; + })(name); + } + this.debug = this.log; + } + return Logger; + })(); + Log = new Logger(); + PixelInfo = (function() { + PixelInfo.coordinatesToLocation = function(x, y, width) { + return (y * width + x) * 4; + }; + PixelInfo.locationToCoordinates = function(loc, width) { + var x; + var y; + y = Math.floor(loc / (width * 4)); + x = (loc % (width * 4)) / 4;return { + x: x, + y: y + }; + }; + function PixelInfo(c) { + this.c = c; + this.loc = 0; + } + PixelInfo.prototype.locationXY = function() { + var x; + var y; + y = this.c.dimensions.height - Math.floor(this.loc / (this.c.dimensions.width * 4)); + x = (this.loc % (this.c.dimensions.width * 4)) / 4;return { + x: x, + y: y + }; + }; + PixelInfo.prototype.getPixelRelative = function(horiz, vert) { + var newLoc; + newLoc = this.loc + (this.c.dimensions.width * 4 * (vert * -1)) + (4 * horiz); + if (newLoc > this.c.pixelData.length || newLoc < 0) { + return { + r: 0, + g: 0, + b: 0, + a: 0 + }; + } + return { + r: this.c.pixelData[newLoc], + g: this.c.pixelData[newLoc + 1], + b: this.c.pixelData[newLoc + 2], + a: this.c.pixelData[newLoc + 3] + }; + }; + PixelInfo.prototype.putPixelRelative = function(horiz, vert, rgba) { + var nowLoc; + nowLoc = this.loc + (this.c.dimensions.width * 4 * (vert * -1)) + (4 * horiz); + if (newLoc > this.c.pixelData.length || newLoc < 0) { + return; + } + this.c.pixelData[newLoc] = rgba.r; + this.c.pixelData[newLoc + 1] = rgba.g; + this.c.pixelData[newLoc + 2] = rgba.b; + this.c.pixelData[newLoc + 3] = rgba.a;return true; + }; + PixelInfo.prototype.getPixel = function(x, y) { + var loc; + loc = this.coordinatesToLocation(x, y, this.width);return { + r: this.c.pixelData[loc], + g: this.c.pixelData[loc + 1], + b: this.c.pixelData[loc + 2], + a: this.c.pixelData[loc + 3] + }; + }; + PixelInfo.prototype.putPixel = function(x, y, rgba) { + var loc; + loc = this.coordinatesToLocation(x, y, this.width); + this.c.pixelData[loc] = rgba.r; + this.c.pixelData[loc + 1] = rgba.g; + this.c.pixelData[loc + 2] = rgba.b;return this.c.pixelData[loc + 3] = rgba.a; + };return PixelInfo; + })(); + Plugin = (function() { + function Plugin() { + } + Plugin.plugins = {}; + Plugin.register = function(name, plugin) { + return this.plugins[name] = plugin; + }; + Plugin.execute = function(context, name, args) { + return this.plugins[name].apply(context, args); + };return Plugin; + })(); + Caman.Plugin = Plugin; + Caman.Renderer = Renderer = (function() { + Renderer.Blocks = Caman.NodeJS ? require('os').cpus().length : 4; + function Renderer(c) { + var _this = this; + this.c = c; + this.processNext = function() { + return Renderer.prototype.processNext.apply(_this, arguments); + }; + this.renderQueue = []; + this.modPixelData = null; + } + Renderer.prototype.add = function(job) { + if (job == null) { + return; + } + return this.renderQueue.push(job); + }; + Renderer.prototype.processNext = function() { + var layer; + if (this.renderQueue.length === 0) { + Event.trigger(this, "renderFinished"); + if (this.finishedFn != null) { + this.finishedFn.call(this.c); + } + return this; + } + this.currentJob = this.renderQueue.shift();switch (this.currentJob.type) { + case Filter.Type.LayerDequeue: + layer = this.c.canvasQueue.shift();this.c.executeLayer(layer);return this.processNext();case Filter.Type.LayerFinished: + this.c.applyCurrentLayer();this.c.popContext();return this.processNext();case Filter.Type.LoadOverlay: + return this.loadOverlay(this.currentJob.layer, this.currentJob.src);case Filter.Type.Plugin: + return this.executePlugin();default: + return this.executeFilter(); + } + }; + Renderer.prototype.execute = function(callback) { + this.finishedFn = callback; + this.modPixelData = Util.dataArray(this.c.pixelData.length);return this.processNext(); + }; + Renderer.prototype.eachBlock = function(fn) { + var blockN; + var blockPixelLength; + var bnum; + var end; + var f; + var i; + var lastBlockN; + var n; + var start; + var _i; + var _ref; + var _results; + var _this = this; + this.blocksDone = 0; + n = this.c.pixelData.length; + blockPixelLength = Math.floor((n / 4) / Renderer.Blocks); + blockN = blockPixelLength * 4; + lastBlockN = blockN + ((n / 4) % Renderer.Blocks) * 4; + _results = []; + for (i = _i = 0, _ref = Renderer.Blocks; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + start = i * blockN; + end = start + (i === Renderer.Blocks - 1 ? lastBlockN : blockN); + if (Caman.NodeJS) { + f = Fiber(function() { + return fn.call(_this, i, start, end); + }); + bnum = f.run();_results.push(this.blockFinished(bnum)); + } else { + _results.push(setTimeout((function(i, start, end) { + return function() { + return fn.call(_this, i, start, end); + }; + })(i, start, end), 0)); + } + } + return _results; + }; + Renderer.prototype.executeFilter = function() { + Event.trigger(this.c, "processStart", this.currentJob); + if (this.currentJob.type === Filter.Type.Single) { + return this.eachBlock(this.renderBlock); + } else { + return this.eachBlock(this.renderKernel); + } + }; + Renderer.prototype.executePlugin = function() { + Log.debug("Executing plugin " + this.currentJob.plugin);Plugin.execute(this.c, this.currentJob.plugin, this.currentJob.args);Log.debug("Plugin " + this.currentJob.plugin + " finished!");return this.processNext(); + }; + Renderer.prototype.renderBlock = function(bnum, start, end) { + var data; + var i; + var pixelInfo; + var res; + var _i; + Log.debug("Block #" + bnum + " - Filter: " + this.currentJob.name + ", Start: " + start + ", End: " + end);Event.trigger(this.c, "blockStarted", { + blockNum: bnum, + totalBlocks: Renderer.Blocks, + startPixel: start, + endPixel: end + }); + data = { + r: 0, + g: 0, + b: 0, + a: 0 + }; + pixelInfo = new PixelInfo(this.c); + for (i = _i = start; _i < end; i = _i += 4) { + pixelInfo.loc = i; + data.r = this.c.pixelData[i]; + data.g = this.c.pixelData[i + 1]; + data.b = this.c.pixelData[i + 2]; + data.a = this.c.pixelData[i + 3]; + res = this.currentJob.processFn.call(pixelInfo, data); + if (res.a == null) { + res.a = data.a; + } + this.c.pixelData[i] = Util.clampRGB(res.r); + this.c.pixelData[i + 1] = Util.clampRGB(res.g); + this.c.pixelData[i + 2] = Util.clampRGB(res.b); + this.c.pixelData[i + 3] = Util.clampRGB(res.a); + } + if (Caman.NodeJS) { + return Fiber["yield"](bnum); + } else { + return this.blockFinished(bnum); + } + }; + Renderer.prototype.renderKernel = function(bnum, start, end) { + var adjust; + var adjustSize; + var bias; + var builder; + var builderIndex; + var divisor; + var i; + var j; + var k; + var kernel; + var n; + var name; + var pixel; + var pixelInfo; + var res; + var _i; + var _j; + var _k; + name = this.currentJob.name; + bias = this.currentJob.bias; + divisor = this.currentJob.divisor; + n = this.c.pixelData.length; + adjust = this.currentJob.adjust; + adjustSize = Math.sqrt(adjust.length); + kernel = [];Log.debug("Rendering kernel - Filter: " + this.currentJob.name); + start = Math.max(start, this.c.dimensions.width * 4 * ((adjustSize - 1) / 2)); + end = Math.min(end, n - (this.c.dimensions.width * 4 * ((adjustSize - 1) / 2))); + builder = (adjustSize - 1) / 2; + pixelInfo = new PixelInfo(this.c); + for (i = _i = start; _i < end; i = _i += 4) { + pixelInfo.loc = i; + builderIndex = 0; + for (j = _j = -builder; -builder <= builder ? _j <= builder : _j >= builder; j = -builder <= builder ? ++_j : --_j) { + for (k = _k = builder; builder <= -builder ? _k <= -builder : _k >= -builder; k = builder <= -builder ? ++_k : --_k) { + pixel = pixelInfo.getPixelRelative(j, k); + kernel[builderIndex * 3] = pixel.r; + kernel[builderIndex * 3 + 1] = pixel.g; + kernel[builderIndex * 3 + 2] = pixel.b;builderIndex++; + } + } + res = this.processKernel(adjust, kernel, divisor, bias); + this.modPixelData[i] = Util.clampRGB(res.r); + this.modPixelData[i + 1] = Util.clampRGB(res.g); + this.modPixelData[i + 2] = Util.clampRGB(res.b); + this.modPixelData[i + 3] = this.c.pixelData[i + 3]; + } + if (Caman.NodeJS) { + return Fiber["yield"](bnum); + } else { + return this.blockFinished(bnum); + } + }; + Renderer.prototype.blockFinished = function(bnum) { + var i; + var _i; + var _ref; + if (bnum >= 0) { + Log.debug("Block #" + bnum + " finished! Filter: " + this.currentJob.name); + } + this.blocksDone++;Event.trigger(this.c, "blockFinished", { + blockNum: bnum, + blocksFinished: this.blocksDone, + totalBlocks: Renderer.Blocks + }); + if (this.blocksDone === Renderer.Blocks) { + if (this.currentJob.type === Filter.Type.Kernel) { + for (i = _i = 0, _ref = this.c.pixelData.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + this.c.pixelData[i] = this.modPixelData[i]; + } + } + if (bnum >= 0) { + Log.debug("Filter " + this.currentJob.name + " finished!"); + } + Event.trigger(this.c, "processComplete", this.currentJob);return this.processNext(); + } + }; + Renderer.prototype.processKernel = function(adjust, kernel, divisor, bias) { + var i; + var val; + var _i; + var _ref; + val = { + r: 0, + g: 0, + b: 0 + }; + for (i = _i = 0, _ref = adjust.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + val.r += adjust[i] * kernel[i * 3]; + val.g += adjust[i] * kernel[i * 3 + 1]; + val.b += adjust[i] * kernel[i * 3 + 2]; + } + val.r = (val.r / divisor) + bias; + val.g = (val.g / divisor) + bias; + val.b = (val.b / divisor) + bias;return val; + }; + Renderer.prototype.loadOverlay = function(layer, src) { + var img; + var proxyUrl; + var _this = this; + img = document.createElement('img'); + img.onload = function() { + layer.context.drawImage(img, 0, 0, _this.c.dimensions.width, _this.c.dimensions.height); + layer.imageData = layer.context.getImageData(0, 0, _this.c.dimensions.width, _this.c.dimensions.height); + layer.pixelData = layer.imageData.data; + _this.c.pixelData = layer.pixelData;return _this.processNext(); + }; + proxyUrl = IO.remoteCheck(src);return img.src = proxyUrl != null ? proxyUrl : src; + };return Renderer; + })(); + Caman.Store = Store = (function() { + function Store() { + } + Store.items = {}; + Store.has = function(search) { + return this.items[search] != null; + }; + Store.get = function(search) { + return this.items[search]; + }; + Store.put = function(name, obj) { + return this.items[name] = obj; + }; + Store.execute = function(search, callback) { + var _this = this; + setTimeout(function() { + return callback.call(_this.get(search), _this.get(search)); + }, 0);return this.get(search); + }; + Store.flush = function(name) { + if (name == null) { + name = false; + } + if (name) { + return delete this.items[name]; + } else { + return this.items = {}; + } + };return Store; + })();Blender.register("normal", function(rgbaLayer, rgbaParent) { + return { + r: rgbaLayer.r, + g: rgbaLayer.g, + b: rgbaLayer.b + }; + });Blender.register("multiply", function(rgbaLayer, rgbaParent) { + return { + r: (rgbaLayer.r * rgbaParent.r) / 255, + g: (rgbaLayer.g * rgbaParent.g) / 255, + b: (rgbaLayer.b * rgbaParent.b) / 255 + }; + });Blender.register("screen", function(rgbaLayer, rgbaParent) { + return { + r: 255 - (((255 - rgbaLayer.r) * (255 - rgbaParent.r)) / 255), + g: 255 - (((255 - rgbaLayer.g) * (255 - rgbaParent.g)) / 255), + b: 255 - (((255 - rgbaLayer.b) * (255 - rgbaParent.b)) / 255) + }; + });Blender.register("overlay", function(rgbaLayer, rgbaParent) { + var result; + result = {}; + result.r = rgbaParent.r > 128 ? 255 - 2 * (255 - rgbaLayer.r) * (255 - rgbaParent.r) / 255 : (rgbaParent.r * rgbaLayer.r * 2) / 255; + result.g = rgbaParent.g > 128 ? 255 - 2 * (255 - rgbaLayer.g) * (255 - rgbaParent.g) / 255 : (rgbaParent.g * rgbaLayer.g * 2) / 255; + result.b = rgbaParent.b > 128 ? 255 - 2 * (255 - rgbaLayer.b) * (255 - rgbaParent.b) / 255 : (rgbaParent.b * rgbaLayer.b * 2) / 255;return result; + });Blender.register("difference", function(rgbaLayer, rgbaParent) { + return { + r: rgbaLayer.r - rgbaParent.r, + g: rgbaLayer.g - rgbaParent.g, + b: rgbaLayer.b - rgbaParent.b + }; + });Blender.register("addition", function(rgbaLayer, rgbaParent) { + return { + r: rgbaParent.r + rgbaLayer.r, + g: rgbaParent.g + rgbaLayer.g, + b: rgbaParent.b + rgbaLayer.b + }; + });Blender.register("exclusion", function(rgbaLayer, rgbaParent) { + return { + r: 128 - 2 * (rgbaParent.r - 128) * (rgbaLayer.r - 128) / 255, + g: 128 - 2 * (rgbaParent.g - 128) * (rgbaLayer.g - 128) / 255, + b: 128 - 2 * (rgbaParent.b - 128) * (rgbaLayer.b - 128) / 255 + }; + });Blender.register("softLight", function(rgbaLayer, rgbaParent) { + var result; + result = {}; + result.r = rgbaParent.r > 128 ? 255 - ((255 - rgbaParent.r) * (255 - (rgbaLayer.r - 128))) / 255 : (rgbaParent.r * (rgbaLayer.r + 128)) / 255; + result.g = rgbaParent.g > 128 ? 255 - ((255 - rgbaParent.g) * (255 - (rgbaLayer.g - 128))) / 255 : (rgbaParent.g * (rgbaLayer.g + 128)) / 255; + result.b = rgbaParent.b > 128 ? 255 - ((255 - rgbaParent.b) * (255 - (rgbaLayer.b - 128))) / 255 : (rgbaParent.b * (rgbaLayer.b + 128)) / 255;return result; + });Blender.register("lighten", function(rgbaLayer, rgbaParent) { + return { + r: rgbaParent.r > rgbaLayer.r ? rgbaParent.r : rgbaLayer.r, + g: rgbaParent.g > rgbaLayer.g ? rgbaParent.g : rgbaLayer.g, + b: rgbaParent.b > rgbaLayer.b ? rgbaParent.b : rgbaLayer.b + }; + });Blender.register("darken", function(rgbaLayer, rgbaParent) { + return { + r: rgbaParent.r > rgbaLayer.r ? rgbaLayer.r : rgbaParent.r, + g: rgbaParent.g > rgbaLayer.g ? rgbaLayer.g : rgbaParent.g, + b: rgbaParent.b > rgbaLayer.b ? rgbaLayer.b : rgbaParent.b + }; + });Filter.register("fillColor", function() { + var color; + if (arguments.length === 1) { + color = Convert.hexToRGB(arguments[0]); + } else { + color = { + r: arguments[0], + g: arguments[1], + b: arguments[2] + }; + } + return this.process("fillColor", function(rgba) { + rgba.r = color.r; + rgba.g = color.g; + rgba.b = color.b; + rgba.a = 255;return rgba; + }); + });Filter.register("brightness", function(adjust) { + adjust = Math.floor(255 * (adjust / 100));return this.process("brightness", function(rgba) { + rgba.r += adjust; + rgba.g += adjust; + rgba.b += adjust;return rgba; + }); + });Filter.register("saturation", function(adjust) { + adjust *= -0.01;return this.process("saturation", function(rgba) { + var max; + max = Math.max(rgba.r, rgba.g, rgba.b); + if (rgba.r !== max) { + rgba.r += (max - rgba.r) * adjust; + } + if (rgba.g !== max) { + rgba.g += (max - rgba.g) * adjust; + } + if (rgba.b !== max) { + rgba.b += (max - rgba.b) * adjust; + } + return rgba; + }); + });Filter.register("vibrance", function(adjust) { + adjust *= -1;return this.process("vibrance", function(rgba) { + var amt; + var avg; + var max; + max = Math.max(rgba.r, rgba.g, rgba.b); + avg = (rgba.r + rgba.g + rgba.b) / 3; + amt = ((Math.abs(max - avg) * 2 / 255) * adjust) / 100; + if (rgba.r !== max) { + rgba.r += (max - rgba.r) * amt; + } + if (rgba.g !== max) { + rgba.g += (max - rgba.g) * amt; + } + if (rgba.b !== max) { + rgba.b += (max - rgba.b) * amt; + } + return rgba; + }); + });Filter.register("greyscale", function(adjust) { + return this.process("greyscale", function(rgba) { + var avg; + avg = Calculate.luminance(rgba); + rgba.r = avg; + rgba.g = avg; + rgba.b = avg;return rgba; + }); + });Filter.register("contrast", function(adjust) { + adjust = Math.pow((adjust + 100) / 100, 2);return this.process("contrast", function(rgba) { + rgba.r /= 255; + rgba.r -= 0.5; + rgba.r *= adjust; + rgba.r += 0.5; + rgba.r *= 255; + rgba.g /= 255; + rgba.g -= 0.5; + rgba.g *= adjust; + rgba.g += 0.5; + rgba.g *= 255; + rgba.b /= 255; + rgba.b -= 0.5; + rgba.b *= adjust; + rgba.b += 0.5; + rgba.b *= 255;return rgba; + }); + });Filter.register("hue", function(adjust) { + return this.process("hue", function(rgba) { + var h; + var hsv; + var rgb; + hsv = Convert.rgbToHSV(rgba.r, rgba.g, rgba.b); + h = hsv.h * 100; + h += Math.abs(adjust); + h = h % 100; + h /= 100; + hsv.h = h; + rgb = Convert.hsvToRGB(hsv.h, hsv.s, hsv.v); + rgb.a = rgba.a;return rgb; + }); + });Filter.register("colorize", function() { + var level; + var rgb; + if (arguments.length === 2) { + rgb = Convert.hexToRGB(arguments[0]); + level = arguments[1]; + } else if (arguments.length === 4) { + rgb = { + r: arguments[0], + g: arguments[1], + b: arguments[2] + }; + level = arguments[3]; + } + return this.process("colorize", function(rgba) { + rgba.r -= (rgba.r - rgb.r) * (level / 100); + rgba.g -= (rgba.g - rgb.g) * (level / 100); + rgba.b -= (rgba.b - rgb.b) * (level / 100);return rgba; + }); + });Filter.register("invert", function() { + return this.process("invert", function(rgba) { + rgba.r = 255 - rgba.r; + rgba.g = 255 - rgba.g; + rgba.b = 255 - rgba.b;return rgba; + }); + });Filter.register("sepia", function(adjust) { + if (adjust == null) { + adjust = 100; + } + adjust /= 100;return this.process("sepia", function(rgba) { + rgba.r = Math.min(255, (rgba.r * (1 - (0.607 * adjust))) + (rgba.g * (0.769 * adjust)) + (rgba.b * (0.189 * adjust))); + rgba.g = Math.min(255, (rgba.r * (0.349 * adjust)) + (rgba.g * (1 - (0.314 * adjust))) + (rgba.b * (0.168 * adjust))); + rgba.b = Math.min(255, (rgba.r * (0.272 * adjust)) + (rgba.g * (0.534 * adjust)) + (rgba.b * (1 - (0.869 * adjust))));return rgba; + }); + });Filter.register("gamma", function(adjust) { + return this.process("gamma", function(rgba) { + rgba.r = Math.pow(rgba.r / 255, adjust) * 255; + rgba.g = Math.pow(rgba.g / 255, adjust) * 255; + rgba.b = Math.pow(rgba.b / 255, adjust) * 255;return rgba; + }); + });Filter.register("noise", function(adjust) { + adjust = Math.abs(adjust) * 2.55;return this.process("noise", function(rgba) { + var rand; + rand = Calculate.randomRange(adjust * -1, adjust); + rgba.r += rand; + rgba.g += rand; + rgba.b += rand;return rgba; + }); + });Filter.register("clip", function(adjust) { + adjust = Math.abs(adjust) * 2.55;return this.process("clip", function(rgba) { + if (rgba.r > 255 - adjust) { + rgba.r = 255; + } else if (rgba.r < adjust) { + rgba.r = 0; + } + if (rgba.g > 255 - adjust) { + rgba.g = 255; + } else if (rgba.g < adjust) { + rgba.g = 0; + } + if (rgba.b > 255 - adjust) { + rgba.b = 255; + } else if (rgba.b < adjust) { + rgba.b = 0; + } + return rgba; + }); + });Filter.register("channels", function(options) { + var chan; + var value; + if (typeof options !== "object") { + return this; + } + for (chan in options) { + if (!__hasProp.call(options, chan)) { + continue; + } + value = options[chan]; + if (value === 0) { + delete options[chan]; + continue; + } + options[chan] /= 100; + } + if (options.length === 0) { + return this; + } + return this.process("channels", function(rgba) { + if (options.red != null) { + if (options.red > 0) { + rgba.r += (255 - rgba.r) * options.red; + } else { + rgba.r -= rgba.r * Math.abs(options.red); + } + } + if (options.green != null) { + if (options.green > 0) { + rgba.g += (255 - rgba.g) * options.green; + } else { + rgba.g -= rgba.g * Math.abs(options.green); + } + } + if (options.blue != null) { + if (options.blue > 0) { + rgba.b += (255 - rgba.b) * options.blue; + } else { + rgba.b -= rgba.b * Math.abs(options.blue); + } + } + return rgba; + }); + });Filter.register("curves", function() { + var bezier; + var chans; + var cps; + var ctrl1; + var ctrl2; + var end; + var i; + var start; + var _i; + var _j; + var _ref; + var _ref1; + chans = arguments[0], cps = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if (typeof chans === "string") { + chans = chans.split(""); + } + if (chans[0] === "v") { + chans = ['r', 'g', 'b']; + } + if (cps.length < 3 || cps.length > 4) { + throw "Invalid number of arguments to curves filter"; + } + start = cps[0]; + ctrl1 = cps[1]; + ctrl2 = cps.length === 4 ? cps[2] : cps[1]; + end = cps[cps.length - 1]; + bezier = Calculate.bezier(start, ctrl1, ctrl2, end, 0, 255); + if (start[0] > 0) { + for (i = _i = 0, _ref = start[0]; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + bezier[i] = start[1]; + } + } + if (end[0] < 255) { + for (i = _j = _ref1 = end[0]; _ref1 <= 255 ? _j <= 255 : _j >= 255; i = _ref1 <= 255 ? ++_j : --_j) { + bezier[i] = end[1]; + } + } + return this.process("curves", function(rgba) { + var _k; + var _ref2; + for (i = _k = 0, _ref2 = chans.length; 0 <= _ref2 ? _k < _ref2 : _k > _ref2; i = 0 <= _ref2 ? ++_k : --_k) { + rgba[chans[i]] = bezier[rgba[chans[i]]]; + } + return rgba; + }); + });Filter.register("exposure", function(adjust) { + var ctrl1; + var ctrl2; + var p; + p = Math.abs(adjust) / 100; + ctrl1 = [0, 255 * p]; + ctrl2 = [255 - (255 * p), 255]; + if (adjust < 0) { + ctrl1 = ctrl1.reverse(); + ctrl2 = ctrl2.reverse(); + } + return this.curves('rgb', [0, 0], ctrl1, ctrl2, [255, 255]); + });Caman.Plugin.register("crop", function(width, height, x, y) { + var canvas; + var ctx; + if (x == null) { + x = 0; + } + if (y == null) { + y = 0; + } + if (typeof exports !== "undefined" && exports !== null) { + canvas = new Canvas(width, height); + } else { + canvas = document.createElement('canvas');Util.copyAttributes(this.canvas, canvas); + canvas.width = width; + canvas.height = height; + } + ctx = canvas.getContext('2d');ctx.drawImage(this.canvas, x, y, width, height, 0, 0, width, height); + this.cropCoordinates = { + x: x, + y: y + }; + this.cropped = true;return this.replaceCanvas(canvas); + });Caman.Plugin.register("resize", function(newDims) { + var canvas; + var ctx; + if (newDims == null) { + newDims = null; + } + if (newDims === null || ((newDims.width == null) && (newDims.height == null))) { + Log.error("Invalid or missing dimensions given for resize");return; + } + if (newDims.width == null) { + newDims.width = this.canvas.width * newDims.height / this.canvas.height; + } else if (newDims.height == null) { + newDims.height = this.canvas.height * newDims.width / this.canvas.width; + } + if (typeof exports !== "undefined" && exports !== null) { + canvas = new Canvas(newDims.width, newDims.height); + } else { + canvas = document.createElement('canvas');Util.copyAttributes(this.canvas, canvas); + canvas.width = newDims.width; + canvas.height = newDims.height; + } + ctx = canvas.getContext('2d');ctx.drawImage(this.canvas, 0, 0, this.canvas.width, this.canvas.height, 0, 0, newDims.width, newDims.height); + this.resized = true;return this.replaceCanvas(canvas); + });Caman.Filter.register("crop", function() { + return this.processPlugin("crop", Array.prototype.slice.call(arguments, 0)); + });Caman.Filter.register("resize", function() { + return this.processPlugin("resize", Array.prototype.slice.call(arguments, 0)); + }); +}).call(this); \ No newline at end of file diff --git a/microscopy/old_microscopy/caman.pack.js b/microscopy/old_microscopy/caman.pack.js index 2c95da9b..4d599baf 100755 --- a/microscopy/old_microscopy/caman.pack.js +++ b/microscopy/old_microscopy/caman.pack.js @@ -1 +1,24 @@ -eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(u(){H $,38,1z,23,F,2U,2T,1w,1M,3u,U,1R,32,24,1o,3J,1W,1J,1e,4p,1X,19,3l,2G,4C={}.at,5Q=[].au||u(7Q){W(H i=0,l=9.O;iC){o C}o 1A};19.3S=u(7A,3h,3q){H 3t,E,13,G,1Q,Z;A(3q==N){3q={}}G=7A.am;Z=[];W(E=0,13=G.O;E<13;E++){3t=G[E];A((3q.4W!=N)&&(1Q=3t.4U,5Q.1g(3q.4W,1Q)>=0)){3R}Z.1y(3h.7T(3t.4U,3t.al))}o Z};19.3A=u(O){A(O==N){O=0}A(F.1Y||(2y.6z!=N)){o 1F 6z(O)}o 1F 4u(O)};o 19})();A(1i 1S!=="2J"&&1S!==N){4p=1S;2T=46(\'D\');32=2T.32;3u=46(\'ak\');3l=46(\'3l\')}S{4p=2y}4p.F=F=(u(){F.5Z={7f:"4.1.1",7N:"4/8/aj"};F.7X=1H;F.1Y=1i 1S!=="2J"&&1S!==N;F.74=!F.1Y;F.3W=2f;F.5G="7M";F.ai=u(){o"ah "+F.5Z.7f+", ag "+F.5Z.7N};F.3O="";F.6f="6h";F.5T=u(D){A(F.1Y){o 2f}A(1i D==="3I"){D=$(D)}A(!((D!=N)&&(D.3b!=N))){o N}o D.3b(\'1j-29-1O\')};u F(){H 15,1C,1O,11=9;A(17.O===0){2w"47 17";}A(9 af F){9.36=9.36.5w(9);9.3v=9.3v.5w(9);15=17[0];A(!F.1Y){1O=3r(F.5T(15[0]),10);1C=1i 15[1]==="u"?15[1]:1i 15[2]==="u"?15[2]:u(){};A(!ae(1O)&&1X.78(1O)){o 1X.2j(1O,1C)}}9.1O=19.4T.2E();9.4d=9.2P=N;9.3m={x:0,y:0};9.7S=1H;9.4f=1H;9.3i=[];9.4Q=[];9.4X=[];9.3s=N;9.6i=1H;9.ad=1F 38(9);9.2u=1F 1e(9);9.6K(u(){11.6Q(15);o 11.6S()});o 9}S{o 1F F(17)}}F.I.6K=u(2Z){H 5e,11=9;A(F.1Y){o 4v(u(){o 2Z.1g(11)},0)}S{A(1B.5q==="4y"){1o.1D("7g 7i");o 4v(u(){o 2Z.1g(11)},0)}S{5e=u(){A(1B.5q==="4y"){1o.1D("7g 7i");o 2Z.1g(11)}};o 1B.7r("ac",5e,1H)}}};F.I.6Q=u(15){H 3C,1A,G,Z;A(15.O===0){2w"47 17 7J";}9.2t=N;9.4I=N;9.40=N;9.1C=u(){};9.7R(15[0]);A(15.O===1){o}39(1i 15[1]){1r"3I":9.40=15[1];2S;1r"u":9.1C=15[1]}A(15.O===2){o}9.1C=15[2];A(15.O===4){G=15[4];Z=[];W(3C 4w G){A(!4C.1g(G,3C))3R;1A=G[3C];Z.1y(9.1a[3C]=1A)}o Z}};F.I.7R=u(2r){A(F.1Y){9.2t=2r;9.4I=\'6a\';o}A(1i 2r==="2q"){9.2t=2r}S{9.2t=$(2r)}A(9.2t==N){2w"ab a1 a0 T 6g D W 9Z.";}o 9.4I=9.2t.4U.3p()};F.I.6S=u(){39(9.4I){1r"6a":o 9.6k();1r"1c":o 9.6q();1r"D":o 9.6r()}};F.I.6k=u(){H 11=9;1o.1D("9Y W 1Y");9.T=1F 32();9.T.5C=u(){1o.1D("32 6A. 6J = "+(11.2I())+", 6N = "+(11.2H()));11.D=1F 2T(11.2I(),11.2H());o 11.36()};9.T.9X=u(6X){2w 6X;};o 9.T.1d=9.2t};F.I.6q=u(){9.T=9.2t;9.D=1B.2i(\'D\');9.1n=9.D.2g(\'2d\');19.3S(9.T,9.D,{4W:[\'1d\']});9.T.5R.5O(9.D,9.T);9.5N();o 9.5A()};F.I.6r=u(){9.D=9.2t;9.1n=9.D.2g(\'2d\');A(9.40!=N){9.T=1B.2i(\'1c\');9.T.1d=9.40;9.5N();o 9.5A()}S{o 9.36()}};F.I.5N=u(){A(9.7k()){1o.1D(9.T.1d,"->",9.4z());9.7t=2f;9.T.1d=9.4z()}A(1R.7v(9.T)){9.T.1d=1R.2Y(9.T.1d);o 1o.1D("9W T 9V, 9U 7H = "+9.T.1d)}};F.I.5A=u(){A(9.7I()){o 9.3v()}S{o 9.T.5C=9.3v}};F.I.7I=u(){A(!9.T.4y){o 1H}A((9.T.5y!=N)&&9.T.5y===0){o 1H}o 2f};F.I.2I=u(){o 9.T.L||9.T.5y};F.I.2H=u(){o 9.T.Q||9.T.9T};F.I.3v=u(){1o.1D("32 6A. 6J = "+(9.2I())+", 6N = "+(9.2H()));A(9.7t){9.D.L=9.2I()/9.4x();9.D.Q=9.2H()/9.4x()}S{9.D.L=9.2I();9.D.Q=9.2H()}o 9.36()};F.I.36=u(){H i,1q,E,13,G;A(9.1n==N){9.1n=9.D.2g(\'2d\')}9.2W=9.3E=9.L=9.D.L;9.3G=9.3V=9.Q=9.D.Q;9.60();A(!9.61()){9.62()}A(9.T!=N){9.1n.3j(9.T,0,0,9.2I(),9.2H(),0,0,9.3E,9.3V)}9.5j();A(F.3W){9.4d=19.3A(9.J.O);9.2P=19.3A(9.J.O);G=9.J;W(i=E=0,13=G.O;E<13;i=++E){1q=G[i];9.4d[i]=1q;9.2P[i]=1q}}9.1G={L:9.D.L,Q:9.D.Q};1X.6e(9.1O,9);9.1C.1g(9,9);o 9.1C=u(){}};F.I.5j=u(){9.1P=9.1n.30(0,0,9.D.L,9.D.Q);o 9.J=9.1P.1j};F.I.9S=u(){H 1q,E,13,G,Z;A(!F.3W){2w"58 4r";}9.2P=19.3A(9.J.O);G=9.J;Z=[];W(E=0,13=G.O;E<13;E++){1q=G[E];Z.1y(9.2P.1y(1q))}o Z};F.I.61=u(){o F.5T(9.D)!=N};F.I.62=u(){A(F.1Y||9.D.3b(\'1j-29-1O\')){o}o 9.D.7T(\'1j-29-1O\',9.1O)};F.I.51=u(){o 9.D.3b(\'1j-29-6p-4r\')!==N};F.I.60=u(){H 2l;A(F.1Y||9.51()){o}2l=9.4x();A(2l!==1){1o.1D("9R 2l = "+2l);9.6i=2f;9.3E=9.D.L;9.3V=9.D.Q;9.D.L=9.3E*2l;9.D.Q=9.3V*2l;9.D.6s.L=""+9.3E+"6x";9.D.6s.Q=""+9.3V+"6x";9.1n.9Q(2l,2l);9.L=9.2W=9.D.L;o 9.Q=9.3G=9.D.Q}};F.I.4x=u(){H 50,2s;2s=2y.2s||1;50=9.1n.9P||9.1n.9N||9.1n.9M||9.1n.9L||9.1n.9E||1;o 2s/50};F.I.6L=u(){o(2y.2s!=N)&&2y.2s!==1};F.I.7k=u(){A(9.51()||!9.6L()){o 1H}o 9.4z()!==N};F.I.4z=u(){A(9.T==N){o N}o 9.T.3b(\'1j-29-6p\')};F.I.4o=u(6P){H 4n;4n=9.D;9.D=6P;9.1n=9.D.2g(\'2d\');4n.5R.5O(9.D,4n);9.L=9.D.L;9.Q=9.D.Q;9.5j();o 9.1G={L:9.D.L,Q:9.D.Q}};F.I.6R=u(1C){H 11=9;A(1C==N){1C=u(){}}1M.2K(9,"6W");o 9.2u.2j(u(){11.1n.4m(11.1P,0,0);o 1C.1g(11)})};F.I.9A=u(){H i,1q,E,13,G;A(!F.3W){2w"58 4r";}G=9.6Z();W(i=E=0,13=G.O;E<13;i=++E){1q=G[i];9.J[i]=1q}o 9.1n.4m(9.1P,0,0)};F.I.9y=u(){H D,1I,i,1P,1q,J,E,13,G;D=1B.2i(\'D\');19.3S(9.D,D);D.L=9.2W;D.Q=9.3G;1I=D.2g(\'2d\');1P=1I.30(0,0,D.L,D.Q);J=1P.1j;G=9.4d;W(i=E=0,13=G.O;E<13;i=++E){1q=G[i];J[i]=1q}1I.4m(1P,0,0);9.3m={x:0,y:0};9.4f=1H;o 9.4o(D)};F.I.6Z=u(){H D,4k,1I,4N,4M,i,1P,1q,J,4j,3Y,4i,4g,L,E,1f,13,G,1Q,2k,5J;A(!F.3W){2w"58 4r";}4j=[];4i=9.3m.x;4N=4i+9.L;4g=9.3m.y;4M=4g+9.Q;A(9.4f){D=1B.2i(\'D\');D.L=9.2W;D.Q=9.3G;1I=D.2g(\'2d\');1P=1I.30(0,0,D.L,D.Q);J=1P.1j;G=9.2P;W(i=E=0,13=G.O;E<13;i=++E){1q=G[i];J[i]=1q}1I.4m(1P,0,0);3Y=1B.2i(\'D\');3Y.L=9.L;3Y.Q=9.Q;1I=3Y.2g(\'2d\');1I.3j(D,0,0,9.2W,9.3G,0,0,9.L,9.Q);J=1I.30(0,0,9.L,9.Q).1j;L=9.L}S{J=9.2P;L=9.2W}W(i=1f=0,1Q=J.O;1f<1Q;i=1f+=4){4k=1W.7x(i,L);A(((4i<=(2k=4k.x)&&2k<4N))&&((4g<=(5J=4k.y)&&5J<4M))){4j.1y(J[i],J[i+1],J[i+2],J[i+3])}}o 4j};F.I.1L=u(X,4e){9.2u.34({Y:U.1Z.5z,X:X,4e:4e});o 9};F.I.5x=u(X,K,1V,28){H i,E,G;A(!1V){1V=0;W(i=E=0,G=K.O;0<=G?EG;i=0<=G?++E:--E){1V+=K[i]}}9.2u.34({Y:U.1Z.5g,X:X,K:K,1V:1V,28:28||0});o 9};F.I.5b=u(2p,15){9.2u.34({Y:U.1Z.1J,2p:2p,15:15});o 9};F.I.4S=u(1C){H 1p;1p=1F 24(9);9.4X.1y(1p);9.2u.34({Y:U.1Z.4L});1C.1g(1p);9.2u.34({Y:U.1Z.5W});o 9};F.I.64=u(1p){o 9.65(1p)};F.I.65=u(1p){9.4Q.1y(9.3s);9.3i.1y(9.J);9.3s=1p;o 9.J=1p.J};F.I.66=u(){9.J=9.3i.67();o 9.3s=9.4Q.67()};F.I.68=u(){o 9.3s.69()};o F})();38=(u(){u 38(c){9.c=c}38.I.9x=u(){H i,22,3H,E,1f,1m,G;22={r:{},g:{},b:{}};W(i=E=0;E<=C;i=++E){22.r[i]=0;22.g[i]=0;22.b[i]=0}W(i=1f=0,G=9.c.J.O;1f0)){o}Z=[];W(E=0,13=3N.O;E<13;E++){1c=3N[E];Z.1y(6m=1F 2U(1c,u(){9.6o();o 9.2j()}))}o Z};A(F.74){(u(){A(1B.5q==="4y"){o F.5S()}S{o 1B.7r("9t",F.5S,1H)}})()}2U=(u(){H 42;42="(\\\\w+)\\\\((.*?)\\\\)";u 2U(2o,6v){9.6w=2o.3b(\'1j-29\');9.29=F(2o,6v.5w(9))}2U.I.6o=u(){H 15,3T,3U,4P,4O,m,r,3X,E,13,G,Z;9.2o=9.29.D;r=1F 6G(42,\'g\');3X=9.6w.4Z(r);A(!(3X.O>0)){o}r=1F 6G(42);Z=[];W(E=0,13=3X.O;E<13;E++){4P=3X[E];G=4P.4Z(r),m=G[0],3T=G[1],15=G[2];4O=1F 9s("o u() { 9."+3T+"("+15+"); };");4Y{3U=4O();Z.1y(3U.1g(9.29))}5B(e){Z.1y(1o.1D(e))}}o Z};2U.I.2j=u(){H 2o;2o=9.2o;o 9.29.6R(u(){o 2o.5R.5O(9.6M(),2o)})};o 2U})();F.1z=1z=(u(){u 1z(){}1z.56={};1z.14=u(X,3U){o 9.56[X]=3U};1z.2j=u(X,P,M){o 9.56[X](P,M)};o 1z})();F.23=23=(u(){u 23(){}23.9r=u(3f,3d,3Q,3P){o R.73(R.1x(3Q-3f,2)+R.1x(3P-3d,2))};23.75=u(1u,V,3M){H 2m;A(3M==N){3M=1H}2m=1u+(R.9q()*(V-1u));A(3M){o 2m.9p(3M)}S{o R.5X(2m)}};23.7j=u(B){o(0.9m*B.r)+(0.9l*B.g)+(0.9i*B.b)};23.1v=u(1h,2b,27,18,48,49){H 52,53,4a,4b,3y,3x,1v,5v,2Q,i,j,35,4c,t,3o,3f,3Q,5H,3k,3d,3P,5M,E,1f,1m,G,1Q;3o=1h[0];3k=1h[1];3f=2b[0];3d=2b[1];3Q=27[0];3P=27[1];5H=18[0];5M=18[1];1v={};3y=3r(3*(3f-3o),10);4a=3*(3Q-3f)-3y;52=5H-3o-3y-4a;3x=3*(3d-3k);4b=3*(3P-3d)-3x;53=5M-3k-3x-4b;W(i=E=0;E<63;i=++E){t=i/63;5v=R.5X((52*R.1x(t,3))+(4a*R.1x(t,2))+(3y*t)+3o);2Q=R.5X((53*R.1x(t,3))+(4b*R.1x(t,2))+(3x*t)+3k);A(48&&2Q<48){2Q=48}S A(49&&2Q>49){2Q=49}1v[5v]=2Q}A(1v.O<18[0]+1){W(i=1f=0,G=18[0];0<=G?1f<=G:1f>=G;i=0<=G?++1f:--1f){A(1v[i]==N){35=[i-1,1v[i-1]];W(j=1m=i,1Q=18[0];i<=1Q?1m<=1Q:1m>=1Q;j=i<=1Q?++1m:--1m){A(1v[j]!=N){4c=[j,1v[j]];2S}}1v[i]=35[1]+((4c[1]-35[1])/(4c[0]-35[0]))*(i-35[0])}}}A(1v[18[0]]==N){1v[18[0]]=1v[18[0]-1]}o 1v};o 23})();1w=(u(){u 1w(){}1w.5P=u(2O){H b,g,r;A(2O.7Z(0)==="#"){2O=2O.4h(1)}r=3r(2O.4h(0,2),16);g=3r(2O.4h(2,2),16);b=3r(2O.4h(4,2),16);o{r:r,g:g,b:b}};1w.9g=u(r,g,b){H d,h,l,V,1u,s;A(1i r==="2q"){g=r.g;b=r.b;r=r.r}r/=C;g/=C;b/=C;V=R.V(r,g,b);1u=R.1u(r,g,b);l=(V+1u)/2;A(V===1u){h=s=0}S{d=V-1u;s=l>0.5?d/(2-V-1u):d/(V+1u);h=(u(){39(V){1r r:o(g-b)/d+(g1){t-=1}A(t<1/6){o p+(q-p)*6*t}A(t<1/2){o q}A(t<2/3){o p+(q-p)*(2/3-t)*6}o p};1w.6j=u(r,g,b){H d,h,V,1u,s,v;r/=C;g/=C;b/=C;V=R.V(r,g,b);1u=R.1u(r,g,b);v=V;d=V-1u;s=V===0?0:d/V;A(V===1u){h=0}S{h=(u(){39(V){1r r:o(g-b)/d+(g0.4K){r=R.1x((r+0.21)/1.21,2.4)}S{r/=12.92}A(g>0.4K){g=R.1x((g+0.21)/1.21,2.4)}S{g/=12.92}A(b>0.4K){b=R.1x((b+0.21)/1.21,2.4)}S{b/=12.92}x=r*0.9d+g*0.9c+b*0.9a;y=r*0.99+g*0.98+b*0.97;z=r*0.96+g*0.94+b*0.93;o{x:x*1k,y:y*1k,z:z*1k}};1w.91=u(x,y,z){H b,g,r;x/=1k;y/=1k;z/=1k;r=(3.8Z*x)+(-1.8Y*y)+(-0.8X*z);g=(-0.8W*x)+(1.8V*y)+(0.8U*z);b=(0.8T*x)+(-0.8S*y)+(1.8P*z);A(r>0.5h){r=(1.21*R.1x(r,0.5i))-0.21}S{r*=12.92}A(g>0.5h){g=(1.21*R.1x(g,0.5i))-0.21}S{g*=12.92}A(b>0.5h){b=(1.21*R.1x(b,0.5i))-0.21}S{b*=12.92}o{r:r*C,g:g*C,b:b*C}};1w.6O=u(x,y,z){H a,b,l,5k,5l,5m;A(1i x==="2q"){y=x.y;z=x.z;x=x.x}5k=95.6T;5l=1k.0;5m=6U.6V;x/=5k;y/=5l;z/=5m;A(x>0.5n){x=R.1x(x,0.5o)}S{x=(7.5p*x)+0.2V}A(y>0.5n){y=R.1x(y,0.5o)}S{y=(7.5p*y)+0.2V}A(z>0.5n){z=R.1x(z,0.5o)}S{z=(7.5p*z)+0.2V}l=70*y-16;a=71*(x-y);b=72*(y-z);o{l:l,a:a,b:b}};1w.8O=u(l,a,b){H x,y,z;A(1i l==="2q"){a=l.a;b=l.b;l=l.l}y=(l+16)/70;x=y+(a/71);z=y-(b/72);A(x>0.5s){x=x*x*x}S{x=0.5t*(x-0.2V)}A(y>0.5s){y=y*y*y}S{y=0.5t*(y-0.2V)}A(z>0.5s){z=z*z*z}S{z=0.5t*(z-0.2V)}o{x:x*95.6T,y:y*1k.0,z:z*6U.6V}};1w.8L=u(r,g,b){H 5u;A(1i r==="2q"){g=r.g;b=r.b;r=r.r}5u=9.6n(r,g,b);o 9.6O(5u)};1w.8J=u(l,a,b){};o 1w})();1M=(u(){u 1M(){}1M.2F={};1M.7a=["7b","7c","6W","7d","7e","37"];1M.2K=u(2e,Y,1j){H 3z,E,13,G,Z;A(9.2F[Y]&&9.2F[Y].O){G=9.2F[Y];Z=[];W(E=0,13=G.O;E<13;E++){3z=G[E];A(3z.2e===N||2e.1O===3z.2e.1O){Z.1y(3z.2A.1g(2e,1j))}S{Z.1y(8I 0)}}o Z}};1M.8H=u(2e,Y,2A){H 5D,5E;A(1i 2e==="3I"){5E=2e;5D=Y;2e=N;Y=5E;2A=5D}A(5Q.1g(9.7a,Y)<0){o 1H}A(!9.2F[Y]){9.2F[Y]=[]}9.2F[Y].1y({2e:2e,2A:2A});o 2f};o 1M})();F.1M=1M;F.U=U=(u(){u U(){}U.1Z={5z:1,5g:2,4L:3,5W:4,5F:5,1J:6};U.14=u(X,7o){o F.I[X]=7o};o U})();F.1R=1R=(u(){u 1R(){}1R.7p=/(?:(?:8G|8E):\\/\\/)((?:\\w+)\\.(?:(?:\\w|\\.)+))/;1R.7v=u(1c){A(1c==N){o 1H}A(9.7s(1c)){o 1H}o 9.4D(1c.1d)};1R.7s=u(1c){H G;o(1c.5G!=N)&&((G=1c.5G.3p())===\'7M\'||G===\'7u-8D\')};1R.4D=u(7w){H 4E;4E=7w.4Z(9.7p);A(4E){o 4E[1]!==1B.8C}S{o 1H}};1R.7z=u(1d){A(9.4D(1d)){A(!F.3O.O){1o.5L("8B 3h 8z a 7D T 8y a 8x 7G. 7H: "+1d)}S{A(F.4D(F.3O)){1o.5L("8w 7u a 7D 7G W 8u 8t.");o}o""+F.3O+"?6h="+(7K(1d))}}};1R.2Y=u(1d){o""+F.3O+"?"+F.6f+"="+(7K(1d))};1R.8r=u(2R){H 4H;4H={8n:\'8m\',8l:\'8b\',8a:\'89\',83:\'82\'};2R=2R.3p();A(4H[2R]!=N){2R=4H[2R]}o"81/9h."+2R};o 1R})();F.I.80=u(){A(1i 1S!=="2J"&&1S!==N){o 9.7Y.33(9,17)}S{o 9.7W.33(9,17)}};F.I.7W=u(Y){H T;A(Y==N){Y="7V"}Y=Y.3p();T=9.5Y(Y).84("T/"+Y,"T/85-86");o 1B.87.88=T};F.I.7Y=u(2X,4J){H 5V;A(4J==N){4J=2f}4Y{5V=3l.8c(2X);A(5V.8d()&&!4J){o 1H}}5B(e){1o.1D("8e 8f 2X "+2X)}o 3l.8g(2X,9.D.8h(),u(){o 1o.1D("8i 8j 3h "+2X)})};F.I.6M=u(Y){H 1c;1c=1B.2i(\'1c\');1c.1d=9.5Y(Y);1c.L=9.1G.L;1c.Q=9.1G.Q;A(2y.2s){1c.L/=2y.2s;1c.Q/=2y.2s}o 1c};F.I.5Y=u(Y){A(Y==N){Y="7V"}Y=Y.3p();o 9.D.8k("T/"+Y)};24=(u(){u 24(c){9.c=c;9.3T=9.c;9.1a={5U:\'7P\',2x:1.0};9.8o=19.4T.2E();9.D=1i 1S!=="2J"&&1S!==N?1F 2T():1B.2i(\'D\');9.D.L=9.c.1G.L;9.D.Q=9.c.1G.Q;9.1n=9.D.2g(\'2d\');9.1n.8p(9.D.L,9.D.Q);9.1P=9.1n.30(0,0,9.D.L,9.D.Q);9.J=9.1P.1j}24.I.4S=u(2Z){o 9.c.4S.1g(9.c,2Z)};24.I.8q=u(7L){9.1a.5U=7L;o 9};24.I.2x=u(2x){9.1a.2x=2x/1k;o 9};24.I.8s=u(){H i,1T,E,G;1T=9.c.J;W(i=E=0,G=9.c.J.O;E9.c.J.O||1U<0){o{r:0,g:0,b:0,a:0}}o{r:9.c.J[1U],g:9.c.J[1U+1],b:9.c.J[1U+2],a:9.c.J[1U+3]}};1W.I.8K=u(4B,4A,B){H 76;76=9.1l+(9.c.1G.L*4*(4A*-1))+(4*4B);A(1U>9.c.J.O||1U<0){o}9.c.J[1U]=B.r;9.c.J[1U+1]=B.g;9.c.J[1U+2]=B.b;9.c.J[1U+3]=B.a;o 2f};1W.I.8M=u(x,y){H 1l;1l=9.5I(x,y,9.L);o{r:9.c.J[1l],g:9.c.J[1l+1],b:9.c.J[1l+2],a:9.c.J[1l+3]}};1W.I.8N=u(x,y,B){H 1l;1l=9.5I(x,y,9.L);9.c.J[1l]=B.r;9.c.J[1l+1]=B.g;9.c.J[1l+2]=B.b;o 9.c.J[1l+3]=B.a};o 1W})();1J=(u(){u 1J(){}1J.5r={};1J.14=u(X,2p){o 9.5r[X]=2p};1J.2j=u(1n,X,15){o 9.5r[X].33(1n,15)};o 1J})();F.1J=1J;F.1e=1e=(u(){1e.2D=F.1Y?46(\'8Q\').8R().O:4;u 1e(c){H 11=9;9.c=c;9.2n=u(){o 1e.I.2n.33(11,17)};9.3w=[];9.2L=N}1e.I.34=u(5d){A(5d==N){o}o 9.3w.1y(5d)};1e.I.2n=u(){H 1p;A(9.3w.O===0){1M.2K(9,"7d");A(9.5c!=N){9.5c.1g(9.c)}o 9}9.1t=9.3w.6F();39(9.1t.Y){1r U.1Z.4L:1p=9.c.4X.6F();9.c.64(1p);o 9.2n();1r U.1Z.5W:9.c.68();9.c.66();o 9.2n();1r U.1Z.5F:o 9.6E(9.1t.1p,9.1t.1d);1r U.1Z.1J:o 9.6D();90:o 9.6C()}};1e.I.2j=u(1C){9.5c=1C;9.2L=19.3A(9.c.J.O);o 9.2n()};1e.I.59=u(2A){H 3F,57,1K,18,f,i,54,n,1h,E,G,Z,11=9;9.4q=0;n=9.c.J.O;57=R.3B((n/4)/1e.2D);3F=57*4;54=3F+((n/4)%1e.2D)*4;Z=[];W(i=E=0,G=1e.2D;0<=G?EG;i=0<=G?++E:--E){1h=i*3F;18=1h+(i===1e.2D-1?54:3F);A(F.1Y){f=3u(u(){o 2A.1g(11,i,1h,18)});1K=f.9b();Z.1y(9.37(1K))}S{Z.1y(4v((u(i,1h,18){o u(){o 2A.1g(11,i,1h,18)}})(i,1h,18),0))}}o Z};1e.I.6C=u(){1M.2K(9.c,"7b",9.1t);A(9.1t.Y===U.1Z.5z){o 9.59(9.6u)}S{o 9.59(9.6t)}};1e.I.6D=u(){1o.1D("9e 2p "+9.1t.2p);1J.2j(9.c,9.1t.2p,9.1t.15);1o.1D("1J "+9.1t.2p+" 4R!");o 9.2n()};1e.I.6u=u(1K,1h,18){H 1j,i,2z,20,E;1o.1D("7n #"+1K+" - U: "+9.1t.X+", 9j: "+1h+", 9k: "+18);1M.2K(9.c,"7e",{7m:1K,7l:1e.2D,9n:1h,9o:18});1j={r:0,g:0,b:0,a:0};2z=1F 1W(9.c);W(i=E=1h;E<18;i=E+=4){2z.1l=i;1j.r=9.c.J[i];1j.g=9.c.J[i+1];1j.b=9.c.J[i+2];1j.a=9.c.J[i+3];20=9.1t.4e.1g(2z,1j);A(20.a==N){20.a=1j.a}9.c.J[i]=19.2c(20.r);9.c.J[i+1]=19.2c(20.g);9.c.J[i+2]=19.2c(20.b);9.c.J[i+3]=19.2c(20.a)}A(F.1Y){o 3u["7h"](1K)}S{o 9.37(1K)}};1e.I.6t=u(1K,1h,18){H K,3D,28,1N,3g,1V,i,j,k,25,n,X,1q,2z,20,E,1f,1m;X=9.1t.X;28=9.1t.28;1V=9.1t.1V;n=9.c.J.O;K=9.1t.K;3D=R.73(K.O);25=[];1o.1D("9v 25 - U: "+9.1t.X);1h=R.V(1h,9.c.1G.L*4*((3D-1)/2));18=R.1u(18,n-(9.c.1G.L*4*((3D-1)/2)));1N=(3D-1)/2;2z=1F 1W(9.c);W(i=E=1h;E<18;i=E+=4){2z.1l=i;3g=0;W(j=1f=-1N;-1N<=1N?1f<=1N:1f>=1N;j=-1N<=1N?++1f:--1f){W(k=1m=1N;1N<=-1N?1m<=-1N:1m>=-1N;k=1N<=-1N?++1m:--1m){1q=2z.7q(j,k);25[3g*3]=1q.r;25[3g*3+1]=1q.g;25[3g*3+2]=1q.b;3g++}}20=9.5x(K,25,1V,28);9.2L[i]=19.2c(20.r);9.2L[i+1]=19.2c(20.g);9.2L[i+2]=19.2c(20.b);9.2L[i+3]=9.c.J[i+3]}A(F.1Y){o 3u["7h"](1K)}S{o 9.37(1K)}};1e.I.37=u(1K){H i,E,G;A(1K>=0){1o.1D("7n #"+1K+" 4R! U: "+9.1t.X)}9.4q++;1M.2K(9.c,"37",{7m:1K,9w:9.4q,7l:1e.2D});A(9.4q===1e.2D){A(9.1t.Y===U.1Z.5g){W(i=E=0,G=9.c.J.O;0<=G?EG;i=0<=G?++E:--E){9.c.J[i]=9.2L[i]}}A(1K>=0){1o.1D("U "+9.1t.X+" 4R!")}1M.2K(9.c,"7c",9.1t);o 9.2n()}};1e.I.5x=u(K,25,1V,28){H i,1A,E,G;1A={r:0,g:0,b:0};W(i=E=0,G=K.O;0<=G?EG;i=0<=G?++E:--E){1A.r+=K[i]*25[i*3];1A.g+=K[i]*25[i*3+1];1A.b+=K[i]*25[i*3+2]}1A.r=(1A.r/1V)+28;1A.g=(1A.g/1V)+28;1A.b=(1A.b/1V)+28;o 1A};1e.I.6E=u(1p,1d){H 1c,2Y,11=9;1c=1B.2i(\'1c\');1c.5C=u(){1p.1n.3j(1c,0,0,11.c.1G.L,11.c.1G.Q);1p.1P=1p.1n.30(0,0,11.c.1G.L,11.c.1G.Q);1p.J=1p.1P.1j;11.c.J=1p.J;o 11.2n()};2Y=1R.7z(1d);o 1c.1d=2Y!=N?2Y:1d};o 1e})();F.1X=1X=(u(){u 1X(){}1X.3a={};1X.78=u(2B){o 9.3a[2B]!=N};1X.2E=u(2B){o 9.3a[2B]};1X.6e=u(X,2r){o 9.3a[X]=2r};1X.2j=u(2B,1C){H 11=9;4v(u(){o 1C.1g(11.2E(2B),11.2E(2B))},0);o 9.2E(2B)};1X.9z=u(X){A(X==N){X=1H}A(X){o 6Y 9.3a[X]}S{o 9.3a={}}};o 1X})();1z.14("7P",u(P,M){o{r:P.r,g:P.g,b:P.b}});1z.14("9B",u(P,M){o{r:(P.r*M.r)/C,g:(P.g*M.g)/C,b:(P.b*M.b)/C}});1z.14("9C",u(P,M){o{r:C-(((C-P.r)*(C-M.r))/C),g:C-(((C-P.g)*(C-M.g))/C),b:C-(((C-P.b)*(C-M.b))/C)}});1z.14("9D",u(P,M){H 1b;1b={};1b.r=M.r>1s?C-2*(C-P.r)*(C-M.r)/C:(M.r*P.r*2)/C;1b.g=M.g>1s?C-2*(C-P.g)*(C-M.g)/C:(M.g*P.g*2)/C;1b.b=M.b>1s?C-2*(C-P.b)*(C-M.b)/C:(M.b*P.b*2)/C;o 1b});1z.14("9F",u(P,M){o{r:P.r-M.r,g:P.g-M.g,b:P.b-M.b}});1z.14("9G",u(P,M){o{r:M.r+P.r,g:M.g+P.g,b:M.b+P.b}});1z.14("9H",u(P,M){o{r:1s-2*(M.r-1s)*(P.r-1s)/C,g:1s-2*(M.g-1s)*(P.g-1s)/C,b:1s-2*(M.b-1s)*(P.b-1s)/C}});1z.14("9I",u(P,M){H 1b;1b={};1b.r=M.r>1s?C-((C-M.r)*(C-(P.r-1s)))/C:(M.r*(P.r+1s))/C;1b.g=M.g>1s?C-((C-M.g)*(C-(P.g-1s)))/C:(M.g*(P.g+1s))/C;1b.b=M.b>1s?C-((C-M.b)*(C-(P.b-1s)))/C:(M.b*(P.b+1s))/C;o 1b});1z.14("9J",u(P,M){o{r:M.r>P.r?M.r:P.r,g:M.g>P.g?M.g:P.g,b:M.b>P.b?M.b:P.b}});1z.14("9K",u(P,M){o{r:M.r>P.r?P.r:M.r,g:M.g>P.g?P.g:M.g,b:M.b>P.b?P.b:M.b}});U.14("4G",u(){H 3c;A(17.O===1){3c=1w.5P(17[0])}S{3c={r:17[0],g:17[1],b:17[2]}}o 9.1L("4G",u(B){B.r=3c.r;B.g=3c.g;B.b=3c.b;B.a=C;o B})});U.14("6I",u(K){K=R.3B(C*(K/1k));o 9.1L("6I",u(B){B.r+=K;B.g+=K;B.b+=K;o B})});U.14("6H",u(K){K*=-0.9O;o 9.1L("6H",u(B){H V;V=R.V(B.r,B.g,B.b);A(B.r!==V){B.r+=(V-B.r)*K}A(B.g!==V){B.g+=(V-B.g)*K}A(B.b!==V){B.b+=(V-B.b)*K}o B})});U.14("6B",u(K){K*=-1;o 9.1L("6B",u(B){H 3n,2v,V;V=R.V(B.r,B.g,B.b);2v=(B.r+B.g+B.b)/3;3n=((R.2C(V-2v)*2/C)*K)/1k;A(B.r!==V){B.r+=(V-B.r)*3n}A(B.g!==V){B.g+=(V-B.g)*3n}A(B.b!==V){B.b+=(V-B.b)*3n}o B})});U.14("7O",u(K){o 9.1L("7O",u(B){H 2v;2v=23.7j(B);B.r=2v;B.g=2v;B.b=2v;o B})});U.14("7F",u(K){K=R.1x((K+1k)/1k,2);o 9.1L("7F",u(B){B.r/=C;B.r-=0.5;B.r*=K;B.r+=0.5;B.r*=C;B.g/=C;B.g-=0.5;B.g*=K;B.g+=0.5;B.g*=C;B.b/=C;B.b-=0.5;B.b*=K;B.b+=0.5;B.b*=C;o B})});U.14("7E",u(K){o 9.1L("7E",u(B){H h,2M,26;2M=1w.6j(B.r,B.g,B.b);h=2M.h*1k;h+=R.2C(K);h=h%1k;h/=1k;2M.h=h;26=1w.6l(2M.h,2M.s,2M.v);26.a=B.a;o 26})});U.14("6y",u(){H 31,26;A(17.O===2){26=1w.5P(17[0]);31=17[1]}S A(17.O===4){26={r:17[0],g:17[1],b:17[2]};31=17[3]}o 9.1L("6y",u(B){B.r-=(B.r-26.r)*(31/1k);B.g-=(B.g-26.g)*(31/1k);B.b-=(B.b-26.b)*(31/1k);o B})});U.14("6d",u(){o 9.1L("6d",u(B){B.r=C-B.r;B.g=C-B.g;B.b=C-B.b;o B})});U.14("6c",u(K){A(K==N){K=1k}K/=1k;o 9.1L("6c",u(B){B.r=R.1u(C,(B.r*(1-(0.a2*K)))+(B.g*(0.a3*K))+(B.b*(0.a4*K)));B.g=R.1u(C,(B.r*(0.a5*K))+(B.g*(1-(0.a6*K)))+(B.b*(0.a7*K)));B.b=R.1u(C,(B.r*(0.a8*K))+(B.g*(0.a9*K))+(B.b*(1-(0.aa*K))));o B})});U.14("6b",u(K){o 9.1L("6b",u(B){B.r=R.1x(B.r/C,K)*C;B.g=R.1x(B.g/C,K)*C;B.b=R.1x(B.b/C,K)*C;o B})});U.14("7y",u(K){K=R.2C(K)*2.55;o 9.1L("7y",u(B){H 2m;2m=23.75(K*-1,K);B.r+=2m;B.g+=2m;B.b+=2m;o B})});U.14("77",u(K){K=R.2C(K)*2.55;o 9.1L("77",u(B){A(B.r>C-K){B.r=C}S A(B.rC-K){B.g=C}S A(B.gC-K){B.b=C}S A(B.b0){B.r+=(C-B.r)*1a.41}S{B.r-=B.r*R.2C(1a.41)}}A(1a.43!=N){A(1a.43>0){B.g+=(C-B.g)*1a.43}S{B.g-=B.g*R.2C(1a.43)}}A(1a.44!=N){A(1a.44>0){B.b+=(C-B.b)*1a.44}S{B.b-=B.b*R.2C(1a.44)}}o B})});U.14("45",u(){H 1v,2h,2a,2b,27,18,i,1h,E,1f,G,1Q;2h=17[0],2a=2<=17.O?5f.1g(17,1):[];A(1i 2h==="3I"){2h=2h.an("")}A(2h[0]==="v"){2h=[\'r\',\'g\',\'b\']}A(2a.O<3||2a.O>4){2w"47 ao ap 17 3h 45 3T";}1h=2a[0];2b=2a[1];27=2a.O===4?2a[2]:2a[1];18=2a[2a.O-1];1v=23.1v(1h,2b,27,18,0,C);A(1h[0]>0){W(i=E=0,G=1h[0];0<=G?EG;i=0<=G?++E:--E){1v[i]=1h[1]}}A(18[0]=C;i=1Q<=C?++1f:--1f){1v[i]=18[1]}}o 9.1L("45",u(B){H 1m,2k;W(i=1m=0,2k=2h.O;0<=2k?1m<2k:1m>2k;i=0<=2k?++1m:--1m){B[2h[i]]=1v[B[2h[i]]]}o B})});U.14("aq",u(K){H 2b,27,p;p=R.2C(K)/1k;2b=[0,C*p];27=[C-(C*p),C];A(K<0){2b=2b.79();27=27.79()}o 9.45(\'26\',[0,0],2b,27,[C,C])});F.1J.14("4V",u(L,Q,x,y){H D,1I;A(x==N){x=0}A(y==N){y=0}A(1i 1S!=="2J"&&1S!==N){D=1F 2T(L,Q)}S{D=1B.2i(\'D\');19.3S(9.D,D);D.L=L;D.Q=Q}1I=D.2g(\'2d\');1I.3j(9.D,x,y,L,Q,0,0,L,Q);9.3m={x:x,y:y};9.7S=2f;o 9.4o(D)});F.1J.14("4F",u(1E){H D,1I;A(1E==N){1E=N}A(1E===N||((1E.L==N)&&(1E.Q==N))){1o.7B("47 6g av 1G 7J W 4F");o}A(1E.L==N){1E.L=9.D.L*1E.Q/9.D.Q}S A(1E.Q==N){1E.Q=9.D.Q*1E.L/9.D.L}A(1i 1S!=="2J"&&1S!==N){D=1F 2T(1E.L,1E.Q)}S{D=1B.2i(\'D\');19.3S(9.D,D);D.L=1E.L;D.Q=1E.Q}1I=D.2g(\'2d\');1I.3j(9.D,0,0,9.D.L,9.D.Q,0,0,1E.L,1E.Q);9.4f=2f;o 9.4o(D)});F.U.14("4V",u(){o 9.5b("4V",4u.I.2G.1g(17,0))});F.U.14("4F",u(){o 9.5b("4F",4u.I.2G.1g(17,0))})}).1g(9);',62,652,'|||||||||this|||||||||||||||return||||||function||||||if|rgba|255|canvas|_i|Caman|_ref|var|prototype|pixelData|adjust|width|rgbaParent|null|length|rgbaLayer|height|Math|else|image|Filter|max|for|name|type|_results||_this||_len|register|args||arguments|end|Util|options|result|img|src|Renderer|_j|call|start|typeof|data|100|loc|_k|context|Log|layer|pixel|case|128|currentJob|min|bezier|Convert|pow|push|Blender|val|document|callback|debug|newDims|new|dimensions|false|ctx|Plugin|bnum|process|Event|builder|id|imageData|_ref1|IO|exports|parentData|newLoc|divisor|PixelInfo|Store|NodeJS|Type|res|055|levels|Calculate|Layer|kernel|rgb|ctrl2|bias|caman|cps|ctrl1|clampRGB||target|true|getContext|chans|createElement|execute|_ref2|ratio|rand|processNext|ele|plugin|object|obj|devicePixelRatio|initObj|renderer|avg|throw|opacity|window|pixelInfo|fn|search|abs|Blocks|get|events|slice|imageHeight|imageWidth|undefined|trigger|modPixelData|hsv|layerData|hex|originalPixelData|curveY|lang|break|Canvas|CamanParser|1379310345|originalWidth|file|proxyUrl|cb|getImageData|level|Image|apply|add|leftCoord|finishInit|blockFinished|Analyze|switch|items|getAttribute|color|y1|chan|x1|builderIndex|to|pixelStack|drawImage|y0|fs|cropCoordinates|amt|x0|toLowerCase|opts|parseInt|currentLayer|attr|Fiber|imageLoaded|renderQueue|Cy|Cx|event|dataArray|floor|key|adjustSize|preScaledWidth|blockN|originalHeight|numPixels|string|Logger|copy|prop|getFloat|imgs|remoteProxy|y2|x2|continue|copyAttributes|filter|func|preScaledHeight|allowRevert|unparsedInstructions|scaledCanvas|hueToRGB|imageUrl|red|INST_REGEX|green|blue|curves|require|Invalid|lowBound|highBound|Bx|By|rightCoord|initializedPixelData|processFn|resized|startY|substr|startX|pixels|coord|dest|putImageData|oldCanvas|replaceCanvas|Root|blocksDone|disabled|root|sel|Array|setTimeout|in|hiDPIRatio|complete|hiDPIReplacement|vert|horiz|__hasProp|isURLRemote|matches|resize|fillColor|langToExt|initType|overwrite|04045|LayerDequeue|endY|endX|instFunc|inst|layerStack|finished|newLayer|uniqid|nodeName|crop|except|canvasQueue|try|match|backingStoreRatio|hiDPIDisabled|Ax|Ay|lastBlockN||blenders|blockPixelLength|Revert|eachBlock|value|processPlugin|finishedFn|job|listener|__slice|Kernel|0031308|4166666667|reloadCanvasData|whiteX|whiteY|whiteZ|008856451679|3333333333|787037037|readyState|plugins|2068965517|1284185493|xyz|curveX|bind|processKernel|naturalWidth|Single|waitForImageLoaded|catch|onload|_fn|_type|LoadOverlay|crossOrigin|x3|coordinatesToLocation|_ref3|console|info|y3|imageAdjustments|replaceChild|hexToRGB|__indexOf|parentNode|DOMUpdated|getAttrId|blendingMode|stats|LayerFinished|round|toBase64|version|hiDPIAdjustments|hasId|assignId|1000|executeLayer|pushContext|popContext|pop|applyCurrentLayer|applyToParent|node|gamma|sepia|invert|put|proxyParam|or|camanProxyUrl|scaled|rgbToHSV|initNode|hsvToRGB|parser|rgbToXYZ|parse|hidpi|initImage|initCanvas|style|renderKernel|renderBlock|ready|dataStr|px|colorize|Uint8Array|loaded|vibrance|executeFilter|executePlugin|loadOverlay|shift|RegExp|saturation|brightness|Width|domIsLoaded|hiDPICapable|toImage|Height|xyzToLab|newCanvas|parseArguments|render|setup|047|108|883|renderStart|err|delete|originalVisiblePixels|116|500|200|sqrt|autoload|randomRange|nowLoc|clip|has|reverse|types|processStart|processComplete|renderFinished|blockStarted|release|DOM|yield|initialized|luminance|needsHiDPISwap|totalBlocks|blockNum|Block|filterFunc|domainRegex|getPixelRelative|addEventListener|corsEnabled|swapped|use|isRemote|url|locationToCoordinates|noise|remoteCheck|from|error|log|remote|hue|contrast|proxy|URL|isImageLoaded|given|encodeURIComponent|mode|anonymous|date|greyscale|normal|item|setInitObject|cropped|setAttribute|channels|png|browserSave|DEBUG|nodeSave|charAt|save|proxies|js|javascript|replace|octet|stream|location|href|pl|perl|py|statSync|isFile|Creating|output|writeFile|toBuffer|Finished|writing|toDataURL|python|rb|ruby|layerID|createImageData|setBlendingMode|useProxy|copyParent|images|loading|overlayImage|Cannot|configured|without|load|warn|Attempting|domain|credentials|https|locationXY|http|listen|void|labToRGB|putPixelRelative|rgbToLab|getPixel|putPixel|labToXYZ|0570|os|cpus|2040|0557|0415|8758|9689|4986|5372|2406|default|xyzToRGB||9505|1192||0193|0722|7152|2126|1805|run|3576|4124|Executing|hslToRGB|rgbToHSL|caman_proxy|114|Start|End|587|299|startPixel|endPixel|toFixed|random|distance|Function|DOMContentLoaded|querySelectorAll|Rendering|blocksFinished|calculateLevels|reset|flush|revert|multiply|screen|overlay|backingStorePixelRatio|difference|addition|exclusion|softLight|lighten|darken|oBackingStorePixelRatio|msBackingStorePixelRatio|mozBackingStorePixelRatio|01|webkitBackingStorePixelRatio|scale|HiDPI|resetOriginalPixelData|naturalHeight|using|detected|Remote|onerror|Initializing|initialization|find|not|607|769|189|349|314|168|272|534|869|Could|readystatechange|analyze|isNaN|instanceof|Released|Version|toString|2013|fibers|nodeValue|attributes|split|number|of|exposure|extend|querySelector|hasOwnProperty|indexOf|missing'.split('|'),0,{})) \ No newline at end of file +eval(function(p, a, c, k, e, r) { + e = function(c) { + return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) + }; + if (!''.replace(/^/, String)) { + while (c--) { + r[e(c)] = k[c] || e(c); + } + k = [function(e) { + return r[e] + }]; + e = function() { + return '\\w+' + }; + c = 1 + } + ; + while (c--) { + if (k[c]) { + p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); + } + } + return p +}('(u(){H $,38,1z,23,F,2U,2T,1w,1M,3u,U,1R,32,24,1o,3J,1W,1J,1e,4p,1X,19,3l,2G,4C={}.at,5Q=[].au||u(7Q){W(H i=0,l=9.O;iC){o C}o 1A};19.3S=u(7A,3h,3q){H 3t,E,13,G,1Q,Z;A(3q==N){3q={}}G=7A.am;Z=[];W(E=0,13=G.O;E<13;E++){3t=G[E];A((3q.4W!=N)&&(1Q=3t.4U,5Q.1g(3q.4W,1Q)>=0)){3R}Z.1y(3h.7T(3t.4U,3t.al))}o Z};19.3A=u(O){A(O==N){O=0}A(F.1Y||(2y.6z!=N)){o 1F 6z(O)}o 1F 4u(O)};o 19})();A(1i 1S!=="2J"&&1S!==N){4p=1S;2T=46(\'D\');32=2T.32;3u=46(\'ak\');3l=46(\'3l\')}S{4p=2y}4p.F=F=(u(){F.5Z={7f:"4.1.1",7N:"4/8/aj"};F.7X=1H;F.1Y=1i 1S!=="2J"&&1S!==N;F.74=!F.1Y;F.3W=2f;F.5G="7M";F.ai=u(){o"ah "+F.5Z.7f+", ag "+F.5Z.7N};F.3O="";F.6f="6h";F.5T=u(D){A(F.1Y){o 2f}A(1i D==="3I"){D=$(D)}A(!((D!=N)&&(D.3b!=N))){o N}o D.3b(\'1j-29-1O\')};u F(){H 15,1C,1O,11=9;A(17.O===0){2w"47 17";}A(9 af F){9.36=9.36.5w(9);9.3v=9.3v.5w(9);15=17[0];A(!F.1Y){1O=3r(F.5T(15[0]),10);1C=1i 15[1]==="u"?15[1]:1i 15[2]==="u"?15[2]:u(){};A(!ae(1O)&&1X.78(1O)){o 1X.2j(1O,1C)}}9.1O=19.4T.2E();9.4d=9.2P=N;9.3m={x:0,y:0};9.7S=1H;9.4f=1H;9.3i=[];9.4Q=[];9.4X=[];9.3s=N;9.6i=1H;9.ad=1F 38(9);9.2u=1F 1e(9);9.6K(u(){11.6Q(15);o 11.6S()});o 9}S{o 1F F(17)}}F.I.6K=u(2Z){H 5e,11=9;A(F.1Y){o 4v(u(){o 2Z.1g(11)},0)}S{A(1B.5q==="4y"){1o.1D("7g 7i");o 4v(u(){o 2Z.1g(11)},0)}S{5e=u(){A(1B.5q==="4y"){1o.1D("7g 7i");o 2Z.1g(11)}};o 1B.7r("ac",5e,1H)}}};F.I.6Q=u(15){H 3C,1A,G,Z;A(15.O===0){2w"47 17 7J";}9.2t=N;9.4I=N;9.40=N;9.1C=u(){};9.7R(15[0]);A(15.O===1){o}39(1i 15[1]){1r"3I":9.40=15[1];2S;1r"u":9.1C=15[1]}A(15.O===2){o}9.1C=15[2];A(15.O===4){G=15[4];Z=[];W(3C 4w G){A(!4C.1g(G,3C))3R;1A=G[3C];Z.1y(9.1a[3C]=1A)}o Z}};F.I.7R=u(2r){A(F.1Y){9.2t=2r;9.4I=\'6a\';o}A(1i 2r==="2q"){9.2t=2r}S{9.2t=$(2r)}A(9.2t==N){2w"ab a1 a0 T 6g D W 9Z.";}o 9.4I=9.2t.4U.3p()};F.I.6S=u(){39(9.4I){1r"6a":o 9.6k();1r"1c":o 9.6q();1r"D":o 9.6r()}};F.I.6k=u(){H 11=9;1o.1D("9Y W 1Y");9.T=1F 32();9.T.5C=u(){1o.1D("32 6A. 6J = "+(11.2I())+", 6N = "+(11.2H()));11.D=1F 2T(11.2I(),11.2H());o 11.36()};9.T.9X=u(6X){2w 6X;};o 9.T.1d=9.2t};F.I.6q=u(){9.T=9.2t;9.D=1B.2i(\'D\');9.1n=9.D.2g(\'2d\');19.3S(9.T,9.D,{4W:[\'1d\']});9.T.5R.5O(9.D,9.T);9.5N();o 9.5A()};F.I.6r=u(){9.D=9.2t;9.1n=9.D.2g(\'2d\');A(9.40!=N){9.T=1B.2i(\'1c\');9.T.1d=9.40;9.5N();o 9.5A()}S{o 9.36()}};F.I.5N=u(){A(9.7k()){1o.1D(9.T.1d,"->",9.4z());9.7t=2f;9.T.1d=9.4z()}A(1R.7v(9.T)){9.T.1d=1R.2Y(9.T.1d);o 1o.1D("9W T 9V, 9U 7H = "+9.T.1d)}};F.I.5A=u(){A(9.7I()){o 9.3v()}S{o 9.T.5C=9.3v}};F.I.7I=u(){A(!9.T.4y){o 1H}A((9.T.5y!=N)&&9.T.5y===0){o 1H}o 2f};F.I.2I=u(){o 9.T.L||9.T.5y};F.I.2H=u(){o 9.T.Q||9.T.9T};F.I.3v=u(){1o.1D("32 6A. 6J = "+(9.2I())+", 6N = "+(9.2H()));A(9.7t){9.D.L=9.2I()/9.4x();9.D.Q=9.2H()/9.4x()}S{9.D.L=9.2I();9.D.Q=9.2H()}o 9.36()};F.I.36=u(){H i,1q,E,13,G;A(9.1n==N){9.1n=9.D.2g(\'2d\')}9.2W=9.3E=9.L=9.D.L;9.3G=9.3V=9.Q=9.D.Q;9.60();A(!9.61()){9.62()}A(9.T!=N){9.1n.3j(9.T,0,0,9.2I(),9.2H(),0,0,9.3E,9.3V)}9.5j();A(F.3W){9.4d=19.3A(9.J.O);9.2P=19.3A(9.J.O);G=9.J;W(i=E=0,13=G.O;E<13;i=++E){1q=G[i];9.4d[i]=1q;9.2P[i]=1q}}9.1G={L:9.D.L,Q:9.D.Q};1X.6e(9.1O,9);9.1C.1g(9,9);o 9.1C=u(){}};F.I.5j=u(){9.1P=9.1n.30(0,0,9.D.L,9.D.Q);o 9.J=9.1P.1j};F.I.9S=u(){H 1q,E,13,G,Z;A(!F.3W){2w"58 4r";}9.2P=19.3A(9.J.O);G=9.J;Z=[];W(E=0,13=G.O;E<13;E++){1q=G[E];Z.1y(9.2P.1y(1q))}o Z};F.I.61=u(){o F.5T(9.D)!=N};F.I.62=u(){A(F.1Y||9.D.3b(\'1j-29-1O\')){o}o 9.D.7T(\'1j-29-1O\',9.1O)};F.I.51=u(){o 9.D.3b(\'1j-29-6p-4r\')!==N};F.I.60=u(){H 2l;A(F.1Y||9.51()){o}2l=9.4x();A(2l!==1){1o.1D("9R 2l = "+2l);9.6i=2f;9.3E=9.D.L;9.3V=9.D.Q;9.D.L=9.3E*2l;9.D.Q=9.3V*2l;9.D.6s.L=""+9.3E+"6x";9.D.6s.Q=""+9.3V+"6x";9.1n.9Q(2l,2l);9.L=9.2W=9.D.L;o 9.Q=9.3G=9.D.Q}};F.I.4x=u(){H 50,2s;2s=2y.2s||1;50=9.1n.9P||9.1n.9N||9.1n.9M||9.1n.9L||9.1n.9E||1;o 2s/50};F.I.6L=u(){o(2y.2s!=N)&&2y.2s!==1};F.I.7k=u(){A(9.51()||!9.6L()){o 1H}o 9.4z()!==N};F.I.4z=u(){A(9.T==N){o N}o 9.T.3b(\'1j-29-6p\')};F.I.4o=u(6P){H 4n;4n=9.D;9.D=6P;9.1n=9.D.2g(\'2d\');4n.5R.5O(9.D,4n);9.L=9.D.L;9.Q=9.D.Q;9.5j();o 9.1G={L:9.D.L,Q:9.D.Q}};F.I.6R=u(1C){H 11=9;A(1C==N){1C=u(){}}1M.2K(9,"6W");o 9.2u.2j(u(){11.1n.4m(11.1P,0,0);o 1C.1g(11)})};F.I.9A=u(){H i,1q,E,13,G;A(!F.3W){2w"58 4r";}G=9.6Z();W(i=E=0,13=G.O;E<13;i=++E){1q=G[i];9.J[i]=1q}o 9.1n.4m(9.1P,0,0)};F.I.9y=u(){H D,1I,i,1P,1q,J,E,13,G;D=1B.2i(\'D\');19.3S(9.D,D);D.L=9.2W;D.Q=9.3G;1I=D.2g(\'2d\');1P=1I.30(0,0,D.L,D.Q);J=1P.1j;G=9.4d;W(i=E=0,13=G.O;E<13;i=++E){1q=G[i];J[i]=1q}1I.4m(1P,0,0);9.3m={x:0,y:0};9.4f=1H;o 9.4o(D)};F.I.6Z=u(){H D,4k,1I,4N,4M,i,1P,1q,J,4j,3Y,4i,4g,L,E,1f,13,G,1Q,2k,5J;A(!F.3W){2w"58 4r";}4j=[];4i=9.3m.x;4N=4i+9.L;4g=9.3m.y;4M=4g+9.Q;A(9.4f){D=1B.2i(\'D\');D.L=9.2W;D.Q=9.3G;1I=D.2g(\'2d\');1P=1I.30(0,0,D.L,D.Q);J=1P.1j;G=9.2P;W(i=E=0,13=G.O;E<13;i=++E){1q=G[i];J[i]=1q}1I.4m(1P,0,0);3Y=1B.2i(\'D\');3Y.L=9.L;3Y.Q=9.Q;1I=3Y.2g(\'2d\');1I.3j(D,0,0,9.2W,9.3G,0,0,9.L,9.Q);J=1I.30(0,0,9.L,9.Q).1j;L=9.L}S{J=9.2P;L=9.2W}W(i=1f=0,1Q=J.O;1f<1Q;i=1f+=4){4k=1W.7x(i,L);A(((4i<=(2k=4k.x)&&2k<4N))&&((4g<=(5J=4k.y)&&5J<4M))){4j.1y(J[i],J[i+1],J[i+2],J[i+3])}}o 4j};F.I.1L=u(X,4e){9.2u.34({Y:U.1Z.5z,X:X,4e:4e});o 9};F.I.5x=u(X,K,1V,28){H i,E,G;A(!1V){1V=0;W(i=E=0,G=K.O;0<=G?EG;i=0<=G?++E:--E){1V+=K[i]}}9.2u.34({Y:U.1Z.5g,X:X,K:K,1V:1V,28:28||0});o 9};F.I.5b=u(2p,15){9.2u.34({Y:U.1Z.1J,2p:2p,15:15});o 9};F.I.4S=u(1C){H 1p;1p=1F 24(9);9.4X.1y(1p);9.2u.34({Y:U.1Z.4L});1C.1g(1p);9.2u.34({Y:U.1Z.5W});o 9};F.I.64=u(1p){o 9.65(1p)};F.I.65=u(1p){9.4Q.1y(9.3s);9.3i.1y(9.J);9.3s=1p;o 9.J=1p.J};F.I.66=u(){9.J=9.3i.67();o 9.3s=9.4Q.67()};F.I.68=u(){o 9.3s.69()};o F})();38=(u(){u 38(c){9.c=c}38.I.9x=u(){H i,22,3H,E,1f,1m,G;22={r:{},g:{},b:{}};W(i=E=0;E<=C;i=++E){22.r[i]=0;22.g[i]=0;22.b[i]=0}W(i=1f=0,G=9.c.J.O;1f0)){o}Z=[];W(E=0,13=3N.O;E<13;E++){1c=3N[E];Z.1y(6m=1F 2U(1c,u(){9.6o();o 9.2j()}))}o Z};A(F.74){(u(){A(1B.5q==="4y"){o F.5S()}S{o 1B.7r("9t",F.5S,1H)}})()}2U=(u(){H 42;42="(\\\\w+)\\\\((.*?)\\\\)";u 2U(2o,6v){9.6w=2o.3b(\'1j-29\');9.29=F(2o,6v.5w(9))}2U.I.6o=u(){H 15,3T,3U,4P,4O,m,r,3X,E,13,G,Z;9.2o=9.29.D;r=1F 6G(42,\'g\');3X=9.6w.4Z(r);A(!(3X.O>0)){o}r=1F 6G(42);Z=[];W(E=0,13=3X.O;E<13;E++){4P=3X[E];G=4P.4Z(r),m=G[0],3T=G[1],15=G[2];4O=1F 9s("o u() { 9."+3T+"("+15+"); };");4Y{3U=4O();Z.1y(3U.1g(9.29))}5B(e){Z.1y(1o.1D(e))}}o Z};2U.I.2j=u(){H 2o;2o=9.2o;o 9.29.6R(u(){o 2o.5R.5O(9.6M(),2o)})};o 2U})();F.1z=1z=(u(){u 1z(){}1z.56={};1z.14=u(X,3U){o 9.56[X]=3U};1z.2j=u(X,P,M){o 9.56[X](P,M)};o 1z})();F.23=23=(u(){u 23(){}23.9r=u(3f,3d,3Q,3P){o R.73(R.1x(3Q-3f,2)+R.1x(3P-3d,2))};23.75=u(1u,V,3M){H 2m;A(3M==N){3M=1H}2m=1u+(R.9q()*(V-1u));A(3M){o 2m.9p(3M)}S{o R.5X(2m)}};23.7j=u(B){o(0.9m*B.r)+(0.9l*B.g)+(0.9i*B.b)};23.1v=u(1h,2b,27,18,48,49){H 52,53,4a,4b,3y,3x,1v,5v,2Q,i,j,35,4c,t,3o,3f,3Q,5H,3k,3d,3P,5M,E,1f,1m,G,1Q;3o=1h[0];3k=1h[1];3f=2b[0];3d=2b[1];3Q=27[0];3P=27[1];5H=18[0];5M=18[1];1v={};3y=3r(3*(3f-3o),10);4a=3*(3Q-3f)-3y;52=5H-3o-3y-4a;3x=3*(3d-3k);4b=3*(3P-3d)-3x;53=5M-3k-3x-4b;W(i=E=0;E<63;i=++E){t=i/63;5v=R.5X((52*R.1x(t,3))+(4a*R.1x(t,2))+(3y*t)+3o);2Q=R.5X((53*R.1x(t,3))+(4b*R.1x(t,2))+(3x*t)+3k);A(48&&2Q<48){2Q=48}S A(49&&2Q>49){2Q=49}1v[5v]=2Q}A(1v.O<18[0]+1){W(i=1f=0,G=18[0];0<=G?1f<=G:1f>=G;i=0<=G?++1f:--1f){A(1v[i]==N){35=[i-1,1v[i-1]];W(j=1m=i,1Q=18[0];i<=1Q?1m<=1Q:1m>=1Q;j=i<=1Q?++1m:--1m){A(1v[j]!=N){4c=[j,1v[j]];2S}}1v[i]=35[1]+((4c[1]-35[1])/(4c[0]-35[0]))*(i-35[0])}}}A(1v[18[0]]==N){1v[18[0]]=1v[18[0]-1]}o 1v};o 23})();1w=(u(){u 1w(){}1w.5P=u(2O){H b,g,r;A(2O.7Z(0)==="#"){2O=2O.4h(1)}r=3r(2O.4h(0,2),16);g=3r(2O.4h(2,2),16);b=3r(2O.4h(4,2),16);o{r:r,g:g,b:b}};1w.9g=u(r,g,b){H d,h,l,V,1u,s;A(1i r==="2q"){g=r.g;b=r.b;r=r.r}r/=C;g/=C;b/=C;V=R.V(r,g,b);1u=R.1u(r,g,b);l=(V+1u)/2;A(V===1u){h=s=0}S{d=V-1u;s=l>0.5?d/(2-V-1u):d/(V+1u);h=(u(){39(V){1r r:o(g-b)/d+(g1){t-=1}A(t<1/6){o p+(q-p)*6*t}A(t<1/2){o q}A(t<2/3){o p+(q-p)*(2/3-t)*6}o p};1w.6j=u(r,g,b){H d,h,V,1u,s,v;r/=C;g/=C;b/=C;V=R.V(r,g,b);1u=R.1u(r,g,b);v=V;d=V-1u;s=V===0?0:d/V;A(V===1u){h=0}S{h=(u(){39(V){1r r:o(g-b)/d+(g0.4K){r=R.1x((r+0.21)/1.21,2.4)}S{r/=12.92}A(g>0.4K){g=R.1x((g+0.21)/1.21,2.4)}S{g/=12.92}A(b>0.4K){b=R.1x((b+0.21)/1.21,2.4)}S{b/=12.92}x=r*0.9d+g*0.9c+b*0.9a;y=r*0.99+g*0.98+b*0.97;z=r*0.96+g*0.94+b*0.93;o{x:x*1k,y:y*1k,z:z*1k}};1w.91=u(x,y,z){H b,g,r;x/=1k;y/=1k;z/=1k;r=(3.8Z*x)+(-1.8Y*y)+(-0.8X*z);g=(-0.8W*x)+(1.8V*y)+(0.8U*z);b=(0.8T*x)+(-0.8S*y)+(1.8P*z);A(r>0.5h){r=(1.21*R.1x(r,0.5i))-0.21}S{r*=12.92}A(g>0.5h){g=(1.21*R.1x(g,0.5i))-0.21}S{g*=12.92}A(b>0.5h){b=(1.21*R.1x(b,0.5i))-0.21}S{b*=12.92}o{r:r*C,g:g*C,b:b*C}};1w.6O=u(x,y,z){H a,b,l,5k,5l,5m;A(1i x==="2q"){y=x.y;z=x.z;x=x.x}5k=95.6T;5l=1k.0;5m=6U.6V;x/=5k;y/=5l;z/=5m;A(x>0.5n){x=R.1x(x,0.5o)}S{x=(7.5p*x)+0.2V}A(y>0.5n){y=R.1x(y,0.5o)}S{y=(7.5p*y)+0.2V}A(z>0.5n){z=R.1x(z,0.5o)}S{z=(7.5p*z)+0.2V}l=70*y-16;a=71*(x-y);b=72*(y-z);o{l:l,a:a,b:b}};1w.8O=u(l,a,b){H x,y,z;A(1i l==="2q"){a=l.a;b=l.b;l=l.l}y=(l+16)/70;x=y+(a/71);z=y-(b/72);A(x>0.5s){x=x*x*x}S{x=0.5t*(x-0.2V)}A(y>0.5s){y=y*y*y}S{y=0.5t*(y-0.2V)}A(z>0.5s){z=z*z*z}S{z=0.5t*(z-0.2V)}o{x:x*95.6T,y:y*1k.0,z:z*6U.6V}};1w.8L=u(r,g,b){H 5u;A(1i r==="2q"){g=r.g;b=r.b;r=r.r}5u=9.6n(r,g,b);o 9.6O(5u)};1w.8J=u(l,a,b){};o 1w})();1M=(u(){u 1M(){}1M.2F={};1M.7a=["7b","7c","6W","7d","7e","37"];1M.2K=u(2e,Y,1j){H 3z,E,13,G,Z;A(9.2F[Y]&&9.2F[Y].O){G=9.2F[Y];Z=[];W(E=0,13=G.O;E<13;E++){3z=G[E];A(3z.2e===N||2e.1O===3z.2e.1O){Z.1y(3z.2A.1g(2e,1j))}S{Z.1y(8I 0)}}o Z}};1M.8H=u(2e,Y,2A){H 5D,5E;A(1i 2e==="3I"){5E=2e;5D=Y;2e=N;Y=5E;2A=5D}A(5Q.1g(9.7a,Y)<0){o 1H}A(!9.2F[Y]){9.2F[Y]=[]}9.2F[Y].1y({2e:2e,2A:2A});o 2f};o 1M})();F.1M=1M;F.U=U=(u(){u U(){}U.1Z={5z:1,5g:2,4L:3,5W:4,5F:5,1J:6};U.14=u(X,7o){o F.I[X]=7o};o U})();F.1R=1R=(u(){u 1R(){}1R.7p=/(?:(?:8G|8E):\\/\\/)((?:\\w+)\\.(?:(?:\\w|\\.)+))/;1R.7v=u(1c){A(1c==N){o 1H}A(9.7s(1c)){o 1H}o 9.4D(1c.1d)};1R.7s=u(1c){H G;o(1c.5G!=N)&&((G=1c.5G.3p())===\'7M\'||G===\'7u-8D\')};1R.4D=u(7w){H 4E;4E=7w.4Z(9.7p);A(4E){o 4E[1]!==1B.8C}S{o 1H}};1R.7z=u(1d){A(9.4D(1d)){A(!F.3O.O){1o.5L("8B 3h 8z a 7D T 8y a 8x 7G. 7H: "+1d)}S{A(F.4D(F.3O)){1o.5L("8w 7u a 7D 7G W 8u 8t.");o}o""+F.3O+"?6h="+(7K(1d))}}};1R.2Y=u(1d){o""+F.3O+"?"+F.6f+"="+(7K(1d))};1R.8r=u(2R){H 4H;4H={8n:\'8m\',8l:\'8b\',8a:\'89\',83:\'82\'};2R=2R.3p();A(4H[2R]!=N){2R=4H[2R]}o"81/9h."+2R};o 1R})();F.I.80=u(){A(1i 1S!=="2J"&&1S!==N){o 9.7Y.33(9,17)}S{o 9.7W.33(9,17)}};F.I.7W=u(Y){H T;A(Y==N){Y="7V"}Y=Y.3p();T=9.5Y(Y).84("T/"+Y,"T/85-86");o 1B.87.88=T};F.I.7Y=u(2X,4J){H 5V;A(4J==N){4J=2f}4Y{5V=3l.8c(2X);A(5V.8d()&&!4J){o 1H}}5B(e){1o.1D("8e 8f 2X "+2X)}o 3l.8g(2X,9.D.8h(),u(){o 1o.1D("8i 8j 3h "+2X)})};F.I.6M=u(Y){H 1c;1c=1B.2i(\'1c\');1c.1d=9.5Y(Y);1c.L=9.1G.L;1c.Q=9.1G.Q;A(2y.2s){1c.L/=2y.2s;1c.Q/=2y.2s}o 1c};F.I.5Y=u(Y){A(Y==N){Y="7V"}Y=Y.3p();o 9.D.8k("T/"+Y)};24=(u(){u 24(c){9.c=c;9.3T=9.c;9.1a={5U:\'7P\',2x:1.0};9.8o=19.4T.2E();9.D=1i 1S!=="2J"&&1S!==N?1F 2T():1B.2i(\'D\');9.D.L=9.c.1G.L;9.D.Q=9.c.1G.Q;9.1n=9.D.2g(\'2d\');9.1n.8p(9.D.L,9.D.Q);9.1P=9.1n.30(0,0,9.D.L,9.D.Q);9.J=9.1P.1j}24.I.4S=u(2Z){o 9.c.4S.1g(9.c,2Z)};24.I.8q=u(7L){9.1a.5U=7L;o 9};24.I.2x=u(2x){9.1a.2x=2x/1k;o 9};24.I.8s=u(){H i,1T,E,G;1T=9.c.J;W(i=E=0,G=9.c.J.O;E9.c.J.O||1U<0){o{r:0,g:0,b:0,a:0}}o{r:9.c.J[1U],g:9.c.J[1U+1],b:9.c.J[1U+2],a:9.c.J[1U+3]}};1W.I.8K=u(4B,4A,B){H 76;76=9.1l+(9.c.1G.L*4*(4A*-1))+(4*4B);A(1U>9.c.J.O||1U<0){o}9.c.J[1U]=B.r;9.c.J[1U+1]=B.g;9.c.J[1U+2]=B.b;9.c.J[1U+3]=B.a;o 2f};1W.I.8M=u(x,y){H 1l;1l=9.5I(x,y,9.L);o{r:9.c.J[1l],g:9.c.J[1l+1],b:9.c.J[1l+2],a:9.c.J[1l+3]}};1W.I.8N=u(x,y,B){H 1l;1l=9.5I(x,y,9.L);9.c.J[1l]=B.r;9.c.J[1l+1]=B.g;9.c.J[1l+2]=B.b;o 9.c.J[1l+3]=B.a};o 1W})();1J=(u(){u 1J(){}1J.5r={};1J.14=u(X,2p){o 9.5r[X]=2p};1J.2j=u(1n,X,15){o 9.5r[X].33(1n,15)};o 1J})();F.1J=1J;F.1e=1e=(u(){1e.2D=F.1Y?46(\'8Q\').8R().O:4;u 1e(c){H 11=9;9.c=c;9.2n=u(){o 1e.I.2n.33(11,17)};9.3w=[];9.2L=N}1e.I.34=u(5d){A(5d==N){o}o 9.3w.1y(5d)};1e.I.2n=u(){H 1p;A(9.3w.O===0){1M.2K(9,"7d");A(9.5c!=N){9.5c.1g(9.c)}o 9}9.1t=9.3w.6F();39(9.1t.Y){1r U.1Z.4L:1p=9.c.4X.6F();9.c.64(1p);o 9.2n();1r U.1Z.5W:9.c.68();9.c.66();o 9.2n();1r U.1Z.5F:o 9.6E(9.1t.1p,9.1t.1d);1r U.1Z.1J:o 9.6D();90:o 9.6C()}};1e.I.2j=u(1C){9.5c=1C;9.2L=19.3A(9.c.J.O);o 9.2n()};1e.I.59=u(2A){H 3F,57,1K,18,f,i,54,n,1h,E,G,Z,11=9;9.4q=0;n=9.c.J.O;57=R.3B((n/4)/1e.2D);3F=57*4;54=3F+((n/4)%1e.2D)*4;Z=[];W(i=E=0,G=1e.2D;0<=G?EG;i=0<=G?++E:--E){1h=i*3F;18=1h+(i===1e.2D-1?54:3F);A(F.1Y){f=3u(u(){o 2A.1g(11,i,1h,18)});1K=f.9b();Z.1y(9.37(1K))}S{Z.1y(4v((u(i,1h,18){o u(){o 2A.1g(11,i,1h,18)}})(i,1h,18),0))}}o Z};1e.I.6C=u(){1M.2K(9.c,"7b",9.1t);A(9.1t.Y===U.1Z.5z){o 9.59(9.6u)}S{o 9.59(9.6t)}};1e.I.6D=u(){1o.1D("9e 2p "+9.1t.2p);1J.2j(9.c,9.1t.2p,9.1t.15);1o.1D("1J "+9.1t.2p+" 4R!");o 9.2n()};1e.I.6u=u(1K,1h,18){H 1j,i,2z,20,E;1o.1D("7n #"+1K+" - U: "+9.1t.X+", 9j: "+1h+", 9k: "+18);1M.2K(9.c,"7e",{7m:1K,7l:1e.2D,9n:1h,9o:18});1j={r:0,g:0,b:0,a:0};2z=1F 1W(9.c);W(i=E=1h;E<18;i=E+=4){2z.1l=i;1j.r=9.c.J[i];1j.g=9.c.J[i+1];1j.b=9.c.J[i+2];1j.a=9.c.J[i+3];20=9.1t.4e.1g(2z,1j);A(20.a==N){20.a=1j.a}9.c.J[i]=19.2c(20.r);9.c.J[i+1]=19.2c(20.g);9.c.J[i+2]=19.2c(20.b);9.c.J[i+3]=19.2c(20.a)}A(F.1Y){o 3u["7h"](1K)}S{o 9.37(1K)}};1e.I.6t=u(1K,1h,18){H K,3D,28,1N,3g,1V,i,j,k,25,n,X,1q,2z,20,E,1f,1m;X=9.1t.X;28=9.1t.28;1V=9.1t.1V;n=9.c.J.O;K=9.1t.K;3D=R.73(K.O);25=[];1o.1D("9v 25 - U: "+9.1t.X);1h=R.V(1h,9.c.1G.L*4*((3D-1)/2));18=R.1u(18,n-(9.c.1G.L*4*((3D-1)/2)));1N=(3D-1)/2;2z=1F 1W(9.c);W(i=E=1h;E<18;i=E+=4){2z.1l=i;3g=0;W(j=1f=-1N;-1N<=1N?1f<=1N:1f>=1N;j=-1N<=1N?++1f:--1f){W(k=1m=1N;1N<=-1N?1m<=-1N:1m>=-1N;k=1N<=-1N?++1m:--1m){1q=2z.7q(j,k);25[3g*3]=1q.r;25[3g*3+1]=1q.g;25[3g*3+2]=1q.b;3g++}}20=9.5x(K,25,1V,28);9.2L[i]=19.2c(20.r);9.2L[i+1]=19.2c(20.g);9.2L[i+2]=19.2c(20.b);9.2L[i+3]=9.c.J[i+3]}A(F.1Y){o 3u["7h"](1K)}S{o 9.37(1K)}};1e.I.37=u(1K){H i,E,G;A(1K>=0){1o.1D("7n #"+1K+" 4R! U: "+9.1t.X)}9.4q++;1M.2K(9.c,"37",{7m:1K,9w:9.4q,7l:1e.2D});A(9.4q===1e.2D){A(9.1t.Y===U.1Z.5g){W(i=E=0,G=9.c.J.O;0<=G?EG;i=0<=G?++E:--E){9.c.J[i]=9.2L[i]}}A(1K>=0){1o.1D("U "+9.1t.X+" 4R!")}1M.2K(9.c,"7c",9.1t);o 9.2n()}};1e.I.5x=u(K,25,1V,28){H i,1A,E,G;1A={r:0,g:0,b:0};W(i=E=0,G=K.O;0<=G?EG;i=0<=G?++E:--E){1A.r+=K[i]*25[i*3];1A.g+=K[i]*25[i*3+1];1A.b+=K[i]*25[i*3+2]}1A.r=(1A.r/1V)+28;1A.g=(1A.g/1V)+28;1A.b=(1A.b/1V)+28;o 1A};1e.I.6E=u(1p,1d){H 1c,2Y,11=9;1c=1B.2i(\'1c\');1c.5C=u(){1p.1n.3j(1c,0,0,11.c.1G.L,11.c.1G.Q);1p.1P=1p.1n.30(0,0,11.c.1G.L,11.c.1G.Q);1p.J=1p.1P.1j;11.c.J=1p.J;o 11.2n()};2Y=1R.7z(1d);o 1c.1d=2Y!=N?2Y:1d};o 1e})();F.1X=1X=(u(){u 1X(){}1X.3a={};1X.78=u(2B){o 9.3a[2B]!=N};1X.2E=u(2B){o 9.3a[2B]};1X.6e=u(X,2r){o 9.3a[X]=2r};1X.2j=u(2B,1C){H 11=9;4v(u(){o 1C.1g(11.2E(2B),11.2E(2B))},0);o 9.2E(2B)};1X.9z=u(X){A(X==N){X=1H}A(X){o 6Y 9.3a[X]}S{o 9.3a={}}};o 1X})();1z.14("7P",u(P,M){o{r:P.r,g:P.g,b:P.b}});1z.14("9B",u(P,M){o{r:(P.r*M.r)/C,g:(P.g*M.g)/C,b:(P.b*M.b)/C}});1z.14("9C",u(P,M){o{r:C-(((C-P.r)*(C-M.r))/C),g:C-(((C-P.g)*(C-M.g))/C),b:C-(((C-P.b)*(C-M.b))/C)}});1z.14("9D",u(P,M){H 1b;1b={};1b.r=M.r>1s?C-2*(C-P.r)*(C-M.r)/C:(M.r*P.r*2)/C;1b.g=M.g>1s?C-2*(C-P.g)*(C-M.g)/C:(M.g*P.g*2)/C;1b.b=M.b>1s?C-2*(C-P.b)*(C-M.b)/C:(M.b*P.b*2)/C;o 1b});1z.14("9F",u(P,M){o{r:P.r-M.r,g:P.g-M.g,b:P.b-M.b}});1z.14("9G",u(P,M){o{r:M.r+P.r,g:M.g+P.g,b:M.b+P.b}});1z.14("9H",u(P,M){o{r:1s-2*(M.r-1s)*(P.r-1s)/C,g:1s-2*(M.g-1s)*(P.g-1s)/C,b:1s-2*(M.b-1s)*(P.b-1s)/C}});1z.14("9I",u(P,M){H 1b;1b={};1b.r=M.r>1s?C-((C-M.r)*(C-(P.r-1s)))/C:(M.r*(P.r+1s))/C;1b.g=M.g>1s?C-((C-M.g)*(C-(P.g-1s)))/C:(M.g*(P.g+1s))/C;1b.b=M.b>1s?C-((C-M.b)*(C-(P.b-1s)))/C:(M.b*(P.b+1s))/C;o 1b});1z.14("9J",u(P,M){o{r:M.r>P.r?M.r:P.r,g:M.g>P.g?M.g:P.g,b:M.b>P.b?M.b:P.b}});1z.14("9K",u(P,M){o{r:M.r>P.r?P.r:M.r,g:M.g>P.g?P.g:M.g,b:M.b>P.b?P.b:M.b}});U.14("4G",u(){H 3c;A(17.O===1){3c=1w.5P(17[0])}S{3c={r:17[0],g:17[1],b:17[2]}}o 9.1L("4G",u(B){B.r=3c.r;B.g=3c.g;B.b=3c.b;B.a=C;o B})});U.14("6I",u(K){K=R.3B(C*(K/1k));o 9.1L("6I",u(B){B.r+=K;B.g+=K;B.b+=K;o B})});U.14("6H",u(K){K*=-0.9O;o 9.1L("6H",u(B){H V;V=R.V(B.r,B.g,B.b);A(B.r!==V){B.r+=(V-B.r)*K}A(B.g!==V){B.g+=(V-B.g)*K}A(B.b!==V){B.b+=(V-B.b)*K}o B})});U.14("6B",u(K){K*=-1;o 9.1L("6B",u(B){H 3n,2v,V;V=R.V(B.r,B.g,B.b);2v=(B.r+B.g+B.b)/3;3n=((R.2C(V-2v)*2/C)*K)/1k;A(B.r!==V){B.r+=(V-B.r)*3n}A(B.g!==V){B.g+=(V-B.g)*3n}A(B.b!==V){B.b+=(V-B.b)*3n}o B})});U.14("7O",u(K){o 9.1L("7O",u(B){H 2v;2v=23.7j(B);B.r=2v;B.g=2v;B.b=2v;o B})});U.14("7F",u(K){K=R.1x((K+1k)/1k,2);o 9.1L("7F",u(B){B.r/=C;B.r-=0.5;B.r*=K;B.r+=0.5;B.r*=C;B.g/=C;B.g-=0.5;B.g*=K;B.g+=0.5;B.g*=C;B.b/=C;B.b-=0.5;B.b*=K;B.b+=0.5;B.b*=C;o B})});U.14("7E",u(K){o 9.1L("7E",u(B){H h,2M,26;2M=1w.6j(B.r,B.g,B.b);h=2M.h*1k;h+=R.2C(K);h=h%1k;h/=1k;2M.h=h;26=1w.6l(2M.h,2M.s,2M.v);26.a=B.a;o 26})});U.14("6y",u(){H 31,26;A(17.O===2){26=1w.5P(17[0]);31=17[1]}S A(17.O===4){26={r:17[0],g:17[1],b:17[2]};31=17[3]}o 9.1L("6y",u(B){B.r-=(B.r-26.r)*(31/1k);B.g-=(B.g-26.g)*(31/1k);B.b-=(B.b-26.b)*(31/1k);o B})});U.14("6d",u(){o 9.1L("6d",u(B){B.r=C-B.r;B.g=C-B.g;B.b=C-B.b;o B})});U.14("6c",u(K){A(K==N){K=1k}K/=1k;o 9.1L("6c",u(B){B.r=R.1u(C,(B.r*(1-(0.a2*K)))+(B.g*(0.a3*K))+(B.b*(0.a4*K)));B.g=R.1u(C,(B.r*(0.a5*K))+(B.g*(1-(0.a6*K)))+(B.b*(0.a7*K)));B.b=R.1u(C,(B.r*(0.a8*K))+(B.g*(0.a9*K))+(B.b*(1-(0.aa*K))));o B})});U.14("6b",u(K){o 9.1L("6b",u(B){B.r=R.1x(B.r/C,K)*C;B.g=R.1x(B.g/C,K)*C;B.b=R.1x(B.b/C,K)*C;o B})});U.14("7y",u(K){K=R.2C(K)*2.55;o 9.1L("7y",u(B){H 2m;2m=23.75(K*-1,K);B.r+=2m;B.g+=2m;B.b+=2m;o B})});U.14("77",u(K){K=R.2C(K)*2.55;o 9.1L("77",u(B){A(B.r>C-K){B.r=C}S A(B.rC-K){B.g=C}S A(B.gC-K){B.b=C}S A(B.b0){B.r+=(C-B.r)*1a.41}S{B.r-=B.r*R.2C(1a.41)}}A(1a.43!=N){A(1a.43>0){B.g+=(C-B.g)*1a.43}S{B.g-=B.g*R.2C(1a.43)}}A(1a.44!=N){A(1a.44>0){B.b+=(C-B.b)*1a.44}S{B.b-=B.b*R.2C(1a.44)}}o B})});U.14("45",u(){H 1v,2h,2a,2b,27,18,i,1h,E,1f,G,1Q;2h=17[0],2a=2<=17.O?5f.1g(17,1):[];A(1i 2h==="3I"){2h=2h.an("")}A(2h[0]==="v"){2h=[\'r\',\'g\',\'b\']}A(2a.O<3||2a.O>4){2w"47 ao ap 17 3h 45 3T";}1h=2a[0];2b=2a[1];27=2a.O===4?2a[2]:2a[1];18=2a[2a.O-1];1v=23.1v(1h,2b,27,18,0,C);A(1h[0]>0){W(i=E=0,G=1h[0];0<=G?EG;i=0<=G?++E:--E){1v[i]=1h[1]}}A(18[0]=C;i=1Q<=C?++1f:--1f){1v[i]=18[1]}}o 9.1L("45",u(B){H 1m,2k;W(i=1m=0,2k=2h.O;0<=2k?1m<2k:1m>2k;i=0<=2k?++1m:--1m){B[2h[i]]=1v[B[2h[i]]]}o B})});U.14("aq",u(K){H 2b,27,p;p=R.2C(K)/1k;2b=[0,C*p];27=[C-(C*p),C];A(K<0){2b=2b.79();27=27.79()}o 9.45(\'26\',[0,0],2b,27,[C,C])});F.1J.14("4V",u(L,Q,x,y){H D,1I;A(x==N){x=0}A(y==N){y=0}A(1i 1S!=="2J"&&1S!==N){D=1F 2T(L,Q)}S{D=1B.2i(\'D\');19.3S(9.D,D);D.L=L;D.Q=Q}1I=D.2g(\'2d\');1I.3j(9.D,x,y,L,Q,0,0,L,Q);9.3m={x:x,y:y};9.7S=2f;o 9.4o(D)});F.1J.14("4F",u(1E){H D,1I;A(1E==N){1E=N}A(1E===N||((1E.L==N)&&(1E.Q==N))){1o.7B("47 6g av 1G 7J W 4F");o}A(1E.L==N){1E.L=9.D.L*1E.Q/9.D.Q}S A(1E.Q==N){1E.Q=9.D.Q*1E.L/9.D.L}A(1i 1S!=="2J"&&1S!==N){D=1F 2T(1E.L,1E.Q)}S{D=1B.2i(\'D\');19.3S(9.D,D);D.L=1E.L;D.Q=1E.Q}1I=D.2g(\'2d\');1I.3j(9.D,0,0,9.D.L,9.D.Q,0,0,1E.L,1E.Q);9.4f=2f;o 9.4o(D)});F.U.14("4V",u(){o 9.5b("4V",4u.I.2G.1g(17,0))});F.U.14("4F",u(){o 9.5b("4F",4u.I.2G.1g(17,0))})}).1g(9);', 62, 652, '|||||||||this|||||||||||||||return||||||function||||||if|rgba|255|canvas|_i|Caman|_ref|var|prototype|pixelData|adjust|width|rgbaParent|null|length|rgbaLayer|height|Math|else|image|Filter|max|for|name|type|_results||_this||_len|register|args||arguments|end|Util|options|result|img|src|Renderer|_j|call|start|typeof|data|100|loc|_k|context|Log|layer|pixel|case|128|currentJob|min|bezier|Convert|pow|push|Blender|val|document|callback|debug|newDims|new|dimensions|false|ctx|Plugin|bnum|process|Event|builder|id|imageData|_ref1|IO|exports|parentData|newLoc|divisor|PixelInfo|Store|NodeJS|Type|res|055|levels|Calculate|Layer|kernel|rgb|ctrl2|bias|caman|cps|ctrl1|clampRGB||target|true|getContext|chans|createElement|execute|_ref2|ratio|rand|processNext|ele|plugin|object|obj|devicePixelRatio|initObj|renderer|avg|throw|opacity|window|pixelInfo|fn|search|abs|Blocks|get|events|slice|imageHeight|imageWidth|undefined|trigger|modPixelData|hsv|layerData|hex|originalPixelData|curveY|lang|break|Canvas|CamanParser|1379310345|originalWidth|file|proxyUrl|cb|getImageData|level|Image|apply|add|leftCoord|finishInit|blockFinished|Analyze|switch|items|getAttribute|color|y1|chan|x1|builderIndex|to|pixelStack|drawImage|y0|fs|cropCoordinates|amt|x0|toLowerCase|opts|parseInt|currentLayer|attr|Fiber|imageLoaded|renderQueue|Cy|Cx|event|dataArray|floor|key|adjustSize|preScaledWidth|blockN|originalHeight|numPixels|string|Logger|copy|prop|getFloat|imgs|remoteProxy|y2|x2|continue|copyAttributes|filter|func|preScaledHeight|allowRevert|unparsedInstructions|scaledCanvas|hueToRGB|imageUrl|red|INST_REGEX|green|blue|curves|require|Invalid|lowBound|highBound|Bx|By|rightCoord|initializedPixelData|processFn|resized|startY|substr|startX|pixels|coord|dest|putImageData|oldCanvas|replaceCanvas|Root|blocksDone|disabled|root|sel|Array|setTimeout|in|hiDPIRatio|complete|hiDPIReplacement|vert|horiz|__hasProp|isURLRemote|matches|resize|fillColor|langToExt|initType|overwrite|04045|LayerDequeue|endY|endX|instFunc|inst|layerStack|finished|newLayer|uniqid|nodeName|crop|except|canvasQueue|try|match|backingStoreRatio|hiDPIDisabled|Ax|Ay|lastBlockN||blenders|blockPixelLength|Revert|eachBlock|value|processPlugin|finishedFn|job|listener|__slice|Kernel|0031308|4166666667|reloadCanvasData|whiteX|whiteY|whiteZ|008856451679|3333333333|787037037|readyState|plugins|2068965517|1284185493|xyz|curveX|bind|processKernel|naturalWidth|Single|waitForImageLoaded|catch|onload|_fn|_type|LoadOverlay|crossOrigin|x3|coordinatesToLocation|_ref3|console|info|y3|imageAdjustments|replaceChild|hexToRGB|__indexOf|parentNode|DOMUpdated|getAttrId|blendingMode|stats|LayerFinished|round|toBase64|version|hiDPIAdjustments|hasId|assignId|1000|executeLayer|pushContext|popContext|pop|applyCurrentLayer|applyToParent|node|gamma|sepia|invert|put|proxyParam|or|camanProxyUrl|scaled|rgbToHSV|initNode|hsvToRGB|parser|rgbToXYZ|parse|hidpi|initImage|initCanvas|style|renderKernel|renderBlock|ready|dataStr|px|colorize|Uint8Array|loaded|vibrance|executeFilter|executePlugin|loadOverlay|shift|RegExp|saturation|brightness|Width|domIsLoaded|hiDPICapable|toImage|Height|xyzToLab|newCanvas|parseArguments|render|setup|047|108|883|renderStart|err|delete|originalVisiblePixels|116|500|200|sqrt|autoload|randomRange|nowLoc|clip|has|reverse|types|processStart|processComplete|renderFinished|blockStarted|release|DOM|yield|initialized|luminance|needsHiDPISwap|totalBlocks|blockNum|Block|filterFunc|domainRegex|getPixelRelative|addEventListener|corsEnabled|swapped|use|isRemote|url|locationToCoordinates|noise|remoteCheck|from|error|log|remote|hue|contrast|proxy|URL|isImageLoaded|given|encodeURIComponent|mode|anonymous|date|greyscale|normal|item|setInitObject|cropped|setAttribute|channels|png|browserSave|DEBUG|nodeSave|charAt|save|proxies|js|javascript|replace|octet|stream|location|href|pl|perl|py|statSync|isFile|Creating|output|writeFile|toBuffer|Finished|writing|toDataURL|python|rb|ruby|layerID|createImageData|setBlendingMode|useProxy|copyParent|images|loading|overlayImage|Cannot|configured|without|load|warn|Attempting|domain|credentials|https|locationXY|http|listen|void|labToRGB|putPixelRelative|rgbToLab|getPixel|putPixel|labToXYZ|0570|os|cpus|2040|0557|0415|8758|9689|4986|5372|2406|default|xyzToRGB||9505|1192||0193|0722|7152|2126|1805|run|3576|4124|Executing|hslToRGB|rgbToHSL|caman_proxy|114|Start|End|587|299|startPixel|endPixel|toFixed|random|distance|Function|DOMContentLoaded|querySelectorAll|Rendering|blocksFinished|calculateLevels|reset|flush|revert|multiply|screen|overlay|backingStorePixelRatio|difference|addition|exclusion|softLight|lighten|darken|oBackingStorePixelRatio|msBackingStorePixelRatio|mozBackingStorePixelRatio|01|webkitBackingStorePixelRatio|scale|HiDPI|resetOriginalPixelData|naturalHeight|using|detected|Remote|onerror|Initializing|initialization|find|not|607|769|189|349|314|168|272|534|869|Could|readystatechange|analyze|isNaN|instanceof|Released|Version|toString|2013|fibers|nodeValue|attributes|split|number|of|exposure|extend|querySelector|hasOwnProperty|indexOf|missing'.split('|'), 0, {})) \ No newline at end of file diff --git a/microscopy/old_microscopy/canvas2image.js b/microscopy/old_microscopy/canvas2image.js index f90c5bbe..e5b5f9bf 100644 --- a/microscopy/old_microscopy/canvas2image.js +++ b/microscopy/old_microscopy/canvas2image.js @@ -6,230 +6,242 @@ var Canvas2Image = (function() { - // check if we have canvas support - var bHasCanvas = false; - var oCanvas = document.createElement("canvas"); - if (oCanvas.getContext("2d")) { - bHasCanvas = true; - } - - // no canvas, bail out. - if (!bHasCanvas) { - return { - saveAsBMP : function(){}, - saveAsPNG : function(){}, - saveAsJPEG : function(){} - } - } - - var bHasImageData = !!(oCanvas.getContext("2d").getImageData); - var bHasDataURL = !!(oCanvas.toDataURL); - var bHasBase64 = !!(window.btoa); - - var strDownloadMime = "image/octet-stream"; - - // ok, we're good - var readCanvasData = function(oCanvas) { - var iWidth = parseInt(oCanvas.width); - var iHeight = parseInt(oCanvas.height); - return oCanvas.getContext("2d").getImageData(0,0,iWidth,iHeight); - } - - // base64 encodes either a string or an array of charcodes - var encodeData = function(data) { - var strData = ""; - if (typeof data == "string") { - strData = data; - } else { - var aData = data; - for (var i=0;i object containing the imagedata - var makeImageObject = function(strSource) { - var oImgElement = document.createElement("img"); - oImgElement.src = strSource; - return oImgElement; - } - - var scaleCanvas = function(oCanvas, iWidth, iHeight) { - if (iWidth && iHeight) { - var oSaveCanvas = document.createElement("canvas"); - oSaveCanvas.width = iWidth; - oSaveCanvas.height = iHeight; - oSaveCanvas.style.width = iWidth+"px"; - oSaveCanvas.style.height = iHeight+"px"; - - var oSaveCtx = oSaveCanvas.getContext("2d"); - - oSaveCtx.drawImage(oCanvas, 0, 0, oCanvas.width, oCanvas.height, 0, 0, iWidth, iHeight); - return oSaveCanvas; - } - return oCanvas; - } - - return { - - saveAsPNG : function(oCanvas, bReturnImg, iWidth, iHeight) { - if (!bHasDataURL) { - return false; - } - var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight); - var strData = oScaledCanvas.toDataURL("image/png"); - if (bReturnImg) { - return makeImageObject(strData); - } else { - saveFile(strData.replace("image/png", strDownloadMime)); - } - return true; - }, - - saveAsJPEG : function(oCanvas, bReturnImg, iWidth, iHeight) { - if (!bHasDataURL) { - return false; - } - - var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight); - var strMime = "image/jpeg"; - var strData = oScaledCanvas.toDataURL(strMime); - - // check if browser actually supports jpeg by looking for the mime type in the data uri. - // if not, return false - if (strData.indexOf(strMime) != 5) { - return false; - } - - if (bReturnImg) { - return makeImageObject(strData); - } else { - saveFile(strData.replace(strMime, strDownloadMime)); - } - return true; - }, - - saveAsBMP : function(oCanvas, bReturnImg, iWidth, iHeight) { - if (!(bHasImageData && bHasBase64)) { - return false; - } - - var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight); - - var oData = readCanvasData(oScaledCanvas); - var strImgData = createBMP(oData); - if (bReturnImg) { - return makeImageObject(makeDataURI(strImgData, "image/bmp")); - } else { - saveFile(makeDataURI(strImgData, strDownloadMime)); - } - return true; - } - }; + // check if we have canvas support + var bHasCanvas = false; + var oCanvas = document.createElement("canvas"); + if (oCanvas.getContext("2d")) { + bHasCanvas = true; + } + + // no canvas, bail out. + if (!bHasCanvas) { + return { + saveAsBMP: function() {}, + saveAsPNG: function() {}, + saveAsJPEG: function() {} + } + } + + var bHasImageData = !!(oCanvas.getContext("2d").getImageData); + var bHasDataURL = !!(oCanvas.toDataURL); + var bHasBase64 = !!(window.btoa); + + var strDownloadMime = "image/octet-stream"; + + // ok, we're good + var readCanvasData = function(oCanvas) { + var iWidth = parseInt(oCanvas.width); + var iHeight = parseInt(oCanvas.height); + return oCanvas.getContext("2d").getImageData(0, 0, iWidth, iHeight); + } + + // base64 encodes either a string or an array of charcodes + var encodeData = function(data) { + var strData = ""; + if (typeof data == "string") { + strData = data; + } else { + var aData = data; + for (var i = 0; i < aData.length; i++) { + strData += String.fromCharCode(aData[i]); + } + } + return btoa(strData); + } + + // creates a base64 encoded string containing BMP data + // takes an imagedata object as argument + var createBMP = function(oData) { + var aHeader = []; + + var iWidth = oData.width; + var iHeight = oData.height; + + aHeader.push(0x42); // magic 1 + aHeader.push(0x4D); + + var iFileSize = iWidth * iHeight * 3 + 54; // total header size = 54 bytes + aHeader.push(iFileSize % 256); + iFileSize = Math.floor(iFileSize / 256); + aHeader.push(iFileSize % 256); + iFileSize = Math.floor(iFileSize / 256); + aHeader.push(iFileSize % 256); + iFileSize = Math.floor(iFileSize / 256); + aHeader.push(iFileSize % 256); + + aHeader.push(0); // reserved + aHeader.push(0); + aHeader.push(0); // reserved + aHeader.push(0); + + aHeader.push(54); // dataoffset + aHeader.push(0); + aHeader.push(0); + aHeader.push(0); + + var aInfoHeader = []; + aInfoHeader.push(40); // info header size + aInfoHeader.push(0); + aInfoHeader.push(0); + aInfoHeader.push(0); + + var iImageWidth = iWidth; + aInfoHeader.push(iImageWidth % 256); + iImageWidth = Math.floor(iImageWidth / 256); + aInfoHeader.push(iImageWidth % 256); + iImageWidth = Math.floor(iImageWidth / 256); + aInfoHeader.push(iImageWidth % 256); + iImageWidth = Math.floor(iImageWidth / 256); + aInfoHeader.push(iImageWidth % 256); + + var iImageHeight = iHeight; + aInfoHeader.push(iImageHeight % 256); + iImageHeight = Math.floor(iImageHeight / 256); + aInfoHeader.push(iImageHeight % 256); + iImageHeight = Math.floor(iImageHeight / 256); + aInfoHeader.push(iImageHeight % 256); + iImageHeight = Math.floor(iImageHeight / 256); + aInfoHeader.push(iImageHeight % 256); + + aInfoHeader.push(1); // num of planes + aInfoHeader.push(0); + + aInfoHeader.push(24); // num of bits per pixel + aInfoHeader.push(0); + + aInfoHeader.push(0); // compression = none + aInfoHeader.push(0); + aInfoHeader.push(0); + aInfoHeader.push(0); + + var iDataSize = iWidth * iHeight * 3; + aInfoHeader.push(iDataSize % 256); + iDataSize = Math.floor(iDataSize / 256); + aInfoHeader.push(iDataSize % 256); + iDataSize = Math.floor(iDataSize / 256); + aInfoHeader.push(iDataSize % 256); + iDataSize = Math.floor(iDataSize / 256); + aInfoHeader.push(iDataSize % 256); + + for (var i = 0; i < 16; i++) { + aInfoHeader.push(0); // these bytes not used + } + + var iPadding = (4 - ((iWidth * 3) % 4)) % 4; + + var aImgData = oData.data; + + var strPixelData = ""; + var y = iHeight; + do { + var iOffsetY = iWidth * (y - 1) * 4; + var strPixelRow = ""; + for (var x = 0; x < iWidth; x++) { + var iOffsetX = 4 * x; + + strPixelRow += String.fromCharCode(aImgData[iOffsetY + iOffsetX + 2]); + strPixelRow += String.fromCharCode(aImgData[iOffsetY + iOffsetX + 1]); + strPixelRow += String.fromCharCode(aImgData[iOffsetY + iOffsetX]); + } + for (var c = 0; c < iPadding; c++) { + strPixelRow += String.fromCharCode(0); + } + strPixelData += strPixelRow; + } while (--y); + + var strEncoded = encodeData(aHeader.concat(aInfoHeader)) + encodeData(strPixelData); + + return strEncoded; + } + + + // sends the generated file to the client + var saveFile = function(strData) { + document.location.href = strData; + } + + var makeDataURI = function(strData, strMime) { + return "data:" + strMime + ";base64," + strData; + } + + // generates a object containing the imagedata + var makeImageObject = function(strSource) { + var oImgElement = document.createElement("img"); + oImgElement.src = strSource; + return oImgElement; + } + + var scaleCanvas = function(oCanvas, iWidth, iHeight) { + if (iWidth && iHeight) { + var oSaveCanvas = document.createElement("canvas"); + oSaveCanvas.width = iWidth; + oSaveCanvas.height = iHeight; + oSaveCanvas.style.width = iWidth + "px"; + oSaveCanvas.style.height = iHeight + "px"; + + var oSaveCtx = oSaveCanvas.getContext("2d"); + + oSaveCtx.drawImage(oCanvas, 0, 0, oCanvas.width, oCanvas.height, 0, 0, iWidth, iHeight); + return oSaveCanvas; + } + return oCanvas; + } + + return { + + saveAsPNG: function(oCanvas, bReturnImg, iWidth, iHeight) { + if (!bHasDataURL) { + return false; + } + var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight); + var strData = oScaledCanvas.toDataURL("image/png"); + if (bReturnImg) { + return makeImageObject(strData); + } else { + saveFile(strData.replace("image/png", strDownloadMime)); + } + return true; + }, + + saveAsJPEG: function(oCanvas, bReturnImg, iWidth, iHeight) { + if (!bHasDataURL) { + return false; + } + + var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight); + var strMime = "image/jpeg"; + var strData = oScaledCanvas.toDataURL(strMime); + + // check if browser actually supports jpeg by looking for the mime type in the data uri. + // if not, return false + if (strData.indexOf(strMime) != 5) { + return false; + } + + if (bReturnImg) { + return makeImageObject(strData); + } else { + saveFile(strData.replace(strMime, strDownloadMime)); + } + return true; + }, + + saveAsBMP: function(oCanvas, bReturnImg, iWidth, iHeight) { + if (!(bHasImageData && bHasBase64)) { + return false; + } + + var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight); + + var oData = readCanvasData(oScaledCanvas); + var strImgData = createBMP(oData); + if (bReturnImg) { + return makeImageObject(makeDataURI(strImgData, "image/bmp")); + } else { + saveFile(makeDataURI(strImgData, strDownloadMime)); + } + return true; + } + }; })(); \ No newline at end of file diff --git a/microscopy/old_microscopy/jquery-1.7.2.js b/microscopy/old_microscopy/jquery-1.7.2.js index 3774ff98..2f68f07a 100644 --- a/microscopy/old_microscopy/jquery-1.7.2.js +++ b/microscopy/old_microscopy/jquery-1.7.2.js @@ -13,9392 +13,9538 @@ * * Date: Wed Mar 21 12:46:34 2012 -0700 */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; - - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } - - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } - - chainable = 1; - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - fired = true; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - pixelMargin: true - }; - - // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead - jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, - paddingMarginBorderVisibility, paddingMarginBorder, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - paddingMarginBorder = "padding:0;margin:0;border:"; - positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; - paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; - style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; - html = "
" + - "" + - "
"; - - container = document.createElement("div"); - container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
t
"; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - div.innerHTML = ""; - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.width = div.style.padding = "1px"; - div.style.border = 0; - div.style.overflow = "hidden"; - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - } - - div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - if ( window.getComputedStyle ) { - div.style.marginTop = "1%"; - support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; - } - - if ( typeof container.style.zoom !== "undefined" ) { - container.style.zoom = 1; - } - - body.removeChild( container ); - marginDiv = div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } - - parts[1] = value; - this.each(function() { - var self = jQuery( this ); - - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise( object ); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, isBool, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); - - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true, - coords: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: selector && quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process events on disabled elements (#6911, #8165) - if ( cur.disabled !== true ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} -// Expose origPOS -// "global" as in regardless of relation to brackets/parens -Expr.match.globalPOS = origPOS; - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.globalPOS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*", "" ], - legend: [ 1, "
", "
" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - col: [ 2, "", "
" ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and