forked from GithubBackups/vichan
main.js: use let
This commit is contained in:
parent
bd5c2c61b9
commit
cb6d6f13dd
@ -71,7 +71,7 @@ var datelocale =
|
|||||||
|
|
||||||
|
|
||||||
function alert(a, do_confirm, confirm_ok_action, confirm_cancel_action) {
|
function alert(a, do_confirm, confirm_ok_action, confirm_cancel_action) {
|
||||||
var handler, div, bg, closebtn, okbtn;
|
let handler, div, bg, closebtn, okbtn;
|
||||||
let close = function() {
|
let close = function() {
|
||||||
handler.fadeOut(400, function() { handler.remove(); });
|
handler.fadeOut(400, function() { handler.remove(); });
|
||||||
return false;
|
return false;
|
||||||
@ -133,11 +133,11 @@ function changeStyle(styleName, link) {
|
|||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
|
|
||||||
if (!document.getElementById('stylesheet')) {
|
if (!document.getElementById('stylesheet')) {
|
||||||
var s = document.createElement('link');
|
let s = document.createElement('link');
|
||||||
s.rel = 'stylesheet';
|
s.rel = 'stylesheet';
|
||||||
s.type = 'text/css';
|
s.type = 'text/css';
|
||||||
s.id = 'stylesheet';
|
s.id = 'stylesheet';
|
||||||
var x = document.getElementsByTagName('head')[0];
|
let x = document.getElementsByTagName('head')[0];
|
||||||
x.appendChild(s);
|
x.appendChild(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,8 +145,8 @@ function changeStyle(styleName, link) {
|
|||||||
selectedstyle = styleName;
|
selectedstyle = styleName;
|
||||||
|
|
||||||
if (document.getElementsByClassName('styles').length != 0) {
|
if (document.getElementsByClassName('styles').length != 0) {
|
||||||
var styleLinks = document.getElementsByClassName('styles')[0].childNodes;
|
let styleLinks = document.getElementsByClassName('styles')[0].childNodes;
|
||||||
for (var i = 0; i < styleLinks.length; i++) {
|
for (let i = 0; i < styleLinks.length; i++) {
|
||||||
styleLinks[i].className = '';
|
styleLinks[i].className = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ function changeStyle(styleName, link) {
|
|||||||
|
|
||||||
var stylesheet_choices = JSON.parse(localStorage.board_stylesheets);
|
var stylesheet_choices = JSON.parse(localStorage.board_stylesheets);
|
||||||
if (board_name && stylesheet_choices[board_name]) {
|
if (board_name && stylesheet_choices[board_name]) {
|
||||||
for (var styleName in styles) {
|
for (let styleName in styles) {
|
||||||
if (styleName == stylesheet_choices[board_name]) {
|
if (styleName == stylesheet_choices[board_name]) {
|
||||||
changeStyle(styleName);
|
changeStyle(styleName);
|
||||||
break;
|
break;
|
||||||
@ -182,7 +182,7 @@ function changeStyle(styleName, link) {
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
if (localStorage.stylesheet) {
|
if (localStorage.stylesheet) {
|
||||||
for (var styleName in styles) {
|
for (let styleName in styles) {
|
||||||
if (styleName == localStorage.stylesheet) {
|
if (styleName == localStorage.stylesheet) {
|
||||||
changeStyle(styleName);
|
changeStyle(styleName);
|
||||||
break;
|
break;
|
||||||
@ -194,11 +194,11 @@ function changeStyle(styleName, link) {
|
|||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
|
|
||||||
function initStyleChooser() {
|
function initStyleChooser() {
|
||||||
var newElement = document.createElement('div');
|
let newElement = document.createElement('div');
|
||||||
newElement.className = 'styles';
|
newElement.className = 'styles';
|
||||||
|
|
||||||
for (styleName in styles) {
|
for (styleName in styles) {
|
||||||
var style = document.createElement('a');
|
let style = document.createElement('a');
|
||||||
style.innerHTML = '[' + styleName + ']';
|
style.innerHTML = '[' + styleName + ']';
|
||||||
style.onclick = function() {
|
style.onclick = function() {
|
||||||
changeStyle(this.innerHTML.substring(1, this.innerHTML.length - 1), this);
|
changeStyle(this.innerHTML.substring(1, this.innerHTML.length - 1), this);
|
||||||
@ -259,8 +259,7 @@ function highlightReply(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let divs = document.getElementsByTagName('div');
|
let divs = document.getElementsByTagName('div');
|
||||||
for (var i = 0; i < divs.length; i++)
|
for (let i = 0; i < divs.length; i++) {
|
||||||
{
|
|
||||||
if (divs[i].className.indexOf('post') != -1) {
|
if (divs[i].className.indexOf('post') != -1) {
|
||||||
divs[i].className = divs[i].className.replace(/highlighted/, '');
|
divs[i].className = divs[i].className.replace(/highlighted/, '');
|
||||||
}
|
}
|
||||||
@ -435,7 +434,7 @@ onReady(init);
|
|||||||
|
|
||||||
{% if config.google_analytics %}{% verbatim %}
|
{% if config.google_analytics %}{% verbatim %}
|
||||||
|
|
||||||
var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endverbatim %}{{ config.google_analytics }}{% verbatim %}']);{% endverbatim %}{% if config.google_analytics_domain %}{% verbatim %}_gaq.push(['_setDomainName', '{% endverbatim %}{{ config.google_analytics_domain }}{% verbatim %}']){% endverbatim %}{% endif %}{% if not config.google_analytics_domain %}{% verbatim %}_gaq.push(['_setDomainName', 'none']){% endverbatim %}{% endif %}{% verbatim %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endverbatim %}{% endif %}
|
var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endverbatim %}{{ config.google_analytics }}{% verbatim %}']);{% endverbatim %}{% if config.google_analytics_domain %}{% verbatim %}_gaq.push(['_setDomainName', '{% endverbatim %}{{ config.google_analytics_domain }}{% verbatim %}']){% endverbatim %}{% endif %}{% if not config.google_analytics_domain %}{% verbatim %}_gaq.push(['_setDomainName', 'none']){% endverbatim %}{% endif %}{% verbatim %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';let s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endverbatim %}{% endif %}
|
||||||
|
|
||||||
{% if config.statcounter_project and config.statcounter_security %}
|
{% if config.statcounter_project and config.statcounter_security %}
|
||||||
var sc = document.createElement('script');
|
var sc = document.createElement('script');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user