33// @name :zh-TW 軟瑟盤
44// @name :ja RandomSexyPicParser
55// @namespace hoothin
6- // @version 1.3.17
6+ // @version 1.3.18
77// @description Random Sexy Pictures Parser
88// @description :zh-TW 隨機色圖
99// @description :ja Random Sexy Pictures Parser
@@ -225,7 +225,7 @@ if (window.top != window.self) {
225225 modeObj . forEach ( item => {
226226 var option = document . createElement ( "option" ) ;
227227 option . value = item [ 1 ] ;
228- option . innerHTML = item [ 0 ] ;
228+ option . innerText = item [ 0 ] ;
229229 if ( item [ 1 ] == searchMode ) {
230230 option . selected = true ;
231231 }
@@ -265,6 +265,14 @@ if (window.top != window.self) {
265265 targetUrl = luckyUrls [ randomIndex ] ;
266266 location . href = targetUrl ;
267267 } ) ;
268+ const _unsafeWindow = ( typeof unsafeWindow == 'undefined' ) ? window : unsafeWindow ;
269+ const escapeHTMLPolicy = ( _unsafeWindow . trustedTypes && _unsafeWindow . trustedTypes . createPolicy ) ? _unsafeWindow . trustedTypes . createPolicy ( 'rspp_default' , {
270+ createHTML : ( string , sink ) => string
271+ } ) : null ;
272+
273+ function createHTML ( html ) {
274+ return escapeHTMLPolicy ? escapeHTMLPolicy . createHTML ( html ) : html ;
275+ }
268276 var curConfig = setuConfig [ document . domain ] , jsonData , hasFloatImg = false , grabed = false , oClient ;
269277 if ( curConfig ) {
270278 if ( ! curConfig . run ) {
@@ -379,7 +387,7 @@ if (window.top != window.self) {
379387 console . log ( e ) ;
380388 jsonData = firstText ;
381389 }
382- document . body . innerHTML = "" ;
390+ document . body . innerHTML = createHTML ( "" ) ;
383391 var imgCon = document . createElement ( "div" ) ;
384392 var btns = document . createElement ( "div" ) ;
385393 var numInput = document . createElement ( "input" ) ;
@@ -405,13 +413,13 @@ if (window.top != window.self) {
405413 config . url = url ;
406414 }
407415 siteA . href = url ;
408- siteA . innerHTML = config . name ;
416+ siteA . innerText = config . name ;
409417 btns . appendChild ( siteA ) ;
410418 }
411419 if ( customRuleArr . length ) {
412420 var otherSiteA = document . createElement ( "a" ) ;
413421 otherSiteA . href = customRuleArr [ Math . floor ( Math . random ( ) * customRuleArr . length ) ] ;
414- otherSiteA . innerHTML = "Other" ;
422+ otherSiteA . innerText = "Other" ;
415423 btns . appendChild ( otherSiteA ) ;
416424 }
417425 btns . appendChild ( numInput ) ;
@@ -803,20 +811,20 @@ if (window.top != window.self) {
803811
804812 btns . className = "btns" ;
805813 document . body . appendChild ( btns ) ;
806- homepage . innerHTML = "<span>Home</span>page" ;
814+ homepage . innerHTML = createHTML ( "<span>Home</span>page" ) ;
807815 homepage . href = "https://sleazyfork.org/en/users/8227-hoothin" ;
808816 homepage . target = "_blank" ;
809817 numInput . type = "number" ;
810818 numInput . title = numInput . placeholder = "Num of sexy pictures" ;
811819 r18Check . type = "checkbox" ;
812820 r18Check . id = "r18Check" ;
813- r18CheckLabel . innerHTML = "R18 " ;
821+ r18CheckLabel . innerText = "R18 " ;
814822 r18CheckLabel . htmlFor = "r18Check" ;
815823 sfwCheck . type = "checkbox" ;
816824 sfwCheck . id = "sfwCheck" ;
817- sfwCheckLabel . innerHTML = "SFW " ;
825+ sfwCheckLabel . innerText = "SFW " ;
818826 sfwCheckLabel . htmlFor = "sfwCheck" ;
819- submit . innerHTML = "Refresh" ;
827+ submit . innerText = "Refresh" ;
820828 submit . onclick = submitParam ;
821829 document . onkeyup = function ( e ) {
822830 var event = e || window . event ;
0 commit comments