Clean up code

Fix indentations, whitespace, and layout
This commit is contained in:
Adrianl3d 2014-11-22 10:39:34 +10:00
parent f1543a9d36
commit 6a66351e7f

View file

@ -70,7 +70,7 @@ var ourWidth = Window.innerWidth;
var ourHeight = Window.innerHeight; var ourHeight = Window.innerHeight;
var text = "placeholder"; var text = "placeholder";
var last_users = GlobalServices.onlineUsers; var last_users = GlobalServices.onlineUsers;
var users =[]; var users = [];
var ctrlIsPressed = false; var ctrlIsPressed = false;
var ready = true; var ready = true;
@ -115,7 +115,7 @@ function createNotification(text){
color: textColor, color: textColor,
backgroundColor: backColor, backgroundColor: backColor,
alpha: backgroundAlpha, alpha: backgroundAlpha,
topargin: topMargin, topMargin: topMargin,
leftMargin: leftMargin, leftMargin: leftMargin,
font: {size: fontSize}, font: {size: fontSize},
text: text, text: text,
@ -124,8 +124,8 @@ function createNotification(text){
var buttonProperties = { var buttonProperties = {
x: buttonLocationX, x: buttonLocationX,
y: bLevel, y: bLevel,
width: 15.0,//37 width: 15.0,
height: 15.0,//35 height: 15.0,
subImage: { x: 0, y: 0, width: 10, height: 10 }, subImage: { x: 0, y: 0, width: 10, height: 10 },
imageURL: "http://hifi-public.s3.amazonaws.com/images/close-small-light.svg", imageURL: "http://hifi-public.s3.amazonaws.com/images/close-small-light.svg",
color: { red: 255, green: 255, blue: 255}, color: { red: 255, green: 255, blue: 255},
@ -140,7 +140,7 @@ function createNotification(text){
// Pushes data to each array and sets up data for 2nd dimension array // Pushes data to each array and sets up data for 2nd dimension array
// to handle auxiliary data not carried by the overlay class // to handle auxiliary data not carried by the overlay class
// specifically notification "heights", "times" of creation, and . // specifically notification "heights", "times" of creation, and .
function Notify (notice, button, height ){ function Notify(notice, button, height){
notifications.push((Overlays.addOverlay("text",notice))); notifications.push((Overlays.addOverlay("text",notice)));
buttons.push((Overlays.addOverlay("image",button))); buttons.push((Overlays.addOverlay("image",button)));
@ -246,8 +246,8 @@ function wordWrap(str){
} }
// wraps whole word to newline // wraps whole word to newline
function stringDivider(str, slotWidth, spaceReplacer) { function stringDivider(str, slotWidth, spaceReplacer) {
if (str.length>slotWidth) { if (str.length > slotWidth) {
var p=slotWidth; var p = slotWidth;
for (; p > 0 && str[p] != ' '; p--) { for (; p > 0 && str[p] != ' '; p--) {
} }
if (p > 0) { if (p > 0) {
@ -259,7 +259,7 @@ function stringDivider(str, slotWidth, spaceReplacer) {
return str; return str;
} }
//This fires a notification on window resize // This fires a notification on window resize
function checkSize(){ function checkSize(){
if((Window.innerWidth!=ourWidth)||(Window.innerHeight!=ourHeight)){ if((Window.innerWidth!=ourWidth)||(Window.innerHeight!=ourHeight)){
var windowResize = "Window has been resized"; var windowResize = "Window has been resized";
@ -320,7 +320,7 @@ function update(){
} }
} }
// This checks the age of the notification and prepares to fade it after 9.0 seconds (var persistTime - 1) // This checks the age of the notification and prepares to fade it after 9.0 seconds (var persistTime - 1)
for (var i = 0; i < arrays.length; i++){ for (var i = 0; i < arrays.length; i++){
if (ready){ if (ready){
var j = arrays[i][2]; var j = arrays[i][2];
@ -365,7 +365,6 @@ var working = firstOut
times.splice(firstOut, 1); times.splice(firstOut, 1);
heights.splice(firstOut, 1); heights.splice(firstOut, 1);
myAlpha.splice(firstOut,1); myAlpha.splice(firstOut,1);
} }
onMuteStateChanged(); onMuteStateChanged();