Clean
This commit is contained in:
@ -1,18 +0,0 @@
|
||||
div.sticky-queue{position:fixed;background:#fff;background:rgba(255,255,255,.9);border-width:0 3px 3px;border-style:solid;border-color:#ccc;border-color:rgba(0,0,0,.6);width:280px;z-index:989}
|
||||
div.sticky-queue.bottom-right,div.sticky-queue.bottom-left {border-width:3px 3px 0;border-style:solid;border-color:#ccc;border-color:rgba(0,0,0,.6)}
|
||||
div.sticky-note{padding-right:20px;padding-left:14px;font-weight:700}
|
||||
div.sticky{font-size:12px;color:#555;display:none;position:relative;padding:10px}
|
||||
div.sticky p {margin-bottom:0}
|
||||
.st-close{position:absolute;top:4px;right:6px}
|
||||
.top-right,.top-left,.top-center{top:38px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px}
|
||||
.bottom-right,.bottom-left{bottom:-2px;border-top-right-radius:6px;border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px}
|
||||
.border-top-right,.border-top-left,.border-top-center{border-top:1px solid #eee;border-top:1px solid rgba(0,0,0,.1)}
|
||||
.border-bottom-right,.border-bottom-left{border-bottom:1px solid #eee;border-bottom:1px solid rgba(0,0,0,.1)}
|
||||
.sticky.st-error{color:#C62626}
|
||||
.sticky.st-success{color:#7fae00}
|
||||
.sticky.st-info{color:#00a6fc}
|
||||
.top-right,.bottom-right{right:20px}
|
||||
.top-left,.bottom-left{left:20px}
|
||||
.top-center{left:50%;margin-left:-140px}
|
||||
div.sticky-queue.top-right .sticky:last-child,div.sticky-queue.top-left .sticky:last-child,div.sticky-queue.top-center .sticky:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px;-moz-border-radius-bottomright:3px;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px}
|
||||
div.sticky-queue.bottom-right .sticky:first-child,div.sticky-queue.bottom-left .sticky:first-child {border-top-right-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-topleft:3px;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px}
|
||||
@ -1,118 +0,0 @@
|
||||
// Sticky v1.0 by Daniel Raftery
|
||||
// http://thrivingkings.com/sticky
|
||||
// http://twitter.com/ThrivingKings
|
||||
|
||||
;(function($) {
|
||||
|
||||
// Using it without an object
|
||||
$.sticky = function(note, options, callback) { return $.fn.sticky(note, options, callback); };
|
||||
|
||||
$.fn.sticky = function(note, options, callback) {
|
||||
|
||||
var settings =
|
||||
{
|
||||
'speed' : 'fast', // animations: fast, slow, or integer
|
||||
'duplicates' : false, // true or false
|
||||
'autoclose' : 5000, // integer or false
|
||||
'position' : 'top-right', // top-center, top-left, top-right, bottom-left, or bottom-right
|
||||
'type' : '' // st-success, st-info, st-error
|
||||
};
|
||||
|
||||
if(options) {
|
||||
$.extend(settings, options);
|
||||
}
|
||||
|
||||
// Passing in the object instead of specifying a note
|
||||
if(!note) {
|
||||
note = this.html();
|
||||
}
|
||||
|
||||
// Variables
|
||||
var display = true, duplicate = 'no';
|
||||
|
||||
// Somewhat of a unique ID
|
||||
var uniqID = Math.floor(Math.random()*99999);
|
||||
|
||||
// Handling duplicate notes and IDs
|
||||
$('.sticky-note').each(function() {
|
||||
if($(this).html() == note && $(this).is(':visible')) {
|
||||
duplicate = 'yes';
|
||||
if(!settings['duplicates']) {
|
||||
display = false;
|
||||
}
|
||||
}
|
||||
if($(this).attr('id')==uniqID) {
|
||||
uniqID = Math.floor(Math.random()*9999999);
|
||||
}
|
||||
});
|
||||
|
||||
// Make sure the sticky queue exists
|
||||
if(!$('body').find('.sticky-queue.'+settings.position).html()) {
|
||||
$('body').append('<div class="sticky-queue ' + settings.position + '"></div>');
|
||||
}
|
||||
|
||||
// Can it be displayed?
|
||||
if(display) {
|
||||
// Building and inserting sticky note
|
||||
$('.sticky-queue.'+settings.position).prepend('<div class="sticky border-' + settings.position + ' ' + settings.type +'" id="' + uniqID + '"></div>');
|
||||
$('#' + uniqID).append('<span class="close st-close" rel="' + uniqID + '" title="Close">×</span>');
|
||||
$('#' + uniqID).append('<div class="sticky-note" rel="' + uniqID + '">' + note + '</div>');
|
||||
|
||||
// Smoother animation
|
||||
var height = $('#' + uniqID).height();
|
||||
$('#' + uniqID).css('height', height);
|
||||
|
||||
$('#' + uniqID).slideDown(settings['speed']);
|
||||
|
||||
display = true;
|
||||
}
|
||||
|
||||
// Listeners
|
||||
$('.sticky').ready(function() {
|
||||
// If 'autoclose' is enabled, set a timer to close the sticky
|
||||
if(settings['autoclose']) {
|
||||
$('#' + uniqID).delay(settings['autoclose']).slideUp(settings['speed'], function(){
|
||||
var closest = $(this).closest('.sticky-queue');
|
||||
var elem = closest.find('.sticky');
|
||||
$(this).remove();
|
||||
if(elem.length == '1'){
|
||||
closest.remove()
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// Closing a sticky
|
||||
$('.st-close').click(function()
|
||||
{
|
||||
$('#' + $(this).attr('rel')).dequeue().slideUp(settings['speed'], function(){
|
||||
var closest = $(this).closest('.sticky-queue');
|
||||
var elem = closest.find('.sticky');
|
||||
$(this).remove();
|
||||
if(elem.length == '1'){
|
||||
closest.remove()
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Callback data
|
||||
var response = {
|
||||
'id' : uniqID,
|
||||
'duplicate' : duplicate,
|
||||
'displayed' : display,
|
||||
'position' : settings.position,
|
||||
'type' : settings.type
|
||||
}
|
||||
|
||||
// Callback function?
|
||||
if(callback) {
|
||||
callback(response);
|
||||
}
|
||||
else {
|
||||
return(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
5
modules/lib/sticky/sticky.min.js
vendored
5
modules/lib/sticky/sticky.min.js
vendored
@ -1,5 +0,0 @@
|
||||
// Sticky v1.0 by Daniel Raftery
|
||||
// http://thrivingkings.com/sticky
|
||||
// http://twitter.com/ThrivingKings
|
||||
|
||||
;(function(a){a.sticky=function(e,d,f){return a.fn.sticky(e,d,f)};a.fn.sticky=function(e,d,f){var b={speed:"fast",duplicates:!1,autoclose:5E3,position:"top-right",type:""};d&&a.extend(b,d);e||(e=this.html());var g=!0,h="no",c=Math.floor(99999*Math.random());a(".sticky-note").each(function(){a(this).html()==e&&a(this).is(":visible")&&(h="yes",b.duplicates||(g=!1));a(this).attr("id")==c&&(c=Math.floor(9999999*Math.random()))});a("body").find(".sticky-queue."+b.position).html()||a("body").append('<div class="sticky-queue '+ b.position+'"></div>');g&&(a(".sticky-queue."+b.position).prepend('<div class="sticky border-'+b.position+" "+b.type+'" id="'+c+'"></div>'),a("#"+c).append('<span class="close st-close" rel="'+c+'" title="Close">×</span>'),a("#"+c).append('<div class="sticky-note" rel="'+c+'">'+e+"</div>"),d=a("#"+c).height(),a("#"+c).css("height",d),a("#"+c).slideDown(b.speed),g=!0);a(".sticky").ready(function(){b.autoclose&&a("#"+c).delay(b.autoclose).slideUp(b.speed,function(){var b=a(this).closest(".sticky-queue"), c=b.find(".sticky");a(this).remove();c.length=="1"&&b.remove()})});a(".st-close").click(function(){a("#"+a(this).attr("rel")).dequeue().slideUp(b.speed,function(){var b=a(this).closest(".sticky-queue"),c=b.find(".sticky");a(this).remove();c.length=="1"&&b.remove()})});d={id:c,duplicate:h,displayed:g,position:b.position,type:b.type};if(f)f(d);else return d}})(jQuery);
|
||||
Reference in New Issue
Block a user