summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2015-04-19 00:53:34 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-05 12:21:27 +0200
commitc6448f49018ba88d5b2525b224415e6d7fd2b4fe (patch)
tree0b22cece7e61f43cf2e353b2bd664b1fbea1add9 /data
parent7a6ddaf571efa3e87d6f40a4e465d31d16583979 (diff)
Do minor refactoring on app js
Diffstat (limited to 'data')
-rw-r--r--data/js/application.js21
-rw-r--r--data/js/script.js9
2 files changed, 21 insertions, 9 deletions
diff --git a/data/js/application.js b/data/js/application.js
index 2ae412051..ef520be65 100644
--- a/data/js/application.js
+++ b/data/js/application.js
@@ -21,15 +21,36 @@ define(
* config contains app config attributes passed from php
*/
onPageLoaded: function (config) {
+ config = config || {};
Util.highlightLineFromHash();
Util.setTabwidthFromLocalStorage();
TabwidthInput.initialize();
LexerInput.initialize(config.lexers);
+ this.configureTooltips();
+ this.setupToggleSelectAllEvent();
},
setupLineHighlight: function () {
$(window).on('hashchange', Util.highlightLineFromHash);
},
+
+ configureTooltips: function () {
+ $('[rel="tooltip"]').tooltip({
+ placement: 'bottom',
+ container: 'body',
+ });
+ },
+
+ setupToggleSelectAllEvent: function () {
+ $('#history-all').on('click', function(event) {
+ // Suppress click event on table heading
+ event.stopImmediatePropagation();
+ });
+ $('#history-all').on('change', function(event) {
+ var checked = $(event.target).prop('checked');
+ $('.delete-history').prop('checked', checked);
+ });
+ }
};
diff --git a/data/js/script.js b/data/js/script.js
index 242cf74de..f0ab3cc94 100644
--- a/data/js/script.js
+++ b/data/js/script.js
@@ -1,14 +1,5 @@
(function($) {
$(function() {
- $('[rel="tooltip"]').tooltip({
- placement: 'bottom',
- container: 'body',
- });
-
- $('#history-all').bind('change', function() {
- $('.delete-history').prop('checked', $(this).is(':checked'));
- });
-
window.lines_wrapped = true;
$('[id^=linewrap-]').click(function() {
if (window.lines_wrapped == true) {