Javascript

This page shows several RTW WebUI Javascripts. Other locations where Javascript is used can be foune here.

Tip! An update to a javascript file is not taken into account now. This is a design decision. You have to change the test to get the newest javascript included. This can be done by editting (e.g. a comment) in the test.

Javascript Examples

A javascript example

The used example source:

function getLinks(searchProduct){
	var search=document.getElementsByClassName("ibm-container-body")[2];
	var links=search.getElementsByTagName('a');
	var noOfLink=0;
	for (i = 4; i < links.length; i++) {
  		if ((links[i].text).search(searchProduct)!=-1){
       		noOfLink=noOfLink+1;
       		}
	}
	return noOfLink.toString();
}
Tip! Make note that the return a String is! -> Not 100% sure anymore.
  function getDateTimeStamp(){
  	var date = new Date();

      var year = date.getFullYear();
      var month = (date.getMonth() + 1);
      if (month<10) month="0"+month;
      var day = date.getDate();
      if (day<10) day="0"+day;
      var hour = date.getHours();
      if (hour<10) hour="0"+hour;
      var mins = date.getMinutes();
      if (mins<10) mins="0"+mins;
      var sec = date.getSeconds();
      if (sec<10) sec="0"+sec;
      var str = year + "-" + month + "-" + day + " " +  hour + ":" + mins + ":" + sec;
      return str;
  }

Other Sources