Greasy Fork

Greasy Fork is available in English.

Cetak Sekaligus Kertas A6

Untuk mencetak multi print buat kertas ukuran A6 untuk Tokopedia, Bukalapak dan Shopee

当前为 2018-08-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 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.3
// @description  Untuk mencetak multi print buat kertas ukuran A6 untuk Tokopedia, Bukalapak dan Shopee
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @match        https://www.tokopedia.com/print-address.pl*
// @match        https://seller.shopee.co.id/api/v2/orders/waybill*
// @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();
  }

})();

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;
    }
    div.address
    {
      page-break-after: always;
    }
    body
    {
      zoom: 117%;
    }
    h5
    {
      display: none;
    }
  }
  </style>`;

  $('body').append(styleCSS);
  $('div.address > table > tbody > tr > td').each(function(x, r)
  {
    if ($(r).find('table').length == 5)
    {
      $(r).find('table:nth-child(4) > tbody > tr > td > div').css('font-size', '15px');
    }
    else if ($(r).find('table').length == 7 || $(r).find('table').length == 6)
    {
      $(r).find('table:nth-child(5) > tbody > tr > td > div').css('font-size', '15px');
    }
  });

  $("table div:contains('bayar asuransi')").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();
    }
  });
}

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;
    }
  }
  </style>`;

  $('style:last').html($('style:last').html().replace('A4 landscape', 'auto'));
  $('head').append(styleCSS);
  $('div.page-breaker').remove();
  $('div:last').remove();
  $('img.scissors-vertical').remove();
}

function cetakBukalapak()
{
}