diff --git a/import.bat b/import.bat new file mode 100644 index 0000000..4446d65 --- /dev/null +++ b/import.bat @@ -0,0 +1,10 @@ +:: This batch script makes the Caché application deployment much faster by building and importing +:: the project. Replace the path below to your Caché installation and build & import application to +:: Caché using only one command. + +:: CHANGE THIS PATH TO YOUR CACHÉ INSTALLATION PATH ON WINDOWS +set CACHE_DIR=C:\Program Files\InterSystems\Ensemble +:: NAMESPACE IMPORTING TO +set NAMESPACE=USER + +npm run gulp & echo w "OK:"_$system.OBJ.ImportDir("%~dp0build\Cache",,"ck") halt | "%CACHE_DIR%\bin\cache.exe" -s "%CACHE_DIR%\mgr" -U %NAMESPACE% \ No newline at end of file diff --git a/package.json b/package.json index 7ac2e85..ef69901 100755 --- a/package.json +++ b/package.json @@ -1,15 +1,26 @@ { "name": "CacheClassExplorer", - "version": "1.20.0", + "version": "1.20.1", "description": "Class Explorer for InterSystems Caché", "directories": { "test": "test" }, "dependencies": {}, - "devDependencies": { "autoprefixer-core": "^5.1.11", "express": "^5.0.0-alpha.1", - "gulp": "^3.9.0", "gulp-add-src": "^0.2.0", "gulp-clean": "^0.3.1", "gulp-concat": "^2.4.1", - "gulp-header": "^1.2.2", "gulp-html-replace": "^1.4.1", "gulp-minify-css": "^0.3.11", - "gulp-postcss": "^5.1.3", "gulp-rename": "^1.2.0", "gulp-replace": "^0.5.3", - "gulp-strip-comments": "^1.0.1", "gulp-uglify": "^1.2.0", "gulp-wrap": "^0.5.0", - "gulp-zip": "^2.0.2" }, + "devDependencies": { + "autoprefixer-core": "^6.0.1", + "gulp": "^3.9.0", + "gulp-add-src": "^0.2.0", + "gulp-clean": "^0.3.1", + "gulp-concat": "^2.6.1", + "gulp-header": "^1.8.8", + "gulp-html-replace": "^1.6.2", + "gulp-minify-css": "^1.2.4", + "gulp-postcss": "^6.4.0", + "gulp-rename": "^1.2.0", + "gulp-replace": "^0.5.3", + "gulp-strip-comments": "^2.4.5", + "gulp-uglify": "^2.1.2", + "gulp-wrap": "^0.13.0", + "gulp-zip": "^4.0.0" + }, "scripts": { "gulp": "gulp" }, "repository": { "type": "git", "url": "https://github.com/ZitRos/CacheUMLExplorer" }, "keywords": [ "UMLExplorer", "Caché", "UML", "diagram" ], diff --git a/web/js/Lib.js b/web/js/Lib.js index 430788e..3c347c6 100644 --- a/web/js/Lib.js +++ b/web/js/Lib.js @@ -16,8 +16,23 @@ Lib.prototype.load = function (url, data, callback) { xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { + var res = {}; try { - return callback(null, JSON.parse(xhr.responseText) || {}); + res = JSON.parse(xhr.responseText); + } catch (e) { + var text = xhr.responseText.replace(/\\x([0-9a-fA-F]{2})/g, "\\u00$1"); + try { + res = JSON.parse(text); + } catch (e) { + try { + res = eval(text); + } catch (e) { + console.error("Unable to parse server response:", text); + } + } + } + try { + return callback(null, res); } catch (e) { console.error(e, url, "Unable to parse:", { data: xhr.responseText }); return {}; @@ -275,7 +290,7 @@ Lib.prototype.highlightXML = function (code) { Lib.prototype.getSelection = function () { var html = ""; - if (typeof window.getSelection != "undefined") { + if (typeof window.getSelection !== "undefined") { var sel = window.getSelection(); if (sel.rangeCount) { var container = document.createElement("div"); @@ -284,8 +299,8 @@ Lib.prototype.getSelection = function () { } html = container.innerHTML; } - } else if (typeof document.selection != "undefined") { - if (document.selection.type == "Text") { + } else if (typeof document.selection !== "undefined") { + if (document.selection.type === "Text") { html = document.selection.createRange().htmlText; } }