Browse Source

Merge pull request #745 from Johann-S/js-refactor

Js refactor
pull/747/head
XhmikosR 10 years ago
parent
commit
ec4b381561
  1. 1
      Gruntfile.js
  2. 30
      js/common.js
  3. 3
      js/push.js
  4. 18
      js/sliders.js
  5. 16
      js/toggles.js

1
Gruntfile.js

@ -50,6 +50,7 @@ module.exports = function (grunt) {
banner: '<%= banner %>'
},
src: [
'js/common.js',
'js/modals.js',
'js/popovers.js',
'js/push.js',

30
js/common.js

@ -0,0 +1,30 @@
/* ========================================================================
* Ratchet: common.js v2.0.2
* http://goratchet.com/
* ========================================================================
* Copyright 2015 Connor Sears
* Licensed under MIT (https://github.com/twbs/ratchet/blob/master/LICENSE)
* ======================================================================== */
!(function () {
'use strict';
// Create Ratchet namespace
if (typeof window.RATCHET === 'undefined') {
window.RATCHET = {};
}
// Original script from http://davidwalsh.name/vendor-prefix
window.RATCHET.getBrowserCapabilities = (function () {
var styles = window.getComputedStyle(document.documentElement, '');
var pre = (Array.prototype.slice
.call(styles)
.join('')
.match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])
)[1];
return {
prefix: '-' + pre + '-',
transform: pre[0].toUpperCase() + pre.substr(1) + 'Transform'
};
})();
}());

3
js/push.js

@ -502,6 +502,9 @@
}
});
window.addEventListener('popstate', popstate);
// TODO : Remove this line in the next major version
window.PUSH = PUSH;
window.RATCHET.push = PUSH;
}());

18
js/sliders.js

@ -25,22 +25,8 @@
var scrollableArea;
var startedMoving;
// Original script from http://davidwalsh.name/vendor-prefix
var getBrowserCapabilities = (function () {
var styles = window.getComputedStyle(document.documentElement, '');
var pre = (Array.prototype.slice
.call(styles)
.join('')
.match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])
)[1];
return {
prefix: '-' + pre + '-',
transform: pre[0].toUpperCase() + pre.substr(1) + 'Transform'
};
})();
var transformPrefix = getBrowserCapabilities.prefix;
var transformProperty = getBrowserCapabilities.transform;
var transformPrefix = window.RATCHET.getBrowserCapabilities.prefix;
var transformProperty = window.RATCHET.getBrowserCapabilities.transform;
var getSlider = function (target) {
var i;

16
js/toggles.js

@ -14,21 +14,7 @@
var touchMove = false;
var distanceX = false;
var toggle = false;
// Original script from http://davidwalsh.name/vendor-prefix
var getBrowserCapabilities = (function () {
var styles = window.getComputedStyle(document.documentElement, '');
var pre = (Array.prototype.slice
.call(styles)
.join('')
.match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])
)[1];
return {
transform: pre[0].toUpperCase() + pre.substr(1) + 'Transform'
};
})();
var transformProperty = getBrowserCapabilities.transform;
var transformProperty = window.RATCHET.getBrowserCapabilities.transform;
var findToggle = function (target) {
var i;

Loading…
Cancel
Save