Skip to content

Instantly share code, notes, and snippets.

View Konark-Web's full-sized avatar
🎯
Focusing

Vladyslav Konark-Web

🎯
Focusing
View GitHub Profile
GET http://127.0.0.1:8000/api/posts
[
{
"id": 6,
"author_id": 2,
"author": "test1",
"title": "My third post by API",
"text": "Yes, it's really work!",
"created_date": "2021-10-23T19:21:41.969850Z",
"date_modified": "23 Oct 2021",
def list_of_vaccinations(request):
result_edit = False
if request.method == "POST":
if request.META.get('HTTP_REFERER').find('edit'):
vaccine = Vaccine.objects.get(id=request.POST.get('id'))
if vaccine:
vaccine.name = request.POST.get('name')
vaccine.date = request.POST.get('date')
vaccine.patient_id = request.POST.get('user_id')
// НЕ РАБОТАЕТ
$('body').on('DOMNodeInserted', '.js-auth-popup-box', function(){
console.log($(this));
});
// РАБОТАЕТ
$('body').on('DOMNodeInserted', '.popup-wrapp', function(){
console.log($(this));
});
<div class="popup-wrapp">
<div class="popup-box js-auth-popup-box">
<header class="popup-header">
<span class="close-icon js-popup"></span>
</header>
<div class="popup-main">
<div class="authorization-box">
<h1 class="title center">
Авторизация </h1>
// Fix jQuery after update WordPress
add_action( 'wp_enqueue_scripts', 'load_old_jquery_fix', 100 );
function load_old_jquery_fix() {
if ( ! is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', ( "//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" ), false, '1.11.3' );
wp_enqueue_script( 'jquery' );
}
}
@Konark-Web
Konark-Web / gist:c0be6a4888b82728caf9b611e5903aec
Created September 24, 2020 08:24
Facebook reposts parser for communities v2
var result = "\n";
var INTERVAL = window.setInterval(function() {
window.clearInterval(INTERVAL);
var items = document.querySelectorAll('#jsc_c_13');
for (var i=0; i < items.length; ++i)
{
if (i == 0) {
continue; // skip author name
}
if( wp_verify_nonce( $_POST['fileup_nonce'], 'my_file_upload' ) ){
if ( ! function_exists( 'wp_handle_upload' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}
// require_once( ABSPATH . 'wp-admin/includes/image.php' );
// require_once( ABSPATH . 'wp-admin/includes/file.php' );
// require_once( ABSPATH . 'wp-admin/includes/media.php' );
function clear_cart_after_logout() {
WC()->cart->empty_cart();
// $cart = new WC_Cart();
// $cart->empty_cart( $clear_persistent_cart = true );
}
add_action('wp_logout', 'clear_cart_after_logout');
#main-section > div.container > span {
font-size: 16px !important;
margin-bottom: 10px;
}
#main-section > div.container > h1 {
font-size: 23px !important;
}
var result = "\n";
var INTERVAL = window.setInterval(function() {
window.clearInterval(INTERVAL);
var items = document.querySelectorAll('#repost_view_dialog .userContentWrapper');
for (var i=0; i < items.length; ++i)
{
var account = items[i].querySelector('.fwb.fcg > a');
result += account.textContent + '\n';
}