1(function() { 2var CheckingScriptObjectCommand = ASPx.CreateClass(null, { 3 constructor: function(scriptName, markerObjectName) { 4 this.scriptName = scriptName; 5 this.markerObjectName = markerObjectName; 6 this.isExisted = false; 7 }, 8 Run: function() { 9 var markerObj = this.GetMarkerObject(); 10 this.isExisted = !!markerObj; 11 if(this.isExisted) 12 markerObj.DXPatched = true; 13 }, 14 GetErrorMessage: function() { 15 return this.GetErrorMessageCore(true); 16 }, 17 GetErrorMessageCore: function(isScriptRequired){ 18 var markerObj = this.GetMarkerObject(); 19 if(this.isExisted && markerObj && markerObj.DXPatched || !isScriptRequired && !markerObj) 20 return null; 21 if(isScriptRequired && !this.GetMarkerObject()){ 22 if(this.isExisted) 23 return this.scriptName + " script was attached but has been overridden."; 24 else 25 return this.scriptName + " script was not attached."; 26 } 27 if(!this.isExisted) 28 return this.scriptName + " script was attached after DevExpress scripts."; 29 return this.scriptName + " script was attached multiple times and mixed up with DevExpress scripts."; 30 }, 31 GetMarkerObject: function() { 32 return ASPx.GetGlobalObject(this.markerObjectName); 33 } 34}); 35var PatchScriptCommand = ASPx.CreateClass(CheckingScriptObjectCommand, { 36 constructor: function(scriptName, markerObjectName, patchMethod, required) { 37 this.constructor.prototype.constructor.call(this, scriptName, markerObjectName); 38 this.required = required; 39 this.patchMethod = patchMethod; 40 }, 41 Run: function() { 42 CheckingScriptObjectCommand.prototype.Run.call(this); 43 if(this.isExisted) 44 this.patchMethod(); 45 }, 46 GetErrorMessage: function() { 47 return this.GetErrorMessageCore(this.required); 48 } 49});
50var ExternalScriptProcessor = ASPx.CreateClass(null, { 51 constructor: function() { 52 this.commands = {}; 53 }, 54 Process: function(scriptName, markerObjectName, patchMethod, required) { 55 var newCommand = this.CreateCommand(scriptName, markerObjectName, patchMethod, !!required); 56 var oldCommand = this.commands[markerObjectName]; 57 if(oldCommand) { 58 if(!oldCommand.patchMethod && !newCommand.patchMethod) 59 newCommand = null; 60 else if(newCommand.patchMethod && (!oldCommand.patchMethod || oldCommand.required)) 61 newCommand.required = true; 62 else if(oldCommand.patchMethod && !newCommand.patchMethod) { 63 oldCommand.required = true; 64 newCommand = null; 65 } 66 } 67 if(newCommand) { 68 this.commands[markerObjectName] = newCommand; 69 newCommand.Run(); 70 } 71 }, 72 CreateCommand: function(scriptName, markerObjectName, patchMethod, required) { 73 if(patchMethod) 74 return new PatchScriptCommand(scriptName, markerObjectName, patchMethod, required); 75 return new CheckingScriptObjectCommand(scriptName, markerObjectName); 76 }, 77 ShowErrorMessages: function() { 78 var messages = this.GetErrorMessages(); 79 var console = window.console; 80 if(!messages.length || !console || !ASPx.IsFunction(console.error)) 81 return; 82 for(var i = 0; i < messages.length; i++) { 83 console.error(messages[i]); 84 } 85 ASPx.ShowKBErrorMessage("Please check the correctness of script registration on the page. For details, see ", "T272309"); 86 }, 87 GetErrorMessages: function() { 88 var messages = []; 89 for (var key in this.commands) { 90 if (this.commands.hasOwnProperty(key)) { 91 var message = this.commands[key].GetErrorMessage(); 92 if (message) 93 messages.push(message); 94 } 95 } 96 return messages; 97 } 98}); 99ExternalScriptProcessor.Instance = null; 100ExternalScriptProcessor.getInstance = function() { 101 if(!ExternalScriptProcessor.Instance) 102 ExternalScriptProcessor.Instance = new ExternalScriptProcessor(); 103 return ExternalScriptProcessor.Instance; 104}; 105ASPx.ExternalScriptProcessor = ExternalScriptProcessor; 106})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.