Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥零秒出手:悬崖上的英雄@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZGlzcGxheU5hbWVcIjpcIuWkp+eGiuW9seinhlwiLFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJqczooXFxuZnVuY3Rpb24gKGFwcHR5cGUsIGFwcFVybCkge1xcbiAgICBsZXQgY2hwID0gW107XFxuICAgIHRyeSB7XFxuICAgICAgICBsZXQgY29udHMgPSBbXSwgaHRtbCA9IEpTT04ucGFyc2UoZmV0Y2goTVlfVVJMLnNwbGl0KFxcXCIjI1xcXCIpWzFdLCB7aGVhZGVyczoge1xcXCJVc2VyLUFnZW50XFxcIjogXFxcIkRhcnQvMi4xMyAoZGFydDppbylcXFwifX0pKTtcXG4gICAgICAgIGlmIChhcHB0eXBlLmluY2x1ZGVzKFxcXCJUVlxcXCIpKSB7XFxuICAgICAgICAgICAgY29udHMgPSBPYmplY3Qua2V5cyhodG1sLnZpZGVvbGlzdCk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGlmIChhcHBVcmwuaW5jbHVkZXMoXFxcImFwaS5waHAvYXBwL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgIGNvbnRzID0gaHRtbC5kYXRhLnZvZF91cmxfd2l0aF9wbGF5ZXI7XFxuICAgICAgICAgICAgICAgIGlmIChjb250cy5sZW5ndGggPCAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250cyA9IGh0bWwuZGF0YS52b2RfcGxheV91cmwuc3BsaXQoXFxcIiQkJFxcXCIpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKGFwcFVybC5pbmNsdWRlcyhcXFwieGdhcHAucGhwL3YxL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250cyA9IGh0bWwuZGF0YS52b2RfaW5mby52b2RfdXJsX3dpdGhfcGxheWVyO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRzLmxlbmd0aCA8IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250cyA9IGh0bWwuZGF0YS52b2RfaW5mby52b2RfcGxheV91cmwuc3BsaXQoXFxcIiQkJFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgY29udHMgPSBodG1sLmRhdGEudm9kX3BsYXlfbGlzdDtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb250cy5sZW5ndGggPCAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udHMgPSBodG1sLmRhdGEudm9kX3BsYXlfdXJsLnNwbGl0KFxcXCIkJCRcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBsaXN0ID0gW107XFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGNvbnRzLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgaWYgKGFwcHR5cGUuaW5jbHVkZXMoXFxcIlRWXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgbGlzdCA9IGh0bWwudmlkZW9saXN0W2NvbnRzW2ldXTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBpZiAoY29udHNbaV0udXJscykge1xcbiAgICAgICAgICAgICAgICAgICAgbGlzdC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FwiLFwicGF0aFwiOlwibGF6eVBhcnNlXCIsXCJydWxlXCI6XCIoXFxuZnVuY3Rpb24gKCkge1xcbiAgICByZXR1cm4gJChcXFwiXFxcIikubGF6eVJ1bGUoKHB0YWIsIHZsaW5rLCBqeFVybCwgYXBwVXJsKSA9PiB7XFxuICAgICAgICBsb2coXFxcIlxcXFx1ODljNlxcXFx1OTg5MVxcXFx1OTRmZVxcXFx1NjNhNTpcXFwiICsgdmxpbmspO1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBmdW5jdGlvbiBjaGFuZ2VWaWRlb1VybCh1cmwpIHtcXG4gICAgICAgICAgICAgICAgaWYgKHVybC5pbmNsdWRlcyhcXFwid2tmaWxlXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVybCA9IHVybCArIFxcXCI7e1JlZmVyZXJAaHR0cHM6Ly9mYW50dWFuLndrZmlsZS5jb20vfVxcXCI7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAocHRhYiA9PSBcXFwiYmlsaWJpbGlcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0gdXJsICsgXFxcIjt7UmVmZXJlckBodHRwczovL3d3dy5iaWxpYmlsaS5jb20vJiZVc2VyLUFnZW50QE1vemlsbGEvNS4wfVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwdGFiID09IFxcXCJtZ3R2XFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyBcXFwiO3tSZWZlcmVyQHd3dy5tZ3R2LmNvbSYmVXNlci1BZ2VudEBNb3ppbGxhLzUuMH1cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1cmwuaW5jbHVkZXMoXFxcIm9qYmtcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0gdXJsICsgXFxcIjt7UmVmZXJlckBodHRwczovL2Jhay5vamJranguY29tL31cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICghdXJsLmluY2x1ZGVzKFxcXCJodHRwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwiXFxcXHU5NGZlXFxcXHU2M2E1XFxcXHU0ZTBkXFxcXHU2NjJmXFxcXHU0ZWU1aHR0cFxcXFx1NWYwMFxcXFx1NTkzNFxcXCIpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKC9cXFxcLm0zdTgvLnRlc3QodXJsKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjYWNoZU0zdTgodXJsKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybCArIFxcXCIjaXNWaWRlbz10cnVlI1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKC9cXFxcLm0zdTh8XFxcXC5tcDR8b2JqXFxcXC90b3N8bmV0ZWFzZVxcXFwuY29tLy50ZXN0KHZsaW5rKSAmJiAvaHR0cC8udGVzdCh2bGluaykgJiYgIS9cXFxcLmh0bWwvLnRlc3QodmxpbmspKSB7XFxuICAgICAgICAgICAgICAgIGxldCBwdXJsID0gdmxpbms7XFxuICAgICAgICAgICAgICAgIGlmIChwdGFiLmluY2x1ZGVzKFxcXCJkdW9kdW96eVxcXCIpIHx8IHZ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qPS4qXFxcIiguKilcXFwiLylbMV0sIHVybCA9IGh0bWwubWF0Y2goL1xcXCJ1cmxcXFwiLio6LipcXFwiKC4qKVxcXCIvKVsxXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKGdldENyeXB0b0pTKCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERlKHdvcmQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGtleSA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKFxcXCJBNDJFQUMwQzJCNDA4NDcyXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpdiA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKHRva2VuKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIENyeXB0b0pTLkFFUy5kZWNyeXB0KHdvcmQsIGtleSwge2l2OiBpdiwgbW9kZTogQ3J5cHRvSlMubW9kZS5DQkMsIHBhZGRpbmc6IENyeXB0b0pTLnBhZC5Qa2NzN30pLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgcHVybCA9IERlKHVybCk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHB1cmwpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAocHRhYi5pbmNsdWRlcyhcXFwibmV0ZmxpeG1vbVxcXCIpIHx8IC9ebmV0ZmxpeG1vbS8udGVzdCh2bGluaykpIHtcXG4gICAgICAgICAgICAgICAganhVcmwgPSBcXFwiaHR0cHM6Ly9kcC5rb25nYnV5YS5jb20vanNvbi5waHA/dXJsPVxcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxvZyhcX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0cmluZyhyZWR1cmwuaW5kZXhPZihcXFwiPWh0dHBcXFwiKSArIDEpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiBjaGFuZ2VWaWRlb1VybChwdXJsKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSBzY29kZS5ib2R5O1xcbiAgICAgICAgICAgIGlmICgvNDA0IE5vdCBGb3VuZHzlpIfmoYjlkI7lj6/nu6fnu63orr/pl64vLnRlc3QoaHRtbCkpIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCI0MDRcXFxcdTRlODZcXFwiKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBpZiAoL1xcXFw8Ym9keS8udGVzdChodG1sKSkge1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKFxcXCJcXFxcdTVjMWRcXFxcdThiZDVcXFxcdTRlY2VcXFxcdTdmNTFcXFxcdTk4NzVcXFxcdTU1YzVcXFxcdTYzYTJcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmVDYWNoZShcXFwiaHR0cHM6Ly9jb2RlLmFsaXl1bi5jb20vbHprMjM1NTkvUHVibGljUnVsZS9yYXcvbWFzdGVyL3g1cnVsZS5qc1xcXCIsIDI0KTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB4NXJ1bGUobGluaywgbGluayk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBsb2coXFxcIlxcXFx1NWMxZFxcXFx1OGJkNVxcXFx1NGVjZVxcXFx1OTc1ZVxcXFx1N2Y1MVxcXFx1OTg3NVxcXFx1NTVjNVxcXFx1NjNhMlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcHVybCA9IEp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AgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodXJsLmluY2x1ZGVzKFxcXFxcXFwib2pia1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyBcXFxcXFxcIjt7UmVmZXJlckBodHRwczovL2Jhay5vamJranguY29tL31cXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKCF1cmwuaW5jbHVkZXMoXFxcXFxcXCJodHRwXFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFxcXFxcIlxcXFxcXFxcdTk0ZmVcXFxcXFxcXHU2M2E1XFxcXFxcXFx1NGUwZFxcXFxcXFxcdTY2MmZcXFxcXFxcXHU0ZWU1aHR0cFxcXFxcXFxcdTVmMDBcXFxcXFxcXHU1OTM0XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICgvXFxcXFxcXFwubTN1OC8udGVzdCh1cmwpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FjaGVNM3U4KHVybCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsICsgXFxcXFxcXCIjaXNWaWRlbz10cnVlI1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKC9cXFxcXFxcXC5tM3U4fFx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zLmxvY2F0aW9uWzBdLnJlcGxhY2UoL1xcXFxcXFxcXFxcXFxcXFwvZywgXFxcXFxcXCJcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgbG9nKFxcXFxcXFwiXFxcXFxcXFx1OTFjZFxcXFxcXFxcdTViOWFcXFxcXFxcXHU1NDExOlxcXFxcXFwiICsgcmVkdXJsKTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcHVybCA9IHJlZHVybDtcXFxcbiAgICAgICAgICAgICAgICBpZiAoL1xcXFxcXFxcPWh0dHAvLnRlc3QocmVkdXJsKSAmJiAvaHRtbHxiaWxpYmlsaS8udGVzdChyZWR1cmwpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHB1cmwgPSBKU09OLnBhcnNlKGZldGNoKHJlZHVybCwge30pKS51cmw7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKC9cXFxcXFxcXD1odHRwLy50ZXN0KHJlZHVybCkgJiYgL1xcXFxcXFxcLm0zdTh8XFxcXFxcXFwubXA0fFxcXFxcXFxcLmZsdi8udGVzdChyZWR1cmwpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXJsID0gcmVkdXJsLnN1YnN0cmluZyhyZWR1cmwuaW5kZXhPZihcXFxcXFxcIj1odHRwXFxcXFxcXCIpICsgMSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHB1cmwpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgbGV0IGh0bWwgPSBzY29kZS5ib2R5O1xcXFxuICAgICAgICAgICAgaWYgKC80MDQgTm90IEZvdW5kfOWkh+ahiOWQjuWPr+e7p+e7reiuv+mXri8udGVzdChodG1sKSkge1xcXFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFc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FxcXFxcLXxyZW5yZW5taVxcXFxcXFxcLXx4ZnlcXFxcXFxcXC0vKSAhPSAtMTtcXFxcbiAgICAgICAgICAgIGlmICgodGVzdDEgfHwgdGVzdDIpICYmIGVuRG4gPT0gXFxcXFxcXCIxXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICBsb2coXFxcXFxcXCJcXFxcXFxcXHU4YzAzXFxcXFxcXFx1NzUyOFxcXFxcXFxcdTY1YWRcXFxcXFxcXHU2M2QyXFxcXFxcXFx1ODllM1xcXFxcXFxcdTY3OTBcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgZXZhbChcXFxcXFxcImxldCBjb25maWcgPVxcXFxcXFwiICsgZmV0Y2goXFxcXFxcXCJoaWtlcjovL2ZpbGVzL2NhY2hlL015UGFyc2VTZXQuanNvblxcXFxcXFwiKSk7XFxcXG4gICAgICAgICAgICAgICAgZXZhbChmZXRjaChjb25maWcuY2opKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gYXl0bVBhcnNlKHZsaW5rKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHZsaW5rO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgfVxcXFxuICAgICwgcHRhYiwgdmxpbmssIGp4VXJsLCBhcHBVcmwpO1xcXFxufVxcXFxuKSgpXFxcIn1dXCJ9IiwicGljVXJsIjoiaHR0cDovL2ltZ3MuamllbWFkaWFuemkuY29tL3ZvZC8yMDE5MTIxMi0xL2VjNWQzYTc0Yjk2YzVkZWVhMDY5ODJjN2MwN2E1YTBiLnBuZ0BSZWZlcmVyPSIsInRpdGxlIjoi6Zu256eS5Ye65omL77ya5oKs5bSW5LiK55qE6Iux6ZuEIn0=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement