From d69349809e2ba039802c5a817ea7e0f8a9140966 Mon Sep 17 00:00:00 2001
From: Zachary Sloan
Date: Thu, 18 Oct 2012 16:40:36 -0500
Subject: Fixed spacing on coffeescript file
---
.../new/javascript/dataset_select_menu.coffee | 588 ++++++++++-----------
1 file changed, 294 insertions(+), 294 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu.coffee b/wqflask/wqflask/static/new/javascript/dataset_select_menu.coffee
index b991afb2..93bf9a07 100644
--- a/wqflask/wqflask/static/new/javascript/dataset_select_menu.coffee
+++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu.coffee
@@ -5,27 +5,27 @@
$ ->
initialDatasetSelection = ->
- defaultSpecies = getDefaultValue("species")
- defaultSet = getDefaultValue("cross")
- defaultType = getDefaultValue("tissue")
- defaultDB = getDefaultValue("database")
- if navigator.userAgent.indexOf("MSIE") >= 0
- sOptions = fillOptionsForIE(null, defaultSpecies)
- menu0 = ""
- document.getElementById("menu0").innerHTML = menu0
- gOptions = fillOptionsForIE("species", defaultSet)
- menu1 = ""
- document.getElementById("menu1").innerHTML = menu1
- tOptions = fillOptionsForIE("cross", defaultType)
- menu2 = ""
- document.getElementById("menu2").innerHTML = menu2
- dOptions = fillOptionsForIE("tissue", defaultDB)
- menu3 = ""
- document.getElementById("menu3").innerHTML = menu3
- else
- fillOptions null
- searchtip()
-
+ defaultSpecies = getDefaultValue("species")
+ defaultSet = getDefaultValue("cross")
+ defaultType = getDefaultValue("tissue")
+ defaultDB = getDefaultValue("database")
+ if navigator.userAgent.indexOf("MSIE") >= 0
+ sOptions = fillOptionsForIE(null, defaultSpecies)
+ menu0 = ""
+ document.getElementById("menu0").innerHTML = menu0
+ gOptions = fillOptionsForIE("species", defaultSet)
+ menu1 = ""
+ document.getElementById("menu1").innerHTML = menu1
+ tOptions = fillOptionsForIE("cross", defaultType)
+ menu2 = ""
+ document.getElementById("menu2").innerHTML = menu2
+ dOptions = fillOptionsForIE("tissue", defaultDB)
+ menu3 = ""
+ document.getElementById("menu3").innerHTML = menu3
+ else
+ fillOptions null
+ searchtip()
+
#
#* input: selectObjId (designated select menu, such as species, cross, etc... )
@@ -34,98 +34,98 @@ $ ->
#* output: options string
#
fillOptionsForIE = (selectObjId, defaultValue) ->
- options = ""
- unless selectObjId?
- len = sArr.length
- i = 1
+ options = ""
+ unless selectObjId?
+ len = sArr.length
+ i = 1
- while i < len
-
- # setting Species' option
- if sArr[i].val is defaultValue
- options = options + ""
- else
- options = options + ""
- i++
- else if selectObjId is "species"
- speciesObj = document.getElementById("species")
- len = lArr.length
- arr = []
- idx = 0
- i = 1
+ while i < len
+
+ # setting Species' option
+ if sArr[i].val is defaultValue
+ options = options + ""
+ else
+ options = options + ""
+ i++
+ else if selectObjId is "species"
+ speciesObj = document.getElementById("species")
+ len = lArr.length
+ arr = []
+ idx = 0
+ i = 1
- while i < len
-
- #get group(cross) info from lArr
- arr[idx++] = lArr[i][1] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and not Contains(arr, lArr[i][1])
- i++
- idx = 0
- len = arr.length
- removeOptions "cross"
- i = 0
+ while i < len
+
+ #get group(cross) info from lArr
+ arr[idx++] = lArr[i][1] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and not Contains(arr, lArr[i][1])
+ i++
+ idx = 0
+ len = arr.length
+ removeOptions "cross"
+ i = 0
- while i < len
-
- # setting Group's option
- if gArr[arr[i]].val is defaultValue
- options = options + ""
- else
- options = options + ""
- i++
- else if selectObjId is "cross"
- speciesObj = document.getElementById("species")
- groupObj = document.getElementById("cross")
- len = lArr.length
- arr = []
- idx = 0
- i = 1
+ while i < len
+
+ # setting Group's option
+ if gArr[arr[i]].val is defaultValue
+ options = options + ""
+ else
+ options = options + ""
+ i++
+ else if selectObjId is "cross"
+ speciesObj = document.getElementById("species")
+ groupObj = document.getElementById("cross")
+ len = lArr.length
+ arr = []
+ idx = 0
+ i = 1
- while i < len
-
- #get type(tissue) info from lArr
- arr[idx++] = lArr[i][2] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and lArr[i][1] is (getIndexByValue("cross", groupObj.value)).toString() and not Contains(arr, lArr[i][2])
- i++
- idx = 0
- len = arr.length
- removeOptions "tissue"
- i = 0
+ while i < len
+
+ #get type(tissue) info from lArr
+ arr[idx++] = lArr[i][2] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and lArr[i][1] is (getIndexByValue("cross", groupObj.value)).toString() and not Contains(arr, lArr[i][2])
+ i++
+ idx = 0
+ len = arr.length
+ removeOptions "tissue"
+ i = 0
- while i < len
-
- # setting Type's option
- if tArr[arr[i]].val is defaultValue
- options = options + ""
- else
- options = options + ""
- i++
- else if selectObjId is "tissue"
- speciesObj = document.getElementById("species")
- groupObj = document.getElementById("cross")
- typeObj = document.getElementById("tissue")
- len = lArr.length
- arr = []
- idx = 0
- i = 1
+ while i < len
+
+ # setting Type's option
+ if tArr[arr[i]].val is defaultValue
+ options = options + ""
+ else
+ options = options + ""
+ i++
+ else if selectObjId is "tissue"
+ speciesObj = document.getElementById("species")
+ groupObj = document.getElementById("cross")
+ typeObj = document.getElementById("tissue")
+ len = lArr.length
+ arr = []
+ idx = 0
+ i = 1
- while i < len
-
- #get dataset(database) info from lArr
- arr[idx++] = lArr[i][3] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and lArr[i][1] is (getIndexByValue("cross", groupObj.value)).toString() and lArr[i][2] is (getIndexByValue("tissue", typeObj.value)).toString() and not Contains(arr, lArr[i][3])
- i++
- idx = 0
- len = arr.length
- removeOptions "database"
- i = 0
+ while i < len
+
+ #get dataset(database) info from lArr
+ arr[idx++] = lArr[i][3] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and lArr[i][1] is (getIndexByValue("cross", groupObj.value)).toString() and lArr[i][2] is (getIndexByValue("tissue", typeObj.value)).toString() and not Contains(arr, lArr[i][3])
+ i++
+ idx = 0
+ len = arr.length
+ removeOptions "database"
+ i = 0
- while i < len
-
- # setting Database's option
- if dArr[arr[i]].val is defaultValue
- options = options + ""
- else
- options = options + ""
- i++
- options
+ while i < len
+
+ # setting Database's option
+ if dArr[arr[i]].val is defaultValue
+ options = options + ""
+ else
+ options = options + ""
+ i++
+ options
#
#* input: selectObjId (designated select menu, such as species, cross, etc... )
@@ -133,92 +133,92 @@ $ ->
#* output: null
#
fillOptions = (selectObjId) ->
- unless selectObjId?
- speciesObj = document.getElementById("species")
- len = sArr.length
- i = 1
+ unless selectObjId?
+ speciesObj = document.getElementById("species")
+ len = sArr.length
+ i = 1
- while i < len
-
- # setting Species' option
- speciesObj.options[i - 1] = new Option(sArr[i].txt, sArr[i].val)
- i++
- updateChocie "species"
- else if selectObjId is "species"
- speciesObj = document.getElementById("species")
- groupObj = document.getElementById("cross")
- len = lArr.length
- arr = []
- idx = 0
- i = 1
+ while i < len
+
+ # setting Species' option
+ speciesObj.options[i - 1] = new Option(sArr[i].txt, sArr[i].val)
+ i++
+ updateChocie "species"
+ else if selectObjId is "species"
+ speciesObj = document.getElementById("species")
+ groupObj = document.getElementById("cross")
+ len = lArr.length
+ arr = []
+ idx = 0
+ i = 1
- while i < len
-
- #get group(cross) info from lArr
- arr[idx++] = lArr[i][1] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and not Contains(arr, lArr[i][1])
- i++
- idx = 0
- len = arr.length
- removeOptions "cross"
- i = 0
+ while i < len
+
+ #get group(cross) info from lArr
+ arr[idx++] = lArr[i][1] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and not Contains(arr, lArr[i][1])
+ i++
+ idx = 0
+ len = arr.length
+ removeOptions "cross"
+ i = 0
- while i < len
-
- # setting Group's option
- groupObj.options[idx++] = new Option(gArr[arr[i]].txt, gArr[arr[i]].val)
- i++
- updateChocie "cross"
- else if selectObjId is "cross"
- speciesObj = document.getElementById("species")
- groupObj = document.getElementById("cross")
- typeObj = document.getElementById("tissue")
- len = lArr.length
- arr = []
- idx = 0
- i = 1
+ while i < len
+
+ # setting Group's option
+ groupObj.options[idx++] = new Option(gArr[arr[i]].txt, gArr[arr[i]].val)
+ i++
+ updateChocie "cross"
+ else if selectObjId is "cross"
+ speciesObj = document.getElementById("species")
+ groupObj = document.getElementById("cross")
+ typeObj = document.getElementById("tissue")
+ len = lArr.length
+ arr = []
+ idx = 0
+ i = 1
- while i < len
-
- #get type(tissue) info from lArr
- arr[idx++] = lArr[i][2] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and lArr[i][1] is (getIndexByValue("cross", groupObj.value)).toString() and not Contains(arr, lArr[i][2])
- i++
- idx = 0
- len = arr.length
- removeOptions "tissue"
- i = 0
+ while i < len
+
+ #get type(tissue) info from lArr
+ arr[idx++] = lArr[i][2] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and lArr[i][1] is (getIndexByValue("cross", groupObj.value)).toString() and not Contains(arr, lArr[i][2])
+ i++
+ idx = 0
+ len = arr.length
+ removeOptions "tissue"
+ i = 0
- while i < len
-
- # setting Type's option
- typeObj.options[idx++] = new Option(tArr[arr[i]].txt, tArr[arr[i]].val)
- i++
- updateChocie "tissue"
- else if selectObjId is "tissue"
- speciesObj = document.getElementById("species")
- groupObj = document.getElementById("cross")
- typeObj = document.getElementById("tissue")
- databaseObj = document.getElementById("database")
- len = lArr.length
- arr = []
- idx = 0
- i = 1
+ while i < len
+
+ # setting Type's option
+ typeObj.options[idx++] = new Option(tArr[arr[i]].txt, tArr[arr[i]].val)
+ i++
+ updateChocie "tissue"
+ else if selectObjId is "tissue"
+ speciesObj = document.getElementById("species")
+ groupObj = document.getElementById("cross")
+ typeObj = document.getElementById("tissue")
+ databaseObj = document.getElementById("database")
+ len = lArr.length
+ arr = []
+ idx = 0
+ i = 1
- while i < len
-
- #get dataset(database) info from lArr
- arr[idx++] = lArr[i][3] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and lArr[i][1] is (getIndexByValue("cross", groupObj.value)).toString() and lArr[i][2] is (getIndexByValue("tissue", typeObj.value)).toString() and not Contains(arr, lArr[i][3])
- i++
- idx = 0
- len = arr.length
- removeOptions "database"
- i = 0
+ while i < len
+
+ #get dataset(database) info from lArr
+ arr[idx++] = lArr[i][3] if lArr[i][0] is (getIndexByValue("species", speciesObj.value)).toString() and lArr[i][1] is (getIndexByValue("cross", groupObj.value)).toString() and lArr[i][2] is (getIndexByValue("tissue", typeObj.value)).toString() and not Contains(arr, lArr[i][3])
+ i++
+ idx = 0
+ len = arr.length
+ removeOptions "database"
+ i = 0
- while i < len
-
- # setting Database's option
- databaseObj.options[idx++] = new Option(dArr[arr[i]].txt, dArr[arr[i]].val)
- i++
- updateChocie "database"
+ while i < len
+
+ # setting Database's option
+ databaseObj.options[idx++] = new Option(dArr[arr[i]].txt, dArr[arr[i]].val)
+ i++
+ updateChocie "database"
#
#* input: arr (targeted array); obj (targeted value)
@@ -226,9 +226,9 @@ $ ->
#* output: return true, if array contains targeted value, otherwise return false
#
Contains = (arr, obj) ->
- i = arr.length
- return true if arr[i] is obj while i--
- false
+ i = arr.length
+ return true if arr[i] is obj while i--
+ false
#
#* input: selectObj (designated select menu, such as species, cross, etc... )
@@ -236,15 +236,15 @@ $ ->
#* output: null
#
removeOptions = (selectObj) ->
- selectObj = document.getElementById(selectObj) unless typeof selectObj is "object"
- len = selectObj.options.length
- i = 0
+ selectObj = document.getElementById(selectObj) unless typeof selectObj is "object"
+ len = selectObj.options.length
+ i = 0
- while i < len
-
- # clear current selection
- selectObj.options[0] = null
- i++
+ while i < len
+
+ # clear current selection
+ selectObj.options[0] = null
+ i++
#
#* input: selectObjId (designated select menu, such as species, cross, etc... )
@@ -253,26 +253,26 @@ $ ->
#* output: index info
#
getIndexByValue = (selectObjId, val) ->
- if selectObjId is "species"
- i = 1
+ if selectObjId is "species"
+ i = 1
- while i < sArr.length
- return i if sArr[i].val is val
- i++
- else if selectObjId is "cross"
- i = 1
+ while i < sArr.length
+ return i if sArr[i].val is val
+ i++
+ else if selectObjId is "cross"
+ i = 1
- while i < gArr.length
- return i if gArr[i].val is val
- i++
- else if selectObjId is "tissue"
- i = 1
+ while i < gArr.length
+ return i if gArr[i].val is val
+ i++
+ else if selectObjId is "tissue"
+ i = 1
- while i < tArr.length
- return i if tArr[i].val is val
- i++
- else
- return
+ while i < tArr.length
+ return i if tArr[i].val is val
+ i++
+ else
+ return
#
#* input: objId (designated select menu, such as species, cross, etc... )
@@ -281,96 +281,96 @@ $ ->
#* output: return true if selected status has been set, otherwise return false.
#
setChoice = (objId, val) ->
- Obj = document.getElementById(objId)
- idx = -1
- i = 0
- while i < Obj.options.length
- if Obj.options[i].value is val
- idx = i
- break
- i++
- if idx >= 0
-
- #setting option's selected status
- Obj.options[idx].selected = true
-
- #update the following select menu
- fillOptions objId
- else
- Obj.options[0].selected = true
- fillOptions objId
+ Obj = document.getElementById(objId)
+ idx = -1
+ i = 0
+ while i < Obj.options.length
+ if Obj.options[i].value is val
+ idx = i
+ break
+ i++
+ if idx >= 0
+
+ #setting option's selected status
+ Obj.options[idx].selected = true
+
+ #update the following select menu
+ fillOptions objId
+ else
+ Obj.options[0].selected = true
+ fillOptions objId
# setting option's selected status based on default setting or cookie setting for Species, Group, Type and Database select menu in the main search page http://www.genenetwork.org/
updateChocie = (selectObjId) ->
- if selectObjId is "species"
- defaultSpecies = getDefaultValue("species")
-
- #setting option's selected status
- setChoice "species", defaultSpecies
- else if selectObjId is "cross"
- defaultSet = getDefaultValue("cross")
-
- #setting option's selected status
- setChoice "cross", defaultSet
- else if selectObjId is "tissue"
- defaultType = getDefaultValue("tissue")
-
- #setting option's selected status
- setChoice "tissue", defaultType
- else if selectObjId is "database"
- defaultDB = getDefaultValue("database")
-
- #setting option's selected status
- setChoice "database", defaultDB
+ if selectObjId is "species"
+ defaultSpecies = getDefaultValue("species")
+
+ #setting option's selected status
+ setChoice "species", defaultSpecies
+ else if selectObjId is "cross"
+ defaultSet = getDefaultValue("cross")
+
+ #setting option's selected status
+ setChoice "cross", defaultSet
+ else if selectObjId is "tissue"
+ defaultType = getDefaultValue("tissue")
+
+ #setting option's selected status
+ setChoice "tissue", defaultType
+ else if selectObjId is "database"
+ defaultDB = getDefaultValue("database")
+
+ #setting option's selected status
+ setChoice "database", defaultDB
#get default value;if cookie exists, then use cookie value, otherwise use default value
getDefaultValue = (selectObjId) ->
-
- #define default value
- defaultSpecies = "mouse"
- defaultSet = "BXD"
- defaultType = "Hippocampus"
- defaultDB = "HC_M2_0606_P"
- if selectObjId is "species"
- #if cookie exists, then use cookie value, otherwise use default value
- cookieSpecies = getCookie("defaultSpecies")
- defaultSpecies = cookieSpecies if cookieSpecies
- defaultSpecies
- else if selectObjId is "cross"
- cookieSet = getCookie("defaultSet")
- defaultSet = cookieSet if cookieSet
- defaultSet
- else if selectObjId is "tissue"
- cookieType = getCookie("defaultType")
- defaultType = cookieType if cookieType
- defaultType
- else if selectObjId is "database"
- cookieDB = getCookie("defaultDB")
- defaultDB = cookieDB if cookieDB
- defaultDB
+ #define default value
+ defaultSpecies = "mouse"
+ defaultSet = "BXD"
+ defaultType = "Hippocampus"
+ defaultDB = "HC_M2_0606_P"
+ if selectObjId is "species"
+
+ #if cookie exists, then use cookie value, otherwise use default value
+ cookieSpecies = getCookie("defaultSpecies")
+ defaultSpecies = cookieSpecies if cookieSpecies
+ defaultSpecies
+ else if selectObjId is "cross"
+ cookieSet = getCookie("defaultSet")
+ defaultSet = cookieSet if cookieSet
+ defaultSet
+ else if selectObjId is "tissue"
+ cookieType = getCookie("defaultType")
+ defaultType = cookieType if cookieType
+ defaultType
+ else if selectObjId is "database"
+ cookieDB = getCookie("defaultDB")
+ defaultDB = cookieDB if cookieDB
+ defaultDB
#setting default value into cookies for the dropdown menus: Species,Group, Type, and Database
setDefault = (thisform) ->
- setCookie "cookieTest", "cookieTest", 1
- cookieTest = getCookie("cookieTest")
- delCookie "cookieTest"
- if cookieTest
- defaultSpecies = thisform.species.value
- setCookie "defaultSpecies", defaultSpecies, 10
- defaultSet = thisform.cross.value
- setCookie "defaultSet", defaultSet, 10
- defaultType = thisform.tissue.value
- setCookie "defaultType", defaultType, 10
- defaultDB = thisform.database.value
- setCookie "defaultDB", defaultDB, 10
- updateChocie "species"
- updateChocie "cross"
- updateChocie "tissue"
- updateChocie "database"
- alert "The current settings are now your default"
- else
- alert "You need to enable Cookies in your browser."
-
+ setCookie "cookieTest", "cookieTest", 1
+ cookieTest = getCookie("cookieTest")
+ delCookie "cookieTest"
+ if cookieTest
+ defaultSpecies = thisform.species.value
+ setCookie "defaultSpecies", defaultSpecies, 10
+ defaultSet = thisform.cross.value
+ setCookie "defaultSet", defaultSet, 10
+ defaultType = thisform.tissue.value
+ setCookie "defaultType", defaultType, 10
+ defaultDB = thisform.database.value
+ setCookie "defaultDB", defaultDB, 10
+ updateChocie "species"
+ updateChocie "cross"
+ updateChocie "tissue"
+ updateChocie "database"
+ alert "The current settings are now your default"
+ else
+ alert "You need to enable Cookies in your browser."
+
# run it
initialDatasetSelection()
\ No newline at end of file
--
cgit v1.2.3