Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove unneeded args, don't allow system tabs to be closed

  • Loading branch information...
commit 9e47410af88fc801e84fbe1d446f38b51a66d786 1 parent 0c76c1f
@samwwwblack authored
Showing with 20 additions and 17 deletions.
  1. +20 −17 main.js
View
37 main.js
@@ -230,7 +230,7 @@ function attachIframeProgressMonitor(windowId) {
*
* @param {String} windowId of tab to be selected
*/
-function selectTab(windowId, system) {
+function selectTab(windowId) {
// Activate windows container if not already active
if (!$("#windows").hasClass("active")) {
activateWindows();
@@ -264,7 +264,7 @@ function newTab(url, system) {
// Add new window to interface
$("#windows").append(newWindow);
- if (system == true) {
+ if (system) {
// Add system tabs
$("#tabs ul#system").append('<li id="tab_' + windowId + '" class="tab"><img></img></li>');
newWindow.addClass("system");
@@ -276,7 +276,7 @@ function newTab(url, system) {
}
// Select new tab
- selectTab(windowId, system);
+ selectTab(windowId);
// Add a new iFrame to new window
var newIframe = makeIframe(windowId);
@@ -317,22 +317,25 @@ function closeTab(windowId) {
if(!windowId)
windowId = $("#windows .selected").attr("id").substring(7);
- // Remove selected window & corresponding tab
- $("#window_" + windowId).remove();
- $("#tab_" + windowId).remove();
+ // Don't allow system tabs to be closed.
+ if (!$("#window_" + windowId).hasClass("system")) {
+ // Remove selected window & corresponding tab
+ $("#window_" + windowId).remove();
+ $("#tab_" + windowId).remove();
- // If no tabs are open, activate home screen
- if($(".window").length < 2) {
- activateHomeScreen();
+ // If no tabs are open, activate home screen
+ if($(".window").length < 2) {
+ activateHomeScreen();
- // otherwise, Select last remaining tab (not including the template window!)
- } else {
- var newLastWindowId = $(".window:not(#window_template)").last().attr("id").substring(7);
- selectTab(newLastWindowId);
- }
+ // otherwise, Select last remaining tab (not including the template window!)
+ } else {
+ var newLastWindowId = $(".window:not(#window_template)").last().attr("id").substring(7);
+ selectTab(newLastWindowId);
+ }
- // Remove browsing history for tab
- urlHistory.splice(windowId, 1);
+ // Remove browsing history for tab
+ urlHistory.splice(windowId, 1);
+ }
}
/**
@@ -424,7 +427,7 @@ function switchElements(elem1, elem2){
*
* Hides the home screen and makes the windows container active
*/
-function activateWindows(system) {
+function activateWindows() {
$("#home_screen").removeClass("active");
$("#windows").addClass("active");
$("#home_button").addClass("active");
Please sign in to comment.
Something went wrong with that request. Please try again.