Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥贡献榜@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIumhtemdouWKoOi9vVwiLFwicGF0aFwiOlwicGFnZUxvYWRcIixcInJ1bGVcIjpcImpzOlxcbihmdW5jdGlvbihpbXBvcnRQYXJhbSkge1xcbiAgICB2YXIgbG9hZFVybCA9IGltcG9ydFBhcmFtIHx8IGdldFBhcmFtKFxcXCJyZWRpcmVjdFxcXCIsIFxcXCJcXFwiKTtcXG4gICAgdHJ5IHtcXG4gICAgICAgIHZhciBjb2RlID0gSlNPTi5wYXJzZShmZXRjaChcXFwiaGlrZXI6Ly9wYWdlL1xcXCIgKyBsb2FkVXJsKSkucnVsZTtcXG4gICAgICAgIC8vbG9nKGNvZGUpXFxuICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgIHNldFJlc3VsdChbe1xcbiAgICAgICAgICAgIGRlc2M6IFxcXCLkuI3lrZjlnKjor6XpobXpnaI6XFxcIiArIGxvYWRVcmwsXFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJxFUlJPUuKAneKAnVxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIlxcbiAgICAgICAgfV0pO1xcbiAgICAgICAgcmV0dXJuO1xcbiAgICB9XFxuXFxuICAgIHRyeSB7XFxuICAgICAgICBldmFsLmNhbGwobnVsbCwgY29kZSk7XFxuICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgIGlmICh0eXBlb2YgZCAhPSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgIHZhciBkID0gW107XFxuICAgICAgICB9XFxuICAgICAgICBkID0gQXJyYXkuaXNBcnJheShkKSA/IGQgOiBbXTtcXG4gICAgICAgIGlmIChlLm1lc3NhZ2UuaW5jbHVkZXMoXFxcIm5lZWQgbG9naW5cXFwiKSkge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6ZyA6KaB55m75b2VXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOlxcXCJoaWtlcjovL3BhZ2UvbG9naW4jbm9IaXN0b3J5IyNub1JlY29yZEhpc3RvcnkjXFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJpZ19iaWdfYmxhbmtfYmxvY2tcXFwiXFxuICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJpZ19iaWdfYmxhbmtfYmxvY2tcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgZGVzYzogZS50b1N0cmluZygpLFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnEVSUk9S4oC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b2FzdDovL+i/mOayoeacieiuvue9ruS/neWtmOi3r+W+hFxcXCI7XFxuICAgICAgICAgICAgbGV0IHMgPSAoY29udGVudCwganNuYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBwYXRoID0gZ2V0SXRlbShcXFwiRHNTYXZlUGF0aFxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgd3JpdGVGaWxlKHBhdGggKyBcXFwiL1xcXCIgKyBqc25hbWUsIGNvbnRlbnQpO1xcbiAgICAgICAgICAgICAgICBpZiAoZmlsZUV4aXN0KHBhdGggKyBcXFwiL1xcXCIgKyBqc25hbWUpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5L+d5a2Y5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kv53lrZjlpLHotKVcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChmaWxlRXhpc3QocGF0aCArIFxcXCIvXFxcIiArIGpzbmFtZSkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIuacrOWcsOW3sue7j+WtmOWcqOivpeaWh+S7tuaYr+WQpuimhueblu+8n1xcXCIpLmNvbmZpcm0ocywgY29udGVudCwganNuYW1lKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHMoY29udGVudCwganNuYW1lKTtcXG4gICAgICAgIH0sIGNvbnRlbnQuY29udGVudCwganNuYW1lKVxcbiAgICB9KTtcXG59IGVsc2UgaWYgKGNvbnRlbnQudHlwZSA9PSBcXFwic2l0ZVxcXCIpIHtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiBcXFwibGluZV9ibGFua1xcXCJcXG4gICAgfSk7XFxuXFxuICAgIGQucHVzaCh7XFx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ZXLmn6XnnItcXFwiLFxcbiAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChjb250ZW50LCBqc3YpID0+IHtcXG4gICAgICAgICAgICBsZXQgZGF0YSA9ICQuZGF0YTtcXG4gICAgICAgICAgICBpZiAoZGF0YS5oYXNPd25Qcm9wZXJ0eShcXFwiZXJyb3JcXFwiKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vXFxcIiArIGRhdGEuZXJyb3JcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgd3JpdGVGaWxlKGpzdiwgZGF0YSk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvZWRpdFNvdXJjZXMjbm9SZWNvcmRIaXN0b3J5IyNub0hpc3RvcnkjP3J1bGU9RHJweUhpa2VyXFxcIlxcbiAgICAgICAgfSwgY29udGVudCwganN2KSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgXFxcImNvbmZpZ1xcXCI6IHtcXG4gICAgICAgICAgICAgICAgcGF0aDogXFxcIlxcXCIsXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICBcXFwic291cmNlXFxcIjoge1xcbiAgICAgICAgICAgICAgICBcXFwiYXBpXFxcIjogc2FwaSxcXG4gICAgICAgICAgICAgICAgXFxcImV4dFxcXCI6IGdldFBhdGgoanN2KSxcXG4gICAgICAgICAgICAgICAgXFxcImZpbHRlcmFibGVcXFwiOiAxLFxcbiAgICAgICAgICAgICAgICBcXFwia2V5XFxcIjogYXBpICsgXFxcIl9cXFwiICsgbmFtZSxcXG4gICAgICAgICAgICAgICAgXFxcIm5hbWVcXFwiOiBuYW1lLFxcbiAgICAgICAgICAgICAgICBcXFwib3JkZXJfbnVtXFxcIjogMCxcXG4gICAgICAgICAgICAgICAgXFxcInF1aWNrU2Vhc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iAgICAgICAgICAgICAgcGF0aDogZnMuZ2V0UGFyZW50UGF0aChwYXRoKSxcXG4gICAgICAgICAgICAgIGZpbGVOYW1lOiBjLm5hbWUsXFxuICAgICAgICAgICAgICBleHRlbnNpb246IGMuZXR5cGUsXFxuICAgICAgICAgICAgICBuYW1lOiBjLndvZW5hbWVcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgIH0sXFxuICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLFxcbiAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLFxcbiAgICAgICAgICBjb25maWd1cmFibGU6IHRydWVcXG4gICAgICAgIH1cXG4gICAgICB9KTtcXG4gICAgICByZXR1cm4gZnM7XFxuICAgIH0sXFxuICAgIGdldE1JTUUoZmlsZVBhdGgpIHtcXG4gICAgICBjb25zdCBQYXRocyA9IGphdmEubmlvLmZpbGUuUGF0aHM7XFxuICAgICAgY29uc3QgRmlsZXMgPSBqYXZhLm5pby5maWxlLkZpbGVzO1xcbiAgICAgIGxldCBwYXRoID0gUGF0aHMuZ2V0KGZpbGVQYXRoKTtcXG4gICAgICBsZXQgbWltZVR5cGU7XFxuICAgICAgdHJ5IHtcXG4gICAgICAgIG1pbWVUeXBlID0gRmlsZXMucHJvYmVDb250ZW50VHlwZShwYXRoKTtcXG4gICAgICAgIGlmIChtaW1lVHlwZSAhPSBudWxsKSB7XFxuICAgICAgICAgIC8vbG9nKFxcXCJNSU1FIHR5cGUgb2YgdGhlIGZpbGUgaXM6IFxcXCIgKyBtaW1lVHlwZSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICBsb2coXFxcIk1JTUUgdHlwZSBjb3VsZCBub3QgYmUgZGV0ZXJtaW5lZC5cXFwiKTtcXG4gICAgICAgIH1cXG4gICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICBsb2coZS5tZXNzYWdlKTtcXG4gICAgICB9XFxuICAgICAgaWYgKG1pbWVUeXBlKSB7XFxuICAgICAgICByZXR1cm4gU3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ICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgY3VycmVudF9tYXRjaCA9IGRycHlFbmNyeXB0LmdldFJlZ2V4KCk7XFxuICAgICAgICAgICAgaWYgKGN1cnJlbnRfbWF0Y2gudGVzdChjb250ZW50KSkge1xcbiAgICAgICAgICAgICAgY29udGVudD1iYXNlNjRFbmNvZGUoY29udGVudCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICB9XFxuICAgICAgICAgIC8vbG9nKGNvbnRlbnQpXFxuXFxuICAgICAgICAgIGxldCBzdWJlID0gZmluZEl0ZW0oXFxcInN1Ym1pdF9uYW1lXFxcIikuZXh0cmE7XFxuICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcInN1Ym1pdF9uYW1lXFxcIiwge1xcbiAgICAgICAgICAgIGV4dHJhOiBPYmplY3QuYXNzaWduKHN1YmUsIHtcXG4gICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogaW5mby5uYW1lXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgfSlcXG5cXG4gICAgICAgICAgbGV0IHJlc3VsdCA9IEFQSS51cEZpbGUoaW5mbywgY29udGVudCk7XFxuICAgICAgICAgIGlmIChyZXN1bHQuY29kZSA9PSAwKSB7XFxuICAgICAgICAgICAgbG9nKHJlc3VsdC5kYXRhKTtcXG4gICAgICAgICAgICB0b2FzdChcXFwi5LiK5Lyg5a6M5oiQXFxcIik7XFxuICAgICAgICAgICAgbGV0IHRhcmdldCA9IGZpbmRJdGVtKFxcXCJzdWJtaXRfZGF0YVxcXCIpLmV4dHJhO1xcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcInN1Ym1pdF9kYXRhXFxcIiwge1xcbiAgICAgICAgICAgICAgZXh0cmE6IE9iamVjdC5hc3NpZ24odGFyZ2V0LCB7XFxuICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogcmVzdWx0LmRhdGEudXJsXFxuICAgICAgICAgICAgICB9KVxcbiAgICAgICAg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RsZTogXFxcIuagt+W8j1xcXCIsXFxuICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICAgICAgbGV0IGhpa2VyUG9wID0gJC5yZXF1aXJlKFxcXCJBUElcXFwiKS5oaWtlclBvcCgpO1xcbiAgICAgICAgbGV0IHN0eWxlcyA9IFsnJ10uY29uY2F0KGdldENvbFR5cGVzKCkpO1xcbiAgICAgICAgc3R5bGVzID0gc3R5bGVzLmZpbHRlcih4ID0+XFxuICAgICAgICAgIC8odGV4dF98ZmxleCkuKi8udGVzdCh4KSAmJiB4ICE9ICd0ZXh0X2ljb24nICYmIHggIT0gXFxcInRleHRfNVxcXCIpO1xcbiAgICAgICAgbGV0IHN0eWxlID0gZ2V0SXRlbShcXFwic3R5bGVcXFwiLCBcXFwidGV4dF8xXFxcIik7XFxuICAgICAgICBoaWtlclBvcC5zZWxlY3RDZW50ZXIoe1xcbiAgICAgICAgICBvcHRpb25zOiBzdHlsZXMsXFxuICAgICAgICAgIGNvbHVtbnM6IDIsXFxuICAgICAgICAgIHRpdGxlOiBcXFwi6K+36YCJ5oupXFxcIixcXG4gICAgICAgICAgcG9zaXRpb246IHN0eWxlcy5maW5kSW5kZXgoeCA9PiB4ID09IHN0eWxlKSxcXG4gICAgICAgICAgY2xpY2socykge1xcbiAgICAgICAgICAgIGhpa2VyUG9wLnJ1bk9uTmV3VGhyZWFkKCgpID0+IHtcXG4gICAgICAgICAgICAgIHNldEl0ZW0oXFxcInN0eWxlXFxcIiwgcyk7XFxuICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5qC35byP6K6+572u5Li6OlxcXCIgKyBzO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICB9LFxcbiAgICAgICAgfSk7X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XCJ0ZXh0X2NlbnRlcl8xXFxcIlxcbiAgICAgICAgfV0pO1xcbiAgICAgICAgcmV0dXJuO1xcbiAgICB9XFxuXFxuICAgIHRyeSB7XFxuICAgICAgICBldmFsLmNhbGwobnVsbCwgY29kZSk7XFxuICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgIGlmICh0eXBlb2YgZCAhPSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgIHZhciBkID0gW107XFxuICAgICAgICB9XFxuICAgICAgICBkID0gQXJyYXkuaXNBcnJheShkKSA/IGQgOiBbXTtcXG4gICAgICAgIGlmIChlLm1lc3NhZ2UuaW5jbHVkZXMoXFxcIm5lZWQgbG9naW5cXFwiKSkge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6ZyA6KaB55m75b2VXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOlxcXCJoaWtlcjovL3BhZ2UvbG9naW4jbm9IaXN0b3J5IyNub1JlY29yZEhpc3RvcnkjXFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJpZ19iaWdfYmxhbmtfYmxvY2tcXFwiXFxuICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJpZ19iaWdfYmxhbmtfYmxvY2tcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgZGVzYzogZS50b1N0cmluZygpLFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnEVSUk9S4oCd4oCdXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBcXF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