diff --git a/src/_h5ai/client/icons/16x16/json.png b/src/_h5ai/client/icons/16x16/json.png new file mode 100644 index 00000000..af1a475e Binary files /dev/null and b/src/_h5ai/client/icons/16x16/json.png differ diff --git a/src/_h5ai/client/icons/48x48/json.png b/src/_h5ai/client/icons/48x48/json.png new file mode 100644 index 00000000..dbe9da65 Binary files /dev/null and b/src/_h5ai/client/icons/48x48/json.png differ diff --git a/src/_h5ai/client/js/inc/parser/generic-json.js b/src/_h5ai/client/js/inc/parser/generic-json.js index adc0f742..6443593a 100644 --- a/src/_h5ai/client/js/inc/parser/generic-json.js +++ b/src/_h5ai/client/js/inc/parser/generic-json.js @@ -1,29 +1,7 @@ -modulejs.define('parser/generic-json', ['_', '$', 'core/settings', 'model/entry'], function (_, $, settings, Entry) { +modulejs.define('parser/generic-json', ['_', '$', 'model/entry'], function (_, $, Entry) { - var parseJson = function (absHref, json) { - - if (!settings.custom) { - settings.custom = {}; - } - if (_.has(json, 'customHeader')) { - settings.custom.header = json.customHeader; - } - if (_.has(json, 'customFooter')) { - settings.custom.footer = json.customFooter; - } - return _.map(json.entries, function (jsonEntry) { - - return Entry.get(jsonEntry.absHref, jsonEntry.time, jsonEntry.size, jsonEntry.status, jsonEntry.content); - }); - }, - - parseJsonStr = function (absHref, jsonStr) { - - return parseJson(absHref, JSON.parse($.trim(jsonStr) || '{}')); - }, - - parse = function (absHref, html) { + var parse = function (absHref, html) { var id = '#data-generic-json', $html = $(html), @@ -33,7 +11,11 @@ modulejs.define('parser/generic-json', ['_', '$', 'core/settings', 'model/entry' $id = $html.find(id); } - return parseJsonStr(absHref, $id.text()); + var json = JSON.parse($.trim($id.text()) || '{}'); + return _.map(json.entries, function (jsonEntry) { + + return Entry.get(jsonEntry.absHref, jsonEntry.time, jsonEntry.size, jsonEntry.status, jsonEntry.content); + }); }; return { diff --git a/src/_h5ai/conf/options.json b/src/_h5ai/conf/options.json index 511341ef..87bd962b 100644 --- a/src/_h5ai/conf/options.json +++ b/src/_h5ai/conf/options.json @@ -223,16 +223,17 @@ Options "install": "plain", "log": "plain", "java": "java", + "js": "js", + "json": "js", "makefile": "xml", "markdown": "plain", - /*"php": "php",*/ + // "php": "php", "python": "python", "readme": "plain", "rb": "ruby", "rtf": "plain", "script": "shell", "text": "plain", - "js": "js", "xml": "xml" } }, diff --git a/src/_h5ai/conf/types.json b/src/_h5ai/conf/types.json index 71ffa28e..14f23ca5 100644 --- a/src/_h5ai/conf/types.json +++ b/src/_h5ai/conf/types.json @@ -40,7 +40,8 @@ File types mapped to file extensions "install": ["install"], "java": [".java"], "jpg": [".jpg", ".jpeg"], - "js": [".js", ".json"], + "js": [".js"], + "json": [".json"], "log": [".log", "changelog"], "makefile": [".pom", "build.xml", "pom.xml"], "markdown": [".markdown", ".md"],