diff --git a/src/EntryBtn/EntryBtn.hbs b/src/EntryBtn/EntryBtn.hbs
deleted file mode 100644
index c35564d..0000000
--- a/src/EntryBtn/EntryBtn.hbs
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/src/Resources/Resources.hbs b/src/Resources/Resources.hbs
deleted file mode 100644
index a8c0abf..0000000
--- a/src/Resources/Resources.hbs
+++ /dev/null
@@ -1,184 +0,0 @@
-
-
- Local Storage
-
-
-
-
-
-
-
-
-
- {{#if localStoreSearchKeyword}}{{localStoreSearchKeyword}}
{{/if}}
-
-
-
-
- {{#if localStoreData}}
- {{#each localStoreData}}
-
- | {{key}} |
- {{val}} |
-
-
- |
-
- {{/each}}
- {{else}}
-
- | Empty |
-
- {{/if}}
-
-
-
-
-
-
- Session Storage
-
-
-
-
-
-
-
-
-
- {{#if sessionStoreSearchKeyword}}{{sessionStoreSearchKeyword}}
{{/if}}
-
-
-
-
- {{#if sessionStoreData}}
- {{#each sessionStoreData}}
-
- | {{key}} |
- {{val}} |
-
-
- |
-
- {{/each}}
- {{else}}
-
- | Empty |
-
- {{/if}}
-
-
-
-
-
-
- Cookie
-
-
-
-
-
-
-
-
-
- {{#if cookieSearchKeyword}}{{cookieSearchKeyword}}
{{/if}}
-
-
-
-
- {{#if cookieData}}
- {{#each cookieData}}
-
- | {{key}} |
- {{val}} |
-
-
- |
-
- {{/each}}
- {{else}}
-
- | Empty |
-
- {{/if}}
-
-
-
-
-
-
- Script
-
-
-
-
-
- {{#if scriptData}}
- {{#each scriptData}}
- -
- {{this}}
-
- {{/each}}
- {{else}}
- - Empty
- {{/if}}
-
-
-
-
- Stylesheet
-
-
-
-
-
- {{#if stylesheetData}}
- {{#each stylesheetData}}
- -
- {{this}}
-
- {{/each}}
- {{else}}
- - Empty
- {{/if}}
-
-
-
-
- Iframe
-
-
-
-
-
- {{#if iframeData}}
- {{#each iframeData}}
- -
- {{this}}
-
- {{/each}}
- {{else}}
- - Empty
- {{/if}}
-
-
-
-
- Image
-
-
-
-
-
- {{#if imageData}}
- {{#each imageData}}
- -
-
-
- {{/each}}
- {{else}}
- - Empty
- {{/if}}
-
-
diff --git a/src/Resources/Resources.js b/src/Resources/Resources.js
index 5fc2753..99accfb 100644
--- a/src/Resources/Resources.js
+++ b/src/Resources/Resources.js
@@ -1,6 +1,8 @@
import Tool from '../DevTools/Tool'
import Settings from '../Settings/Settings'
import $ from 'licia/$'
+import escape from 'licia/escape'
+import isEmpty from 'licia/isEmpty'
import unique from 'licia/unique'
import each from 'licia/each'
import isStr from 'licia/isStr'
@@ -17,7 +19,7 @@ import lowerCase from 'licia/lowerCase'
import contain from 'licia/contain'
import filter from 'licia/filter'
import map from 'licia/map'
-import { safeStorage, isErudaEl } from '../lib/util'
+import { safeStorage, isErudaEl, classPrefix as c } from '../lib/util'
import evalCss from '../lib/evalCss'
import chobitsu from '../lib/chobitsu'
import LunaModal from 'luna-modal'
@@ -41,7 +43,6 @@ export default class Resources extends Tool {
this._iframeData = []
this._imageData = []
this._observeElement = true
- this._tpl = require('./Resources.hbs')
}
init($el, container) {
super.init($el)
@@ -395,7 +396,6 @@ export default class Resources extends Tool {
.separator()
}
_render() {
- const cookieData = this._cookieData
const scriptData = this._scriptData
const stylesheetData = this._stylesheetData
const imageData = this._imageData
@@ -416,29 +416,263 @@ export default class Resources extends Tool {
})
}
- this._renderHtml(
- this._tpl({
- localStoreData: filterData(
- this._localStoreData,
+ const localStoreData = filterData(
+ this._localStoreData,
+ localStoreSearchKeyword
+ )
+ let localStoreDataHtml = '| Empty |
'
+ if (!isEmpty(localStoreData)) {
+ localStoreDataHtml = map(localStoreData, ({ key, val }) => {
+ key = escape(key)
+
+ return `
+ | ${key} |
+ ${escape(val)} |
+
+
+ |
+
`
+ }).join('')
+ }
+
+ const localStorageHtml = `
+
+ Local Storage
+
+
+
+
+
+
+
+
+
+ ${
localStoreSearchKeyword
- ),
- localStoreSearchKeyword,
- sessionStoreData: filterData(
- this._sessionStoreData,
+ ? `${escape(
+ localStoreSearchKeyword
+ )}
`
+ : ''
+ }
+
+
+
+
+ ${localStoreDataHtml}
+
+
+
+
`
+
+ const sessionStoreData = filterData(
+ this._sessionStoreData,
+ sessionStoreSearchKeyword
+ )
+
+ let sessionStoreDataHtml = '| Empty |
'
+ if (!isEmpty(sessionStoreData)) {
+ sessionStoreDataHtml = map(sessionStoreData, ({ key, val }) => {
+ key = escape(key)
+
+ return `
+ | ${key} |
+ ${escape(val)} |
+
+
+ |
+
`
+ }).join('')
+ }
+
+ const sessionStorageHtml = `
+
+ Session Storage
+
+
+
+
+
+
+
+
+
+ ${
sessionStoreSearchKeyword
- ),
- sessionStoreSearchKeyword,
- cookieData: filterData(cookieData, cookieSearchKeyword),
- cookieSearchKeyword,
- cookieState: getState('cookie', cookieData.length),
- scriptData,
- scriptState: getState('script', scriptData.length),
- stylesheetData,
- stylesheetState: getState('stylesheet', stylesheetData.length),
- iframeData: this._iframeData,
- imageData,
- imageState: getState('image', imageData.length),
- })
+ ? `${escape(
+ sessionStoreSearchKeyword
+ )}
`
+ : ''
+ }
+
+
+
+
+ ${sessionStoreDataHtml}
+
+
+
+
`
+
+ const cookieData = filterData(this._cookieData, cookieSearchKeyword)
+ const cookieState = getState('cookie', this._cookieData.length)
+
+ let cookieDataHtml = '| Empty |
'
+ if (!isEmpty(cookieData)) {
+ cookieDataHtml = map(cookieData, ({ key, val }) => {
+ key = escape(key)
+
+ return `
+ | ${key} |
+ ${escape(val)} |
+
+
+ |
+
`
+ }).join('')
+ }
+
+ const cookieHtml = `
+
+ Cookie
+
+
+
+
+
+
+
+
+
+ ${
+ cookieSearchKeyword
+ ? `${escape(
+ cookieSearchKeyword
+ )}
`
+ : ''
+ }
+
+
+
+
+ ${cookieDataHtml}
+
+
+
+
`
+
+ const scriptState = getState('script', scriptData.length)
+ let scriptDataHtml = 'Empty'
+ if (!isEmpty(scriptData)) {
+ scriptDataHtml = map(scriptData, (script) => {
+ script = escape(script)
+ return `${script}`
+ }).join('')
+ }
+
+ const scriptHtml = ``
+
+ const stylesheetState = getState('stylesheet', stylesheetData.length)
+ let stylesheetDataHtml = 'Empty'
+ if (!stylesheetData) {
+ stylesheetDataHtml = map(stylesheetData, (stylesheet) => {
+ stylesheet = escape(stylesheet)
+ return ` ${stylesheet}`
+ }).join('')
+ }
+
+ const stylesheetHtml = `
+
+ Stylesheet
+
+
+
+
+
+ ${stylesheetDataHtml}
+
+
`
+
+ let iframeDataHtml = 'Empty'
+ if (!isEmpty(this._iframeData)) {
+ iframeDataHtml = map(this._iframeData, (iframe) => {
+ iframe = escape(iframe)
+ return `${iframe}`
+ }).join('')
+ }
+ const iframeHtml = ``
+
+ const imageState = getState('image', imageData.length)
+ let imageDataHtml = 'Empty'
+ if (!isEmpty(imageData)) {
+ imageDataHtml = map(imageData, (image) => {
+ return `
+
+ `
+ }).join('')
+ }
+
+ const imageHtml = ``
+
+ this._renderHtml(
+ [
+ localStorageHtml,
+ sessionStorageHtml,
+ cookieHtml,
+ scriptHtml,
+ stylesheetHtml,
+ iframeHtml,
+ imageHtml,
+ ].join('')
)
}
_renderHtml(html) {