Skip to content

Instantly share code, notes, and snippets.

@shikachii
Last active June 25, 2017 17:23
Show Gist options
  • Save shikachii/f0dba15b8d5dc8e98bd6ddb9a5395d51 to your computer and use it in GitHub Desktop.
Save shikachii/f0dba15b8d5dc8e98bd6ddb9a5395d51 to your computer and use it in GitHub Desktop.
Twitter公式の画像一覧でツイートの内容を一緒に表示されるようにするやつ
{
"name" : "tweet-disp",
"version" : "0.0.1",
"manifest_version" : 2,
"description" : "disp tweet in media. in 2017/6/25",
"content_scripts" : [
{
"matches" : [
"https://twitter.com/*"
],
"js" : ["script.js"]
}
]
}
(function(){
"use strict"
const elem = ".GalleryTweet .content>*"
const gElem = ".GalleryTweet"
const fit = ".media-image"
// .GalleryTweet DOM
let gallery = document.querySelector(gElem)
let command = function(){
let items = document.querySelectorAll(elem)
let size = document.querySelector(fit)
for( let v of items ){
//display : none -> display : block
v.style.display = "block"
}
size.style.margin = "0"
};
// .GalleryTweetを監視し,変更されたらcommandを実行
let mo = new MutationObserver(command)
// 子ノードを監視対象にする
const options = {childList : true}
//監視開始
mo.observe(gallery,options);
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment