MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / loadExampleHtml

Function loadExampleHtml

examples/js/editor.js:87–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85}
86
87function loadExampleHtml() {
88 var locationParam = getLocationParam();
89 if (!locationParam) {
90 return;
91 }
92 var href = window.location.toString();
93 var mapUrl = href.substr(0, href.lastIndexOf('/') + 1);
94 mapUrl = mapUrl + locationParam + ".html";
95 if (!mapUrl) {
96 return;
97 }
98 var isError = false;
99 var response = $.ajax({
100 url: mapUrl,
101 async: false,
102 error: function (error) {
103 alert(resources.editor.envTips);
104 isError = true;
105 }
106 });
107 var html = response.responseText;
108 if (html && html != "" && !isError) {
109 $('#editor').val(html);
110 loadPreview(html);
111 } else {
112 window.location.href = window.location.origin + '/web/404.html';
113 }
114}
115
116function getLocationParam() {
117 var param = window.location.toString();

Callers 1

initEditorFunction · 0.85

Calls 4

getLocationParamFunction · 0.85
loadPreviewFunction · 0.85
$Function · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected