Skip to content

Commit 49c4556

Browse files
committed
Comply to the new JSCS rules.
1 parent 93785be commit 49c4556

File tree

5 files changed

+56
-50
lines changed

5 files changed

+56
-50
lines changed

docs/assets/js/ie10-viewport-bug-workaround.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* IE10 viewport hack for Surface/desktop Windows 8 bug
3-
* Copyright 2014 Twitter, Inc.
3+
* Copyright 2014-2015 Twitter, Inc.
44
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
55
* details, see http://creativecommons.org/licenses/by/3.0/.
66
*/
@@ -10,6 +10,7 @@
1010

1111
(function () {
1212
'use strict';
13+
1314
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
1415
var msViewportStyle = document.createElement('style')
1516
msViewportStyle.appendChild(
@@ -19,4 +20,5 @@
1920
)
2021
document.querySelector('head').appendChild(msViewportStyle)
2122
}
23+
2224
})();

docs/assets/js/src/application.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,26 @@
5858

5959
// theme toggler
6060
;(function () {
61-
var stylesheetLink = $('#bs-theme-stylesheet')
62-
var themeBtn = $('.bs-docs-theme-toggle')
61+
var $stylesheetLink = $('#bs-theme-stylesheet')
62+
var $themeBtn = $('.bs-docs-theme-toggle')
6363

6464
var activateTheme = function () {
65-
stylesheetLink.attr('href', stylesheetLink.attr('data-href'))
66-
themeBtn.text('Disable theme preview')
65+
$stylesheetLink.attr('href', $stylesheetLink.attr('data-href'))
66+
$themeBtn.text('Disable theme preview')
6767
localStorage.setItem('previewTheme', true)
6868
}
6969

7070
if (localStorage.getItem('previewTheme')) {
7171
activateTheme()
7272
}
7373

74-
themeBtn.click(function () {
75-
var href = stylesheetLink.attr('href')
74+
$themeBtn.click(function () {
75+
var href = $stylesheetLink.attr('href')
7676
if (!href || href.indexOf('data') === 0) {
7777
activateTheme()
7878
} else {
79-
stylesheetLink.attr('href', '')
80-
themeBtn.text('Preview theme')
79+
$stylesheetLink.attr('href', '')
80+
$themeBtn.text('Preview theme')
8181
localStorage.removeItem('previewTheme')
8282
}
8383
})
@@ -102,22 +102,22 @@
102102

103103
// Button state demo
104104
$('#loading-example-btn').on('click', function () {
105-
var btn = $(this)
106-
btn.button('loading')
105+
var $btn = $(this)
106+
$btn.button('loading')
107107
setTimeout(function () {
108-
btn.button('reset')
108+
$btn.button('reset')
109109
}, 3000)
110110
})
111111

112112
// Modal relatedTarget demo
113113
$('#exampleModal').on('show.bs.modal', function (event) {
114-
var button = $(event.relatedTarget) // Button that triggered the modal
115-
var recipient = button.data('whatever') // Extract info from data-* attributes
114+
var $button = $(event.relatedTarget) // Button that triggered the modal
115+
var recipient = $button.data('whatever') // Extract info from data-* attributes
116116
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
117117
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
118-
var modal = $(this)
119-
modal.find('.modal-title').text('New message to ' + recipient)
120-
modal.find('.modal-body input').val(recipient)
118+
var $modal = $(this)
119+
$modal.find('.modal-title').text('New message to ' + recipient)
120+
$modal.find('.modal-body input').val(recipient)
121121
})
122122

123123
// Activate animated progress bar
@@ -137,11 +137,11 @@
137137
$(this).before(btnHtml)
138138
})
139139
var zeroClipboard = new ZeroClipboard($('.btn-clipboard'))
140-
var htmlBridge = $('#global-zeroclipboard-html-bridge')
140+
var $htmlBridge = $('#global-zeroclipboard-html-bridge')
141141

142142
// Handlers for ZeroClipboard
143143
zeroClipboard.on('load', function () {
144-
htmlBridge
144+
$htmlBridge
145145
.data('placement', 'top')
146146
.attr('title', 'Copy to clipboard')
147147
.tooltip()
@@ -155,7 +155,7 @@
155155

156156
// Notify copy success and reset tooltip title
157157
zeroClipboard.on('complete', function () {
158-
htmlBridge
158+
$htmlBridge
159159
.attr('title', 'Copied!')
160160
.tooltip('fixTitle')
161161
.tooltip('show')
@@ -177,5 +177,6 @@
177177

178178
;(function () {
179179
'use strict';
180-
addAnchors('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5');
180+
181+
addAnchors('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5')
181182
})();

docs/assets/js/src/customizer.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
window.onload = function () { // wait for load in a dumb way because B-0
1313
'use strict';
14+
1415
var cw = '/*!\n' +
1516
' * Bootstrap v3.3.4 (http://getbootstrap.com)\n' +
1617
' * Copyright 2011-' + new Date().getFullYear() + ' Twitter, Inc.\n' +
1718
' * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n' +
1819
' */\n\n'
1920

2021
var supportsFile = window.File && window.FileReader && window.FileList && window.Blob
21-
var importDropTarget = $('#import-drop-target')
22+
var $importDropTarget = $('#import-drop-target')
2223

2324
function showError(msg, err) {
2425
$('<div id="bsCustomizerAlert" class="bs-customizer-alert">' +
@@ -39,15 +40,15 @@ window.onload = function () { // wait for load in a dumb way because B-0
3940
}
4041

4142
function showCallout(msg, showUpTop) {
42-
var callout = $('<div class="bs-callout bs-callout-danger">' +
43+
var $callout = $('<div class="bs-callout bs-callout-danger">' +
4344
'<h4>Attention!</h4>' +
4445
'<p>' + msg + '</p>' +
4546
'</div>')
4647

4748
if (showUpTop) {
48-
callout.appendTo('.bs-docs-container')
49+
$callout.appendTo('.bs-docs-container')
4950
} else {
50-
callout.insertAfter('.bs-customize-download')
51+
$callout.insertAfter('.bs-customize-download')
5152
}
5253
}
5354

@@ -200,8 +201,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
200201
}
201202

202203
function generateFonts() {
203-
var glyphicons = $('#less-section [value="glyphicons.less"]:checked')
204-
if (glyphicons.length) {
204+
var $glyphicons = $('#less-section [value="glyphicons.less"]:checked')
205+
if ($glyphicons.length) {
205206
return __fonts
206207
}
207208
}
@@ -358,7 +359,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
358359
}
359360

360361
function removeImportAlerts() {
361-
importDropTarget.nextAll('.alert').remove()
362+
$importDropTarget.nextAll('.alert').remove()
362363
}
363364

364365
function handleConfigFileSelect(e) {
@@ -380,9 +381,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
380381
}
381382

382383
updateCustomizerFromJson(json)
383-
showAlert('success', '<strong>Woohoo!</strong> Your configuration was successfully uploaded. Tweak your settings, then hit Download.', importDropTarget)
384+
showAlert('success', '<strong>Woohoo!</strong> Your configuration was successfully uploaded. Tweak your settings, then hit Download.', $importDropTarget)
384385
} catch (err) {
385-
return showAlert('danger', '<strong>Shucks.</strong> We can only read valid <code>.json</code> files. Please try again.', importDropTarget)
386+
return showAlert('danger', '<strong>Shucks.</strong> We can only read valid <code>.json</code> files. Please try again.', $importDropTarget)
386387
}
387388
}
388389

@@ -398,31 +399,31 @@ window.onload = function () { // wait for load in a dumb way because B-0
398399
}
399400

400401
if (supportsFile) {
401-
importDropTarget
402+
$importDropTarget
402403
.on('dragover', handleConfigDragOver)
403404
.on('drop', handleConfigFileSelect)
404405
}
405406

406407
$('#import-file-select').on('change', handleConfigFileSelect)
407408
$('#import-manual-trigger').on('click', removeImportAlerts)
408409

409-
var inputsComponent = $('#less-section input')
410-
var inputsPlugin = $('#plugin-section input')
411-
var inputsVariables = $('#less-variables-section input')
410+
var $inputsComponent = $('#less-section input')
411+
var $inputsPlugin = $('#plugin-section input')
412+
var $inputsVariables = $('#less-variables-section input')
412413

413414
$('#less-section .toggle').on('click', function (e) {
414415
e.preventDefault()
415-
inputsComponent.prop('checked', !inputsComponent.is(':checked'))
416+
$inputsComponent.prop('checked', !$inputsComponent.is(':checked'))
416417
})
417418

418419
$('#plugin-section .toggle').on('click', function (e) {
419420
e.preventDefault()
420-
inputsPlugin.prop('checked', !inputsPlugin.is(':checked'))
421+
$inputsPlugin.prop('checked', !$inputsPlugin.is(':checked'))
421422
})
422423

423424
$('#less-variables-section .toggle').on('click', function (e) {
424425
e.preventDefault()
425-
inputsVariables.val('')
426+
$inputsVariables.val('')
426427
})
427428

428429
$('[data-dependencies]').on('click', function () {
@@ -431,8 +432,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
431432
if (!dependencies) return
432433
dependencies = dependencies.split(',')
433434
for (var i = 0; i < dependencies.length; i++) {
434-
var dependency = $('[value="' + dependencies[i] + '"]')
435-
dependency && dependency.prop('checked', true)
435+
var $dependency = $('[value="' + dependencies[i] + '"]')
436+
$dependency && $dependency.prop('checked', true)
436437
}
437438
})
438439

@@ -442,8 +443,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
442443
if (!dependents) return
443444
dependents = dependents.split(',')
444445
for (var i = 0; i < dependents.length; i++) {
445-
var dependent = $('[value="' + dependents[i] + '"]')
446-
dependent && dependent.prop('checked', false)
446+
var $dependent = $('[value="' + dependents[i] + '"]')
447+
$dependent && $dependent.prop('checked', false)
447448
}
448449
})
449450

js/tab.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
// ====================
1515

1616
var Tab = function (element) {
17+
// jscs:disable requireDollarBeforejQueryAssignment
1718
this.element = $(element)
19+
// jscs:enable requireDollarBeforejQueryAssignment
1820
}
1921

2022
Tab.VERSION = '3.3.4'

js/tests/unit/modal.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,16 @@ $(function () {
166166
assert.expect(3)
167167
var done = assert.async()
168168

169-
var div = $('<div id="modal-test"/>')
170-
div
169+
var $div = $('<div id="modal-test"/>')
170+
$div
171171
.on('shown.bs.modal', function () {
172172
assert.ok($('#modal-test').length, 'modal insterted into dom')
173173
assert.ok($('#modal-test').is(':visible'), 'modal visible')
174-
div.trigger($.Event('keydown', { which: 27 }))
174+
$div.trigger($.Event('keydown', { which: 27 }))
175175

176176
setTimeout(function () {
177177
assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
178-
div.remove()
178+
$div.remove()
179179
done()
180180
}, 0)
181181
})
@@ -186,16 +186,16 @@ $(function () {
186186
assert.expect(3)
187187
var done = assert.async()
188188

189-
var div = $('<div id="modal-test"/>')
190-
div
189+
var $div = $('<div id="modal-test"/>')
190+
$div
191191
.on('shown.bs.modal', function () {
192192
assert.ok($('#modal-test').length, 'modal inserted into dom')
193193
assert.ok($('#modal-test').is(':visible'), 'modal visible')
194-
div.trigger($.Event('keyup', { which: 27 }))
194+
$div.trigger($.Event('keyup', { which: 27 }))
195195

196196
setTimeout(function () {
197-
assert.ok($('#modal-test').is(':visible'), 'modal still visible')
198-
div.remove()
197+
assert.ok($div.is(':visible'), 'modal still visible')
198+
$div.remove()
199199
done()
200200
}, 0)
201201
})

0 commit comments

Comments
 (0)