I want to ask about how to clear cookie with signed=true.
For the following two optons, the first case cleared the cookie : res.clearCookie('test, OPTION2), but the second case didn't clear the cookie: res.clearCookie('test, OPTION1).
Only difference is signed=true and signed=false.
How to clear the cookie with signed=true?
const OPTION1 = {
secure: true,
signed: true,
maxAge: 1000 * 60 * 10,
sameSite: 'Strict',
}
const OPTION2 = {
secure: true,
signed: false,
maxAge: 1000 * 60 * 10,
sameSite: 'Strict',
}
To get a solution about my asking
Related
I need four slide holder with tooltips. When I try 3 then it works, but when I try 4 then it shows the following error:
Uncaught Error: noUiSlider (10.0.0): must pass a formatter for all
handles
My code
noUiSlider.create(handlesSlider4, {
start: [4000, 8000, 12000, 16000],
connect: [false, true, false, true, false],
tooltips: [false, wNumb({ decimals: 1 }), true],
range: {
'min': [2000],
'max': [20000]
}
});
Missing tooltip
screenshot
http://prntscr.com/hh66qy
updated code
noUiSlider.create(handlesSlider4, {
start: [4000, 8000, 12000,16000],
connect: [false, true, false, true,false],
// tooltips: [false, wNumb({ decimals: 1 }), true],
tooltips: [false, wNumb({ decimals: 1 }), true, false],
range: {
'min': [2000],
'max': [20000]
}
});
How I can see tooltip on all handlers?
You need to add the same number of hanldes (start) and the formatters (tooltips).
So, if you are using 4 start handles, tooltips should also have a length of 4.
...
// add a 4th input here, I have used `false` but use as per your requirement
tooltips: [false, wNumb({ decimals: 1 }), true, false],
....
This question already has an answer here:
jPlayer - Save user settings through page redirect's
(1 answer)
Closed 6 years ago.
First of all I should say that I am not very experienced with JavaScript and I would like some help on passing a sessionStorage value to a setting.
$(document).ready(function(){
window.userSettings = null;
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
title: "TestRadio",
mp3: "http:/streamlink"
});
},
swfPath: "jplayer/dist/jplayer",
supplied: "mp3",
wmode: "window",
volume: "75",
useStateClassSkin: true,
loop: true,
autoBlur: true,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: false,
toggleDuration: false
});
});
function storeUserjPlayerSettings(){
var settings = new Object();
settings.volume = $("#jquery_jplayer_1").data().jPlayer.status.volume;
settings.paused = $("#jquery_jplayer_1").data().jPlayer.status.paused;
settings.src = $("#jquery_jplayer_1").data().jPlayer.status.src;
sessionStorage.setItem('userjPlayerSettings', JSON.stringify(settings));
window.userSettings = JSON.parse(sessionStorage.getItem('settings'));
}
What I would like to do is to pass the settings.volume web stored value to the volume parameter
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
title: "TestRadio",
mp3: "http:/streamlink"
});
},
swfPath: "jplayer/dist/jplayer",
supplied: "mp3",
wmode: "window",
**volume**: "75",
useStateClassSkin: true,
loop: true,
autoBlur: true,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: false,
toggleDuration: false
});
});
You are saving the volume earlier, so you just access it in the reverse process when you need it.
For example, change the volume: 75 initialization to a call to a function that get the volume from your saved settings: volume: volumeSetting().
Here's an example of how you might write that function itself:
function volumeSetting() {
var settings = sessionStorage.getItem("userjPlayerSettings");
if (settings != null) {
settings = JSON.parse(settings);
if (typeof settings.volume == 'number')
return settings.volume;
}
return 75;
}
I have, on my application two datepickers, StartDate and EndDate. I would like to set a limit of 30 days, because the amout of data in a bigger range will be huge and the application will freeze.
I would like something like: If user select on the startDate today, on the endDate will apear only, the 30 days next. But if the user choose today on the endDate, enable only the 30 past days.
My Code:
$('#data_1 .input-group.date').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
calendarWeeks: true,
autoclose: true,
language: 'pt-BR'
});
$('#data_2 .input-group.date').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
calendarWeeks: true,
autoclose: true,
language: 'pt-BR'
});
I solve my problem this way... On button click
var data1 = $('#data1').val();
var data2 = $('#data2').val();
var umDia = 24 * 60 * 60 * 1000; // horas*minutos*segundos*milisegundos
var dias = Math.round(Math.abs((toDate(data1.substr(0, 10)).getTime() - toDate(data2.substr(0, 10)).getTime()) / (umDia)));
So, I did a condicional like:
if (dias < 31)
{
$.ajax({
url: '/Portaria/AtendOperador',
dataType: "json",
type: "GET",
data: { 'data1': data1, 'data2': data2, 'evento': evento, 'cuc': cuc, 'conta': conta },
async: false,
cache: false,
delay: 15,
success: function (data) {
I have framed an array like below
iArray = [true, true, false, false, false, false, false, false, true, true, true, false,
true, false, false, false, false, true]
Condtional check:
If anyone of the value in this array is false I will be showing an error message
else if everything is true I will be showing success message.
I tired below code to iterate, however couldn't frame the logic in it.
var boolIteration = iArray.split(',');
var i;
for (i = 0; i < boolIteration.length; ++i) {
//conditional check
}
I'm struggling to iterate the array using the above condition.
Can anyone point me in the right direction with an efficient solution.
No need for jQuery
if (iArray.indexOf(false) !== -1) {
// error
}
Also, as previous commenters have already pointed out, iArray is already an array, there's no need to use split on it.
The Array.prototype.indexOf is not available in Internet Explorer below 9. However, this functionality could be easily added with a matching algorithm. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf for compatibility and how to create a workaround.
iArray is already an array, so there is no need to split it again (split is a method for String, Arrays don't have it)
What you need to do is check the index of a false value, if it is there then there is a false value in the array.
using jQuery - the array indexOf is not used because of IE compatibility
iArray = [true, true, false, false, false, false, false, false, true, true, true, false,
true, false, false, false, false, true]
if($.inArray(false, iArray ) != -1){
//error
}
var iArray = [true, true, false, false, false, false, false, false, true, true,
true, false,true, false, false, false, false, true];
for (var i = 0; i < iArray.length; i++) {
if (iArray[i]) {
alert("success");
}
else {
alert("error");
}
}
Aternatives:
if (/false/i.test(iArray)) { }
or
if ( ''.replace.call(iArray,/true|,/g,'').length ) { }
The jQuery.inArray function is nice for checking to see if a particular value is contained within an array.
iArray = [true, true, false, false, false, false, false, false, true, true, true, false, true, false, false, false, false, true];
if ($.inArray(iArray, false) >= 0) {
// the value "false" is contained within the array, show an error message
}
I am trying to get fullduration my MP3 file but it returns me NaN,
Here is my code:
<script>
$f("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf", {
clip: {
// our song
url: '1.mp3',
// when music starts grab song's metadata and display it using content plugin
onStart: function(){
var fullduration = parseInt(this.getClip().fullDuration, 10);
alert(fullduration);
var p = this, c = p.getClip(), d;
timer = setInterval(function(){
d = showtime(c.fullDuration);
$("a[href=" + c.url + "] > samp").html(showtime(p.getTime()) + "/" + d);
}, 1000);
}
},
plugins: {
// content plugin settings
content: {
url: 'flowplayer.content-3.2.0.swf',
backgroundColor: '#002200',
top: 25,
right: 25,
width: 160,
height: 60
},
// and a bit of controlbar skinning
controls: {
backgroundColor: '#002200',
height: 30,
fullscreen: false,
autoHide: false,
volume: false,
mute: true,
time: true,
stop: false,
play: false
}
}
});
</script>
I had a look at your code using flowplayer version 3.2.7 and 3.2.8. With version 3.2.7 I get the same error and with 3.2.8 I get the duration in seconds which is what is expected. So you'll need to upgrade and change the following from
http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf
to
http://releases.flowplayer.org/swf/flowplayer-3.2.8.swf