// ==UserScript== // @name Tokopedia - Bulk Print // @namespace BulkPrint // @description Plugin Tokopedia (unofficial) untuk menggabungkan 2 atau lebih detail pengiriman, tujuan utamanya untuk mengurangi jumlah kertas cetak. // @include https://www.tokopedia.com/myshop_order_process.pl // @exclude // @version 1.0 // @grant none // @author dimazarno // @downloadURL none // ==/UserScript== $(".maincontent-admin").append(""); $("#myshop-order-list").find(".mt-10:first").append(''); $('#printClick').on('click',function(){ var myHTML = $("#bulk-print").html(); var scriptNode = document.createElement('script'), targ = document.getElementsByTagName ('head')[0] || document.body || document.documentElement; scriptNode.type = "text/javascript"; scriptNode.textContent = "(function(html){var d=window.open('about:blank', '_blank').document;d.open();d.write(html);d.close();})(" + JSON.stringify(myHTML) + ");"; targ.appendChild(scriptNode); }); $('.order_checkbox').on('change',function(){ var value = $(this).attr('value'); if ($(this).is(':checked')){ var $row = $("#order-"+value); var dest_receiver_name = $row.find(".dest_receiver_name").val(); var dest_address = $row.find(".dest_address").val().replace(new RegExp("
", "g"), ', ').replace(new RegExp("Telp", "g"), '
Telp'); var ship_shipping_name = $row.find(".ship_shipping_name").val(); var shop_phone = $row.find(".shop_phone").val(); var shop_name = $('.fs-12:first').text(); var dropship_name = $row.find(".dropship_name").val(); var dropship_telp = $row.find(".dropship_telp").val(); var product_qty = $row.find(".product_qty").val(); var mod_product_qty = product_qty.split("Barang"); if (dropship_name!=='') { shop_name = dropship_name; shop_phone = dropship_telp; } html = '
'; html += 'Dari : '+shop_name+' ('+shop_phone+')
'; html += 'Kurir : '+ship_shipping_name+'
'; html += 'Kepada : '+dest_receiver_name+'
'; html += 'Alamat : '+dest_address+'
Item :
'; $row.find('.products').each(function (index, element) { html += "- "+$(element).find('.product_name').val()+" (Qty : "+mod_product_qty[0]+")
"; }); html += '
'; //printhtml += html; $("#bulk-print").append( html ); } else { $("#bp-"+value).remove(); } });