hemi345
11/08/2022, 3:04 PM<div class="travFormInput">
<select x-model="p_person_to" name="p_person_to" required>
<option value="">Choose one</option>
<template x-for="u in acctUsers" :key="u['USERID']">
<template x-if="p_person_to == u['USERID']">
<option :value="u['USERID']" x-text="u['FULLNAME']" SELECTED></option>
</template>
<template x-if="p_person_to != u['USERID']">
<option :value="u['USERID']" x-text="u['FULLNAME']"></option>
</template>
</template>
</select>
</div>
any ideas or better ways to do this?chris-schmitz
11/16/2022, 1:55 PM<script type="module">
import { initializeApp } from "<https://www.gstatic.com/firebasejs/9.14.0/firebase-app.js>";
import { getMessaging, getToken, onMessage } from "<https://www.gstatic.com/firebasejs/9.14.0/firebase-messaging.js>";
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "<Api-Key>",
authDomain: "<Domain>",
projectId: "<ProjectId>",
storageBucket: "<Bucket>",
messagingSenderId: "<Sender-Id>",
appId: "<App-Id>",
name: "<App-Name>"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const messaging = getMessaging();
getToken( messaging, { vapidKey: '<Public-Key>' } )
.then((currentToken) => {
if (currentToken) {
window.localStorage.setItem( 'fbToken', currentToken );
} else {
console.log('No registration token available. Request permission to generate one.');
}
}).catch((err) => {
console.log('An error occurred while retrieving token. ', err);
});
onMessage(messaging, payload => {
console.log("Message received. ", payload);
const { title, ...options } = payload.notification;
});
</script>
On clicking a button the app reads the token from local storage and sends an ajax request to CF which then uses cfhttp()
to send a message to Firebase with this request body:
{
"to" : arguments.data.fbToken
, "notification" : {
"message": arguments.data.msg
, "title": "Greetings"
}
}
The result of the cfhttp()
call shows success: 1
(plus things like multicast_id
and message_id
), so I assume that I did things right so far.
Yet the onMessage()
event handler never fires, and I don't know whether the message never arrives or if there is a different problem.
Any ideas or hints?s1deburn
11/21/2022, 2:41 PMMark Takata (Adobe)
12/21/2022, 7:11 PMJonas Eriksson
01/19/2023, 1:30 PMChris Tierney
02/20/2023, 11:40 PMphillipsenn
05/05/2023, 3:14 PMAlex
05/22/2023, 8:13 AMSimone
06/18/2023, 12:31 AMfunction showMessage() {
swal({
title: "",
html: 'This will trigger some updates</b>',
type: "warning",
showCancelButton: true,
confirmButtonColor: "##EF5350",
confirmButtonText: "Yes, Proceed",
cancelButtonText: "Cancel",
reverseButtons: true
},function(isConfirmed) {
alert(isConfirmed)
if (isConfirmed) {
alert($(".openStandings").attr('data-href'));
$.ajax({
type: "POST",
url: $(".openStandings").attr('data-href'),
success: function(data) {
alert(data);
if (data.toLowerCase().indexOf("error") >= 0) {
swal({
title: "Oops",
text: data,
type: "error",
showCancelButton: false,
confirmButtonColor: "##EF5350",
confirmButtonText: "OK",
closeOnConfirm: true
});
} else {
swal({
title: "Great",
text: data,
type: "success",
showCancelButton: false,
confirmButtonColor: "##EF5350",
confirmButtonText: "OK",
closeOnConfirm: true
});
}
}
})
}
})
}
J
06/22/2023, 2:56 PMSimone
06/23/2023, 4:00 PMdaniel
07/17/2023, 12:38 PMSimone
08/03/2023, 2:00 AMSimone
08/03/2023, 2:06 AMdocument.addEventListener('readystatechange', function(e) {
switch (e.target.readyState) {
case "complete":
$('.totalsTeal').trigger('input');
break;
}
});
$(document).on('input', '.totalsTeal', function() {
let self = $(this);
let day = self.attr('data-name');
console.log(self.val());
if (self.val() === "0.00") {
$('#w1_' + day).parent().find('label').css('display', 'none');
} else {
$('#w1_' + day).parent().find('label').css('display', 'block');
}
});
so everytime, the value entered in the input field will have the updated value in the input field having a class of .totalsTeal and it should fire, the class is common to 3 or 4 inputs and every input works like a rowjohnbarrett
08/18/2023, 6:29 PMI am trying to make a digital clock, but it always shows PM, and never shows AM, can anybody help me with this code to find out why it is not working correctly? I think the issue is with " let timeOfDay = hour >= 12 ? "AM" : "PM";" function update() {
//Get todays date
let today = new Date();
//Extract time from date
let hour = today.getHours();
let minutes = today.getMinutes();
let seconds = today.getSeconds();
const weekday = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];
let day = weekday[today.getDay()];
let date = today.getDate();
const monthArr = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
let month = monthArr[today.getMonth()];
// console.log(day,date,month);
//Pad 0 if time is < 10 (single digit)
hour = hour < 10 ? "0" + hour : hour;
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
//Convert railway clock to AM/PM clock
hour = hour > 12 ? hour - 12 : hour;
hour = hour == 0 ? 12 : hour;
//Assign AM or PM according to time
let timeOfDay = hour >= 12 ? "AM" : "PM";
//Insert time using dom
document.getElementById("hours").innerHTML = hour + " : ";
document.getElementById("minutes").innerHTML = minutes + " : ";
document.getElementById("seconds").innerHTML = seconds + " ";
document.getElementById("timeOfDay").innerHTML = timeOfDay;
document.getElementById("day").innerHTML = day + " ,";
document.getElementById("date").innerHTML = date + "  ";
document.getElementById("month").innerHTML = month;
}
setInterval(() => {
update();
}, 1000);
Tim
08/18/2023, 6:53 PMif hour is 12 or more, then AM, else PM
is what you have written there. so it doesn't seem like it should always be PM. But it does seem like it's backwards.Tim
08/18/2023, 6:54 PMhour < 12 ? "AM" : "PM"
would be right... 0-11 is am, 12-23 is pm. Assuming that the value in hour is a number from 0-24...Ryan Albrecht
10/04/2023, 5:44 PMgsr
11/02/2023, 6:51 PMgsr
12/10/2023, 3:59 AMfunction checkTableData() {
var allTables = $('#tableBody');
var highestValue = -1;
for (var i = 0; i < allTables.length; i++) {
var table = allTables[i];
var trs = $(table).find('tr');
for (var j = 0; j < trs.length; j++) {
var tr = trs[j];
var dataSuccess = $(tr).attr('data-mode');
var dataPure = $(tr).attr('data-pure');
console.log(highestValue);
if (dataSuccess === 'success' && dataPure === 'yes' && highestValue < 0) {
highestValue = 0;
console.log('0');
} else if (dataSuccess === 'success' && dataPure === 'no' && highestValue < 1) {
highestValue = 1;
console.log('1');
} else if (dataSuccess === 'error') {
console.log('2');
errorCount++;
if (errorCount >= 1) {
console.log('more than 2');
return 2;
}
}
}
}
return highestValue;
}
i need some guidance on it, Thanksgsr
03/24/2024, 3:29 PMgsr
04/27/2024, 10:24 PM$("#dialogFrame").dialog({
autoOpen: false, // Dialog is not shown on page load
modal: true, // Make the dialog modal
buttons: {
"Close": function() {
$(this).dialog("close");
}
}
});
$(document).on('click', ".opendialog1", function(e) {
e.preventDefault();
var dialogHref = $(this).data('dialog-href');
var cssFile = $(this).data('css');
var dialogTitle = $(this).data('dialog-title') || 'View Details';
var dialogWidth = $(this).data('dialog-width') || 600;
var dialogHeight = $(this).data('dialog-height') || 600;
// Set the dialog content
$("#dialogFrame").html('<iframe id="myIframe" src="' + dialogHref + '" width="100%" height="100%" frameborder="0"></iframe>');
// Update dialog options
$("#dialogFrame").dialog("option", "width", dialogWidth);
$("#dialogFrame").dialog("option", "height", dialogHeight);
$("#dialogFrame").dialog("option", "title", dialogTitle);
// Open the dialog
$("#dialogFrame").dialog("open");
// Handle the iframe's load event
$("#myIframe").on("load", function() {
if (cssFile) {
var iframeDoc = this.contentDocument || this.contentWindow.document;
var link = iframeDoc.createElement("link");
link.rel = "stylesheet";
link.href = cssFile;
iframeDoc.head.appendChild(link);
}
});
});
with this code
<button name="updateGallery" id="updateGallery" data-load="iframe" data-dialog-href="uploadGallery.cfm?page=about&ID=15" class="main-btn warning-btn btn-hover moss opendialog1" data-dialog-title="Upload Additional Images" data-dialog-width="800" data-dialog-height="800">Upload Gallery</button>
getting an error
Uncaught TypeError: i.getClientRects is not a function
which is pointing to this:
$("#dialogFrame").dialog("option", "width", dialogWidth);Ryan Albrecht
05/16/2024, 5:06 PMRyan Albrecht
05/16/2024, 5:06 PM//object to store throttled function for each topic
var topic_funcs = {}
//function to create new throttled dispatch function
var createDispatchFunc = ()=>{
return _.throttle( (payload)=>{
store.dispatch('broker/handleMessage', payload)
}, 3000);
}
//function to retrieve dispatch function
var getFunc = (topic) => {
if( topic_funcs[topic] == undefined ){
topic_funcs[topic] = createDispatchFunc();
}
return topic_funcs[topic];
}
// on message recieved from mqtt broker
client.on('message', (topic,payload) => {
//get func and execute
getFunc(topic)(payload);
} )
elpete
06/20/2024, 2:13 AMDave Merrill
07/09/2024, 7:14 PMDaniel Mejia
08/17/2024, 1:59 AMgsr
09/20/2024, 10:19 PMDave Merrill
11/26/2024, 10:16 PMfunction loadPage(url)
{
fetch(url)
.then(response => response.text())
.then(data => {
document.documentElement.innerHTML = data;
})
.catch(error => {
console.error('Error:', error);
});
}
loadPage(document.URL);
cfsimplicity
01/01/2025, 11:52 AM