Ex 1. if 50 qty = 100 rs so 200 qty = ?
200/50 * 100 = 400
Ex 2. if 36 qty = 34.02 so 144 qty = ?
144/36 * 34.02 = 136.08
Shopify, Shopify Apps, Magento, WordPress, Codeigniter, Joomla, Big Commerce | PHP
Ex 1. if 50 qty = 100 rs so 200 qty = ?
200/50 * 100 = 400
Ex 2. if 36 qty = 34.02 so 144 qty = ?
144/36 * 34.02 = 136.08
var container = document.querySelector('iframe#gorgias-chat-container');
var chatButtonHead = container?.querySelector('#chat-button')?.contentWindow.document.querySelector('head');
var chatButton = container?.querySelector('#chat-button')?.contentWindow.document.querySelector('body');
chatButton = chatButton?.querySelector('button');
if (chatButton?.children.length){
var chatbuttonStyle = document.createElement('div');
chatbuttonStyle.style.textAlign = "center";
chatbuttonStyle.style.fontWeight = "500";
chatbuttonStyle.textContent = 'Chat';
chatButton.appendChild(chatbuttonStyle);
window.clearInterval(gorgiasChatbutton);
}
Example 2
var gorgiasChatbutton = window.setInterval(function() {
var container = document.querySelector('#gorgias-chat-container');
var chatButtonHead = container?.querySelector('#chat-button')?.contentWindow.document.querySelector('head');
var chatButton = container?.querySelector('#chat-button')?.contentWindow.document.querySelector('body');
var chatButton = container?.querySelector('#chat-button')?.contentWindow.document.querySelector('body');
chatButton = chatButton?.querySelector('button');
chatButton = chatButton?.querySelector('.messenger-button-iframe-uscp54');
chatButton = chatButton?.querySelector('.messenger-button-iframe-clht14');
if (chatButton?.children.length){
var buttonStyle = document.createElement('style');
buttonStyle.textContent = '.chattext{color: #0e2fb5;text-align: center;font-weight: 500;position: absolute;bottom: 6px;left: 2px;font-size: 12px;background: #FFF;border-radius: 100%;}'; // the custom CSS for the chat button
chatButtonHead.appendChild(buttonStyle);
var chatbuttonStyle = document.createElement('div');
chatbuttonStyle.classList.add("chattext")
chatbuttonStyle.textContent = 'Chat';
chatButton.appendChild(chatbuttonStyle);
window.clearInterval(gorgiasChatbutton);
}
}, 100);
Sort by updated date
<script>
var data = "[
{
"_id": "5efd566ab3e22f002484bbb0",
"first_name": "Jaydip",
"last_name": "Kansagra",
"rate": "0",
"createdAt": "2020-07-02T03:37:14.808Z",
"updatedAt": "2020-07-02T03:37:14.808Z"
},
{
"_id": "5f16d3933fdf4a0024b7a2f8",
"first_name": "Jaydip",
"last_name": "Kansagra",
"rate": "5",
"createdAt": "2020-07-21T11:37:55.310Z",
"updatedAt": "2020-07-21T11:37:55.310Z"
},
{
"_id": "5f3bc286436d850024a2b574",
"first_name": "Jaydip",
"last_name": "Kansagra",
"rate": "3",
"createdAt": "2020-08-18T11:59:02.825Z",
"updatedAt": "2020-08-18T11:59:02.825Z"
}
]";
theme.blend_Obj = data;
theme.blend_Obj.sort((a, b) => (a.updatedAt > b.updatedAt) ? 1 : -1)
</script>
==================================
Sort by Rate (integer value)
<script>
topRates = [...theme.blend_Obj]
topRates.sort((a, b) => (parseInt(a.rate) < parseInt(b.rate)) ? 1 : -1);
</script>
<div class="gallery-placeholder">CSS
<div class="fotorama__stage__frame fotorama__active">
<img class="fotorama__img" src="<?php echo 'https://kansagra/jaydip/jaydip.jpg'; ?>" >
</div>
</div>
<div class="gallery-popup fixed-full-popup-model">
<div class="gallery-zoom-img">
<div class="gallery-main-img" style=""></div>
</div>
</div>
<style>JS
.gallery-popup {
cursor: url(../images/zoom-out.svg),pointer;
}
body .gallery-placeholder .fotorama__stage__frame.fotorama__active .fotorama__img {
cursor: url(../images/zoom-in.svg),pointer;
}
.gallery-popup .gallery-zoom-img .gallery-main-img {
width: 100%;
height: 100vh;
background-position: 0 0;
background-repeat: no-repeat;
background-size: cover;
}
.fixed-full-popup-model {
position: fixed;
top: 0;
left: 0;
z-index: 21;
background: #FFF;
width: 100%;
height: 100%;
display: none;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('body .gallery-placeholder').on('click', '.fotorama__stage__frame.fotorama__active .fotorama__img',function(){
var $this = $(this);
var img = $this.attr('src');
$('.gallery-popup .gallery-zoom-img .gallery-main-img').css("background-image", "url(" + img + ")")
$(".gallery-popup").fadeIn();
$("body").css("overflow", "hidden");
});
$(".gallery-popup").on("mousemove",".gallery-main-img",function(e){
var pixelToMove=100;
var height=$(this).innerHeight();
var newValueY=(e.clientY / height)*pixelToMove;
$(this).css('background-position',0+' '+newValueY+'%');
});
$(document).keyup(function(e) {
if (e.keyCode == 27) {
$(".gallery-popup").fadeOut();
$("body").css("overflow-y", "inherit");
}
});
$(".gallery-popup .gallery-main-img").click(function(){
$(".gallery-popup").fadeOut();
$("body").css("overflow-y", "inherit");
$('.gallery-popup .gallery-zoom-img .gallery-main-img').css("background-image", "");
});
});
</script>
var jaydip = {};
for(var i=0; i < items.length; i++){
jaydip[items[i]] = items[i]+'123';
}
console.log(jaydip);
alert(JSON.stringify(jaydip));
<?php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$lastchar = substr($actual_link, -1);
if($lastchar == '/'){
$redirecturl = rtrim($actual_link,"/");
?>
<script>
window.history.pushState('page2', 'Title', '<?php echo $redirecturl; ?>');
</script>
<?php } ?>
var x = 30; //minutes interval
var timesarr = []; // time array
var tt = 0; // start time
var ap = ['AM', 'PM']; // AM-PM
//Loop to increment the time and push results in times array
for (var i=0;tt<24*60; i++) {
var hh = Math.floor(tt/60); // getting hours of day in 0-24 format
var mm = (tt%60); // getting minutes of the hour in 0-55 format
timesarr[i] = ("0" + (hh % 12)).slice(-2) + ':' + ("0" + mm).slice(-2) + ' ' + ap[Math.floor(hh/12)]; // pushing data in array in [00:00 - 12:00 AM/PM format]
tt = tt + x;
}
console.log(timesarr);
$('#artsearch').keyup(function(){
var searchtext = $('#artsearch').val();
if(searchtext.length >= 3){
$('#photoPreview .file-row').each(function(){
var $this = $(this);
var $text = $this.find('.arttitle .name').text();
var indexcount = $text.indexOf(searchtext);
if(indexcount > -1){
$this.show();
}else{
$this.hide();
}
});
}
if(searchtext.length == 0){
$('#photoPreview .file-row').show();
}
});
var a = 1;
// global scope
function one() {
alert(a); // alerts '1'
}
var a = 1;
function two(a) {
alert(a); // alerts the given argument, not the global value of '1'
}
// local scope again
function three() {
var a = 3; // alerts '3'
alert(a);
}
let
)var a = 1;
function four() {
if (true) {
var a = 4;
}
alert(a); // alerts '4', not the global value of '1'
}
var a = 1;
function five() {
this.a = 5;
}
alert(new five().a); // alerts '5'
var a = 1;
var six = (function() {
var a = 6;
return function() {
// JavaScript "closure" means I have access to 'a' in here,
// because it is defined in the function in which I was defined.
alert(a); // alerts '6'
};
})();
var a = 1;
function seven() {
this.a = 7;
}
// [object].prototype.property loses to
// [object].property in the lookup chain. For example...
// Won't get reached, because 'a' is set in the constructor above.
seven.prototype.a = -1;
// Will get reached, even though 'b' is NOT set in the constructor.
seven.prototype.b = 8;
alert(new seven().a); // alerts '7'
alert(new seven().b); // alerts '8'
var x = 5;
(function () {
console.log(x);
var x = 10;
console.log(x);
})();
This will print out undefined and 10 rather than 5 and 10 since JavaScript always moves variable declarations (not initializations) to the top of the scope, making the code equivalent to:
var x = 5;
(function () {
var x;
console.log(x);
x = 10;
console.log(x);
})();
var e = 5;
console.log(e);
try {
throw 6;
} catch (e) {
console.log(e);
}
console.log(e);
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
var option_count = "text something";
$(document).ready(function(){
$('div').append('<?php echo add_option("' + option_count + '"); ?>');
});
</script>
<div></div>
<?php
ini_set('display_errors', 1);
function add_option($count) { ob_start();
echo $count;
$stuff = ob_get_contents();
ob_end_clean();
echo replace_newline($stuff);
}
function replace_newline($string) {
return trim((string)str_replace(array("\r", "\r\n", "\n", "\t"), ' ', $string));
}
?>
<script>
inIframe();
function inIframe () {
try {
var isif = window.self !== window.top;
if(isif == false){
//not iframe
}else{
//in iframe
}
} catch (e) {
//not iframe
}
}
</script>
[jems-countdown token="4" data-id="20136582"]
jQuery(document).ready(function(){
$('body *').contents().each(function() {
if(this.nodeType == 3) {
var u = this.nodeValue;
var reg = /\[(jems-countdown.*)\]/g;
$(this).replaceWith(u.replace(reg,'<div class="metcounter" $1>kanasagra</div>'));
}
});
});
<div class="showCodeWrapper">
<btn class="btn btn-default copyMe">
<i class="fa fa-clipboard"></i>
Copy
</btn>
<textarea data-app-type="countdown-timer" class="form-control embedShortcode showCode selectAll" readonly="">test</textarea>
</div>
<script>
$( "li.third-item" ).siblings().css( "background-color", "green" );
$(document).on("click", ".copyMe", function() {
var e = $(this).siblings("textarea")[0];
e.select();
try {
if (!document.execCommand("copy")) throw "Copy unsuccessful";
$(this).hide().html('<i class="fa fa-check"></i> Copied').fadeIn("fast")
} catch (t) {
$(this).hide().html("Press ⌘+C to copy.").fadeIn("fast"), debug("Copying text error " + t)
}
})
</script>