Permalink
Browse files

Case insensitive.

  • Loading branch information...
1 parent 5669fa3 commit b93a4d42135bebcbdb2f5304a18ba91c6fcb4ca0 @mythmon committed Jan 29, 2013
Showing with 14 additions and 1 deletion.
  1. +14 −1 manager.js
View
@@ -33,6 +33,10 @@ _.each(config.resetUrls, function(url) {
utils.shuffle(contentSet);
exports.addScreen = function(name) {
+ if (findScreen('name', name)) {
+ // No duplicate names.
+ throw "Duplicate screen name.";
+ }
var id = utils.getId();
var screen = {
id: id,
@@ -56,8 +60,17 @@ removeScreen = function(id) {
findScreen = function(key, value, moveNextScreen) {
var found, index;
+
+ if (value.toLowerCase !== undefined) {
+ value = value.toLowerCase();
+ }
+
_.each(screens, function(s, i) {
- if (s[key] === value) {
+ var screenVal = s[key];
+ if (screenVal.toLowerCase !== undefined) {
+ screenVal = screenVal.toLowerCase();
+ }
+ if (screenVal === value) {
found = s;
index = i;
}

0 comments on commit b93a4d4

Please sign in to comment.