1
브라우저의 각 YouTube 동영상 URL 끝에 &vhs=1
매개 변수를 추가하고 싶습니다. 다음 스크립트를 사용해 보았지만 반복문이 멈추었습니다 (계속해서 &vhs=1
&vhs=1...
을 추가합니다).페이지의 URL 매개 변수 변경
// ==UserScript==
// @name Youtube Tape Mode
// @namespace _pc
// @match *://*.youtube.com/watch?*
// @run-at document-start
// ==/UserScript==
var oldUrlPath = window.location.pathname;
/*--- Test that "&vhs=1" is at end of URL, excepting any "hashes"
or searches.
*/
if (! /\&vhs=1$/.test (oldUrlPath)) {
var newURL = window.location.protocol + "//"
+ window.location.hostname
+ oldUrlPath
+ window.location.search.replace + "&vhs=1"
+ window.location.hash
;
/*-- replace() puts the good page in the history instead of the
bad page.
*/
window.location.replace (newURL);
}
누구든지이 목적을 위해 스크립트를 작성하는 방법에 대한 통찰력과 조언을 제공 할 수 있습니까? 무한 루프 문제를 해결하는 방법을 알아낼 수 없습니다.
그게 완벽합니다! 원래 스크립트 btw 주셔서 감사! –
당신을 진심으로 환영합니다! 이 답변이 도움이 될 경우 [옆에있는 체크 표시를하십시오] (http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235)를 클릭하십시오. –