Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //hook all the dialog opens and replace jqui style with our stuff
  2.     $(document).on("dialogopen", '.ui-dialog-content', function(e) {
  3.         //close button
  4.         $(this).parent().find('button.ui-dialog-titlebar-close').removeClass().addClass('btn-blank btn-dialog-close right');
  5.         $(this).parent().find('span.ui-icon').removeClass().addClass('flaticon-close');
  6.         $(this).parent().find('.btn-dialog-close .ui-button-text').remove();
  7.        
  8.         //okay button
  9.         $(this).parent().find('.ui-dialog-buttonset button').removeClass().addClass('btn-orange');
  10.         $(this).parent().find('.ui-dialog-buttonset span').removeClass();
  11.        
  12.         //disable bg scrolling if its a modal popup
  13.         if($(this).dialog('option', 'modal') === true) {
  14.             //$('#main_wrap').css('overflow', 'hidden');
  15.             $('body').css({'overflow': 'hidden'});
  16.         }
  17.        
  18.         //bind the enter button to the first dialog button
  19.         var dialog = $(this);
  20.         $(this).keypress(function(e) {
  21.             console.log('dialog keyhooks live');
  22.             if(e.keyCode === $.ui.keyCode.ENTER) {
  23.                 console.log('Smashed dat ENTER key');
  24.                 $(this).parent().find(".ui-dialog-buttonpane button:first").trigger("click");
  25.             }
  26.         });
  27.        
  28.         //remove the hidden if there is one (shouldnt be...)
  29.         $(this).removeClass('none');
  30.     });
  31.    
  32.     //reset the dialog stuff on close
  33.     $(document).on("dialogclose", '.ui-dialog-content', function(e) {
  34.         //enable bg scrolling
  35.         if($(this).dialog('option', 'modal') === true) {
  36.             //$('#main_wrap').removeAttr('style');
  37.             $('body').removeAttr('style');
  38.         }
  39.        
  40.         //unbind keypresses
  41.         $(this).unbind('keypress');
  42.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement