diff --git a/script/pen.js b/script/pen.js index 2ab8744..5fc062c 100644 --- a/script/pen.js +++ b/script/pen.js @@ -1,33 +1,36 @@ -var yearmod = 288 +/* jshint browser: true, jquery: true */ +/* global ClipboardJS */ +'use strict'; +var yearmod = 288; -$(document).ready(function() { +$(document).ready(function () { $('#year').html(getYear()); $('#input').bind('input change', run); - $('#save').click(function() { download('pencode.txt', $('#input').val()) }); - $('#load').click(function() { loadFile($('#template').val()) }); + $('#save').click(function () { download('pencode.txt', $('#input').val()); }); + $('#load').click(function () { loadFile($('#template').val()); }); $('.controlgroup').controlgroup(); // get clipboard.js set up var clip = new ClipboardJS('#copy'); - clip.on('success', function() { - alert('Copied to clipboard.') + clip.on('success', function () { + alert('Copied to clipboard.'); }); - clip.on('failure', function() { - alert('Failed to copy.') + clip.on('failure', function () { + alert('Failed to copy.'); }); // keep #copy loaded with the path currently on #template - $('#template').on('selectmenuchange', function() { - var temp = $('#template').val() - $('#copy').attr('data-clipboard-text','http://ps.ss13.net#' + temp.substring(0, temp.indexOf('.txt'))) + $('#template').on('selectmenuchange', function () { + var temp = $('#template').val(); + $('#copy').attr('data-clipboard-text','http://ps.ss13.net#' + temp.substring(0, temp.indexOf('.txt'))); }); - setTimeout(function() { + setTimeout(function () { var hash = $(location).attr('hash'); - loadFile(hash ? hash.substring(1) + '.txt' : 'instructions.txt') - }, 100); + loadFile(hash ? hash.substring(1) + '.txt' : 'instructions.txt'); + }, 100); }); @@ -102,7 +105,7 @@ function processText(str) { .replaceAll('[xynlogo]', '') .replaceAll('[editorbr]', '') - ) + ); return str; } @@ -140,7 +143,7 @@ function download(filename, text) { document.body.removeChild(element); - alert('Document saved as ' + filename) + alert('Document saved as ' + filename); } function loadFile(filename) {