當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript w2ui.w2popup類代碼示例

本文整理匯總了TypeScript中w2ui.w2popup的典型用法代碼示例。如果您正苦於以下問題:TypeScript w2popup類的具體用法?TypeScript w2popup怎麽用?TypeScript w2popup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了w2popup類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: createFinalPath

 $("#dialogCancel").click(function() {
    if(ignoreOrCancelCallback) {
       var dialogPathDetails: FilePath = createFinalPath(); 
       ignoreOrCancelCallback(dialogPathDetails);
    }
    w2popup.close();
 });
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:7,代碼來源:dialog.ts

示例2: isCheckboxSelected

 $("#dialogSave").click(function() {
    var searchText = $("#searchText").html();
    var replaceText = $("#replaceText").html();
    var filePatterns = $("#fileFilterPatterns").html();
    var searchCriteria = {
          caseSensitive: isCheckboxSelected("inputCaseSensitive"),
          regularExpression: isCheckboxSelected("inputRegularExpression"),
          wholeWord: isCheckboxSelected("inputWholeWord"),
          enableReplace: true,
          replace: replaceText
       };
    
    Command.replaceTokenInFiles(searchText, searchCriteria, filePatterns);
    w2popup.close();
 });
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:15,代碼來源:dialog.ts

示例3: createEvaluateDialog

 function createEvaluateDialog(inputText, dialogTitle) { 
    var windowHeight = $(window).height();   // returns height of browser viewport
    var windowWidth = $(window).width();   // returns width of browser viewport
    var dialogBody = createGridDialogLayout(inputText ? Common.escapeHtml(inputText) : '');
    var focusInput = function() {
       var element = document.getElementById('dialogPath');
       element.contentEditable = "true";
       element.focus();
    };
    var executeEvaluation = function() {
       var text = $("#dialogPath").html();
       var expression = Common.clearHtml(text);
       
       Command.browseScriptEvaluation([], expression, true); // clear the variables 
    };
    w2popup.open({
       title : dialogTitle,
       body : dialogBody.content,
       buttons : '<button id="dialogSave" class="btn dialogButton">Evaluate</button>',
       width : Math.max(700, windowWidth / 2),
       height : Math.max(400, windowHeight / 2),
       overflow : 'hidden',
       color : '#999',
       speed : '0.3',
       opacity : '0.8',
       modal : false,
       showClose : true,
       showMax : true,
       onOpen : function(event) {
          setTimeout(function() {
             dialogBody.init(); // bind the functions
             $('#dialog').w2grid({
                recordTitles: false, // show tooltips
                name : 'evaluation',
                columns : [ {
                   field : 'name',
                   caption : 'Name',
                   size : '40%',
                   sortable : false
                }, {
                   field : 'value',
                   caption : 'Value',
                   size : '30%',
                   sortable : false
                }, {
                   field : 'type',
                   caption : 'Type',
                   size : '30%'
                } ],
                onClick : function(event) {
                   var grid = this;
                   event.onComplete = function() {
                      var sel = grid.getSelection();
                      if (sel.length == 1) {
                         var record = grid.get(sel[0]);
                         var text = $("#dialogPath").html();
                         var expression = Common.clearHtml(text);
                         
                         VariableManager.toggleExpandEvaluation(record.path, expression);
                      }
                      grid.selectNone();
                      grid.refresh();
                   }
                }               
             }); 
             focusInput();
             
             setTimeout(function() {
                VariableManager.showVariables();
             }, 200);
          }, 200);
       },
       onClose : function(event) {
          w2ui['evaluation'].destroy(); // destroy grid so you can recreate it
          //$("#dialog").remove(); // delete the element
          VariableManager.clearEvaluation();
          Command.browseScriptEvaluation([], "", true); // clear the variables
       },
       onMax : function(event) {
          event.onComplete = function() {
             w2ui['evaluation'].refresh(); // resize
             focusInput();
          }
          $(window).trigger('resize');
       },
       onMin : function(event) {
          event.onComplete = function() {
             w2ui['evaluation'].refresh(); // resize
             focusInput();
          }
          $(window).trigger('resize');
       },
       onKeydown : function(event) {
          console.log('keydown');
       }
    });
    $("#dialogSave").click(function() {
       executeEvaluation();
    });
 }
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:100,代碼來源:dialog.ts

示例4:

 $("#dialogCancel").click(function() {
    w2popup.close();
 });
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:3,代碼來源:dialog.ts

示例5: createTreeDialog

 function createTreeDialog(resourceDetails: FilePath, foldersOnly: boolean, saveCallback: any, ignoreOrCancelCallback: any, nameIsBlank: boolean, dialogTitle: string, treePath: string) {
    var windowHeight: number = $(window).height();   // returns height of browser viewport
    var windowWidth: number = $(window).width();   // returns width of browser viewport
    var dialogExpandPath: string = "/";
 
    if (resourceDetails != null) {
       dialogExpandPath = resourceDetails.getProjectDirectory(); // /src/blah
    }
    var dialogBody = createFileSelectionDialogLayout(dialogExpandPath, '');
    var focusInput = function() {
       var element = document.getElementById('dialogPath');
       element.contentEditable = "true";
       element.focus();
    };
    var createFinalPath = function() {
       var originalDialogFileName = $('#dialogPath').html();
       var originalDialogFolder = $('#dialogFolder').html();
       var dialogPathName: string = FileTree.cleanResourcePath(originalDialogFileName);
       var dialogFolder: string = FileTree.cleanResourcePath(originalDialogFolder);
       var dialogProjectPath: string = dialogFolder + "/" + dialogPathName; // /src/blah/script.snap
       var dialogPathDetails: FilePath = FileTree.createResourcePath(dialogProjectPath); 
       
       return dialogPathDetails;
    }
    w2popup.open({
       title : dialogTitle,
       body : dialogBody.content, 
       buttons : '<button id="dialogSave" class="btn dialogButton">Save</button><button id="dialogCancel" class="btn dialogButton">Cancel</button>',
       width : Math.max(500, windowWidth / 2),
       height : Math.max(400, windowHeight / 2),
       overflow : 'hidden',
       color : '#999',
       speed : '0.3',
       opacity : '0.8',
       modal : true,
       showClose : true,
       showMax : true,
       onOpen : function(event) {
          setTimeout(function() {
             dialogBody.init();
             focusInput();
          }, 200);
       },
       onClose : function(event) {
          console.log('close');
       },
       onMax : function(event) {
          console.log('max');
          $(window).trigger('resize');
          event.onComplete = function() {
             focusInput();
          };
       },
       onMin : function(event) {
          console.log('min');
          $(window).trigger('resize');
          event.onComplete = function() {
             focusInput();
          };
       },
       onKeydown : function(event) {
          console.log('keydown');
       }
    });
    $("#dialogSave").click(function() {
       if(saveCallback) {
          var dialogPathDetails: FilePath = createFinalPath(); 
          saveCallback(dialogPathDetails);
       }
       w2popup.close();
    });
    $("#dialogCancel").click(function() {
       if(ignoreOrCancelCallback) {
          var dialogPathDetails: FilePath = createFinalPath(); 
          ignoreOrCancelCallback(dialogPathDetails);
       }
       w2popup.close();
    });
    if (resourceDetails != null) {
       $('#dialogFolder').html(FileTree.cleanResourcePath(resourceDetails.getProjectDirectory())); // /src/blah
       
       if(!nameIsBlank) {
          $('#dialogPath').html(FileTree.cleanResourcePath(resourceDetails.getFileName())); // script.snap
       }
    }
    FileTree.createTree(treePath, "dialog", "dialogTree", dialogExpandPath, foldersOnly, null, function(event, data) {
       var selectedFileDetails: FilePath = FileTree.createResourcePath(data.node.tooltip);
 
       if (data.node.isFolder()) {
          $('#dialogFolder').html(FileTree.cleanResourcePath(selectedFileDetails.getProjectDirectory()));
          //$('#dialogPath').html(""); // DO NOT CLEAR THE PATH INPUT
       } else {
          $('#dialogFolder').html(FileTree.cleanResourcePath(selectedFileDetails.getProjectDirectory())); // /src/blah
          $('#dialogPath').html(FileTree.cleanResourcePath(selectedFileDetails.getFileName())); // file.snap
       }
    });
 }
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:97,代碼來源:dialog.ts

示例6: createTextSearchAndReplaceDialog

   export function createTextSearchAndReplaceDialog(listFunction, fileFilterPatterns, dialogTitle) { // listFunction(token): [a, b, c]
      var windowHeight = $(window).height();   // returns height of browser viewport
      var windowWidth = $(window).width();   // returns width of browser viewport
      var focusInput = function() {
         var element = document.getElementById('searchText');
         element.contentEditable = "true";
         element.focus();
      };
      var executeSearch = function() {
         var expressionText = $("#searchText").html();
         
         // add a delay before you execute
         executeIfTextUnchanged(expressionText, "searchText", 300, function() {
            var searchCriteria = {
                  caseSensitive: isCheckboxSelected("inputCaseSensitive"),
                  regularExpression: isCheckboxSelected("inputRegularExpression"),
                  wholeWord: isCheckboxSelected("inputWholeWord")
               };
            var expressionPattern = null;
            
            if(fileFilterPatterns) {
               expressionPattern = $("#fileFilterPatterns").html();
               expressionPattern = Common.clearHtml(expressionPattern);
            }
            if(expressionText) {
               expressionText = Common.clearHtml(expressionText);
            } 
            listFunction(expressionText, expressionPattern, searchCriteria, function(list, requestedText) {
               var currentText = $("#searchText").html();
               
               if(!requestedText || currentText == requestedText) {
                  var content = createDialogListTable(list);
                  
                  if(content.content){
                     $("#dialog").html(content.content);
                  }else {
                     $("#dialog").html('');
                  }
                  // this is kind of crap, but we need to be sure the html is rendered before binding
                  if(content.init) {
                     setTimeout(content.init, 100); // register the init function to run 
                  }
               }
            });
         });
      };
      var dialogBody = createTextSearchAndReplaceDialogLayout(fileFilterPatterns, '', executeSearch);
      w2popup.open({
         title : dialogTitle,
         body : dialogBody.content,
         buttons : '<button id="dialogSave" class="btn dialogButton">Replace</button><button id="dialogCancel" class="btn dialogButton">Cancel</button>',
         width : Math.max(800, windowWidth / 2),
         height : Math.max(400, windowHeight / 2),
         overflow : 'hidden',
         color : '#999',
         speed : '0.3',
         opacity : '0.8',
         modal : true,
         showClose : true,
         showMax : true,
         onOpen : function(event) {
            setTimeout(function() {
               dialogBody.init();
               $('#searchText').on('change keyup paste', executeSearch);
//               $('#inputCaseSensitive').change(executeSearch);
//               $('#inputRegularExpression').change(executeSearch);
//               $('#inputWholeWord').change(executeSearch);
               focusInput();
            }, 200);
         },
         onMax : function(event) {
            console.log('max');
            $(window).trigger('resize');
            event.onComplete = function() {
               focusInput();
            };
         },
         onMin : function(event) {
            console.log('min');
            $(window).trigger('resize');
            event.onComplete = function() {
               focusInput();
            };
         }
      });
      $("#dialogSave").click(function() {
         var searchText = $("#searchText").html();
         var replaceText = $("#replaceText").html();
         var filePatterns = $("#fileFilterPatterns").html();
         var searchCriteria = {
               caseSensitive: isCheckboxSelected("inputCaseSensitive"),
               regularExpression: isCheckboxSelected("inputRegularExpression"),
               wholeWord: isCheckboxSelected("inputWholeWord"),
               enableReplace: true,
               replace: replaceText
            };
         
         Command.replaceTokenInFiles(searchText, searchCriteria, filePatterns);
         w2popup.close();
      });
//.........這裏部分代碼省略.........
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:101,代碼來源:dialog.ts

示例7: createListDialog

 export function createListDialog(listFunction, patternList, dialogTitle) { // listFunction(token): [a, b, c]
    var windowHeight = $(window).height();   // returns height of browser viewport
    var windowWidth = $(window).width();   // returns width of browser viewport
    var dialogBody = createListDialogLayout();
    var focusInput = function() {
       var element = document.getElementById('dialogPath');
       element.contentEditable = "true";
       element.focus();
    };
    w2popup.open({
       title : dialogTitle,
       body : dialogBody.content,
       buttons : '<button id="dialogCancel" class="btn dialogButton">Cancel</button>',
       width : Math.max(800, windowWidth / 2),
       height : Math.max(400, windowHeight / 2),
       overflow : 'hidden',
       color : '#999',
       speed : '0.3',
       opacity : '0.8',
       modal : true,
       showClose : true,
       showMax : true,
       onOpen : function(event) {
          setTimeout(function() {
             dialogBody.init();
             $('#dialogPath').on('change keyup paste', function() {
                var expressionText = $("#dialogPath").html();
                
                // add a delay before you execute
                executeIfTextUnchanged(expressionText, "dialogPath", 300, function() {
                   var expressionPattern = null;
                   
                   if(patternList) {
                      expressionPattern = $("#dialogFolder").html();
                      expressionPattern = Common.clearHtml(expressionPattern);
                   }
                   if(expressionText) {
                      expressionText = Common.clearHtml(expressionText);
                   } 
                   listFunction(expressionText, expressionPattern, function(list, requestedExpression) {
                      var currentExpression = $("#dialogPath").html();
                      
                      if(!requestedExpression || requestedExpression == currentExpression) {
                         var content = createDialogListTable(list);
                         
                         if(content.content){
                            $("#dialog").html(content.content);
                         }else {
                            $("#dialog").html('');
                         }
                         // this is kind of crap, but we need to be sure the html is rendered before binding
                         if(content.init) {
                            setTimeout(content.init, 100); // register the init function to run 
                         }
                      }
                   });
                });
             });
             focusInput();
          }, 200);
       },
       onMax : function(event) {
          console.log('max');
          $(window).trigger('resize');
          event.onComplete = function() {
             focusInput();
          };
       },
       onMin : function(event) {
          console.log('min');
          $(window).trigger('resize');
          event.onComplete = function() {
             focusInput();
          };
       }
    });
    $("#dialogSave").click(function() {
       w2popup.close();
    });
    $("#dialogCancel").click(function() {
       w2popup.close();
    });
 }
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:83,代碼來源:dialog.ts

示例8: completeFunction

 $("#dialogSave").click(function() {
    completeFunction();
    w2popup.close();
 });
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:4,代碼來源:dialog.ts


注:本文中的w2ui.w2popup類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。