Greasy Fork

Greasy Fork is available in English.

Cetak Sekaligus Kertas A6

Untuk mencetak sekaligus buat kertas ukuran A6 untuk Tokopedia, Bukalapak, Shopee, dan Akulaku

当前为 2019-01-26 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Cetak Sekaligus Kertas A6
// @author       Celleven Store
// @namespace    https://www.tokopedia.com/celleven
// @version      0.0.9
// @description  Untuk mencetak sekaligus buat kertas ukuran A6 untuk Tokopedia, Bukalapak, Shopee, dan Akulaku
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @match        https://www.tokopedia.com/logistic/print-address*
// @match        https://www.tokopedia.com/print-address.pl*
// @match        https://seller.shopee.co.id/api/v2/orders/waybill*
// @match        https://www.bukalapak.com/payment/transactions/print_preview*
// @run-at       document-idle
// ==/UserScript==

(function() {
  'use strict';

  var backgroundImage = '';
  var logo = '';

  if (window.location.href.indexOf("tokopedia") > -1)
  {
    cetakTokopedia();
  }
  else if (window.location.href.indexOf("shopee") > -1)
  {
    cetakShopee();
  }
  else if (window.location.href.indexOf("bukalapak") > -1)
  {
    cetakBukalapak();
  }
  else if (window.location.href.indexOf("akulaku") > -1)
  {
    cetakAkulaku();
  }

})();

function cetakTokopedia()
{
  var styleCSS = `<style>
  @page
  {
    size: 105mm 148mm portrait;
    margin: 3mm 2mm 2mm 3mm;
  }
  @media print
  {
    div.address_contaier_left, div.address_contaier_right, div.address
    {
      float: none !important;
      padding-left: 0px;
      width: 540px !important;
    }
    div.address
    {
      page-break-after: always;
    }
    /*body
    {
      zoom: 117%;
    }*/
    h5
    {
      display: none;
    }
    div.address_contaier_left > div > table, div.address_contaier_right > div > table
    {
      width: 540px !important;
    }
    div.additional_info_wrapper
    {
      margin-top: 7px;
      margin-bottom: -10px;
    }
    div.header_wrapper
    {
      padding: 10px;
      margin-bottom: 5px;
    }
  }
  </style>`;

  $('body').append(styleCSS);
  $('div.address > table > tbody > tr > td').each(function(x, r)
  {
    $(r).find('table:contains("Kepada") > tbody > tr > td > div').css('font-size', '17px');
  });

  $("table div:contains('bayar asuransi')").remove();
  $("div.page-break").remove();
  $("td div:contains('Asuransi')").next().html('+ Rp 0').css('text-decoration', 'none');
  $("td div:contains('Ongkir')").next().css('text-decoration', 'none');
  $("div.address_contaier_right").each(function()
  {
    if ($(this).children().length == 0)
    {
      $(this).remove();
    }
  });
  $("div.address").filter(function()
  {
    return $(this).text().trim() == "";
  }).remove();
  $("div.address_contaier_right").filter(function()
  {
    return $(this).text().trim() == "";
  }).remove();
}

function cetakShopee()
{
  var styleCSS = `<style>
  @page
  {
    margin: 4mm 1mm 2mm 4mm;
  }
  @media print
  {
    .page
    {
      float: none !important;
      page-break-after: always;
      border-right: none !important;
      width: 48%;
    }
    .left
    {
      margin-left: -1px;
    }
    .page.left
    {
      padding: 0 0.55in 0 0;
      border-right: none;
    }
    .page.right
    {
      padding: 0 0.55in 0 0;
      border-left: none;
    }
  }
  </style>`;

  $('style:last').html($('style:last').html().replace('A4 landscape', 'auto'));
  $('style:first').html($('style:first').html().replace('A4 landscape', 'auto'));
  $('head').append(styleCSS);
  $('div.page-breaker').remove();
  $('div:last').remove();
  $('img.scissors-vertical').remove();
  $(".page.right").each(function()
  {
    if ($("div.job-shipping-label", this).length > 0)
    {
      $("style:last").html($('style:last').html().replace(/(padding: 0 0.55in 0 0;)/g, ""));
    }
  });
}

function cetakBukalapak()
{
  var styleCSS = `<style>
  @media print
  {
    div.transaction-slip
    {
      page-break-after: always;
      margin-top: 20px;
    }
    div#page > div.row > div.row-item
    {
      float: none;
      width: 100%;
    }
    div.row
    {
      font-size: 13pt;
    }
    div.bukalapak-transaction-slip-footer
    {
      font-size: 12pt;
    }
    div.transaction-slip > div.row > table > tbody > tr > td > span
    {
      font-size: 13pt !important;
    }
    div.notice
    {
      font-size: 12pt;
    }
    div.section-logistic-booking > strong
    {
      font-size: 18pt !important;
    }
    div.section-logistic-booking > img
    {
      height: 82px !important;
      width: 500px !important;
    }
    div.brand-logo > img
    {
      height: 39px !important;
    }
    div.row-item > img
    {
      height: 64px !important;
    }
  }
  </style>`;

  $('body').append(styleCSS);
}

function cetakAkulaku()
{
}