Browse Source

* code style

experimental
RubaXa 9 years ago
parent
commit
b1defd32ff
  1. 9
      Sortable.js
  2. 2
      Sortable.min.js
  3. 108
      knockout-sortable.js

9
Sortable.js

@ -4,7 +4,6 @@
* @license MIT
*/
(function (factory) {
"use strict";
@ -24,10 +23,10 @@
})(function () {
"use strict";
if (typeof window == "undefined" || typeof window.document == "undefined") {
return function() {
throw new Error( "Sortable.js requires a window with a document" );
}
if (typeof window == "undefined" || !window.document) {
return function SortableError() {
throw new Error("Sortable.js requires a window with a document");
};
}
var dragEl,

2
Sortable.min.js vendored

File diff suppressed because one or more lines are too long

108
knockout-sortable.js

@ -1,55 +1,61 @@
/*global ko*/
(function (factory) {
"use strict";
//get ko ref via global or require
var koRef;
if (typeof ko !== 'undefined') {
//global ref already defined
koRef = ko;
}
else if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
//commonjs / node.js
koRef = require('knockout');
}
//get sortable ref via global or require
var sortableRef;
if (typeof Sortable !== 'undefined') {
//global ref already defined
sortableRef = Sortable;
}
else if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
//commonjs / node.js
sortableRef = require('sortablejs');
}
//use references if we found them
if (koRef !== undefined && sortableRef !== undefined) {
factory(koRef, sortableRef);
}
//if both references aren't found yet, get via AMD if available
else if (typeof define === 'function' && define.amd){
//we may have a reference to only 1, or none
if (koRef !== undefined && sortableRef === undefined) {
define(['./Sortable'], function(amdSortableRef){ factory(koRef, amdSortableRef); });
}
else if (koRef === undefined && sortableRef !== undefined) {
define(['knockout'], function(amdKnockout){ factory(amdKnockout, sortableRef); });
}
else if (koRef === undefined && sortableRef === undefined) {
define(['knockout', './Sortable'], factory);
}
}
//no more routes to get references
else {
//report specific error
if (koRef !== undefined && sortableRef === undefined) {
throw new Error('knockout-sortable could not get reference to Sortable');
}
else if (koRef === undefined && sortableRef !== undefined) {
throw new Error('knockout-sortable could not get reference to Knockout');
}
else if (koRef === undefined && sortableRef === undefined) {
throw new Error('knockout-sortable could not get reference to Knockout or Sortable');
}
}
"use strict";
//get ko ref via global or require
var koRef;
if (typeof ko !== 'undefined') {
//global ref already defined
koRef = ko;
}
else if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
//commonjs / node.js
koRef = require('knockout');
}
//get sortable ref via global or require
var sortableRef;
if (typeof Sortable !== 'undefined') {
//global ref already defined
sortableRef = Sortable;
}
else if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
//commonjs / node.js
sortableRef = require('sortablejs');
}
//use references if we found them
if (koRef !== undefined && sortableRef !== undefined) {
factory(koRef, sortableRef);
}
//if both references aren't found yet, get via AMD if available
else if (typeof define === 'function' && define.amd) {
//we may have a reference to only 1, or none
if (koRef !== undefined && sortableRef === undefined) {
define(['./Sortable'], function (amdSortableRef) {
factory(koRef, amdSortableRef);
});
}
else if (koRef === undefined && sortableRef !== undefined) {
define(['knockout'], function (amdKnockout) {
factory(amdKnockout, sortableRef);
});
}
else if (koRef === undefined && sortableRef === undefined) {
define(['knockout', './Sortable'], factory);
}
}
//no more routes to get references
else {
//report specific error
if (koRef !== undefined && sortableRef === undefined) {
throw new Error('knockout-sortable could not get reference to Sortable');
}
else if (koRef === undefined && sortableRef !== undefined) {
throw new Error('knockout-sortable could not get reference to Knockout');
}
else if (koRef === undefined && sortableRef === undefined) {
throw new Error('knockout-sortable could not get reference to Knockout or Sortable');
}
}
})(function (ko, Sortable) {
"use strict";

Loading…
Cancel
Save