Skip to content

Commit 1127f11

Browse files
committed
Fixing many == to ===, != to !==
1 parent ab39d5c commit 1127f11

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed

src/timeline/js/controllers.js

+42-42
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ App.controller("TimelineCtrl", function ($scope) {
159159
continue;
160160
}
161161
// Determine if this property is a Keyframe
162-
if (typeof object[child] == "object" && "Points" in object[child]) {
162+
if (typeof object[child] === "object" && "Points" in object[child]) {
163163
for (var point = 0; point < object[child].Points.length; point++) {
164164
var co = object[child].Points[point].co;
165165
if (co.X >= clip_start_x && co.X <= clip_end_x) {
@@ -169,7 +169,7 @@ App.controller("TimelineCtrl", function ($scope) {
169169
}
170170
}
171171
// Determine if this property is a Color Keyframe
172-
if (typeof object[child] == "object" && "red" in object[child]) {
172+
if (typeof object[child] === "object" && "red" in object[child]) {
173173
for (var point = 0; point < object[child]["red"].Points.length; point++) {
174174
var co = object[child]["red"].Points[point].co;
175175
if (co.X >= clip_start_x && co.X <= clip_end_x) {
@@ -189,7 +189,7 @@ App.controller("TimelineCtrl", function ($scope) {
189189
continue;
190190
}
191191
// Determine if this property is a Keyframe
192-
if (typeof object["effects"][effect][child] == "object" && "Points" in object["effects"][effect][child]) {
192+
if (typeof object["effects"][effect][child] === "object" && "Points" in object["effects"][effect][child]) {
193193
for (var point = 0; point < object["effects"][effect][child].Points.length; point++) {
194194
var co = object["effects"][effect][child].Points[point].co;
195195
if (co.X >= clip_start_x && co.X <= clip_end_x) {
@@ -199,7 +199,7 @@ App.controller("TimelineCtrl", function ($scope) {
199199
}
200200
}
201201
// Determine if this property is a Color Keyframe
202-
if (typeof object["effects"][effect][child] == "object" && "red" in object["effects"][effect][child]) {
202+
if (typeof object["effects"][effect][child] === "object" && "red" in object["effects"][effect][child]) {
203203
for (var point = 0; point < object["effects"][effect][child]["red"].Points.length; point++) {
204204
var co = object["effects"][effect][child]["red"].Points[point].co;
205205
if (co.X >= clip_start_x && co.X <= clip_end_x) {
@@ -315,7 +315,7 @@ App.controller("TimelineCtrl", function ($scope) {
315315
$scope.setAudioData = function (clip_id, audio_data) {
316316
// Find matching clip
317317
for (var clip_index = 0; clip_index < $scope.project.clips.length; clip_index++) {
318-
if ($scope.project.clips[clip_index].id == clip_id) {
318+
if ($scope.project.clips[clip_index].id === clip_id) {
319319
// Set audio data
320320
$scope.$apply(function () {
321321
$scope.project.clips[clip_index].audio_data = audio_data;
@@ -334,7 +334,7 @@ App.controller("TimelineCtrl", function ($scope) {
334334
$scope.hideAudioData = function (clip_id) {
335335
// Find matching clip
336336
for (var clip_index = 0; clip_index < $scope.project.clips.length; clip_index++) {
337-
if ($scope.project.clips[clip_index].id == clip_id) {
337+
if ($scope.project.clips[clip_index].id === clip_id) {
338338
// Set audio data
339339
$scope.$apply(function () {
340340
$scope.project.clips[clip_index].show_audio = false;
@@ -360,7 +360,7 @@ App.controller("TimelineCtrl", function ($scope) {
360360
$scope.hasAudioData = function (clip_id) {
361361
// Find matching clip
362362
for (var clip_index = 0; clip_index < $scope.project.clips.length; clip_index++) {
363-
if ($scope.project.clips[clip_index].id == clip_id && "audio_data" in $scope.project.clips[clip_index] && $scope.project.clips[clip_index].audio_data.length > 0) {
363+
if ($scope.project.clips[clip_index].id === clip_id && "audio_data" in $scope.project.clips[clip_index] && $scope.project.clips[clip_index].audio_data.length > 0) {
364364
return true;
365365
}
366366
}
@@ -507,12 +507,12 @@ App.controller("TimelineCtrl", function ($scope) {
507507
var id = clip_id.replace("clip_", "");
508508

509509
// Clear transitions also (if needed)
510-
if (id != "" && clear_selections) {
510+
if (id !== "" && clear_selections) {
511511
$scope.selectTransition("", clear_selections);
512512
$scope.selectEffect("", clear_selections);
513513
}
514514
// Call slice method and exit (don't actually select the clip)
515-
if (id != "" && $scope.enable_razor) {
515+
if (id !== "" && $scope.enable_razor) {
516516
if ($scope.Qt) {
517517
var cursor_seconds = $scope.getJavaScriptPosition(event.clientX);
518518
timeline.RazorSliceAtCursor(id, "", cursor_seconds);
@@ -528,7 +528,7 @@ App.controller("TimelineCtrl", function ($scope) {
528528

529529
// Unselect all clips
530530
for (var clip_index = 0; clip_index < $scope.project.clips.length; clip_index++) {
531-
if ($scope.project.clips[clip_index].id == id) {
531+
if ($scope.project.clips[clip_index].id === id) {
532532
$scope.project.clips[clip_index].selected = true;
533533
if ($scope.Qt) {
534534
timeline.addSelection(id, "clip", clear_selections);
@@ -549,12 +549,12 @@ App.controller("TimelineCtrl", function ($scope) {
549549
var id = tran_id.replace("transition_", "");
550550

551551
// Clear clips also (if needed)
552-
if (id != "" && clear_selections) {
552+
if (id !== "" && clear_selections) {
553553
$scope.selectClip("", true);
554554
$scope.selectEffect("", true);
555555
}
556556
// Call slice method and exit (don't actually select the transition)
557-
if (id != "" && $scope.enable_razor) {
557+
if (id !== "" && $scope.enable_razor) {
558558
if ($scope.Qt) {
559559
var cursor_seconds = $scope.getJavaScriptPosition(event.clientX);
560560
timeline.RazorSliceAtCursor("", id, cursor_seconds);
@@ -571,7 +571,7 @@ App.controller("TimelineCtrl", function ($scope) {
571571

572572
// Unselect all transitions
573573
for (var tran_index = 0; tran_index < $scope.project.effects.length; tran_index++) {
574-
if ($scope.project.effects[tran_index].id == id) {
574+
if ($scope.project.effects[tran_index].id === id) {
575575
$scope.project.effects[tran_index].selected = true;
576576
if ($scope.Qt) {
577577
timeline.addSelection(id, "transition", clear_selections);
@@ -750,10 +750,10 @@ App.controller("TimelineCtrl", function ($scope) {
750750

751751
// Find item in JSON
752752
var item_object = null;
753-
if (item_type == "clip") {
753+
if (item_type === "clip") {
754754
item_object = findElement($scope.project.clips, "id", item_id);
755755
}
756-
else if (item_type == "transition") {
756+
else if (item_type === "transition") {
757757
item_object = findElement($scope.project.effects, "id", item_id);
758758
}
759759
else {
@@ -773,10 +773,10 @@ App.controller("TimelineCtrl", function ($scope) {
773773
});
774774

775775
// update clip in Qt (very important =)
776-
if (item_type == "clip") {
776+
if (item_type === "clip") {
777777
timeline.update_clip_data(JSON.stringify(item_object), true, true, false);
778778
}
779-
else if (item_type == "transition") {
779+
else if (item_type === "transition") {
780780
timeline.update_transition_data(JSON.stringify(item_object), true, false);
781781
}
782782

@@ -788,7 +788,7 @@ App.controller("TimelineCtrl", function ($scope) {
788788

789789
// Check again for missing transitions
790790
var missing_transition_details = $scope.getMissingTransitions(item_object);
791-
if ($scope.Qt && missing_transition_details != null) {
791+
if ($scope.Qt && missing_transition_details !== null) {
792792
timeline.add_missing_transition(JSON.stringify(missing_transition_details));
793793
}
794794
// Remove manual move stylesheet
@@ -802,10 +802,10 @@ App.controller("TimelineCtrl", function ($scope) {
802802
$scope.startManualMove = function (item_type, item_id) {
803803
// Select the item
804804
$scope.$apply(function () {
805-
if (item_type == "clip") {
805+
if (item_type === "clip") {
806806
$scope.selectClip(item_id, true);
807807
}
808-
else if (item_type == "transition") {
808+
else if (item_type === "transition") {
809809
$scope.selectTransition(item_id, true);
810810
}
811811
});
@@ -814,12 +814,12 @@ App.controller("TimelineCtrl", function ($scope) {
814814
// This needs to be done inline due to async issues with the
815815
// above calls to selectClip/selectTransition
816816
for (var clip_index = 0; clip_index < $scope.project.clips.length; clip_index++) {
817-
$scope.project.clips[clip_index].selected = $scope.project.clips[clip_index].id == item_id;
817+
$scope.project.clips[clip_index].selected = $scope.project.clips[clip_index].id === item_id;
818818
}
819819

820820
// Select new transition object (and unselect others)
821821
for (var tran_index = 0; tran_index < $scope.project.effects.length; tran_index++) {
822-
$scope.project.effects[tran_index].selected = $scope.project.effects[tran_index].id == item_id;
822+
$scope.project.effects[tran_index].selected = $scope.project.effects[tran_index].id === item_id;
823823
}
824824

825825
// JQuery selector for element (clip or transition)
@@ -838,7 +838,7 @@ App.controller("TimelineCtrl", function ($scope) {
838838
bounding_box.track_position = 0;
839839

840840
// Set z-order to be above other clips/transitions
841-
if (item_type != "os_drop") {
841+
if (item_type !== "os_drop") {
842842
bounding_box.element.addClass("manual-move");
843843
}
844844
};
@@ -973,7 +973,7 @@ App.controller("TimelineCtrl", function ($scope) {
973973
var clip = $scope.project.clips[index];
974974

975975
// skip clips that are not on the same layer
976-
if (original_clip.layer != clip.layer) {
976+
if (original_clip.layer !== clip.layer) {
977977
continue;
978978
}
979979

@@ -993,22 +993,22 @@ App.controller("TimelineCtrl", function ($scope) {
993993
transition_size = {"position": clip_left, "layer": clip.layer, "start": 0, "end": (original_right - clip_left)};
994994
}
995995

996-
if (transition_size != null && transition_size.end >= 0.5) {
996+
if (transition_size !== null && transition_size.end >= 0.5) {
997997
// Found a possible missing transition
998998
break;
999999
}
1000-
else if (transition_size != null && transition_size.end < 0.5) {
1000+
else if (transition_size !== null && transition_size.end < 0.5) {
10011001
// Too small to be a missing transitions, clear and continue looking
10021002
transition_size = null;
10031003
}
10041004
}
10051005
// Search through all existing transitions, and don't overlap an existing one
1006-
if (transition_size != null) {
1006+
if (transition_size !== null) {
10071007
for (var tran_index = 0; tran_index < $scope.project.effects.length; tran_index++) {
10081008
var tran = $scope.project.effects[tran_index];
10091009

10101010
// skip transitions that are not on the same layer
1011-
if (tran.layer != transition_size.layer) {
1011+
if (tran.layer !== transition_size.layer) {
10121012
continue;
10131013
}
10141014

@@ -1114,7 +1114,7 @@ App.controller("TimelineCtrl", function ($scope) {
11141114

11151115
// Show the nearby snapping line
11161116
$scope.showSnapline = function (position) {
1117-
if (position != $scope.snapline_position || !$scope.snapline) {
1117+
if (position !== $scope.snapline_position || !$scope.snapline) {
11181118
// Only update if value has changed
11191119
$scope.$apply(function () {
11201120
$scope.snapline_position = position;
@@ -1216,7 +1216,7 @@ App.controller("TimelineCtrl", function ($scope) {
12161216
var key_value = action.key[key_index];
12171217

12181218
// Check the key type
1219-
if (key_value.constructor == String) {
1219+
if (key_value.constructor === String) {
12201220
// Does the key value exist in scope?, No match, bail out
12211221
if (!current_object.hasOwnProperty(key_value)) {
12221222
return false;
@@ -1227,21 +1227,21 @@ App.controller("TimelineCtrl", function ($scope) {
12271227
current_key = key_value;
12281228

12291229
}
1230-
else if (key_value.constructor == Object) {
1230+
else if (key_value.constructor === Object) {
12311231
// Get the id from the object (if any)
12321232
var id = null;
12331233
if ("id" in key_value) {
12341234
id = key_value["id"];
12351235
}
12361236
// Be sure the current_object is an Array
1237-
if (current_object.constructor == Array) {
1237+
if (current_object.constructor === Array) {
12381238
// Filter the current_object for a specific id
12391239
current_position = 0;
12401240
for (var child_index = 0; child_index < current_object.length; child_index++) {
12411241
var child_object = current_object[child_index];
12421242

12431243
// Find matching child
1244-
if (child_object.hasOwnProperty("id") && child_object.id == id) {
1244+
if (child_object.hasOwnProperty("id") && child_object.id === id) {
12451245
// set current level and previous level
12461246
previous_object = current_object;
12471247
current_object = child_object;
@@ -1257,28 +1257,28 @@ App.controller("TimelineCtrl", function ($scope) {
12571257
// Now that we have a matching object in the $scope.project...
12581258
if (current_object) {
12591259
// INSERT OBJECT
1260-
if (action.type == "insert") {
1260+
if (action.type === "insert") {
12611261
// Insert action's value into current_object
1262-
if (current_object.constructor == Array) {
1262+
if (current_object.constructor === Array) {
12631263
// push new element into array
12641264
current_object.push(action.value);
12651265
}
12661266
else {
12671267
// replace the entire value
1268-
if (previous_object.constructor == Array) {
1268+
if (previous_object.constructor === Array) {
12691269
// replace entire value in OBJECT
12701270
previous_object[current_position] = action.value;
12711271
}
1272-
else if (previous_object.constructor == Object) {
1272+
else if (previous_object.constructor === Object) {
12731273
// replace entire value in OBJECT
12741274
previous_object[current_key] = action.value;
12751275
}
12761276
}
12771277
}
1278-
else if (action.type == "update") {
1278+
else if (action.type === "update") {
12791279
// UPDATE OBJECT
12801280
// Update: If action and current object are Objects
1281-
if (current_object.constructor == Object && action.value.constructor == Object) {
1281+
if (current_object.constructor === Object && action.value.constructor === Object) {
12821282
for (var update_key in action.value) {
12831283
if (update_key in current_object) {
12841284
// Only copy over keys that exist in both action and current_object
@@ -1288,17 +1288,17 @@ App.controller("TimelineCtrl", function ($scope) {
12881288
}
12891289
else {
12901290
// replace the entire value
1291-
if (previous_object.constructor == Array) {
1291+
if (previous_object.constructor === Array) {
12921292
// replace entire value in OBJECT
12931293
previous_object[current_position] = action.value;
12941294
}
1295-
else if (previous_object.constructor == Object) {
1295+
else if (previous_object.constructor === Object) {
12961296
// replace entire value in OBJECT
12971297
previous_object[current_key] = action.value;
12981298
}
12991299
}
13001300
}
1301-
else if (action.type == "delete") {
1301+
else if (action.type === "delete") {
13021302
// DELETE OBJECT
13031303
// delete current object from it's parent (previous object)
13041304
previous_object.splice(current_position, 1);

src/timeline/js/directives/clip.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ App.directive("tlClip", function ($timeout) {
137137
new_right = (Math.round((new_right * scope.project.fps.num) / scope.project.fps.den) * scope.project.fps.den ) / scope.project.fps.num;
138138
new_left = (Math.round((new_left * scope.project.fps.num) / scope.project.fps.den) * scope.project.fps.den ) / scope.project.fps.num;
139139

140-
if (scope.clip.end != new_right) {
140+
if (scope.clip.end !== new_right) {
141141
scope.clip.end = new_right;
142142
}
143-
if (scope.clip.start != new_left) {
143+
if (scope.clip.start !== new_left) {
144144
scope.clip.start = new_left;
145145
scope.clip.position = new_position;
146146
}
@@ -306,7 +306,7 @@ App.directive("tlClip", function ($timeout) {
306306
drag: function (e, ui) {
307307
var previous_x = ui.originalPosition.left;
308308
var previous_y = ui.originalPosition.top;
309-
if (previous_drag_position != null) {
309+
if (previous_drag_position !== null) {
310310
// if available, override with previous drag position
311311
previous_x = previous_drag_position.left;
312312
previous_y = previous_drag_position.top;

src/timeline/js/directives/track.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ App.directive("tlTrack", function ($timeout) {
121121
var drop_track_num = findTrackAtLocation(scope, parseInt(item_middle, 10));
122122

123123
// if the droptrack was found, update the json
124-
if (drop_track_num != -1) {
124+
if (drop_track_num !== -1) {
125125

126126
// find the item in the json data
127127
item_data = null;

0 commit comments

Comments
 (0)