removing tE()

This commit is contained in:
Jeremy Schomery 2017-07-19 17:08:27 +04:30 committed by tophf
parent 332f95e1ff
commit 7affeedd3b
2 changed files with 3 additions and 14 deletions

View File

@ -1234,7 +1234,7 @@ function init() {
const params = getParams(); const params = getParams();
if (!params.id) { // match should be 2 - one for the whole thing, one for the parentheses if (!params.id) { // match should be 2 - one for the whole thing, one for the parentheses
// This is an add // This is an add
tE('heading', 'addStyleTitle'); $('#heading').textContent = t('addStyleTitle');
const section = {code: ''}; const section = {code: ''};
for (const i in CssToProperty) { for (const i in CssToProperty) {
if (params[i]) { if (params[i]) {
@ -1252,7 +1252,7 @@ function init() {
return; return;
} }
// This is an edit // This is an edit
tE('heading', 'editStyleHeading', null, false); $('#heading').textContent = t('editStyleHeading');
getStylesSafe({id: params.id}).then(styles => { getStylesSafe({id: params.id}).then(styles => {
let style = styles[0]; let style = styles[0];
if (!style) { if (!style) {
@ -1505,7 +1505,7 @@ function saveComplete(style) {
// Go from new style URL to edit style URL // Go from new style URL to edit style URL
if (location.href.indexOf('id=') === -1) { if (location.href.indexOf('id=') === -1) {
history.replaceState({}, document.title, 'edit.html?id=' + style.id); history.replaceState({}, document.title, 'edit.html?id=' + style.id);
tE('heading', 'editStyleHeading', null, false); $('#heading').textContent = t('editStyleHeading');
} }
updateTitle(); updateTitle();
} }

View File

@ -17,17 +17,6 @@ function t(key, params) {
} }
function tE(id, key, attr, esc) {
if (attr) {
document.getElementById(id).setAttribute(attr, t(key));
} else if (typeof esc === 'undefined' || esc) {
document.getElementById(id).appendChild(document.createTextNode(t(key)));
} else {
document.getElementById(id).innerHTML = t(key);
}
}
function tHTML(html, tag) { function tHTML(html, tag) {
// body is a text node without HTML tags // body is a text node without HTML tags
if (typeof html === 'string' && !tag && /<\w+/.test(html) === false) { if (typeof html === 'string' && !tag && /<\w+/.test(html) === false) {