the-hacker-news-rss/src/ef/news_scroll.js
hornetfighter515 f5d29b3136 testing new js
2021-07-23 21:41:54 -04:00

58 lines
1.6 KiB
JavaScript

var startdelay = 2; // START SCROLLING DELAY IN SECONDS
var scrollspeed = 1.1; // ADJUST SCROLL SPEED
var scrollwind = 1; // FRAME START ADJUST
var speedjump = 30; // ADJUST SCROLL JUMPING = RANGE 20 TO 40
var nextdelay = 0; // SECOND SCROLL DELAY IN SECONDS 0 = QUICKEST
var topspace = "2px"; // TOP SPACING FIRST TIME SCROLLING
var frameheight = 176; // IF YOU RESIZE THE CSS HEIGHT, EDIT THIS HEIGHT TO MATCH
var color_theme = "hornetfighter-red"; // CHANGE THIS TO WHAT YOU WANT FROM palette.css
window.onload=function(){
SetColor("news_iframe_scroll")
}
id=function(n){return document.getElementById(n);};
current = (scrollspeed);
function SetColor(el_id){
el = id(el_id);
if(el!=null){
console.log("El is not null.");
el.setAttribute("color-theme", color_theme);
}
else{
console.log("el " + el_id + " was null")
}
}
function HeightData(){
AreaHeight=dataobj.offsetHeight
if (AreaHeight===0){
setTimeout("HeightData()",( startdelay * 1000 ))
}
else {
ScrollNewsDiv()
}
}
function NewsScrollStart(){
SetColor("news-scroll-body")
dataobj=document.all? document.all.NewsDiv : id("NewsDiv")
dataobj.style.top=topspace
setTimeout("HeightData()",( startdelay * 1000 ))
}
function ScrollNewsDiv(){
dataobj.style.top=scrollwind+'px';
scrollwind-=scrollspeed;
if (parseInt(dataobj.style.top)<AreaHeight*(-1)) {
dataobj.style.top=frameheight+'px';
scrollwind=frameheight;
setTimeout("ScrollNewsDiv()",( nextdelay * 1000 ))
}
else {
setTimeout("ScrollNewsDiv()",speedjump)
}
}