Permalink
Browse files

Cache jquery selectors

  • Loading branch information...
1 parent 1d070fd commit 6b6983e3eeaeebdb349c5555ce4e484fa80154de @VSEphpbb VSEphpbb committed Apr 30, 2016
Showing with 12 additions and 6 deletions.
  1. +12 −6 styles/prosilver/template/editor.js
View
18 styles/prosilver/template/editor.js
@@ -2,14 +2,20 @@
'use strict';
- var authorTpl;
+ var authorTpl,
+ $elem = {
+ author: $('.skeleton-author'),
+ addAuthor: $('#skeleton-new-author'),
+ components: $('.components'),
+ marklist: $('.skeleton-marklist')
+ };
$(function() {
- authorTpl = $('.skeleton-author').first().clone();
+ authorTpl = $elem.author.first().clone();
});
- $('#skeleton-new-author').click(function() {
- var count = $('.skeleton-author').length,
+ $elem.addAuthor.on('click', function() {
+ var count = $elem.author.length,
$author = authorTpl.clone();
$author.find('label').each(function() {
@@ -23,9 +29,9 @@
$(this).before($('<hr />')).before($author);
});
- $('.skeleton-marklist').on('click', function(e) {
+ $elem.marklist.on('click', function(e) {
e.preventDefault();
- $('.components').prop('checked', $(this).hasClass('markall'));
+ $elem.components.prop('checked', $(this).hasClass('markall'));
});
})(jQuery); // Avoid conflicts with other libraries

0 comments on commit 6b6983e

Please sign in to comment.