Use strict mode in JavaScript

Strict mode is supported by 98% of the browsers, including Internet
Explorer 10, and it helps developers avoid common JavaScript pitfalls.
This commit is contained in:
Javi Martín
2019-06-30 21:39:06 +02:00
parent 747767386a
commit 86e704d8a4
60 changed files with 124 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
"use strict"
App.AdvancedSearch =
advanced_search_terms: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.AllowParticipation =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Answers =
initializeAnswers: (answers) ->

View File

@@ -1 +1,3 @@
"use strict"
window.App = {}

View File

@@ -88,6 +88,8 @@
//= require votations
var initialize_modules = function() {
"use strict";
App.Answers.initialize();
App.Questions.initialize();
App.Comments.initialize();
@@ -141,6 +143,8 @@ var initialize_modules = function() {
};
$(function(){
"use strict";
Turbolinks.enableProgressBar();
$(document).ready(initialize_modules);

View File

@@ -1,3 +1,5 @@
"use strict"
App.Banners =
initialize: ->
$("[data-js-banner-title]").on

View File

@@ -1,3 +1,5 @@
"use strict"
App.BudgetEditAssociations =
set_text: (response)->

View File

@@ -1,3 +1,5 @@
"use strict"
App.CheckAllNone =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.CheckboxToggle =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.ColumnsSelector =
initColums: () ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Comments =
add_comment: (parent_id, response_html) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Cookies =
saveCookie: (name, value, days) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Documentable =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.EmbedVideo =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.FixedBar =
initialize: ->
$("[data-fixed-bar]").each ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Flaggable =
update: (resource_id, button) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Followable =
update: (followable_id, button, notice) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Forms =
disableEnter: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.FoundationExtras =
clearSticky: ->
$("[data-sticky]").foundation("destroy") if $("[data-sticky]").length

View File

@@ -1,3 +1,5 @@
"use strict"
i18n = {
es: {
"Comments": "Comentarios",

View File

@@ -1,3 +1,5 @@
"use strict"
App.Globalize =
selected_language: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.IeAlert =
set_cookie_and_hide: (event) ->
event.preventDefault()

View File

@@ -1,3 +1,5 @@
"use strict"
App.Imageable =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.InvestmentReportAlert =
initialize: ->
$("#js-investment-report-alert").on "click", ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Legislation =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.LegislationAdmin =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.LegislationAllegations =
toggle_comments: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.LegislationAnnotatable =
makeEditableAndHighlight: (colour) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.LocationChanger =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Managers =
generatePassword: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Map =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.MarkdownEditor =
refresh_preview: (element, md) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.ModalDownload =
enableButton: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.ModeratorBudgetInvestments =
add_class_faded: (id) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.ModeratorComments =
add_class_faded: (id) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.ModeratorDebates =
add_class_faded: (id) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.ModeratorProposalNotifications =
add_class_faded: (id) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.ModeratorProposals =
add_class_faded: (id) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Polls =
generateToken: ->
token = ""

View File

@@ -1,3 +1,5 @@
"use strict"
App.PollsAdmin =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.PreventDoubleSubmission =
disable_buttons: (buttons) ->
setTimeout ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Questions =
nestedQuestions: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.RegistrationForm =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.SendAdminNotificationAlert =
initialize: ->
$("#js-send-admin_notification-alert").on "click", ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.SendNewsletterAlert =
initialize: ->
$("#js-send-newsletter-alert").on "click", ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Settings =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.SocialShare =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Sortable =
initialize: ->
$(".sortable").sortable

View File

@@ -4,10 +4,14 @@
//= require stats
var initialize_stats_modules = function() {
"use strict";
App.Stats.initialize();
};
$(function(){
"use strict";
$(document).ready(initialize_stats_modules);
$(document).on("page:load", initialize_stats_modules);
$(document).on("ajax:complete", initialize_stats_modules);

View File

@@ -1,3 +1,5 @@
"use strict"
# Helper for generate C3.js graphs
#----------------------------------------------------------------------

View File

@@ -1,3 +1,5 @@
"use strict"
App.Suggest =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.TableSortable =
getCellValue: (row, index) ->
$(row).children("td").eq(index).text()

View File

@@ -1,3 +1,5 @@
"use strict"
App.TagAutocomplete =
split: ( val ) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Tags =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.TreeNavigator =
setNodes: (nodes) ->
children = nodes.children("ul")

View File

@@ -1,3 +1,5 @@
"use strict"
App.Users =
initialize: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.ValuationBudgetInvestmentForm =
showFeasibleFields: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Votations =
checkMaxVotes: ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.Votes =
hoverize: (votes) ->

View File

@@ -1,3 +1,5 @@
"use strict"
App.WatchFormChanges =
forms: ->
return $("form[data-watch-changes]")