document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  <script type="text/javascript">
  2.                 $(document).ready(function(){
  3.                     var window = $("#window");
  4.                     var okButton = $("#okButton");
  5.                     var openButton = $("#openButton");
  6.                    
  7.                     //attach click event to the open button  
  8.                     openButton.on("click", function(){
  9.                         //open kendo window
  10.                         window.data("kendoWindow").open();
  11.                         //hide open button
  12.                         openButton.hide();
  13.                     });
  14.                    
  15.                     //attach click event to the OK button
  16.                     okButton.on("click", function(){
  17.                         //close kendo window on
  18.                         window.data("kendoWindow").close();
  19.                        
  20.                     });
  21.                     //handler function for window\'s close event
  22.                     var onClose = function(){
  23.                         openButton.show();
  24.                     };
  25.                     //handler function for window\'s activate event
  26.                     var onActivate = function(){
  27.                         //the ok button must have the focus on it in order to intercept the keypress event
  28.                         okButton.focus();
  29.                     };
  30.                    
  31.                     if (!window.data("kendoWindow")) {
  32.                         window.kendoWindow({
  33.                             width: "600px",
  34.                             title: "My window",
  35.                             close: onClose,
  36.                             activate: onActivate,
  37.                             visible: true
  38.                         });
  39.                     }
  40.                     //centers the window on the page
  41.                     window.data("kendoWindow").center();
  42.                    
  43.                     //handler funtion for the keypress event
  44.                     $("#window").keypress(function(event){
  45.                         //if the key press is ESC
  46.                         if (event.keyCode === 27) {
  47.                             //close the KendoUI window
  48.                             window.data("kendoWindow").close();
  49.                         }
  50.                     });
  51.                 });
  52.             </script>
');