2013-04-25 3 views

답변

2

이것은 매우 일반적인 문제입니다. 이런 종류의 문제를 해결하는 방법에 대한 자세한 내용은 "Choosing and activating the right controls on an AJAX-driven site"을 참조하십시오.

레시피가 주어지면, 유일한 예술/기술/어려운 부분은 올바른 jQuery 선택기를 선택하는 것입니다.

#synopsis div.copy a.show-more-truncate 


그래서, 전체 작업 스크립트은 다음과 같습니다 :이 경우, "더 많이 표시"링크를 안정적으로 가지게 될 수

// ==UserScript== 
// @name  _BBC episode, click "Show More" link 
// @include http://www.bbc.co.uk/programmes/* 
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js 
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js 
// @grant GM_addStyle 
// ==/UserScript== 
/*- The @grant directive is needed to work around a design change 
    introduced in GM 1.0. It restores the sandbox. 
*/ 

waitForKeyElements (
    "#synopsis div.copy a.show-more-truncate", clickShowMoreLink, true 
); 

function clickShowMoreLink (jNode) { 
    var clickEvent = document.createEvent('MouseEvents'); 
    clickEvent.initEvent ("click", true, true); 
    jNode[0].dispatchEvent (clickEvent); 
} 
+0

브록, 그것은 완벽했다. 모든 세부 사항에 감사드립니다. waitForKeyElements를 좋아하십시오. –

+0

당신을 진심으로 환영합니다. 기꺼이 도와주세요. –

+0

질문은 내 문제를 해결하는 방법으로 대답되었습니다. 모호한 경우 어떻게했는지 이해할 수 없습니다. :-) –