Mercurial > hg > webaudioevaluationtool
comparison test_create/test_core.js @ 2562:9c167c0d6c26
Added video and youtube creation to test_create #134
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Fri, 02 Sep 2016 11:38:09 +0100 |
parents | 23bbd100b403 |
children | 26045169b4b5 |
comparison
equal
deleted
inserted
replaced
2492:f0b0809c7ee5 | 2562:9c167c0d6c26 |
---|---|
853 maximumEntry.setAttribute("name","max"); | 853 maximumEntry.setAttribute("name","max"); |
854 maximumEntry.addEventListener("change",this,false); | 854 maximumEntry.addEventListener("change",this,false); |
855 maximumEntry.value = this.option.max; | 855 maximumEntry.value = this.option.max; |
856 this.dynamic.appendChild(maximum); | 856 this.dynamic.appendChild(maximum); |
857 break; | 857 break; |
858 case "video": | |
859 case "youtube": | |
860 this.dynamic.appendChild(id); | |
861 | |
862 var mandatory = document.createElement("div"); | |
863 var mandatoryInput = document.createElement("input"); | |
864 var mandatoryText = document.createElement("span"); | |
865 mandatoryText.textContent = "Mandatory: "; | |
866 mandatory.appendChild(mandatoryText); | |
867 mandatory.appendChild(mandatoryInput); | |
868 mandatory.className = "survey-entry-attribute"; | |
869 mandatoryInput.type = "checkbox"; | |
870 if (this.option.mandatory) {mandatoryInput.checked = true;} else {mandatoryInput.checked = false;} | |
871 mandatoryInput.setAttribute("name","mandatory"); | |
872 mandatoryInput.addEventListener("change",this,false); | |
873 this.dynamic.appendChild(mandatory); | |
874 | |
875 var url = document.createElement("div"); | |
876 var urlInput = document.createElement("input"); | |
877 var urlText = document.createElement("span"); | |
878 urlText.textContent = "URL: "; | |
879 url.appendChild(urlText); | |
880 url.appendChild(urlInput); | |
881 url.className = "survey-entry-attribute"; | |
882 urlInput.type = "text"; | |
883 if (this.option.mandatory) {urlInput.value = this.option.mandatory;} else {urlInput.value = "";} | |
884 urlInput.setAttribute("name","url"); | |
885 urlInput.addEventListener("change",this,false); | |
886 this.dynamic.appendChild(url); | |
887 break; | |
858 case "checkbox": | 888 case "checkbox": |
859 case "radio": | 889 case "radio": |
860 this.dynamic.appendChild(id); | 890 this.dynamic.appendChild(id); |
861 var optionHolder = document.createElement("div"); | 891 var optionHolder = document.createElement("div"); |
862 optionHolder.className = 'node'; | 892 optionHolder.className = 'node'; |
936 optionHolder.appendChild(obj.rootDOM); | 966 optionHolder.appendChild(obj.rootDOM); |
937 } | 967 } |
938 this.dynamic.appendChild(optionHolder); | 968 this.dynamic.appendChild(optionHolder); |
939 } | 969 } |
940 } | 970 } |
941 this.handleEvent = function() | 971 this.handleEvent = function(event) |
942 { | 972 { |
943 var name = event.currentTarget.getAttribute("name"); | 973 var name = event.currentTarget.getAttribute("name"); |
944 var nodeName = event.currentTarget.nodeName; | 974 var nodeName = event.currentTarget.nodeName; |
945 if (name == "type" && nodeName == "SELECT") { | 975 if (name == "type" && nodeName == "SELECT") { |
946 // If type has changed, we may need to rebuild the entire state node | 976 // If type has changed, we may need to rebuild the entire state node |
1886 var mandatory = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("mandatory")[0]); | 1916 var mandatory = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("mandatory")[0]); |
1887 var min = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("min")[0]); | 1917 var min = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("min")[0]); |
1888 var max = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("max")[0]); | 1918 var max = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("max")[0]); |
1889 this.attributeDOM.appendChild(id.holder); | 1919 this.attributeDOM.appendChild(id.holder); |
1890 this.attributes.push(id); | 1920 this.attributes.push(id); |
1921 this.attributeDOM.appendChild(mandatory.holder); | |
1922 this.attributes.push(mandatory); | |
1891 this.attributeDOM.appendChild(min.holder); | 1923 this.attributeDOM.appendChild(min.holder); |
1892 this.attributes.push(min); | 1924 this.attributes.push(min); |
1893 this.attributeDOM.appendChild(max.holder); | 1925 this.attributeDOM.appendChild(max.holder); |
1894 this.attributes.push(max); | 1926 this.attributes.push(max); |
1895 break; | 1927 break; |
1902 case "radio": | 1934 case "radio": |
1903 this.titleDOM.textContent = "Radio"; | 1935 this.titleDOM.textContent = "Radio"; |
1904 var id = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("id")[0]); | 1936 var id = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("id")[0]); |
1905 this.attributeDOM.appendChild(id.holder); | 1937 this.attributeDOM.appendChild(id.holder); |
1906 this.attributes.push(id); | 1938 this.attributes.push(id); |
1939 break; | |
1940 case "video": | |
1941 this.titleDOM.textContent = "Video"; | |
1942 var id = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("id")[0]); | |
1943 this.attributeDOM.appendChild(id.holder); | |
1944 this.attributes.push(id); | |
1945 var mandatory = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("mandatory")[0]); | |
1946 var url = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("url")[0]); | |
1947 this.attributeDOM.appendChild(mandatory.holder); | |
1948 this.attributes.push(mandatory); | |
1949 this.attributeDOM.appendChild(url.holder); | |
1950 this.attributes.push(url); | |
1951 break; | |
1952 case "youtube": | |
1953 this.titleDOM.textContent = "YouTube"; | |
1954 var id = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("id")[0]); | |
1955 this.attributeDOM.appendChild(id.holder); | |
1956 this.attributes.push(id); | |
1957 var mandatory = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("mandatory")[0]); | |
1958 var url = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("url")[0]); | |
1959 this.attributeDOM.appendChild(mandatory.holder); | |
1960 this.attributes.push(mandatory); | |
1961 this.attributeDOM.appendChild(url.holder); | |
1962 this.attributes.push(url); | |
1907 break; | 1963 break; |
1908 } | 1964 } |
1909 } | 1965 } |
1910 this.build(); | 1966 this.build(); |
1911 | 1967 |