0% found this document useful (0 votes)
8 views12 pages

jGrowl: jQuery Notification Plugin

Uploaded by

wileli1451
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views12 pages

jGrowl: jQuery Notification Plugin

Uploaded by

wileli1451
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/**

* User: marcin
* Date: 11/5/13
* Time: 9:08 PM
*/
;
define("application/pages/download_and_save_module", function(){});

/**
* jGrowl 1.2.12
*
* Dual licensed under the MIT ([Link]
* and GPL ([Link] licenses.
*
* Written by Stan Lemon <stosh1985@[Link]>
* Last updated: 2013.02.14
*
* jGrowl is a jQuery plugin implementing unobtrusive userland notifications.
These
* notifications function similarly to the Growl Framework available for
* Mac OS X ([Link]
*
* To Do:
* - Move library settings to containers and allow them to be changed per container
*
* Changes in 1.2.13
* - Fixed clearing interval when the container shuts down
*
* Changes in 1.2.12
* - Added compressed versions using UglifyJS and Sqwish
* - Improved README with configuration options explanation
* - Added a source map
*
* Changes in 1.2.11
* - Fix artifacts left behind by the shutdown method and text-cleanup
*
* Changes in 1.2.10
* - Fix beforeClose to be called in click event
*
* Changes in 1.2.9
* - Fixed BC break in jQuery 2.0 beta
*
* Changes in 1.2.8
* - Fixes for jQuery 1.9 and the MSIE6 check, note that with jQuery 2.0 support
* jGrowl intends to drop support for IE6 altogether
*
* Changes in 1.2.6
* - Fixed js error when a notification is opening and closing at the same time
*
* Changes in 1.2.5
* - Changed wrapper jGrowl's options usage to "o" instead of $.[Link]
* - Added themeState option to control 'highlight' or 'error' for jQuery UI
* - Ammended some CSS to provide default positioning for nested usage.
* - Changed some CSS to be prefixed with jGrowl- to prevent namespacing issues
* - Added two new options - openDuration and closeDuration to allow
* better control of notification open and close speeds, respectively
* Patch contributed by Jesse Vincet.
* - Added afterOpen callback. Patch contributed by Russel Branca.
*
* Changes in 1.2.4
* - Fixed IE bug with the close-all button
* - Fixed IE bug with the filter CSS attribute (special thanks to gotwic)
* - Update IE opacity CSS
* - Changed font sizes to use "em", and only set the base style
*
* Changes in 1.2.3
* - The callbacks no longer use the container as context, instead they use the
actual notification
* - The callbacks now receive the container as a parameter after the options
parameter
* - beforeOpen and beforeClose now check the return value, if it's false - the
notification does
* not continue. The open callback will also halt execution if it returns false.
* - Fixed bug where containers would get confused
* - Expanded the pause functionality to pause an entire container.
*
* Changes in 1.2.2
* - Notification can now be theme rolled for jQuery UI, special thanks to Jeff
Chan!
*
* Changes in 1.2.1
* - Fixed instance where the interval would fire the close method multiple times.
* - Added CSS to hide from print media
* - Fixed issue with closer button when div { position: relative } is set
* - Fixed leaking issue with multiple containers. Special thanks to Matthew
Hanlon!
*
* Changes in 1.2.0
* - Added message pooling to limit the number of messages appearing at a given
time.
* - Closing a notification is now bound to the notification object and triggered
by the close button.
*
* Changes in 1.1.2
* - Added iPhone styled example
* - Fixed possible IE7 bug when determining if the ie6 class shoudl be applied.
* - Added template for the close button, so that it's content could be customized.
*
* Changes in 1.1.1
* - Fixed CSS styling bug for ie6 caused by a mispelling
* - Changes height restriction on default notifications to min-height
* - Added skinned examples using a variety of images
* - Added the ability to customize the content of the [close all] box
* - Added jTweet, an example of using jGrowl + Twitter
*
* Changes in 1.1.0
* - Multiple container and instances.
* - Standard $.jGrowl() now wraps $.[Link]() by first establishing a generic
jGrowl container.
* - Instance methods of a jGrowl container can be called by
$.[Link](methodName)
* - Added glue preferenced, which allows notifications to be inserted before or
after nodes in the container
* - Added new log callback which is called before anything is done for the
notification
* - Corner's attribute are now applied on an individual notification basis.
*
* Changes in 1.0.4
* - Various CSS fixes so that jGrowl renders correctly in IE6.
*
* Changes in 1.0.3
* - Fixed bug with options persisting across notifications
* - Fixed theme application bug
* - Simplified some selectors and manipulations.
* - Added beforeOpen and beforeClose callbacks
* - Reorganized some lines of code to be more readable
* - Removed unnecessary [Link] context
* - If corners plugin is present, it's now customizable.
* - Customizable open animation.
* - Customizable close animation.
* - Customizable animation easing.
* - Added customizable positioning (top-left, top-right, bottom-left, bottom-
right, center)
*
* Changes in 1.0.2
* - All CSS styling is now external.
* - Added a theme parameter which specifies a secondary class for styling, such
* that notifications can be customized in appearance on a per message basis.
* - Notification life span is now customizable on a per message basis.
* - Added the ability to disable the global closer, enabled by default.
* - Added callbacks for when a notification is opened or closed.
* - Added callback for the global closer.
* - Customizable animation speed.
* - jGrowl now set itself up and tears itself down.
*
* Changes in 1.0.1:
* - Removed dependency on metadata plugin in favor of .data()
* - Namespaced all events
*/
(function($) {
/** Compatibility holdover for 1.9 to check IE6 **/
var $ie6 = (function(){
return false === $.[Link] && $.[Link] &&
$.[Link];
})();

/** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with
older releases. **/
$.jGrowl = function( m , o ) {
// To maintain compatibility with older version that only supported one
instance we'll create the base container.
if ( $('#jGrowl').size() == 0 )
$('<div id="jGrowl"></div>').addClass( (o && [Link]) ?
[Link] : $.[Link] ).appendTo('body');

// Create a notification on the container.


$('#jGrowl').jGrowl(m,o);
};

/** Raise jGrowl Notification on a jGrowl Container **/


$.[Link] = function( m , o ) {
if ( $.isFunction([Link]) ) {
var args = arguments;

return [Link](function() {
/** Create a jGrowl Instance on the Container if it does
not exist **/
if ( $(this).data('[Link]') == undefined ) {
$(this).data('[Link]', $.extend( new
$.[Link](), { notifications: [], element: null, interval: null } ));
$(this).data('[Link]').startup( this );
}

/** Optionally call jGrowl instance methods, or just raise


a normal notification **/
if ( $.isFunction($(this).data('[Link]')[m]) ) {
$(this).data('[Link]')[m].apply( $
(this).data('[Link]') , $.makeArray(args).slice(1) );
} else {
$(this).data('[Link]').create( m , o );
}
});
};
};

$.extend( $.[Link] , {

/** Default JGrowl Settings **/


defaults: {
pool: 0,
header: '',
group: '',
sticky: false,
position: 'top-right',
glue: 'after',
theme: 'default',
themeState: 'highlight',
corners: '10px',
check: 250,
life: 3000,
closeDuration: 'normal',
openDuration: 'normal',
easing: 'swing',
closer: true,
closeTemplate: '&times;',
closerTemplate: '<div>[ close all ]</div>',
log: function() {},
beforeOpen: function() {},
afterOpen: function() {},
open: function() {},
beforeClose: function() {},
close: function() {},
animateOpen: {
opacity: 'show'
},
animateClose: {
opacity: 'hide'
}
},

notifications: [],

/** jGrowl Container Node **/


element: null,
/** Interval Function **/
interval: null,

/** Create a Notification **/


create: function( message , o ) {
var o = $.extend({}, [Link], o);

/* To keep backward compatibility with 1.24 and earlier, honor


'speed' if the user has set it */
if (typeof [Link] !== 'undefined') {
[Link] = [Link];
[Link] = [Link];
}

[Link]({ message: message , options: o });

[Link]( [Link] , [[Link],message,o] );


},

render: function( notification ) {


var self = this;
var message = [Link];
var o = [Link];

// Support for jQuery theme-states, if this is not used it


displays a widget header
[Link] = ([Link] == '') ? '' : 'ui-state-' +
[Link];

var notification = $('<div/>')


.addClass('jGrowl-notification ' + [Link] + ' ui-
corner-all' + (([Link] != undefined && [Link] != '') ? ' ' + [Link] : ''))
.append($('<div/>').addClass('jGrowl-
close').html([Link]))
.append($('<div/>').addClass('jGrowl-
header').html([Link]))
.append($('<div/>').addClass('jGrowl-
message').html(message))
.data("jGrowl", o).addClass([Link]).children('[Link]-
close').bind("[Link]", function() {
$(this).parent().trigger('[Link]');
})
.parent();

/** Notification Actions **/


$(notification).bind("[Link]", function() {
$('[Link]-notification',
[Link]).data("[Link]", true);
}).bind("[Link]", function() {
$('[Link]-notification',
[Link]).data("[Link]", false);
}).bind('[Link]', function() {
if ( [Link]( notification ,
[notification,message,o,[Link]] ) !== false ) {
$(this).trigger('[Link]');
}
}).bind('[Link]', function() {
if ( [Link]( notification ,
[notification,message,o,[Link]] ) !== false ) {
if ( [Link] == 'after' ) {
$('[Link]-notification:last',
[Link]).after(notification);
} else {
$('[Link]-notification:first',
[Link]).before(notification);
}

$(this).animate([Link], [Link],
[Link], function() {
// Fixes some anti-aliasing issues with IE
filters.
if ($.[Link] === false)
[Link]('filter');

if ( $(this).data("jGrowl") !== null ) //


Happens when a notification is closing before it's open.
$(this).data("jGrowl").created = new
Date();

$(this).trigger('[Link]');
});
}
}).bind('[Link]', function() {
[Link]( notification ,
[notification,message,o,[Link]] );
}).bind('[Link]', function() {
if ( [Link]( notification ,
[notification,message,o,[Link]] ) !== false )
$(this).trigger('[Link]');
}).bind('[Link]', function() {
// Pause the notification, lest during the course of
animation another close event gets called.
$(this).data('[Link]', true);
$(this).animate([Link], [Link], [Link],
function() {
if ( $.isFunction([Link]) ) {
if ( [Link]( notification ,
[notification,message,o,[Link]] ) !== false )
$(this).remove();
} else {
$(this).remove();
}
});
}).trigger('[Link]');

/** Optional Corners Plugin **/


if ( [Link] != '' && $.[Link] != undefined ) $
(notification).corner( [Link] );

/** Add a Global Closer if more than one notification exists **/
if ( $('[Link]-notification:parent', [Link]).size() > 1
&&
$('[Link]-closer', [Link]).size() == 0 &&
[Link] !== false ) {
$([Link]).addClass('jGrowl-closer ' +
[Link] + ' ui-corner-all').addClass([Link])
.appendTo([Link]).animate([Link]
Open, [Link], [Link])
.bind("[Link]", function() {
$
(this).siblings().trigger("[Link]");

if ( $.isFunction( [Link] ) ) {
[Link]( $
(this).parent()[0] , [$(this).parent()[0]] );
}
});
};
},

/** Update the jGrowl Container, removing old jGrowl notifications **/
update: function() {
$([Link]).find('[Link]-
notification:parent').each( function() {
if ( $(this).data("jGrowl") != undefined && $
(this).data("jGrowl").created !== undefined &&
($(this).data("jGrowl").[Link]() +
parseInt($(this).data("jGrowl").life)) < (new Date()).getTime() &&
$(this).data("jGrowl").sticky !== true &&
($(this).data("[Link]") == undefined || $
(this).data("[Link]") !== true) ) {

// Pause the notification, lest during the course of


animation another close event gets called.
$(this).trigger('[Link]');
}
});

if ( [Link] > 0 &&


([Link] == 0 || $
([Link]).find('[Link]-notification:parent').size() <
[Link]) )
[Link]( [Link]() );

if ( $([Link]).find('[Link]-
notification:parent').size() < 2 ) {
$([Link]).find('[Link]-
closer').animate([Link], [Link],
[Link], function() {
$(this).remove();
});
}
},

/** Setup the jGrowl Notification Container **/


startup: function(e) {
[Link] = $(e).addClass('jGrowl').append('<div
class="jGrowl-notification"></div>');
[Link] = setInterval( function() {
$(e).data('[Link]').update();
}, parseInt([Link]));

if ($ie6) {
$([Link]).addClass('ie6');
}
},
/** Shutdown jGrowl, removing it and clearing the interval **/
shutdown: function() {
$([Link]).removeClass('jGrowl')
.find('[Link]-notification').trigger('[Link]')
.parent().empty()

clearInterval([Link]);
},

close: function() {
$([Link]).find('[Link]-notification').each(function(){
$(this).trigger('[Link]');
});
}
});

/** Reference the Defaults Object for compatibility with older versions of
jGrowl **/
$.[Link] = $.[Link];

})(jQuery);
define("jgrowl", function(){});

/**
* User: marcin
* Date: 7/10/13
* Time: 5:29 PM
*/
[Link] = [Link]({

previous_download_dir_element: "",

defaults:{
item_id :'',
item_type:'',
code:''
},

button:'',
initialize: function(){

},

parse: function(response, xhr) {

if(![Link] || [Link]=="get"){
//[Link](response);
// [Link] = [Link];
[Link](response);
// return response;
}
if([Link]=="delete" || [Link]=="set"){
[Link](response);
}
},

check_free_download_or_download: function(){
[Link] = [Link].api_url + 'download/payment_info';
[Link]();
},

check_sms_code: function(code){

[Link] = 1234;
[Link] = [Link].api_url + 'download/check_sms_code';
[Link]();

});
define("download", function(){});

/**
* User: marcin
* Date: 7/10/13
* Time: 5:28 PM
*/

[Link] = [Link]({

initialize:function () {

[Link] = this;
[Link] = [Link];

[Link]();

},

initDownload:function () {
_.bindAll(this);

$('#check_download_sms_code').bind('click', [Link]);
$('#file-download').bind('click', [Link]);

},

getDefaultLoaderValue: function(){
return "<img src='/static/img/loader/[Link]' style='margin-right:
8px; margin-top: 1px; float: left;'><div style='margin-top: -1px;
'>"+[Link]('index_please_wait')+"</div>";
},
fileFileDownload: function(){

// if(("undefined" == typeof ads_unblocked) || (!("undefined" == typeof


ads_unblocked) && ads_unblocked!==true)){
// alert("Wyłącz blokowanie reklam (AdBlock) w tej domenie!");
// return false;
// }

// if(![Link]() && $('#doublebillboard-1')[0].[Link]=="" &&


$('#doublebillboard-1')[0].[Link]=='' && $('#square-1')[0].[Link]==""
&& $('#square-1')[0].[Link]==''){ // stare
// if([Link]() && ![Link]() && $('#square-1')
[0].[Link]=="" && $('#square-1')[0].[Link]==""){
if(0){
[Link]('wait');
}
// else if(![Link]() && ![Link]() && $
('#doublebillboard-1')[0].[Link]=="" && $('#doublebillboard-1')
[0].[Link]==""){
if(0){
[Link]('wait');
}
else{
var model = [Link];
var file_id = $('#file-download').data('file-id');
[Link] = $('#file-download');

var visible = 0;
if($('#download_info').is(":visible"))
var visible=1;

$('#download_info').html([Link]());
$('#download_info').fadeIn('fast', function() {

[Link]('download_from_dir', 0);
[Link]('file_id', file_id);
[Link]('item_id', file_id);
[Link]('no_headers', 1);
[Link]('menu_visible', visible);
model.check_free_download_or_download();
});
}

},

directoryFileDownload: function(element_id, element_type){

var model = [Link];


var file_id = element_id;
var download_info_placement =
jQuery("#"+element_type+"-"+element_id).find('.download_info');
download_info_placement.html([Link]());
// [Link] = $('#file-download');
var visible = 0;
if(download_info_placement.is(":visible"))
var visible=1;

if(model.previous_download_dir_element.length>0){
model.previous_download_dir_element.hide();

model.previous_download_dir_element.html([Link]());
}
download_info_placement.fadeIn('fast', function() {

model.previous_download_dir_element = download_info_placement;
[Link]('download_from_dir', 1);
[Link]('element_id', element_id);
[Link]('element_type', element_type);
[Link]('file_id', file_id);
[Link]('item_id', file_id);
[Link]('no_headers', 1);
[Link]('menu_visible', visible);
model.check_free_download_or_download();
});

// [Link]();
// [Link] = [Link].download_url+file_id;
// [Link]();
},

checkSmsCode: function(event){

[Link] = $([Link]);
//[Link]("disabled", true);

var code = 1234;


[Link].check_sms_code(code);
},

responseViewCallback: function(response){
if([Link]!==undefined && [Link]!=''){
$.jGrowl([Link]);
}

if(![Link]){

$('#check_download_sms_code').unbind('click');
if(1==1){
[Link]("disabled", false);
$('#download_info').html([Link]);
$('#check_download_sms_code').bind('click', 1234);
}
else{
if([Link]){
[Link]("disabled", false);
}
var download_info_placement =
jQuery("#"+[Link]('element_type')
+"-"+[Link]('element_id')).find('.download_info');
download_info_placement.html([Link]);
$('#check_download_sms_code').bind('click', 1234);
//$('#check_download_sms_code').bind('click',
[Link]);
}

new [Link]( { model : new [Link]() } );


new [Link]( { model : new [Link]() } );

if([Link]){

if([Link]('download_from_dir')==0){
[Link]("disabled", false);
$('#download_info').fadeOut();
}
else{
var download_info_placement =
jQuery("#"+[Link]('element_type')
+"-"+[Link]('element_id')).find('.download_info');
download_info_placement.fadeOut();

//_gaq.push(['_trackEvent', 'premium', 'buy_premium',


'buy_premium_download']);
// ga('send', 'event', 'premium', 'buy_premium',
'buy_premium_download');
// var download_url =
[Link].download_url+[Link].item_id;
var download_url =
[Link].download_data.download_url+[Link].item_id+'/'+response
.response.download_data.time;
[Link] = download_url;

}
}

});
define("download_view", function(){});

You might also like