ie fixes
This commit is contained in:
Vendored
+16
-17
@@ -1,11 +1,11 @@
|
|||||||
/** Notify.js - v0.0.1 - 2013/04/11
|
/** Notify.js - v0.0.1 - 2013/04/16
|
||||||
* http://notifyjs.com/
|
* http://notifyjs.com/
|
||||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||||
*/
|
*/
|
||||||
(function(window,document,undefined) {
|
(function(window,document,undefined) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Notification, arrowDirs, bootstrapDetected, className, cornerElem, create, getAnchorElement, inherit, insertCSS, pluginName, pluginOptions, styles;
|
var Notification, arrowDirs, bootstrapDetected, className, cornerElem, createElem, getAnchorElement, inherit, insertCSS, pluginName, pluginOptions, styles;
|
||||||
|
|
||||||
pluginName = 'notify';
|
pluginName = 'notify';
|
||||||
|
|
||||||
@@ -62,8 +62,8 @@ pluginOptions = {
|
|||||||
offsetX: 0
|
offsetX: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
create = function(tag) {
|
createElem = function(tag) {
|
||||||
return $(document.createElement(tag));
|
return $("<" + tag + "></" + tag + ">");
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit = function(a, b) {
|
inherit = function(a, b) {
|
||||||
@@ -73,20 +73,16 @@ inherit = function(a, b) {
|
|||||||
return $.extend(true, new F(), b);
|
return $.extend(true, new F(), b);
|
||||||
};
|
};
|
||||||
|
|
||||||
cornerElem = create("div").addClass("" + className + "Corner");
|
cornerElem = createElem("div").addClass("" + className + "Corner");
|
||||||
|
|
||||||
getAnchorElement = function(element) {
|
getAnchorElement = function(element) {
|
||||||
var fBefore, radios;
|
var radios;
|
||||||
if (element.is('[type=radio]')) {
|
if (element.is('[type=radio]')) {
|
||||||
radios = element.parents('form:first').find('[type=radio]').filter(function(i, e) {
|
radios = element.parents('form:first').find('[type=radio]').filter(function(i, e) {
|
||||||
return $(e).attr('name') === element.attr('name');
|
return $(e).attr('name') === element.attr('name');
|
||||||
});
|
});
|
||||||
element = radios.first();
|
element = radios.first();
|
||||||
}
|
}
|
||||||
fBefore = element.prev();
|
|
||||||
if (fBefore.is('span.styled,span.OBS_checkbox')) {
|
|
||||||
element = fBefore;
|
|
||||||
}
|
|
||||||
return element;
|
return element;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -96,12 +92,15 @@ insertCSS = function(style) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elem = style.cssElem;
|
elem = style.cssElem;
|
||||||
if (elem) {
|
if (!elem) {
|
||||||
return elem.html(style.css);
|
elem = createElem("style");
|
||||||
} else {
|
|
||||||
elem = create("style").attr('type', 'text/css').html(style.css);
|
|
||||||
$("head").append(elem);
|
$("head").append(elem);
|
||||||
return style.cssElem = elem;
|
style.cssElem = elem;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return elem.html(style.css);
|
||||||
|
} catch (e) {
|
||||||
|
return elem[0].styleSheet.cssText = style.css;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -175,7 +174,7 @@ Notification = (function() {
|
|||||||
args.push(this.options.hideDuration);
|
args.push(this.options.hideDuration);
|
||||||
}
|
}
|
||||||
args.push(callback);
|
args.push(callback);
|
||||||
return elems[fn].apply(elems, callback);
|
return elems[fn].apply(elems, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
Notification.prototype.updatePosition = function() {
|
Notification.prototype.updatePosition = function() {
|
||||||
@@ -342,7 +341,7 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$[pluginName] = function(elem, data, options) {
|
$[pluginName] = function(elem, data, options) {
|
||||||
if (elem instanceof HTMLElement || elem.jquery) {
|
if ((elem && elem.nodeName) || elem.jquery) {
|
||||||
return $(elem)[pluginName](data, options);
|
return $(elem)[pluginName](data, options);
|
||||||
} else {
|
} else {
|
||||||
options = data;
|
options = data;
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+12
-12
@@ -143,8 +143,8 @@ pluginOptions =
|
|||||||
#parents: { '.ui-dialog': 5001 }
|
#parents: { '.ui-dialog': 5001 }
|
||||||
|
|
||||||
# plugin helpers
|
# plugin helpers
|
||||||
create = (tag) ->
|
createElem = (tag) ->
|
||||||
$ document.createElement(tag)
|
$ "<#{tag}></#{tag}>"
|
||||||
|
|
||||||
inherit = (a, b) ->
|
inherit = (a, b) ->
|
||||||
F = () ->
|
F = () ->
|
||||||
@@ -152,7 +152,7 @@ inherit = (a, b) ->
|
|||||||
$.extend true, new F(), b
|
$.extend true, new F(), b
|
||||||
|
|
||||||
# container for element-less notifications
|
# container for element-less notifications
|
||||||
cornerElem = create("div").addClass("#{className}Corner")
|
cornerElem = createElem("div").addClass("#{className}Corner")
|
||||||
|
|
||||||
#gets first on n radios, and gets the fancy stylised input for hidden inputs
|
#gets first on n radios, and gets the fancy stylised input for hidden inputs
|
||||||
getAnchorElement = (element) ->
|
getAnchorElement = (element) ->
|
||||||
@@ -162,20 +162,21 @@ getAnchorElement = (element) ->
|
|||||||
$(e).attr('name') is element.attr('name')
|
$(e).attr('name') is element.attr('name')
|
||||||
element = radios.first()
|
element = radios.first()
|
||||||
#custom-styled inputs - find thier real element
|
#custom-styled inputs - find thier real element
|
||||||
fBefore = element.prev()
|
|
||||||
element = fBefore if fBefore.is('span.styled,span.OBS_checkbox')
|
|
||||||
element
|
element
|
||||||
|
|
||||||
insertCSS = (style) ->
|
insertCSS = (style) ->
|
||||||
return unless style and style.css
|
return unless style and style.css
|
||||||
elem = style.cssElem
|
elem = style.cssElem
|
||||||
if elem
|
unless elem
|
||||||
elem.html style.css
|
elem = createElem("style")
|
||||||
else
|
|
||||||
elem = create("style").attr('type','text/css').html style.css
|
|
||||||
$("head").append elem
|
$("head").append elem
|
||||||
style.cssElem = elem
|
style.cssElem = elem
|
||||||
|
|
||||||
|
try
|
||||||
|
elem.html style.css
|
||||||
|
catch e #ie fix
|
||||||
|
elem[0].styleSheet.cssText = style.css
|
||||||
|
|
||||||
#define plugin
|
#define plugin
|
||||||
class Notification
|
class Notification
|
||||||
|
|
||||||
@@ -245,7 +246,7 @@ class Notification
|
|||||||
|
|
||||||
args.push callback
|
args.push callback
|
||||||
|
|
||||||
elems[fn].apply elems, callback
|
elems[fn].apply elems, args
|
||||||
|
|
||||||
updatePosition: ->
|
updatePosition: ->
|
||||||
return unless @elem
|
return unless @elem
|
||||||
@@ -400,8 +401,7 @@ $ ->
|
|||||||
# return alert "$.#{pluginName} already defined" if $[pluginName]?
|
# return alert "$.#{pluginName} already defined" if $[pluginName]?
|
||||||
# $.pluginName( { ... } ) changes options for all instances
|
# $.pluginName( { ... } ) changes options for all instances
|
||||||
$[pluginName] = (elem, data, options) ->
|
$[pluginName] = (elem, data, options) ->
|
||||||
if elem instanceof HTMLElement or
|
if (elem and elem.nodeName) or elem.jquery
|
||||||
elem.jquery
|
|
||||||
$(elem)[pluginName](data, options)
|
$(elem)[pluginName](data, options)
|
||||||
else
|
else
|
||||||
options = data
|
options = data
|
||||||
|
|||||||
Reference in New Issue
Block a user