Skip to content

Commit

Permalink
Merge pull request malihu#264 from xqwzts/node-nwjs-support
Browse files Browse the repository at this point in the history
nwjs/Browserify Support
  • Loading branch information
malihu committed Mar 8, 2015
2 parents 9e2b329 + d6b0199 commit e5b5c8c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
21 changes: 16 additions & 5 deletions jquery.mCustomScrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,27 @@ the production-ready jquery.mCustomScrollbar.concat.min.js which contains the pl
and dependencies (minified).
*/

;(function($,window,document){
(function (factory) {
if(typeof module !== 'undefined' && module.exports) {
module.exports = factory;
} else {
factory(jQuery, window, document);
}
}(function($){

(function(init){
var _rjs=typeof define==="function" && define.amd, /* RequireJS */
_njs=typeof module !== 'undefined' && module.exports, /* NodeJS */
_dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";
if(!_rjs){
/* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS
(works when mCustomScrollbar fn is called on window load) */
$.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));
if (_njs) {
require("jquery-mousewheel")($);
} else {
/* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS
(works when mCustomScrollbar fn is called on window load) */
$.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));
}
}
init();
}(function(){
Expand Down Expand Up @@ -2279,4 +2290,4 @@ and dependencies (minified).

});

}))}(jQuery,window,document));
}))}));
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
"description": "Highly customizable custom scrollbar jQuery plugin, featuring vertical/horizontal scrollbars, scrolling momentum, mouse-wheel, keyboard and touch support user defined callbacks etc.",
"license": "MIT",
"homepage": "http://manos.malihu.gr/jquery-custom-content-scroller",
"main": [
"./jquery.mCustomScrollbar.js",
"./jquery.mCustomScrollbar.css",
"./mCSB_buttons.png"
],
"main": "./jquery.mCustomScrollbar.js",
"repository": {
"type": "git",
"url": "https://github.com/malihu/malihu-custom-scrollbar-plugin.git"
Expand All @@ -31,7 +27,10 @@
"jam": {
"dependencies": {
"jquery": ">=1.6",
"jquery-mousewheel": ">=3.0.6"
"jquery-mousewheel": ">=3.0.6"
}
},
"dependencies": {
"jquery-mousewheel": ">=3.0.6"
}
}
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ npm: `npm install malihu-custom-scrollbar-plugin`

`$(selector).mCustomScrollbar();`

###### Using with [Browserify](http://browserify.org/)

var $ = require('jquery');
require('malihu-custom-scrollbar-plugin')($);


#### For more information

* [Plugin homepage and documentation](http://manos.malihu.gr/jquery-custom-content-scroller)
Expand Down

0 comments on commit e5b5c8c

Please sign in to comment.