aliaspooryorik
aliaspooryorik
<https://jqueryvalidation.org/>
? Oh I guess you mean <https://github.com/victorjonsson/jQuery-Form-Validator>
but you aren't making this easy!gus_dancy
07/15/2022, 11:01 PMTim
08/25/2022, 9:25 PMbrowserify
to bundle an application, and include it in an html page, which sounded like what I wanted, so I'm trying to do that, but this is also where things have gotten complicated.
I was able to sort out that if I put this code at the top of my d3.charts.js file, it pulls in the correct dependencies.
const d3 = require("d3/dist/d3");
const htl = require("htl/dist/htl");
And I can use browserify
to bundle all those dependencies into a single file.
The charts depend on d3 per above. d3 depends on jquery. But I also use foundation-sites which also depends on jquery. So I figured that it would be a good idea™ to package jquery as one bundle, foundation as a second bundle, and d3 and the charts as a third bundle (so as not to have jquery duplicated, and to not include the chart bundle on pages that don't need it), and that somehow, I'd be able to set it up so that foundation and my chart bundle would be able to reference jquery.
I was able to work out how to exclude jquery from my foundation and chart bundles (browserify -x jquery
), but what I haven't successfully worked out is how to reference jquery in the HTML so that foundation and the charts can see and use it. It seems that browserify --standalone
is involved somehow, because that's what's supposed to make things visible from outside the bundle. But I haven't figured out how to make this work.
I'm not sure what additional code, etc. might be useful, so I'm going to leave it here, but can reply with whatever. Also, if anyone has a completely different approach, I'm also open to that. Like I said at the start -- I just want the chart in the page...Simone
09/20/2022, 6:18 PMreturn this.system.filter(function (item, key) {
if(key.)
});
what ia m tryin to chhieve , if the key is: 1,2,3,4,5 it should be equal to 9 and it should also exclude key 7 from the list, i know in cf we can do listfind but i am nt sure in javascriptgsr
09/27/2022, 5:57 PMSimone
10/21/2022, 11:38 PMSimone
10/21/2022, 11:38 PMgus_dancy
10/26/2022, 6:52 PMJonas Eriksson
11/08/2022, 9:53 AMfunction countEurobat10items() {
var eurobat10counterX = Array.from(containermixitup.querySelectorAll('.LongLife'));
console.log(eurobat10counterX.length); // example: 35 total in DOM, 15 have "display:none" -> I want this number to be 20
eurobat10counter = eurobat10counterX.length;
// set this counter value into a span ID in the filter box
$('#eurobat10counter').html(eurobat10counter);
// change the className of the filter row, i.e. if we filter on one kind, we fade the others
if ( eurobat10counter < 1 )
{
document.getElementById("eurobat10Label").className = "configuratorOptionItemSmallDisabled";
document.getElementById("eurobat10counter").className = "configuratorOptionCounterDisabled";
}
else {
document.getElementById("eurobat10Label").className = "configuratorOptionItemSmall";
document.getElementById("eurobat10counter").className = "configuratorOptionCounter";
} ;
}
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, Thanks