This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This method works only when pdf is rendered with Text Layer | |
// It compares particular text/word element coordinates with | |
// the rectangle's coordinates. If text/word coordinates is in | |
// the rectangle, text has got. And successing texts are similar. | |
// Check out text layer rendering option at the article below. | |
// https://www.sitepoint.com/custom-pdf-rendering/ | |
function getTextInRect(pageNumber, Xi, Yi, Xl, Yl) { // modify pageNumber if required | |
// Get the page if page render method works like (page-1, page-2, ...) | |
// If not, modify according to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Landing Page | |
// Send to Parıltı | |
window.onload = document.getElementById("parilti").addEventListener("click", function(){ | |
document.cookie = "send_to_parilti = 1; path=/"; | |
window.location.href = "https://wewalk.io/tr/product/wewalk-akilli-baston/"}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a client side script to update distant sales agreement on a Woocommerce / Wordpress checkout page | |
shipmentDifferent = document.getElementById("ship-to-different-address-checkbox"); | |
function update(to, from) { | |
val = ""; | |
for (var i in from) { | |
val += document.getElementById(from[i]).value + " "; | |
} | |
document.getElementById(to).innerText = val; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Landing Page | |
// Do not send to Parıltı : send to myself | |
window.onload = document.getElementById("myself").addEventListener("click", function(){ | |
document.cookie = "send_to_parilti = 0; path=/"; | |
window.location.href = "https://wewalk.io/tr/product/wewalk-akilli-baston/"}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Product Page | |
function getCookie(name) { | |
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)'); | |
return v ? v[2] : null; | |
} | |
var cookieValue = getCookie("send_to_parilti"); | |
if(cookieValue == 1) { | |
document.getElementsByName("add-to-cart")[0].innerText = "Parıltı'ya Gönder"; // Means "Send to Parıltı" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Checkout page | |
<p>Gönderi tercihiniz şu şekilde: </p><select id="shipping_selector" style="width:400px; height:40px"> | |
<option value="myself">Kendime ya da tanıdığım bir görme engelliye alıyorum.</option> | |
<option value="parilti">Parıltı Derneği'ne göndermek istiyorum.</option> | |
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCookie(name) { | |
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)'); | |
return v ? v[2] : null; | |
} | |
function fillParilti() { | |
//Show Other Shipping Address Field | |
document.getElementsByClassName("shipping_address")[0].style.display = "block"; | |
document.getElementById("ship-to-different-address-checkbox").checked = true; | |
// Fill info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// API - SQL Query | |
select sum(orders.product_qty) | |
from wp_postmeta as company, wp_wc_order_product_lookup as orders | |
where company.meta_key = "_shipping_company" and company.meta_value = "Parıltı" and company.post_id = orders.order_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// API Progress.php | |
<?php | |
$servername = "localhost"; | |
$username = ""; | |
$password = ""; | |
$dbname = "wordpress"; | |
$sql = 'select sum(orders.product_qty) as sum from wp_postmeta as company, wp_wc_order_product_lookup as orders where company.meta_key = "_shipping_company" and company.meta_value = "Parıltı" and company.post_id = orders.order_id'; | |
$link = mysqli_connect("localhost", $username, $password, $dbname); | |
mysqli_set_charset($link, "utf8"); |
OlderNewer