vendor/assets/javascripts/humane.jquery.js in humane-rails-2.7.1.0.1.1 vs vendor/assets/javascripts/humane.jquery.js in humane-rails-2.8.0.0.1.1

- old
+ new

@@ -37,11 +37,11 @@ function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : name.toLowerCase(); } function getConfig(type, config) { - return win.humane[type][config] !== void 0 ? win.humane[type][config] : win.humane[config]; + return currentMessage.instance[config] !== void 0 ? currentMessage.instance[config] : win.humane[config]; } on (win,'load', setup); function setup() { @@ -70,11 +70,11 @@ clearTimeout(timeout); timeout = null; } var next = queue.shift(); - currentMessage = { type: next[0], message: next[1], callback: next[2] }; + currentMessage = { type: next[0], message: next[1], instance: next[2], callback: next[3] }; var content = currentMessage.message, type = currentMessage.type; if ( getConfig(type, 'clickToClose') === true ) { on (humaneEl, 'click', remove); @@ -139,11 +139,11 @@ var setOpacity = useFilter ? function (opacity) { humaneEl.filters.item('DXImageTransform.Microsoft.Alpha').Opacity = opacity*100; } : function (opacity) { humaneEl.style.opacity = String(opacity); } - function jsAnimateOpacity (level,type) { + function jsAnimateOpacity (level, type) { var interval; var opacity; if (level === 1) { opacity = 0; @@ -179,13 +179,13 @@ }, 100 / 20); } } function notifier (type) { - return function (message, cb) { - queue.push( [type, message, cb] ); - events['add'](type,message,'add'); + return function instance (message, cb) { + queue.push( [type, message, instance, cb] ); + events['add'](type, message, 'add'); if (isSetup) run(); } } // types @@ -193,9 +193,17 @@ humane.log = notifier('log'); humane.error = notifier('error'); humane.info = notifier('info'); humane.success = notifier('success'); humane.remove = remove; + + humane.create = function (options) { + var type = notifier(options.type || 'log'); + type.timeout = options.timeout || 2500; + type.waitForMove = options.waitForMove || false; + type.clickToClose = options.clickToClose || false; + return type; + } // options humane.timeout = 2500; humane.waitForMove = false; humane.clickToClose = false; \ No newline at end of file