RSS tickler does not tick when using a collection of links rather than texts: what is wrong?

I am using a solution at: https://www.cssscript.com/rss-feed-scroller-marquee/ in order to create a tickler for my web page. All fine, but for the fact the tickler just showed the texts of the rss feed but it was impossible to click them to get to article. So I tried to tamper with it constructing a proper url and trying to animate it. Yet the item seems well constructed, but when I animate it, nothing happens. This the code of the modified js class:

/*!
* RSS Marquee
*
* Licensed under MIT
* Copyright (c) 2020 (Samuel Carreira)
*/
class RSSMarquee {
/**
*
* @param {string()} feedURLs Feed URLs
* @param {object} elementContainer the selector of the marquee container
* @param {number} options.speed duration in ms per character. Bigger values = slow speed
* @param {number} options.maxItems specify max number of titles to show (useful to debug)
* @param {object} options.hostnameSelector The selector of the element where you want to show the URL of the news feed source (usefull for copyright atttribution)
*/
constructor(feedURLs, elementContainer, options = { speed: 110, maxItems: null, hostnameSelector: null }) {
this._feedURLs = new Array();
SEMrush

if (Array.isArray(feedURLs)) {
this._feedURLs = feedURLs;
} else {
this._feedURLs(0) = feedURLs;
}

const URLvalidation = this._feedURLs.every(this.validateURL);

if (!URLvalidation) {
throw new TypeError(‘Invalid URL on list’);
}

this._urlIndex = 0;

this._anim = null;

this._newsText = ”;

this._lastTime = Date.now();

if (elementContainer === null) {
throw new TypeError(‘Invalid element selector’);
}

this._elementContainer = elementContainer;
this.styleElementContainer();

this._options = {
speed: this.validateSpeed(options.speed),
maxItems: options.maxItems,
hostnameSelector: options.hostnameSelector,
// …options
};

this.getRSS();
}

validateSpeed(speed) {
if (!Number(speed) || speed < 50 || speed > 300) {
return 110; // default safe value
} else {
return speed;
}
}

/**
* Set the animation speed
* @param {number} speed value between 50-300
*/
set setSpeed(speed) {
this._options.speed = this.validateSpeed(speed);
}

get getSpeed() {
return this._options.speed;
}

/**
* Validate URL (uses URL interface)
*
* @param {string} url Url to check
* @returns {boolean} true if valid
*/
validateURL(url) {
try {
const u = new URL(url);
return true;
} catch (e) {
return false;
}
}

/**
* Get Hostname from url string
*
* Sample: “https://www.dnoticias.pt/rss/desporto.xml”
* returns url
*
* @param {string} url url string
* @returns {string} hostname
*/
getHostname(url) {
try {
const u = new URL(url);
return u.hostname;
} catch (e) {
return ”;
}
}

getRSS() {
const url = this._feedURLs(this._urlIndex);

this.fetchRSS(url)
.then((xmlText) => {
this._newsText = this.parseXMLFeed(xmlText);

this.showMarquee(this._newsText);

this.showHostname(url);
})
.catch((err) => {
console.error(err);

this.handleErrors();
});

}

handleErrors() {
const diffTime = Date.now() – this._lastTime;

if (diffTime > 5000) {
console.log(‘Trying next feed URL…’);

this.nextURL();
this._lastTime = Date.now();
} else {
if (this._newsText === ”) {
console.log(‘delay…’);
setTimeout(() => {
this.nextURL();
}, 5000);
} else {
console.log(‘show again cached saved news’);
this.showMarquee(this._newsText);
}
}
}

nextURL() {
this.increaseIndex();

this.getRSS();
}

styleElementContainer() {
this._elementContainer.style.overflow = ‘hidden’;
this._elementContainer.style.whiteSpace = ‘nowrap’;
}

showHostname(url) {
if (!this._options.hostnameSelector) {
return;
}

this._options.hostnameSelector.innerText = this.getHostname(url);
}

showMarquee(aCollection) {

try {
const animKeyframes = ({
transform: ‘translateX(0)’
},
{
transform: ‘translateX(-100%)’
}
);

const animOptions = {
duration: 25000, // The number of milliseconds each iteration of the animation takes to complete. Defaults to 0. Although this is technically optional, keep in mind that your animation will not run if this value is 0.
easing: ‘linear’, // The rate of the animation’s change over time. Accepts the pre-defined values “linear”, “ease”, “ease-in”, “ease-out”, and “ease-in-out”, or a custom “cubic-bezier” value like “cubic-bezier(0.42, 0, 0.58, 1)”. Defaults to “linear”.
iterations: 1, // The number of times the animation should repeat. Defaults to 1, and can also take a value of Infinity to make it repeat for as long as the element exists.
delay: 0, // The number of milliseconds to delay the start of the animation. Defaults to 0.
endDelay: 0 // The number of milliseconds to delay after the end of an animation. This is primarily of use when sequencing animations based on the end time of another animation. Defaults to 0.
};

animOptions.duration = aCollection.length * this._options.speed;

const elementChildNode = document.createElement(‘span’);
elementChildNode.style.display = ‘inline-block’;
elementChildNode.style.paddingLeft = ‘100%’;

//const textNode = document.createTextNode(text);
console.log(aCollection.lenght);
aCollection.forEach(function(item, index, array) {
elementChildNode.appendChild(item)
})
console.log(“totale:”);
console.log(elementChildNode);
//elementChildNode.appendChild(textNode);

//this._elementContainer.appendChild(elementChildNode);

this._anim = elementChildNode.animate(animKeyframes, animOptions);
console.log(‘start animation’);
this._anim.onfinish = () => {
console.log(‘end’);
while (this._elementContainer.firstChild) {
this._elementContainer.firstChild.remove();
}
delete this._anim.onfinish;

this.nextURL();
};

this._lastTime = Date.now();
} catch (err) {
console.error(err);
}
}

increaseIndex() {
this._urlIndex += 1;
if (this._urlIndex > this._feedURLs.length – 1) {
this._urlIndex = 0;
}
}

/**
* Fetch RSS
* @param {string} feedURL RSS XML url
*/
fetchRSS(feedURL) {
return new Promise((resolve, reject) => {
console.info(`Start fetching ${feedURL}…`);

fetch(feedURL, { mode: ‘cors’, redirect: ‘follow’ })
.then((response) => {
return response.text();
})
.then((xmlTxt) => {
return resolve(xmlTxt);
})
.catch(() => {
console.error(‘Error in fetching the RSS feed’);
reject();
})
});
}

/**
* Parses RSS XML feed
*
* – Select title elementContainer
* – add dot separator between “headlines”
* – remove <!(CDATA( string
* – remove html tags
*
* @param {string} xmlText
* @returns {string} parsed feed
*/
parseXMLFeed(xmlText) {
try {
const parser = new DOMParser();
const doc = parser.parseFromString(xmlText, “text/xml”);

let news = ”;
let aCollection=();
let totals = 0;

for (let item of doc.querySelectorAll(‘item’)) {
let title = item.getElementsByTagName(“title”)(0).childNodes(0).nodeValue;
// let description = item.getElementsByTagName(“description”)(0).childNodes(0).nodeValue;
let link = item.getElementsByTagName(“link”)(0).childNodes(0).nodeValue;
if (title) {
if (news.length) {
news += ‘xa0’ + ‘ • ‘ + ‘xa0’;
}
title = this.remoteCData(title);
title = this.stripTags(title);
news += title;
var a = document.createElement(‘a’);
var linkText = document.createTextNode(title);
a.appendChild(linkText);
a.title = title;
a.href = link;
aCollection.push(a);
totals += 1;
}

if (this._options.maxItems !== null && totals >= this._options.maxItems) {
console.info(‘Maximum items reached!’);
break;
}
}
//console.log(aCollection);
//console.log(news);
console.info(`Parsed ${totals} title(s)`);
return aCollection;
} catch (err) {
console.error(err);
return ‘ ‘;
}
}

stripTags(textWithTags) {
return textWithTags.replace(/<(.|n)*?>/g, ”);
}

remoteCData(originalText) {
return originalText.replace(“<!(CDATA(“, “”).replace(“))>”, “”);
}
}

The non occurring animation is in function: showMarquee(aCollection). The original site shows how to test it.

Thanks,

 

multi select – PrimeNG – Multiselect won’t show label and tick

I have MultiSelect

<p-multiSelect id="test_product_function" (options)="productFunction" ((ngModel))="selectedProductFunction" (filter)="true" (showToggleAll)="false" (maxSelectedLabels)="1" appendTo="body"></p-multiSelect>

One of the productFunction items is

{label: 'DBO - Batch reorganization (Unload/Reload)', value: 'DBO - Batch reorganization (Unload/Reload)'}

Then I pull data from database and want to set the selected values in MultiSelect

this.selectedProductFunction = data.func;

where data.func property is

"func": ("CMPIMS - Batch utilities","DBO - Batch Reorganization (Unload/Reload)"),

MultiSelect‘s label is empty and corresponding item is not checked, if I check manually some, label changes to “2 items selected“.
I have tried to eliminate all space, special characters and put it all to lowercase but it didn’t help. I’ve also tried just with the second value in data. It works for some other values, but not for all, what am I missing? 🙁

Giga Tick – Fully Responsive WHMCS Hosting Template

Admin submitted a new resource:

Giga Tick – Fully Responsive WHMCS Hosting Template – Giga Tick – Fully Responsive WHMCS Hosting Template

View attachment 12862

Giga Tick is a fully responsive WHMCS hosting template that is fully integrated with WHMCS software. The matching HTML template is… Click to expand…

Giga…​

Read more

.

checkout – How to show the tick mark after clicking the popup button in Jquery?

In checkout, we have enabled the “Terms and conditions” pop up and my requirement is to show the tick mark after closing the pop-up but right now it is happening only when we click the checkbox.
Please give me suggestions to make this work.

Code for Terms and condition:

<div class="checkout-agreement">
    <input type="checkbox" class="required-entry">
    <label class="label">
        <button type="button" class="action action-show">
            <span>I agree the Terms Conditions</span>
        </button>
    </label>
</div>

Code for Footer:

    <button class="action-close" data-role="closeBtn" type="button">
        <span>Close</span>
    </button>
</header>
<div class="modal-content">
    <div id="checkout-agreements-modal">
            <div>
                <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
            </div>
    </div>
</div>

<footer class="modal-footer">

    <button class="action secondary action-hide-popup" type="button" "><span>Close</span></button>
        
    </footer>
    
</div>

enter image description here

enter image description here
enter image description here

sharepoint online – Differences between “Green tick icons” & “Solid green circle with the white check mark” in OneDrive status column

The green tick icon means it is locally available (stored on your device) and can be opened when offline but if you have Storage Sense enabled these files will become online only again after an amount of time that you have set.

The solid green circle with a white tick means the file will always will be available on your device if you are offline (stored locally). The Storage Sense policy would not make this file online only after a certain period of time.

More information can be found here:

https://support.microsoft.com/en-us/office/save-disk-space-with-onedrive-files-on-demand-for-windows-10-0e6860d3-d9f3-4971-b321-7092438fb38e

rotation – UE4 – Event Tick and getting Forward Vector

I’m trying to make a game where my character rotates towards cursor (that works). He can choose between a few weapons (also works). One of the weapons works like a machine gun. My idea was to make a simple solution with:

Event tick -> gate (opened by pulling LBM and closed by releasing it) -> gate (closed after firing and opened after some delay) -> spawning projectile which leads to a sequence that closes / opens the second gate.

This doesn't work

It doesn’t work perfectly. The projectile spawns with the right scale and location, but the rotation is always pointing straight forward.

If the exactly same blueprint is attached to anything else (straight up to the LMB pull or a timer), it works perfectly. However, doing the LMB pull defeats the whole purpose, as it’s not a machine gun any more, and timer… is less then perfect I believe. I liked my solution using gates but it just doesn’t want to work.

For example, this bit works with no problem (even though the spawning and rotation code is literally copy pasted):
enter image description here

Does anyone have an idea on how to fix this?

Python Selenium First Project – loop through pages and check/uncheck tick boxes

New to Python/Selenium and learning on the fly with my first basic selenium script.

Request user input – activate or deactivate.
Open’s website, loops through shop url as well as activate/deactivate checkboxes.

Would be greatful for some feedback on how to optimise the code.

# IMPORTS
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

# X PATH LOCATIONS
shop = '//*(@id="zz2_TopNavigationMenun1")/table/tbody/tr/td/a'
product_range = '//*(@id="zz1_QuickLaunchMenun2")/td/table/tbody/tr/td/a'
product_sale = '//*(@id="divBdyGroup_WG_Main")/table/tbody/tr(2)/td/a'
product_record = '//*(@id="Enregistrer_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0")'
# WEB MAG URL
webmag_login = 'URL'
webmag_url = 'URL'
# CONTROLS
shopcodes = ('251' ,'257' ,'268' ,'271' ,'285' ,'411' ,'495' ,'787' ,'794' ,'838' ,'842' ,'847' ,'852' ,'857' ,'977' ,'978' ,'979' ,'A74' ,'A75' ,'A77' ,'A78' ,'B08' ,'C01' ,'C02' ,'D14' ,'D93' ,'E41' ,'E42' ,'E50' ,'G38' ,'G52' ,'G84' ,'G85' ,'G95' ,'R20' ,'R67')  # SHOP CODES TO CHECK
plucodes = ("2432")  # PLU CODES TO CHECK
# VARIABLES
prompt = input("Do you want to 'activate' or 'deactivate' items?nn")
# OPTIONS
chrome_options = Options()
# chrome_options.add_argument("--kiosk")
driver = webdriver.Chrome(options=chrome_options)

##################################################

print("n( --------------- ACTIVE PRODUCT CHECK ------------)nnShop codes to check :")
print(shopcodes)
print("nPLU codes to check :")
print(plucodes)
print("n( ------------- STARTING MAIN SCRIPT --------------)n")


##################################################

def webmag_launch_login():
    print(">>> launch web driver")
    driver.get(webmag_login)
    # driver.fullscreen_window()
    print(">>> open and login to webmagnn( ------------ ITERATE THROUGH SHOPS --------------)n")
    time.sleep(1)


def webmag_nav_to_range_tick():
    for Y in shopcodes:
        driver.get(webmag_url + Y)
        print(Y + " - Login to Store")
        time.sleep(1)
        driver.find_element_by_xpath(product_range).click()
        time.sleep(1)
        driver.find_element_by_xpath(product_sale).click()
        time.sleep(1)
        print("( - CHECKING ITEMS -- )")

        for X in plucodes:  # iterate through PLU CODES
            try:
                checkbox = "//td(div='" + X + "')/following-sibling::td/input(@type='checkbox')"
                productname = "//td(div='" + X + "')/following-sibling::td(1)"
                result = driver.find_element_by_xpath(checkbox).is_selected()
                if result:
                    print(X + " - " + driver.find_element_by_xpath(productname).text + "tPLU - already ticked")
                    # print(driver.find_element_by_xpath(productname).text)
                else:
                    driver.find_element_by_xpath(checkbox).click()
                    print(X + " - " + driver.find_element_by_xpath(productname).text + "tPLU - ticked")
                time.sleep(1)

            except:
                print(X + "- PLU - not found")
                time.sleep(1)
            # driver.find_element_by_xpath(shop).click()

        # SAVE BUTTON
        # driver.find_element_by_xpath(product_record).click()


def webmag_nav_to_range_untick():
    for Y in shopcodes:
        driver.get(webmag_url + Y)
        print(Y + " - Login to Store")
        time.sleep(1)
        driver.find_element_by_xpath(product_range).click()
        time.sleep(1)
        driver.find_element_by_xpath(product_sale).click()
        time.sleep(1)
        print("( - CHECKING ITEMS -- )")

        for X in plucodes:  # iterate through PLU CODES
            try:
                checkbox = "//td(div='" + X + "')/following-sibling::td/input(@type='checkbox')"
                productname = "//td(div='" + X + "')/following-sibling::td(1)"
                result = driver.find_element_by_xpath(checkbox).is_selected()
                if result:
                    print(X + " - " + driver.find_element_by_xpath(productname).text + "tPLU - unticked")
                    driver.find_element_by_xpath(checkbox).click()
                else:
                    print(X + " - " + driver.find_element_by_xpath(productname).text + "tPLU - already unticked")
                time.sleep(1)

            except:
                print(X + "- PLU - not found")
                time.sleep(1)
            # driver.find_element_by_xpath(shop).click()

        # SAVE BUTTON
        # driver.find_element_by_xpath(product_record).click()


# EXECUTE DEF

if prompt == "activate":
    webmag_launch_login()
    webmag_nav_to_range_untick()
elif prompt == "deactivate":
    webmag_launch_login()
    webmag_nav_to_range_tick()
else:
    print("Script Ended")
print("Script Finished Running")
```

javascript – how can i make checkbox to not remove tick on page refresh when checked and have the checkbox update the complete field in my database table

I am creating a todo list app in flask python and mysql as my school assignment. problem is i have a “complete” field on my task form and in my db, when i click the checkbox on the form to check it as complete and refresh my web page it goes back to default unchecked and doesn`t update the db.

here is my checkbox:

<td>
        <div class="checkbox-container">
          <input id="chkDone" name="done" type="checkbox"> Mark as Done <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
        </div>
      </td>

and here is my inline Js:

<script>
function check() {
  document.getElementById("chkDone").checked = true;
}

function uncheck() {
  document.getElementById("chkDone").checked = false;
}
</script>