remove ugly coffeescript variable hoisting, fix indexOf polyfill

This commit is contained in:
Jaime Pillora
2015-11-03 14:43:27 +11:00
parent 904d09251b
commit 521514180d
+31 -24
View File
@@ -1,6 +1,7 @@
// UMD start /* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
// https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
(function (factory) { (function (factory) {
// UMD start
// https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define(['jquery'], factory); define(['jquery'], factory);
@@ -27,24 +28,28 @@
factory(jQuery); factory(jQuery);
} }
}(function ($) { }(function ($) {
var Notification, addStyle, blankFieldName, coreStyle, createElem, defaults, encode, find, findFields, getAnchorElement, getStyle, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns, //IE8 indexOf polyfill
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; var indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
pluginName = 'notify'; if (i in this && this[i] === item) {
return i;
pluginClassName = pluginName + 'js'; }
}
blankFieldName = pluginName + "!blank"; return -1;
positions = {
t: 'top',
m: 'middle',
b: 'bottom',
l: 'left',
c: 'center',
r: 'right'
}; };
var pluginName = "notify";
var pluginClassName = pluginName + "js";
var blankFieldName = pluginName + "!blank";
var positions = {
t: "top",
m: "middle",
b: "bottom",
l: "left",
c: "center",
r: "right"
};
var hAligns = ["l", "c", "r"]; var hAligns = ["l", "c", "r"];
var vAligns = ["t", "m", "b"]; var vAligns = ["t", "m", "b"];
var mainPositions = ["t", "b", "l", "r"]; var mainPositions = ["t", "b", "l", "r"];
@@ -593,13 +598,15 @@
}); });
$(function() { $(function() {
insertCSS(coreStyle.css).attr('id', 'core-notify'); insertCSS(coreStyle.css).attr("id", "core-notify");
$(document).on('click', "." + pluginClassName + "-hidable", function(e) { $(document).on("click", "." + pluginClassName + "-hidable", function(e) {
return $(this).trigger('notify-hide'); return $(this).trigger("notify-hide");
}); });
return $(document).on('notify-hide', "." + pluginClassName + "-wrapper", function(e) { return $(document).on("notify-hide", "." + pluginClassName + "-wrapper", function(e) {
var _ref; var elem = $(this).data(pluginClassName);
return (_ref = $(this).data(pluginClassName)) != null ? _ref.show(false) : void 0; if(elem) {
elem.show(false);
}
}); });
}); });