Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //hook all the dialog opens and replace jqui style with our stuff
- $(document).on("dialogopen", '.ui-dialog-content', function(e) {
- //close button
- $(this).parent().find('button.ui-dialog-titlebar-close').removeClass().addClass('btn-blank btn-dialog-close right');
- $(this).parent().find('span.ui-icon').removeClass().addClass('flaticon-close');
- $(this).parent().find('.btn-dialog-close .ui-button-text').remove();
- //okay button
- $(this).parent().find('.ui-dialog-buttonset button').removeClass().addClass('btn-orange');
- $(this).parent().find('.ui-dialog-buttonset span').removeClass();
- //disable bg scrolling if its a modal popup
- if($(this).dialog('option', 'modal') === true) {
- //$('#main_wrap').css('overflow', 'hidden');
- $('body').css({'overflow': 'hidden'});
- }
- //bind the enter button to the first dialog button
- var dialog = $(this);
- $(this).keypress(function(e) {
- console.log('dialog keyhooks live');
- if(e.keyCode === $.ui.keyCode.ENTER) {
- console.log('Smashed dat ENTER key');
- $(this).parent().find(".ui-dialog-buttonpane button:first").trigger("click");
- }
- });
- //remove the hidden if there is one (shouldnt be...)
- $(this).removeClass('none');
- });
- //reset the dialog stuff on close
- $(document).on("dialogclose", '.ui-dialog-content', function(e) {
- //enable bg scrolling
- if($(this).dialog('option', 'modal') === true) {
- //$('#main_wrap').removeAttr('style');
- $('body').removeAttr('style');
- }
- //unbind keypresses
- $(this).unbind('keypress');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement