Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_快猫@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQGxpY2Vuc2UgTUlUCi8vIEBuYW1lICAgICAgICAg5b+r54yr6KeG6aKR5YWN6LS555yLCi8vIEBuYW1lc3BhY2UgICAgaHR0cDovL3RhbXBlcm1vbmtleS5uZXQvCi8vIEB2ZXJzaW9uICAgICAgMC40LjcKLy8gQGRlc2NyaXB0aW9uICDpkojlr7nlv6vnjKvop4bpopHnmoTkvJjljJbohJrmnKzvvIzmraTohJrmnKzlj6/ku6XorqnnlKjmiLfop4LnnItWSVDop4bpopEKLy8gQGF1dGhvciAgICAgICBZb3UKLy8gQGluY2x1ZGUgICAgICAvXmh0dHBzOi8vd3d3LmttYmJcZCtcLmNvbS4rJC8KLy8gQGluY2x1ZGUgICAgICAvXmh0dHBzOi8vd3d3LmttYmJiXGQrXC5jb20uKyQvCi8vIEBpbmNsdWRlICAgICAgL15odHRwczovL2g1LmttYmJcZCtcLmNvbS4rJC8KLy8gQGluY2x1ZGUgICAgICAvXmh0dHBzOi8vaDUua21iYmJcZCtcLmNvbS4rJC8KLy8gQG1hdGNoICAgICAgICBodHRwOi8vcmUwNS5jYy8qCi8vIEBpY29uICAgICAgICAgaHR0cHM6Ly93d3cua21iYjU5LmNvbS9mYXZpY29uLmljbwovLyBAZ3JhbnQgICAgICAgIEdNX3NldFZhbHVlCi8vIEBncmFudCAgICAgICAgR01fZ2V0VmFsdWUKLy8gPT0vVXNlclNjcmlwdD09CgoKbGV0IGdsb2JhbCA9IHsgdHlwZTogJ3BjJyB9CgpmdW5jdGlvbiBpbXBvcnRMaWIoKXsKICAgIGltcG9ydEpTKCJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9jcnlwdG8tanMvNC4wLjAvY3J5cHRvLWpzLm1pbi5qcyIpCiAgICBpbXBvcnRKUygiaHR0cHM6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GxheVVybCh2aWRlb0lkKSB7CiAgICBsZXQgZ2V0VXJsQXBpID0gImh0dHBzOi8veG5rbGdhcy5jbi92aWRlby9nZXRVcmwiCiAgICAvL2xldCBkYXRhID0geyAidmlkZW9JZCI6IHZpZGVvSWQsICJjbGllbnRUeXBlIjogMSwgImFnZW50SWQiOiBudWxsIH07CiAgICBsZXQgZGF0YSA9IHsgImNsaWVudFR5cGUiOiAxLCAidmlkZW9JZCI6IHZpZGVvSWQgfQogICAgbGV0IHJlcyA9IGF3YWl0IGZldGNoKGdldFVybEFwaSwgewogICAgICAgIG1ldGhvZDogJ1BPU1QnLCAvLyBvciAnUFVUJwogICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KGRhdGEpLCAvLyBkYXRhIGNhbiBiZSBgc3RyaW5nYCBvciB7b2JqZWN0fSEKICAgICAgICBoZWFkZXJzOiBuZXcgSGVhZGVycyh7CiAgICAgICAgICAgICdDb250ZW50LVR5cGUnOiAnYXBwbGljYXRpb24vanNvbicsCiAgICAgICAgICAgICd0b2tlbic6IGdldFRva2VuKCkKICAgICAgICB9KQoKICAgIH0pCiAgICBsZXQgcmVzdWx0ID0gYXdhaXQgcmVzLmpzb24oKQogICAgbGV0IGpzb25TdHIgPSBkZWNyeXB0QUVTRm4ocmVzdWx0LmRhdGEpCiAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoanNvblN0cikKICAgIGxldCBwbGF5VXJsID0ganNvbi51cmwKICAgIHJldHVybiBwbGF5VXJsCn0KCmZ1bmN0aW9uIGRlc3Ryb3lQbGF5ZXIoKSB7CiAgICBpZiAod2luZG93LmRwKSB7CiAgICAgICAgd2luZG93LmRwLnBhdXNlKCkKICAgICAgICB3aW5kb3cuZHAuZGVzdHJveSgpCiAgICAgICAgd2luZG93LmRwPW51bGw7CiAgICB9CiAgICBpZiAod2luZG93LnJldEJ0bikgewogICAgICAgIHdpbmRvdy5yZXRCdG4ucmVtb3ZlRXZlbnRMaXN0ZW5lcigiY2xpY2siLGRlc3Ryb3lQbGF5ZXIpCiAgICB9Cn0KCmZ1bmN0aW9uIHBsYXkocGxheWVyVXJsLCBwaWMpIHsKICAgIGlmIChnbG9iYWwudHlwZSAhPT0gJ3BjJykgewogICAgICAgIHdpbmRvdy5yZXRCdG49ZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiI3ZpZGVvQ29udGVudCAudmFuLW5hdi1iYXJfX2xlZnQiKQogICAgICAgIHdpbmRvdy5yZXRCdG4uYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLGRlc3Ryb3lQbGF5ZXIpCiAgICB9CgogICAgd2luZG93LmRwID0gbmV3IERQbGF5ZXIoewogICAgICAgIGVsZW1lbnQ6IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi51bkxvZ2luQm94IiksICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIxwbGF5ZXLlhYPntKAKICAgICAgICBhdXRvcGxheTogZmFsc2UsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5Y+v6YCJ77yM6Ieq5Yqo5pKt5pS+6KeG6aKR77yM5LiN5pSv5oyB56e75Yqo5rWP6KeI5ZmoCiAgICAgICAgdGhlbWU6ICcjRkFERkEzJywgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOWPr+mAie+8jOS4u+mimOminOiJsu+8jOm7mOiupDogI2I3ZGFmZgogICAgICAgIGxvb3A6IHRydWUsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzlvqrnjq/mkq3mlL7pn7PkuZDvvIzpu5jorqTvvJp0cnVlCiAgICAgICAgbGFuZzogJ3poJywgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOWPr+mAie+8jOivreiogO+8jGB6aCfnlKjkuo7kuK3mlofvvIxgZW4n55So5LqO6Iux6K+t77yM6buY6K6k77yaTmF2aWdhdG9yIGxhbmd1YWdlCiAgICAgICAgc2NyZWVuc2hvdDogdHJ1ZSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOWPr+mAie+8jOWQr+eUqOaIquWbvuWKn+iDve+8jOm7mOiupOWAvO+8mmZhbHNl77yM5rOo5oSP77ya5aaC5p6c6K6+572u5Li6dHJ1Ze+8jOinhumikeWSjOinhumikeaIquWbvuW/hemhu+WQr+eUqOi3qOWfnwogICAgICAgIGhvdGtleTogdHJ1ZSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIznu5Hlrprng63plK7vvIzljIXmi6zlt6blj7PplK7lkoznqbrmoLzvvIzpu5jorqTlgLzvvJp0cnVlCiAgICAgICAgcHJlbG9hZDogJ2F1dG8nLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOWPr+mAie+8jOmihOWKoOi9veeahOaWueW8j+WPr+S7peaYrydub25lJydtZXRhZGF0YScnYXV0byfvvIzpu5jorqTlgLzvvJonYXV0bycKICAgICAgICB2aWRlbzogeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5b+F6ZyA77yM6KeG6aKR5L+h5oGvCiAgICAgICAgICAgIHVybDogcGxheWVyVXJsLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5b+F5aGr77yM6KeG6aKR572R5Z2ACiAgICAgICAgICAgIHBpYzogcGljLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5Y+v6YCJ77yM6KeG6aKR5oiq5Zu+CiAgICAgICAgICAgIHR5cGU6ICdobHMnCiAgICAgICAgfQogICAgfSk7CiAgICBjb25zb2xlLmxvZyhkcCkKfQoKYXN5bmMgZn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G9yYWdlLnBhc3N3b3JkCiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGxvY2FsU3RvcmFnZS51c2VyTmFtZSAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICBsb2dpbihhY2NvdW50KQogICAgICAgICAgICAgICAgcmV0dXJuCiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgfQoKICAgIGlmIChoYXNTdG9yZWRQaG9uZSgpICE9IG51bGwpIHsKICAgICAgICBsZXQgYWNjb3VudCA9IGdldEFjY291bnQoKQogICAgICAgIGxvZ2luKGFjY291bnQpCiAgICAgICAgcmV0dXJuCiAgICB9CgogICAgbGV0IGFjY291bnQgPSB7CiAgICAgICAgcGhvbmU6IGdlblJhbmRvbVBob25lTnVtKCksCiAgICAgICAgcGFzc3dvcmQ6ICIxMjM0NTYiCiAgICB9CiAgICBsZXQgaSA9IDA7CiAgICBsZXQgcmVnaXN0ZXJBY2NvdW50U3RhdGUgPSBhd2FpdCByZWdpc3RlckFjY291bnQoYWNjb3VudCk7CiAgICB3aGlsZSAocmVnaXN0ZXJBY2NvdW50U3RhdGUgPT0gZmFsc2UpIHsKICAgICAgICBpKysKICAgICAgICBjb25zb2xlLmxvZygi5rOo5YaM5aSx6LSl77yMIiwgYWNjb3VudCkKICAgICAgICBhY2NvdW50ID0gewogICAgICAgICAgICBwaG9uZTogZ2VuUmFuZG9tUGhvbmVOdW0oKSwKICAgICAgICAgICAgcGFzc3dvcmQ6ICIxMjM0NTYiCiAgICAgICAgfQogICAgICAgIGNvbnNvbGUubG9nKCLph43mlrDms6jlhozvvIwiLCBhY2NvdW50KQogICAgICAgIHJlZ2lzdGVyQWNjb3VudFN0YXRlID0gYXdhaXQgcmVnaXN0ZXJBY2NvdW50KGFjY291bnQpOwogICAgICAgIGlmIChpID49IDEwKSB7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKCLor7fmiYvliqjms6jlhozvvIwiLCBhY2NvdW50KQogICAgICAgICAgICByZWdpc3RlckFjY291bnRT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Ugc3RyaWN0JzsKICAgIGltcG9ydExpYigpOwogICAgc2V0VGltZW91dCgoKSA9PiB7CiAgICAgICAgaW5pdCgpOwogICAgICAgIHJlbG9hZFBsYXllcigpOwogICAgICAgIGlmIChnbG9iYWwudHlwZSA9PT0gJ21vYmlsZScpIHsKICAgICAgICAgICAgc2V0SW50ZXJ2YWwoKCk9PnsKICAgICAgICAgICAgICAgIGluaXQoKTsKICAgICAgICAgICAgICAgIHJlc2V0KCkKICAgICAgICAgICAgfSw2MDApCiAgICAgICAgfQoKICAgIH0sIDEyMDApCgp9KSgpOwo=
Add Comment
Please, Sign In to add comment