0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-03-15 15:29:22 +01:00

Merge pull request #16392 from twbs/jscs

Update JSCS rules
This commit is contained in:
XhmikosR 2015-05-05 06:58:16 +03:00
commit 280f6c5d5c
12 changed files with 89 additions and 88 deletions

View File

@ -2029,7 +2029,9 @@ if (typeof jQuery === 'undefined') {
// ==================== // ====================
var Tab = function (element) { var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element) this.element = $(element)
// jscs:enable requireDollarBeforejQueryAssignment
} }
Tab.VERSION = '3.3.4' Tab.VERSION = '3.3.4'

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* IE10 viewport hack for Surface/desktop Windows 8 bug * IE10 viewport hack for Surface/desktop Windows 8 bug
* Copyright 2014 Twitter, Inc. * Copyright 2014-2015 Twitter, Inc.
* Licensed under the Creative Commons Attribution 3.0 Unported License. For * Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/. * details, see http://creativecommons.org/licenses/by/3.0/.
*/ */
@ -10,6 +10,7 @@
(function () { (function () {
'use strict'; 'use strict';
if (navigator.userAgent.match(/IEMobile\/10\.0/)) { if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement('style') var msViewportStyle = document.createElement('style')
msViewportStyle.appendChild( msViewportStyle.appendChild(
@ -19,4 +20,5 @@
) )
document.querySelector('head').appendChild(msViewportStyle) document.querySelector('head').appendChild(msViewportStyle)
} }
})(); })();

File diff suppressed because one or more lines are too long

View File

@ -58,12 +58,12 @@
// theme toggler // theme toggler
;(function () { ;(function () {
var stylesheetLink = $('#bs-theme-stylesheet') var $stylesheetLink = $('#bs-theme-stylesheet')
var themeBtn = $('.bs-docs-theme-toggle') var $themeBtn = $('.bs-docs-theme-toggle')
var activateTheme = function () { var activateTheme = function () {
stylesheetLink.attr('href', stylesheetLink.attr('data-href')) $stylesheetLink.attr('href', $stylesheetLink.attr('data-href'))
themeBtn.text('Disable theme preview') $themeBtn.text('Disable theme preview')
localStorage.setItem('previewTheme', true) localStorage.setItem('previewTheme', true)
} }
@ -71,13 +71,13 @@
activateTheme() activateTheme()
} }
themeBtn.click(function () { $themeBtn.click(function () {
var href = stylesheetLink.attr('href') var href = $stylesheetLink.attr('href')
if (!href || href.indexOf('data') === 0) { if (!href || href.indexOf('data') === 0) {
activateTheme() activateTheme()
} else { } else {
stylesheetLink.attr('href', '') $stylesheetLink.attr('href', '')
themeBtn.text('Preview theme') $themeBtn.text('Preview theme')
localStorage.removeItem('previewTheme') localStorage.removeItem('previewTheme')
} }
}) })
@ -102,22 +102,22 @@
// Button state demo // Button state demo
$('#loading-example-btn').on('click', function () { $('#loading-example-btn').on('click', function () {
var btn = $(this) var $btn = $(this)
btn.button('loading') $btn.button('loading')
setTimeout(function () { setTimeout(function () {
btn.button('reset') $btn.button('reset')
}, 3000) }, 3000)
}) })
// Modal relatedTarget demo // Modal relatedTarget demo
$('#exampleModal').on('show.bs.modal', function (event) { $('#exampleModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal var $button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('whatever') // Extract info from data-* attributes var recipient = $button.data('whatever') // Extract info from data-* attributes
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback). // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead. // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
var modal = $(this) var $modal = $(this)
modal.find('.modal-title').text('New message to ' + recipient) $modal.find('.modal-title').text('New message to ' + recipient)
modal.find('.modal-body input').val(recipient) $modal.find('.modal-body input').val(recipient)
}) })
// Activate animated progress bar // Activate animated progress bar
@ -137,11 +137,11 @@
$(this).before(btnHtml) $(this).before(btnHtml)
}) })
var zeroClipboard = new ZeroClipboard($('.btn-clipboard')) var zeroClipboard = new ZeroClipboard($('.btn-clipboard'))
var htmlBridge = $('#global-zeroclipboard-html-bridge') var $htmlBridge = $('#global-zeroclipboard-html-bridge')
// Handlers for ZeroClipboard // Handlers for ZeroClipboard
zeroClipboard.on('load', function () { zeroClipboard.on('load', function () {
htmlBridge $htmlBridge
.data('placement', 'top') .data('placement', 'top')
.attr('title', 'Copy to clipboard') .attr('title', 'Copy to clipboard')
.tooltip() .tooltip()
@ -155,7 +155,7 @@
// Notify copy success and reset tooltip title // Notify copy success and reset tooltip title
zeroClipboard.on('complete', function () { zeroClipboard.on('complete', function () {
htmlBridge $htmlBridge
.attr('title', 'Copied!') .attr('title', 'Copied!')
.tooltip('fixTitle') .tooltip('fixTitle')
.tooltip('show') .tooltip('show')
@ -177,5 +177,6 @@
;(function () { ;(function () {
'use strict'; 'use strict';
addAnchors('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5');
addAnchors('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5')
})(); })();

View File

@ -11,6 +11,7 @@
window.onload = function () { // wait for load in a dumb way because B-0 window.onload = function () { // wait for load in a dumb way because B-0
'use strict'; 'use strict';
var cw = '/*!\n' + var cw = '/*!\n' +
' * Bootstrap v3.3.4 (http://getbootstrap.com)\n' + ' * Bootstrap v3.3.4 (http://getbootstrap.com)\n' +
' * Copyright 2011-' + new Date().getFullYear() + ' Twitter, Inc.\n' + ' * Copyright 2011-' + new Date().getFullYear() + ' Twitter, Inc.\n' +
@ -18,7 +19,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
' */\n\n' ' */\n\n'
var supportsFile = window.File && window.FileReader && window.FileList && window.Blob var supportsFile = window.File && window.FileReader && window.FileList && window.Blob
var importDropTarget = $('#import-drop-target') var $importDropTarget = $('#import-drop-target')
function showError(msg, err) { function showError(msg, err) {
$('<div id="bsCustomizerAlert" class="bs-customizer-alert">' + $('<div id="bsCustomizerAlert" class="bs-customizer-alert">' +
@ -39,15 +40,15 @@ window.onload = function () { // wait for load in a dumb way because B-0
} }
function showCallout(msg, showUpTop) { function showCallout(msg, showUpTop) {
var callout = $('<div class="bs-callout bs-callout-danger">' + var $callout = $('<div class="bs-callout bs-callout-danger">' +
'<h4>Attention!</h4>' + '<h4>Attention!</h4>' +
'<p>' + msg + '</p>' + '<p>' + msg + '</p>' +
'</div>') '</div>')
if (showUpTop) { if (showUpTop) {
callout.appendTo('.bs-docs-container') $callout.appendTo('.bs-docs-container')
} else { } else {
callout.insertAfter('.bs-customize-download') $callout.insertAfter('.bs-customize-download')
} }
} }
@ -200,8 +201,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
} }
function generateFonts() { function generateFonts() {
var glyphicons = $('#less-section [value="glyphicons.less"]:checked') var $glyphicons = $('#less-section [value="glyphicons.less"]:checked')
if (glyphicons.length) { if ($glyphicons.length) {
return __fonts return __fonts
} }
} }
@ -358,7 +359,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
} }
function removeImportAlerts() { function removeImportAlerts() {
importDropTarget.nextAll('.alert').remove() $importDropTarget.nextAll('.alert').remove()
} }
function handleConfigFileSelect(e) { function handleConfigFileSelect(e) {
@ -380,9 +381,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
} }
updateCustomizerFromJson(json) updateCustomizerFromJson(json)
showAlert('success', '<strong>Woohoo!</strong> Your configuration was successfully uploaded. Tweak your settings, then hit Download.', importDropTarget) showAlert('success', '<strong>Woohoo!</strong> Your configuration was successfully uploaded. Tweak your settings, then hit Download.', $importDropTarget)
} catch (err) { } catch (err) {
return showAlert('danger', '<strong>Shucks.</strong> We can only read valid <code>.json</code> files. Please try again.', importDropTarget) return showAlert('danger', '<strong>Shucks.</strong> We can only read valid <code>.json</code> files. Please try again.', $importDropTarget)
} }
} }
@ -398,7 +399,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
} }
if (supportsFile) { if (supportsFile) {
importDropTarget $importDropTarget
.on('dragover', handleConfigDragOver) .on('dragover', handleConfigDragOver)
.on('drop', handleConfigFileSelect) .on('drop', handleConfigFileSelect)
} }
@ -406,23 +407,23 @@ window.onload = function () { // wait for load in a dumb way because B-0
$('#import-file-select').on('change', handleConfigFileSelect) $('#import-file-select').on('change', handleConfigFileSelect)
$('#import-manual-trigger').on('click', removeImportAlerts) $('#import-manual-trigger').on('click', removeImportAlerts)
var inputsComponent = $('#less-section input') var $inputsComponent = $('#less-section input')
var inputsPlugin = $('#plugin-section input') var $inputsPlugin = $('#plugin-section input')
var inputsVariables = $('#less-variables-section input') var $inputsVariables = $('#less-variables-section input')
$('#less-section .toggle').on('click', function (e) { $('#less-section .toggle').on('click', function (e) {
e.preventDefault() e.preventDefault()
inputsComponent.prop('checked', !inputsComponent.is(':checked')) $inputsComponent.prop('checked', !$inputsComponent.is(':checked'))
}) })
$('#plugin-section .toggle').on('click', function (e) { $('#plugin-section .toggle').on('click', function (e) {
e.preventDefault() e.preventDefault()
inputsPlugin.prop('checked', !inputsPlugin.is(':checked')) $inputsPlugin.prop('checked', !$inputsPlugin.is(':checked'))
}) })
$('#less-variables-section .toggle').on('click', function (e) { $('#less-variables-section .toggle').on('click', function (e) {
e.preventDefault() e.preventDefault()
inputsVariables.val('') $inputsVariables.val('')
}) })
$('[data-dependencies]').on('click', function () { $('[data-dependencies]').on('click', function () {
@ -431,8 +432,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
if (!dependencies) return if (!dependencies) return
dependencies = dependencies.split(',') dependencies = dependencies.split(',')
for (var i = 0; i < dependencies.length; i++) { for (var i = 0; i < dependencies.length; i++) {
var dependency = $('[value="' + dependencies[i] + '"]') var $dependency = $('[value="' + dependencies[i] + '"]')
dependency && dependency.prop('checked', true) $dependency && $dependency.prop('checked', true)
} }
}) })
@ -442,8 +443,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
if (!dependents) return if (!dependents) return
dependents = dependents.split(',') dependents = dependents.split(',')
for (var i = 0; i < dependents.length; i++) { for (var i = 0; i < dependents.length; i++) {
var dependent = $('[value="' + dependents[i] + '"]') var $dependent = $('[value="' + dependents[i] + '"]')
dependent && dependent.prop('checked', false) $dependent && $dependent.prop('checked', false)
} }
}) })

View File

@ -2029,7 +2029,9 @@ if (typeof jQuery === 'undefined') {
// ==================== // ====================
var Tab = function (element) { var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element) this.element = $(element)
// jscs:enable requireDollarBeforejQueryAssignment
} }
Tab.VERSION = '3.3.4' Tab.VERSION = '3.3.4'

View File

@ -17,8 +17,11 @@
"requireCamelCaseOrUpperCaseIdentifiers": true, "requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCapitalizedConstructors": true, "requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true, "requireCommaBeforeLineBreak": true,
"requireDollarBeforejQueryAssignment": true,
"requireDotNotation": true, "requireDotNotation": true,
"requireLineFeedAtFileEnd": true, "requireLineFeedAtFileEnd": true,
"requirePaddingNewLinesAfterUseStrict": true,
"requirePaddingNewLinesBeforeExport": true,
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpaceAfterLineComment": true, "requireSpaceAfterLineComment": true,
@ -31,7 +34,9 @@
"requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
"requireSpacesInsideObjectBrackets": "allButNested", "requireSpacesInsideObjectBrackets": "allButNested",
"validateAlignedFunctionParameters": true,
"validateIndentation": 2, "validateIndentation": 2,
"validateLineBreaks": "LF", "validateLineBreaks": "LF",
"validateNewlineAfterArrayElements": true,
"validateQuoteMarks": "'" "validateQuoteMarks": "'"
} }

View File

@ -14,7 +14,9 @@
// ==================== // ====================
var Tab = function (element) { var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element) this.element = $(element)
// jscs:enable requireDollarBeforejQueryAssignment
} }
Tab.VERSION = '3.3.4' Tab.VERSION = '3.3.4'

View File

@ -166,16 +166,16 @@ $(function () {
assert.expect(3) assert.expect(3)
var done = assert.async() var done = assert.async()
var div = $('<div id="modal-test"/>') var $div = $('<div id="modal-test"/>')
div $div
.on('shown.bs.modal', function () { .on('shown.bs.modal', function () {
assert.ok($('#modal-test').length, 'modal insterted into dom') assert.ok($('#modal-test').length, 'modal insterted into dom')
assert.ok($('#modal-test').is(':visible'), 'modal visible') assert.ok($('#modal-test').is(':visible'), 'modal visible')
div.trigger($.Event('keydown', { which: 27 })) $div.trigger($.Event('keydown', { which: 27 }))
setTimeout(function () { setTimeout(function () {
assert.ok(!$('#modal-test').is(':visible'), 'modal hidden') assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
div.remove() $div.remove()
done() done()
}, 0) }, 0)
}) })
@ -186,16 +186,16 @@ $(function () {
assert.expect(3) assert.expect(3)
var done = assert.async() var done = assert.async()
var div = $('<div id="modal-test"/>') var $div = $('<div id="modal-test"/>')
div $div
.on('shown.bs.modal', function () { .on('shown.bs.modal', function () {
assert.ok($('#modal-test').length, 'modal inserted into dom') assert.ok($('#modal-test').length, 'modal inserted into dom')
assert.ok($('#modal-test').is(':visible'), 'modal visible') assert.ok($('#modal-test').is(':visible'), 'modal visible')
div.trigger($.Event('keyup', { which: 27 })) $div.trigger($.Event('keyup', { which: 27 }))
setTimeout(function () { setTimeout(function () {
assert.ok($('#modal-test').is(':visible'), 'modal still visible') assert.ok($div.is(':visible'), 'modal still visible')
div.remove() $div.remove()
done() done()
}, 0) }, 0)
}) })

View File

@ -54,12 +54,12 @@
"grunt-exec": "~0.4.6", "grunt-exec": "~0.4.6",
"grunt-html": "~4.0.2", "grunt-html": "~4.0.2",
"grunt-jekyll": "~0.4.2", "grunt-jekyll": "~0.4.2",
"grunt-jscs": "~1.6.0", "grunt-jscs": "~1.8.0",
"grunt-saucelabs": "~8.6.1", "grunt-saucelabs": "~8.6.1",
"grunt-sed": "twbs/grunt-sed#v0.2.0", "grunt-sed": "twbs/grunt-sed#v0.2.0",
"load-grunt-tasks": "~3.1.0", "load-grunt-tasks": "~3.1.0",
"markdown-it": "^4.1.1", "markdown-it": "^4.2.0",
"npm-shrinkwrap": "^200.1.0", "npm-shrinkwrap": "^200.4.0",
"time-grunt": "^1.1.1" "time-grunt": "^1.1.1"
}, },
"engines": { "engines": {

View File

@ -247,8 +247,8 @@
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-0.2.0.tgz" "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-0.2.0.tgz"
}, },
"caniuse-db": { "caniuse-db": {
"version": "1.0.30000149", "version": "1.0.30000150",
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000149.tgz" "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000150.tgz"
}, },
"num2fraction": { "num2fraction": {
"version": "1.1.0", "version": "1.1.0",
@ -2349,14 +2349,8 @@
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz" "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz"
}, },
"tough-cookie": { "tough-cookie": {
"version": "1.0.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-1.0.0.tgz", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-1.1.0.tgz"
"dependencies": {
"punycode": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz"
}
}
}, },
"tunnel-agent": { "tunnel-agent": {
"version": "0.4.0", "version": "0.4.0",
@ -2679,14 +2673,8 @@
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz" "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz"
}, },
"tough-cookie": { "tough-cookie": {
"version": "1.0.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-1.0.0.tgz", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-1.1.0.tgz"
"dependencies": {
"punycode": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz"
}
}
}, },
"tunnel-agent": { "tunnel-agent": {
"version": "0.4.0", "version": "0.4.0",
@ -3169,16 +3157,16 @@
} }
}, },
"grunt-jscs": { "grunt-jscs": {
"version": "1.6.0", "version": "1.8.0",
"resolved": "https://registry.npmjs.org/grunt-jscs/-/grunt-jscs-1.6.0.tgz", "resolved": "https://registry.npmjs.org/grunt-jscs/-/grunt-jscs-1.8.0.tgz",
"dependencies": { "dependencies": {
"hooker": { "hooker": {
"version": "0.2.3", "version": "0.2.3",
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz" "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz"
}, },
"jscs": { "jscs": {
"version": "1.12.0", "version": "1.13.0",
"resolved": "https://registry.npmjs.org/jscs/-/jscs-1.12.0.tgz", "resolved": "https://registry.npmjs.org/jscs/-/jscs-1.13.0.tgz",
"dependencies": { "dependencies": {
"chalk": { "chalk": {
"version": "1.0.0", "version": "1.0.0",
@ -3241,8 +3229,8 @@
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.5.tgz" "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.5.tgz"
}, },
"esprima-harmony-jscs": { "esprima-harmony-jscs": {
"version": "1.1.0-templates", "version": "1.1.0-bin",
"resolved": "https://registry.npmjs.org/esprima-harmony-jscs/-/esprima-harmony-jscs-1.1.0-templates.tgz" "resolved": "https://registry.npmjs.org/esprima-harmony-jscs/-/esprima-harmony-jscs-1.1.0-bin.tgz"
}, },
"estraverse": { "estraverse": {
"version": "1.9.3", "version": "1.9.3",
@ -3324,6 +3312,10 @@
} }
} }
}, },
"pathval": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-0.1.1.tgz"
},
"prompt": { "prompt": {
"version": "0.2.14", "version": "0.2.14",
"resolved": "https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz", "resolved": "https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz",
@ -3689,14 +3681,8 @@
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz" "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz"
}, },
"tough-cookie": { "tough-cookie": {
"version": "1.0.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-1.0.0.tgz", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-1.1.0.tgz"
"dependencies": {
"punycode": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz"
}
}
}, },
"tunnel-agent": { "tunnel-agent": {
"version": "0.4.0", "version": "0.4.0",