Files
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

124 lines
3.9 KiB
JavaScript

( function( $ ) {
var w;
if ( 'settings_page_media' == window.adminpage )
window.adminpage = 'options-media-php';
if ( 'settings_page_media' == window.pagenow )
window.pagenow = 'options-media';
if ( $(window).width() < 600 )
w = '90%';
else if ( $(window).width() > 1024 )
w = '500';
else
w = '50%';
window.emlConfirmDialog = function( title, html, yes, no, yesClass ) {
var def = $.Deferred(),
confirmdialog = $('<div id="eml-dialog-modal"></div>').appendTo('body')
.html( html )
.dialog({
dialogClass : 'eml-dialog-modal',
modal : true,
resizable : false,
width : w,
autoOpen : false,
title : title,
buttons : [
{
'text' : yes,
'class' : yesClass,
'click' : function() {
$(this).dialog( 'close' );
def.resolve();
}
},
{
'text' : no,
'click': function() {
$(this).dialog( 'close' );
def.reject();
}
}
],
close: function() {
$(this).remove();
}
});
confirmdialog.dialog('open');
return def.promise();
}
window.emlAlertDialog = function( title, html, yes, yesClass ) {
var def = $.Deferred(),
alertdialog = $('<div id="eml-dialog-modal"></div>').appendTo('body')
.html( html )
.dialog({
dialogClass : 'eml-dialog-modal',
modal : true,
resizable : false,
width : w,
autoOpen : false,
title : title,
buttons : [
{
'text' : yes,
'class' : yesClass,
'click' : function() {
$(this).dialog( 'close' );
def.resolve();
}
}
],
close: function() {
$(this).remove();
}
});
alertdialog.dialog('open');
return def.promise();
}
window.emlFullscreenSpinnerStart = function( text ) {
$('body').append( '<div class="fullscreen-spinner-box"><div class="fullscreen-spinner-inner-box"><span class="eml-spinner">'+text+'</span></div></div>' );
}
window.emlFullscreenSpinnerStop = function() {
$('.fullscreen-spinner-box').remove();
}
$( document ).ready( function() {
$( '.rating-stars' ).find( 'a' ).hover(
function() {
$( this ).nextAll( 'a' ).children( 'span' ).removeClass( 'dashicons-star-filled' ).addClass( 'dashicons-star-empty' );
$( this ).prevAll( 'a' ).children( 'span' ).removeClass( 'dashicons-star-empty' ).addClass( 'dashicons-star-filled' );
$( this ).children( 'span' ).removeClass( 'dashicons-star-empty' ).addClass( 'dashicons-star-filled' );
}, function() {
var rating = $( 'input#rating' ).val();
if ( rating ) {
var list = $( '.rating-stars a' );
list.children( 'span' ).removeClass( 'dashicons-star-filled' ).addClass( 'dashicons-star-empty' );
list.slice( 0, rating ).children( 'span' ).removeClass( 'dashicons-star-empty' ).addClass( 'dashicons-star-filled' );
}
}
);
});
})( jQuery );