Skip to content

Instantly share code, notes, and snippets.

@pacochi
Last active January 10, 2018 14:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pacochi/28e1533e3ca025350d919cb2d755ade4 to your computer and use it in GitHub Desktop.
Save pacochi/28e1533e3ca025350d919cb2d755ade4 to your computer and use it in GitHub Desktop.
スマホから Pawoo Music に曲を追加するための Deck バーを出します。
// ==UserScript==
// @name Pawoo Music deck bar for smartphone
// @namespace hen.acho.co
// @include https://music.pawoo.net/web/*
// @version 1.170911
// @description You can add music from your smartphone.
// @downloadURL https://gist.github.com/pacochi/28e1533e3ca025350d919cb2d755ade4/raw/pawoomusic_deck_sp.user.js
// @run-at document-idle
// @grant none
// ==/UserScript==
(e => {
document.head.appendChild(Object.assign(document.createElement('style'), { textContent: `
@media screen and (max-width:1024px) {
div.player-control{
display: flex;
}
}
.player-control.is-open div.control-bar__deck {
transform: scale(0.4) translate(-980px,-820px);
}
`}));
// innerWidth 偽装で常に 1025px を返す
// 参考: https://gist.github.com/unarist/71067609416aed633cf74eddb6feb725
Object.defineProperty(window, 'innerWidth',
Object.assign({}, Object.getOwnPropertyDescriptor(window, 'innerWidth'), {
get() { return 1025 }
})
);
//e = document.createEvent('UIEvents');
//e.initUIEvent('resize', true, true, window, 0);
e = new CustomEvent('resize');
window.dispatchEvent(e);
console.log(e,window.innerWidth);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment