Selleck-molecular Library Warehousing Instock-js

Source: Internet
Author: User

Generated by Coffeescript 1.10.0var model, model, bind = function (fn, me) {return function () {return fn.apply (me, Argu ments); };  };model = null;$ (function () {var dropZone;  Model = new Model ();  Ko.applybindings (model);  DropZone = document.getElementById (' drop-zone ');  Dropzone.addeventlistener (' DragEnter ', model.stoppropagation);  Dropzone.addeventlistener (' dragover ', model.stoppropagation); return dropzone.addeventlistener (' drop ', model.processdrop);});    Model = (function () {function Model () {this.instock = Bind (this.instock, this);  This.processdrop = Bind (this.processdrop, this);  } Model.prototype.racks = Ko.observablearray ();  Model.prototype.cat = ";    Model.prototype.stopPropagation = function (e) {e.stoppropagation ();  return E.preventdefault ();  };    Model.prototype.processDrop = function (e) {var file, reader;    This.stoppropagation (e);    File = e.datatransfer.files[0]; If (file.name.match (/^s\d{4}.*\.csv$/i)) {$ (' #fileInfo '). text (file.name);      This.cat = file.name.substring (0, 5). touppercase ();      reader = new FileReader (); Reader.onload = (function (_this) {return function () {var hasnoread, i, j, len, len1, plate, platerow, RA          ck, ref;          Rack = new Codelibrack ();          Rack.loadfromcsv (reader.result);          _this.racks.removeall ();          _this.racks.push (rack);          Hasnoread = false;          ref = rack.plates;            For (i = 0, len = ref.length; i < len; i++) {platerow = ref[i];              For (j = 0, len1 = platerow.length; J < len1; j + +) {plate = platerow[j];              If (' No Read ' = = = Plate.code) {hasnoread = true;        }}} return $ (' #inStockButton '). prop (' disabled ', hasnoread);      };      }) (this);    return Reader.readastext (file);      } else {$ (' #fileInfo '). text (' Invalid file ');      $ (' #inStockButton '). prop (' disabled ', true);   return This.racks.removeAll (); }  };    Model.prototype.inStock = function () {var codes, i, j, len, len1, plate, platerow, racks, ref;    codes = [];    Racks = Ko.mapping.toJS (this.racks);      If (racks.length) {ref = racks[0].plates;        For (i = 0, len = ref.length; i < len; i++) {platerow = ref[i];          For (j = 0, len1 = platerow.length; J < len1; j + +) {plate = platerow[j];          If (plate.code.match (/^\d+$/)) {codes.push (plate.code); }}} return $.postjson (' doinstock.jhtml ', {cat:this.cat, codes:codes}). done ((func          tion (_this) {return function (json) {if (json.error) {return alert (json.error);          } else {return alert (' upload succeeded ');      }        };    }) (this));  }  }; Return Model;}) ();

Selleck-molecular Library Warehousing Instock-js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.