Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102856676
branch3-r.component.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 24, 22:04
Size
8 KB
Mime Type
text/x-java
Expires
Wed, Feb 26, 22:04 (2 d)
Engine
blob
Format
Raw Data
Handle
24422635
Attached To
R8244 Eawag_Swing_Weight_Elicitation
branch3-r.component.ts
View Options
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import * as $ from 'jquery';
import 'jquery-ui/ui/widgets/slider.js';
import { Hl } from '../hl';
import { Title } from '@angular/platform-browser';
@Component({
selector: 'app-branch3-r',
templateUrl: './branch3-r.component.html',
styleUrls: ['./branch3-r.component.css']
})
export class Branch3RComponent implements OnInit {
myValue1 : Number;
myValue2 : Number;
firstObj: String;
firstObj_full: String;
firstObj_best: Number;
firstObj_worst: Number;
firstObj_unit: String;
secondObj : String;
secondObj_full : String;
secondObj_best : Number;
secondObj_worst : Number;
secondObj_unit: String;
thirdObj : String;
thirdObj_full : String;
thirdObj_best : Number;
thirdObj_worst : Number;
thirdObj_unit : String;
constructor(private router: Router, private hl: Hl, private title: Title) {
var tota = this;
var totb = this;
$(document).change(function(){
tota.myValue1= $("#tota").text();
totb.myValue2 = $("#totb").text();
})
}
/*
doSomething(value,value1){
this.myValue1 = value;
this.myValue2 = value1;
}
*/
next(){
var item = [];
item.push("100");
if (this.myValue1 != null){
item.push(this.myValue1);
}else{
item.push("1");
}
if (this.myValue2 != null){
item.push(this.myValue2);
}else{
item.push("1");
}
item.push("0");
// Save data to sessionStorage
sessionStorage.setItem('branch3r', JSON.stringify(item));
this.router.navigateByUrl('/survey-v1/branch4');
}
ngOnInit() {
this.title.setTitle('Survey v1');
// var data = Array.from(sessionStorage.getItem('branch1'));
// console.log(data);
//var storedArray = JSON.parse(sessionStorage.getItem("branch1"));//no brackets
//var i;
//for (i = 0; i < storedArray.length; i++) {
// alert(storedArray[i]);
//}
//console.log(storedArray);
var data = JSON.parse(sessionStorage.getItem('branch3'));
//console.log(data[0]);
if (data[0] == String(this.hl.heirarchyList[5].objName)){
if(data[1] == String(this.hl.heirarchyList[6].objName)){
this.firstObj = this.hl.heirarchyList[5].objName;
this.firstObj_full = this.hl.heirarchyList[5].objFull;
this.firstObj_best = this.hl.heirarchyList[5].best;
this.firstObj_worst = this.hl.heirarchyList[5].worst;
this.firstObj_unit = this.hl.heirarchyList[5].unit;
this.secondObj = this.hl.heirarchyList[6].objName;
this.secondObj_full = this.hl.heirarchyList[6].objFull;
this.secondObj_best = this.hl.heirarchyList[6].best;
this.secondObj_worst = this.hl.heirarchyList[6].worst;
this.secondObj_unit = this.hl.heirarchyList[6].unit;
this.thirdObj = this.hl.heirarchyList[7].objName;
this.thirdObj_full = this.hl.heirarchyList[7].objFull;
this.thirdObj_best = this.hl.heirarchyList[7].best;
this.thirdObj_worst = this.hl.heirarchyList[7].worst;
this.thirdObj_unit = this.hl.heirarchyList[7].unit;
}else{
this.firstObj = this.hl.heirarchyList[5].objName;
this.firstObj_full = this.hl.heirarchyList[5].objFull;
this.firstObj_best = this.hl.heirarchyList[5].best;
this.firstObj_worst = this.hl.heirarchyList[5].worst;
this.firstObj_unit = this.hl.heirarchyList[5].unit;
this.secondObj = this.hl.heirarchyList[7].objName;
this.secondObj_full = this.hl.heirarchyList[7].objFull;
this.secondObj_best = this.hl.heirarchyList[7].best;
this.secondObj_worst = this.hl.heirarchyList[7].worst;
this.secondObj_unit = this.hl.heirarchyList[7].unit;
this.thirdObj = this.hl.heirarchyList[6].objName;
this.thirdObj_full = this.hl.heirarchyList[6].objFull;
this.thirdObj_best = this.hl.heirarchyList[6].best;
this.thirdObj_worst = this.hl.heirarchyList[6].worst;
this.thirdObj_unit = this.hl.heirarchyList[6].unit;
}
}else if(data[0] == String(this.hl.heirarchyList[6].objName)){
if(data[1] == String(this.hl.heirarchyList[7].objName)){
this.firstObj = this.hl.heirarchyList[6].objName;
this.firstObj_full = this.hl.heirarchyList[6].objFull;
this.firstObj_best = this.hl.heirarchyList[6].best;
this.firstObj_worst = this.hl.heirarchyList[6].worst;
this.firstObj_unit = this.hl.heirarchyList[6].unit;
this.secondObj = this.hl.heirarchyList[7].objName;
this.secondObj_full = this.hl.heirarchyList[7].objFull;
this.secondObj_best = this.hl.heirarchyList[7].best;
this.secondObj_worst = this.hl.heirarchyList[7].worst;
this.secondObj_unit = this.hl.heirarchyList[7].unit;
this.thirdObj = this.hl.heirarchyList[5].objName;
this.thirdObj_full = this.hl.heirarchyList[5].objFull;
this.thirdObj_best = this.hl.heirarchyList[5].best;
this.thirdObj_worst = this.hl.heirarchyList[5].worst;
this.thirdObj_unit = this.hl.heirarchyList[5].unit;
}else{
this.firstObj = this.hl.heirarchyList[6].objName;
this.firstObj_full = this.hl.heirarchyList[6].objFull;
this.firstObj_best = this.hl.heirarchyList[6].best;
this.firstObj_worst = this.hl.heirarchyList[6].worst;
this.firstObj_unit = this.hl.heirarchyList[6].unit;
this.secondObj = this.hl.heirarchyList[5].objName;
this.secondObj_full = this.hl.heirarchyList[5].objFull;
this.secondObj_best = this.hl.heirarchyList[5].best;
this.secondObj_worst = this.hl.heirarchyList[5].worst;
this.secondObj_unit = this.hl.heirarchyList[5].unit;
this.thirdObj = this.hl.heirarchyList[7].objName;
this.thirdObj_full = this.hl.heirarchyList[7].objFull;
this.thirdObj_best = this.hl.heirarchyList[7].best;
this.thirdObj_worst = this.hl.heirarchyList[7].worst;
this.thirdObj_unit = this.hl.heirarchyList[7].unit;
}
}else{
if(data[1] == String(this.hl.heirarchyList[5].objName)){
this.firstObj = this.hl.heirarchyList[7].objName;
this.firstObj_full = this.hl.heirarchyList[7].objFull;
this.firstObj_best = this.hl.heirarchyList[7].best;
this.firstObj_worst = this.hl.heirarchyList[7].worst;
this.firstObj_unit = this.hl.heirarchyList[7].unit;
this.secondObj = this.hl.heirarchyList[5].objName;
this.secondObj_full = this.hl.heirarchyList[5].objFull;
this.secondObj_best = this.hl.heirarchyList[5].best;
this.secondObj_worst = this.hl.heirarchyList[5].worst;
this.secondObj_unit = this.hl.heirarchyList[5].unit;
this.thirdObj = this.hl.heirarchyList[6].objName;
this.thirdObj_full = this.hl.heirarchyList[6].objFull;
this.thirdObj_best = this.hl.heirarchyList[6].best;
this.thirdObj_worst = this.hl.heirarchyList[6].worst;
this.thirdObj_unit = this.hl.heirarchyList[6].unit;
}else{
this.firstObj = this.hl.heirarchyList[7].objName;
this.firstObj_full = this.hl.heirarchyList[7].objFull;
this.firstObj_best = this.hl.heirarchyList[7].best;
this.firstObj_worst = this.hl.heirarchyList[7].worst;
this.firstObj_unit = this.hl.heirarchyList[7].unit;
this.secondObj = this.hl.heirarchyList[6].objName;
this.secondObj_full = this.hl.heirarchyList[6].objFull;
this.secondObj_best = this.hl.heirarchyList[6].best;
this.secondObj_worst = this.hl.heirarchyList[6].worst;
this.secondObj_unit = this.hl.heirarchyList[6].unit;
this.thirdObj = this.hl.heirarchyList[5].objName;
this.thirdObj_full = this.hl.heirarchyList[5].objFull;
this.thirdObj_best = this.hl.heirarchyList[5].best;
this.thirdObj_worst = this.hl.heirarchyList[5].worst;
this.thirdObj_unit = this.hl.heirarchyList[5].unit;
}
}
/*
$(function()
{
$('.slider').on('input change', function(){
$(this).next($('.slider_label')).html(this.value);
});
$('.slider_label').each(function(){
var value = $(this).prev().attr('value');
$(this).html(value);
});
})
*/
$(function()
{
var tota, totb,altval;
//On Change event
$(document).on("change", "#range1, #range2", function (e) {
//Gather all slider values
tota = parseInt($("input#range1").val());
totb = parseInt($("input#range2").val());
if(tota < totb){
altval = tota;
// alert("Second slider should be less than first slider!");
$("#tota").text(altval);
$("#totb").text(altval);
$("input#range2").val(altval);
$(".range2").slider("refresh");
totb = altval;
}
//Update
else{
$("#tota").text(tota);
$("#totb").text(totb);
}
});
})
}
}
Event Timeline
Log In to Comment