投稿

ラベル(ブックマークレット)が付いた投稿を表示しています

ヤフオク系ブックマークレット2022

Quick Edit Pencil
目次

ヤフオク商品ページ印刷最適化ブックマークレット

javascript:

/* -----------------------------------------------
ヤフオク商品ページ印刷最適化ブックマークレット
TAGO.OKに投稿してる
https://tagook.blogspot.com/2022/04/2022_24.html
----------------------------------------------- */

/*タイトルを変更*/
document.title = document.title.replace(/商品画像│|商品ページ│/g, '');
document.title = '商品ページ│' + document.querySelector("#ProductTitle > div > h1").textContent + " - ヤフオク!";

/*スタイルとスクリプト削除*/
var styleElms = document.querySelectorAll("#bmcustom");
for (var i = 0; i < styleElms.length; i++) {
  console.log(styleElms[i]);
  styleElms[i].remove();
}

/*スタイル要素を追加*/
var body = document.getElementsByTagName('body').item(0);
var style = document.createElement('style');
var text = text = `
/**/
#fb-root,
#l-header,
#l-footer,
.bannerFrame,
#ProductProcedures,
#Banner,
#pageTop > div.l-contents > div.l-contentsFoot,
/**/
#l-main > div > div.SocialButton,
#l-main > div > div.PosYDNText,
#l-main > div > div.Carousel.js-Carousel.js-recommend-wrap.is-CarouselDisabled,
#l-main > div > div.Carousel.js-Carousel.js-recommend-wrap,
#l-sub > div.ProductInformation > ul > li.ProductInformation__item.js-stickyNavigation-start > div.CouponCrm.js-Carousel,
#auc_detail_paylater_pc,
#l-sub > div.ProductInformation > ul > li > div.ProductInformation__note,
#l-sub > div.ProductInformation > ul > li.ProductInformation__item.js-stickyNavigation-start > div.Price.Price--buynow > div.Price__borderBox > dd,
#auc_detail_ymobile_pc,
#l-sub > div.ProductInformation > ul > li > dl > dd.Seller__note,
#l-sub > div.ProductInformation > ul > li > dl > dd.Seller__card > div,
#l-sub > div.hideLRECState,
#auc_detail_paylater_pc
{display:none!important;}
`;
var rule = document.createTextNode(text);
/*style.media = 'screen';*/
style.type = 'text/css';
style.id = 'bmcustom';
style.appendChild(rule);
body.appendChild(style);

/*プリンtダイアログを開く*/
window.print();

ヤフオク商品イメージ印刷最適化ブックマークレット

javascript:

/* -----------------------------------------------
ヤフオク商品イメージ印刷最適化ブックマークレット
TAGO.OKに投稿してる
https://tagook.blogspot.com/2022/04/2022_24.html
----------------------------------------------- */

/*タイトルを変更*/
document.title = document.title.replace(/商品画像│|商品ページ│/g, '');
document.title = '商品画像│' + document.querySelector("#ProductTitle > div > h1").textContent + " - ヤフオク!";

/*スタイルとスクリプト削除*/
var styleElms = document.querySelectorAll("#bmcustom,link,style,script,noscript");
for (var i = 0; i < styleElms.length; i++) {
  console.log(styleElms[i]);
  styleElms[i].remove();
}

/*スタイル要素を追加*/
var body = document.getElementsByTagName('body').item(0);
var style = document.createElement('style');
var text = text = `
/**/
#fb-root,
#l-header,
#l-footer,
/**/
#pageTop > div.l-contents > div.l-contentsHead,
#pageTop > div.l-contents > div.l-contentsFoot,
#l-sub,
#l-main > div > div.ProductImage.js-imageGallery.js-disabledContextMenu > div.ProductImage__body.js-imageGallery-body > ul > li[class*='is-clone-'],
#l-main > div > div.ProductImage.js-imageGallery.js-disabledContextMenu > div.ProductImage__footer.js-imageGallery-footer,
#l-main > div > div.ProductDetail,
#l-main > div > div.SocialButton,
#l-main > div > div.ProductNote,
#l-main > div > div.PosYDNText,
#l-main > div > div.Carousel.js-Carousel.js-recommend-wrap,
/**/
#StickyNavigation,
#ProductExplanation,
#ProductProcedures,
#Banner,
#BidModals,
#js-BannerFrameHensei
{display:none!important;}
/*リセット*/
*{line-height: normal!important; width: 100%!important; height: auto!important; margin:0!important; padding:0!important;}
/*商品メイン画像の印刷改行指定*/
li.ProductImage__image{padding-top: 1px!important; page-break-after:always!important;}
`;
var rule = document.createTextNode(text);
/*style.media = 'screen';*/
style.type = 'text/css';
style.id = 'bmcustom';
style.appendChild(rule);
body.appendChild(style);

/*クリップボードに商品名をコピーして印刷ダイアログを開く*/
async function copyToClipboard(text) {
  try {
    await navigator.clipboard.writeText(text);
    console.log('コピーしました');
    /*プリンtダイアログを開く*/
    /*window.print();*/
  } catch (error) {
    alert((error && error.message) || 'コピーに失敗しました');
  }
}
copyToClipboard(document.title);

メルカリ系ブックマークレット

Quick Edit Pencil
目次

メルカリ取引画面印刷最適化ブックマークレット

javascript:
/* -----------------------------------------------
メルカリ取引画面印刷最適化ブックマークレット
アプデ:2023/12/26
TAGO.OKに投稿してる
https://tagook.blogspot.com/2018/06/blog-post.html
----------------------------------------------- */
/*商品名を取得*/
var itemName = document.querySelector("mer-item-object");
console.log(itemName);
itemName = itemName.shadowRoot.querySelector(".container").getAttribute('aria-label');
console.log(itemName);
/*タイトルを変更*/
document.title = document.title.replace(' - ', '│' + itemName + ' - ');

/*スタイル属性を追加*/
document.querySelector("aside[aria-label='取引が完了しました'] + div").setAttribute("style", "display:none;");

/*スタイル要素を追加*/
var body = document.getElementsByTagName('body').item(0);
var style = document.createElement('style');
var text = `
footer{display:none!important;}
`;
var rule = document.createTextNode(text);
/*style.media = 'screen';*/
style.type = 'text/css';
style.appendChild(rule);
body.appendChild(style);

/*クリップボードに商品をコピーして印刷ダイアログを開く*/
async function copyToClipboard(text) {
  try {
    await navigator.clipboard.writeText(text);
    console.log('コピーしました');
    /*プリンtダイアログを開く*/
    window.print();
  } catch (error) {
    alert((error && error.message) || 'コピーに失敗しました');
  }
}
copyToClipboard(itemName);

メルカリ商品ページ印刷最適化ブックマークレット

javascript:

/* -----------------------------------------------
メルカリ商品ページ印刷最適化ブックマークレット
アプデ:2023/12/26
TAGO.OKに投稿してる
https://tagook.blogspot.com/2022/04/2022.html
----------------------------------------------- */

/*タイトルを変更*/
document.title = document.title.replace(/商品画像│|商品ページ│/g, '');
document.title = '商品ページ│' + document.title;

/*出品者要素を定義*/
var seller = document.querySelector("a[location-1='seller_info']").parentNode.parentNode;

/*スタイル属性を追加*/
var elms = new Array();
/*メルカリ安心への取り組み*/
elms.push(document.querySelector("a[href='https://static.jp.mercari.com/safe/description']").parentNode);
/*ポイント利用案内*/
elms.push(document.querySelector("#item-info > section > div + section > div + aside"));

/*SoldOutの場合*/
if (document.querySelector("div[aria-label*='売り切れ']")) {
  /*こちらの商品もおすすめです*/
  elms.push(document.querySelector("#item-info div[data-testid*='checkout-button-container'] + section"));
}

/*コメント*/
elms.push(seller.nextSibling);
/*この出品者の商品*/
elms.push(document.querySelector("main article + section"));
/*この商品を見ている人におすすめ*/
elms.push(document.querySelector("main article + section + section"));
/*パンクズ*/
elms.push(document.querySelector("main > div"));
/*フッター*/
elms.push(document.querySelector("footer"));
/*nullを除外*/
elms = elms.filter(Boolean);
for (var i = 0; i < elms.length; i++) {
  console.log(elms[i]);
  elms[i].setAttribute("style", "display:none;");
}
/*スタイル要素を追加*/
var body = document.getElementsByTagName('body').item(0);
var style = document.createElement('style');
var text = `
div[data-testid='vertical-thumbnail-scroll'] .slick-list{height: auto!important;}
div.show-more-button{display:none;}
div.clamp{-webkit-line-clamp: none!important;}
`;
var rule = document.createTextNode(text);
/*style.media = 'screen';*/
style.type = 'text/css';
style.appendChild(rule);
body.appendChild(style);

/*shadow-root商品説明*/
var descriptionOfItem = document.querySelector("div.merShowMore");
var content = descriptionOfItem.querySelector("div[class*='clamp']");
content.setAttribute("style", "-webkit-line-clamp: none");
var button = descriptionOfItem.querySelector("button[data-testid*='show-more-toggle']");
button.setAttribute("style", "display: none");

/*出品者*/
seller.setAttribute("style", "height: 200px");

/*クリップボードに商品名をコピーして印刷ダイアログを開く*/
async function copyToClipboard(text) {
  try {
    await navigator.clipboard.writeText(text);
    console.log('コピーしました');
    /*プリンtダイアログを開く*/
    /*window.print();*/
  } catch (error) {
    alert((error && error.message) || 'コピーに失敗しました');
  }
}
copyToClipboard(document.title);

/*プリンtダイアログを開く*/
window.print();

メルカリ商品イメージ印刷最適化ブックマークレット

javascript:

/* -----------------------------------------------
メルカリ商品イメージ印刷最適化ブックマークレット
アプデ:2023/12/26
TAGO.OKに投稿してる
https://tagook.blogspot.com/2022/04/2022.html
----------------------------------------------- */

/*タイトルを変更*/
document.title = document.title.replace(/商品画像│|商品ページ│/g, '');
document.title = '商品画像│' + document.title;

/*スタイルとスクリプト削除*/
var styleElms = document.querySelectorAll("link,style,script,noscript");
for (var i = 0; i < styleElms.length; i++) {
  console.log(styleElms[i]);
  styleElms[i].remove();
}

/*サムネイルのソースを配列に格納*/
var arrImgSrc = new Array();

var itemimages = document.querySelector("div[aria-label='商品画像カルーセル'] > div + div");

var imagesSrc = itemimages.querySelectorAll("img");
for (var i = 0; i < imagesSrc.length; i++) {
  console.log(imagesSrc[i].src);
  arrImgSrc.push(imagesSrc[i].src);
}

/*ボディを初期化*/
var body = document.body;
body.innerHTML = "";

/*印刷用イメージ要素をクリエイト*/
var img_element;
for (var i = 0; i < arrImgSrc.length; i++) {
  console.log(arrImgSrc[i]);
  img_element = document.createElement('img');
    img_element.src = arrImgSrc[i].replace('s-l64', 's-l1600');
    body.appendChild(img_element);
}

/*スタイル要素を追加*/
var style = document.createElement('style');
var text = `
/*画像調整*/
img
{width:100%;height:auto;padding-top:1px;}
/*非表示*/
button
{display:none!important;}
`;
var rule = document.createTextNode(text);
/*style.media = 'screen';*/
style.type = 'text/css';
style.appendChild(rule);
body.appendChild(style);

/*クリップボードに商品名をコピーして印刷ダイアログを開く*/
async function copyToClipboard(text) {
  try {
    await navigator.clipboard.writeText(text);
    console.log('コピーしました');
    /*プリンtダイアログを開く*/
    /*window.print();*/
  } catch (error) {
    alert((error && error.message) || 'コピーに失敗しました');
  }
}
copyToClipboard(document.title);

ホームページ 印刷調整 ブックマークレット

Quick Edit Pencil
javascript: (function() {
var url = location.href;
if (/hogehoge\.com/.test(url)){
let elm= document.body;
var tar, arr, len; 
/*-- header  --*/
/*ヘッダを置換tar= elm.querySelector('div.navi-002-01.nav_cont_box');tar.innerHTML='<header style="font-size: -webkit-xxx-large;font-weight: bolder;text-align: center;"><h1>DIY Clip!</h1><p>─暮らしにる来る喜びを─</p></header>';*/
/*ロゴの属性を追加*/tar= elm.querySelector('div.logo');if(tar){tar.setAttribute("style", "width: 25%; margin: auto;");}
/*コントの属性を追加*/tar= elm.querySelector('div.cont');if(tar){tar.setAttribute("style", "text-align: center!important;");}
/*コントロイモールロゴの属性を追加*/tar= elm.querySelector('div.col.col-1.nav_cont_box_inner_1');if(tar){tar.setAttribute("style", "padding-top: 12px;");}
/*オンラインショップボタンを削除*/tar= elm.querySelector('div.component.button.component-2.shop_button');if(tar){tar.remove();}
/*検索ボックスを削除*/tar= elm.querySelector('div.col.col-2.nav_cont_box_inner_2');if(tar){tar.remove();}
/*ナビゲーションを削除*/tar= elm.querySelector('nav');if(tar){tar.remove();}
/*-- contents  --*/
/*パンくずを削除*/tar= elm.querySelector('div.breadcrumbs');if(tar){
    tar.setAttribute("style", "display: block!important; text-align: center!important;");
    tar.firstChild.setAttribute("style", "display: inline-block;");
    tar.nextElementSibling.setAttribute("style", "margin-top: 0px;");}
/*共有ボタン群を削除*/
arr= elm.querySelectorAll('div.social-button');
len = arr.length;
console.log(len);
if(arr){
    for (var i = 0; i < len; i++) {
        tar= elm.querySelector('div.social-button');
        tar.innerHTML="";
        tar.setAttribute("style", "padding-bottom: 12px;");
        tar.classList.remove('social-button');
    }
}
/*関連記事を調整*/tar= elm.querySelector('div.link-embed');if(tar){tar.parentNode.parentNode.setAttribute("style", "display: flex; padding-top: 12px;");}
/*-- side  --*/
/*サイド右を削除*/var tar= elm.querySelector('div.side.right');if(tar){tar.remove();}
/*-- foot  --*/
/*フッタを削除*/tar= elm.querySelector('div.foot');if(tar){tar.remove();}
/*-- ボタン類を削除  -- */
arr= elm.querySelectorAll('div.component.button');
if(arr){
    len = arr.length;
    for (var i = 0; i < len; i++) {
        tar= elm.querySelector('div.component.button');tar.parentNode.parentNode.remove();
    }
}
/*-- 木材カットサービスバナー削除  -- */
tar= elm.querySelector('[id*="8dfd49608c5e026bdede076c"]');if(tar){tar.parentNode.remove();}
/*-- Section2を削除  -- */tar= elm.querySelector('section.content-element.content-2');if(tar){tar.remove();}
/*-- 大きい画像を調整  -- */
arr= elm.querySelectorAll('div.component.component-2.text');
if(arr){
    len = arr.length;
    for (var i = 0; i < len; i++) {
        arr[i].parentNode.parentNode.setAttribute("style", "display: flex; padding-bottom: 12px;");
    }
}
/*-- 最下部にスクロール  -- */
var element = document.documentElement;
var bottom = element.scrollHeight + element.clientHeight;
var speed = 64;/*時間あたりに移動するpx量です。デフォルトでは1pxにしていますが、自由に変えてください*/
var interval = 100;/*移動する間隔です。デフォルトでは0.1秒おきにしていますが、自由に変えてください*/
var scrollTop = document.body.scrollTop;
var counter = scrollTop + speed;
var timerId = setInterval(function() {
    var scroll = scrollTop + speed;
    window.scrollBy(0, scroll);
    console.log("counter="+counter+"bottom="+bottom);
    if(counter>=bottom){
        clearInterval(timerId);
        /*-- プリントダイアログを表示  --*/window.print();
    }
    counter+=scroll;
},interval);
}else{
    alert('このブックマークレットは、” hogehoge.com ” のページで動作します。');
}
}());

ブックマークレット DOM ソース変更

Quick Edit Pencil
javascript: (function() {
    /*https://www.atmarkit.co.jp/ait/articles/0808/04/news124.html*/
    /*https://into-the-program.com/removechild/*/
    /*ヘッダのタグを削除*/
    var scripts= document.head.getElementsByTagName('script');
    let len = scripts.length;
    for (var i = 0; i < len; i++) {
      document.head.removeChild(scripts[0]);
    }
    var links= document.head.getElementsByTagName('link');
    len = links.length;
    for (var i = 0; i < len; i++) {
      document.head.removeChild(links[0]);
    }
    var style= document.head.getElementsByTagName('style');
    len = style.length;
    for (var i = 0; i < len; i++) {
      document.head.removeChild(style[0]);
    }
    /*クリップボードに保存*/
    var clips = document.title;
    clips += '; ';
    clips +=  document.body.querySelector('p.size').textContent;
    clips += '; ';
    clips +=  document.URL;
    console.log(clips);
    /*イメージの集合要素を保存*/
    var images= document.body.querySelector('ul.item_pager');
    images.removeAttribute('class');
    images.removeAttribute('style');
    console.log(images);
    /*新たなBODYタグ要素のノードオブジェクト*/
    var targetNode = document.getElementsByTagName('body')[0];
    console.log(targetNode);
    /*新たなBODYタグを作成*/
    var newNode = document.createElement('body');
    newNode.appendChild(images);
    /*BODYタグを置き換える*/
    targetNode.parentNode.replaceChild(newNode, targetNode);
    /*クリップボードにコピー*/
    javascript:
    function copyTextToClipboard(textVal){
    var copyFrom = document.createElement("textarea");
    copyFrom.textContent = textVal;
    var bodyElm = document.getElementsByTagName("body")[0];
    bodyElm.appendChild(copyFrom);
    copyFrom.select();
    var retVal = document.execCommand('copy');
    return retVal;
    }
    copyTextToClipboard(clips);
}());