有人可以帮助我将此代码转换为import requests
import time
exts = ['conf', 'bak', 'swp', 'txt', 'old', 'tar', 'gz', 'bz2', 'zip']
pre = ['old', 'bak', 'backup', 'copyof']
session = requests.head("http://challenge01.root-me.org/")
if session.status_code == 200:
print "[i] Connection is working."
http = "http://challenge01.root-me.org"
file = "/realiste/ch1/login.php"
urls = []
codes = []
def store(request, code):
urls.append(request)
codes.append(code)
for ext in exts:
req = http + file + "." + ext
connection = requests.head(req)
store(req, connection.status_code)
time.sleep(0.1)
for search in range(0, len(codes)):
ecx = 1
if codes[search] != 404:
print "============="
print "[" + str(ecx) + "] URL ::: " + urls[search].replace("\n", "").replace("\r", "")
print "|__ COD ::: " + str(codes[search])
print "============="
print "[*] Done."
吗?
https://codepen.io/spz457/pen/NaNddP
我希望能够为进入窗口视图的元素添加类名。这就是我的脚本所做的。
plugin
答案 0 :(得分:0)
这是您的代码插件。 jquery How to Create a Basic Plugin页面对于学习如何制作插件非常有用。
(function($) {
var isScrolledIntoView = function($element) {
var windowTop = $(window).scrollTop();
var windowBottom = windowTop + $(window).height();
var elementTop = $element.offset().top;
var elementBottom = elementTop + $element.height();
return (elementBottom <= windowBottom) && (elementTop >= windowTop);
};
$.fn.addClassOnScrollVisible = function(className) {
var $collection = this; // the jQuery set the plugin is acting on
$(window).on("scroll", function() {
// loop over each element in the collection
$collection.each(function() {
var $element = $(this);
if (isScrolledIntoView($element)) {
$element.addClass(className);
} else {
$element.removeClass(className);
}
});
});
return $collection; // return the input collection
};
}(jQuery));
// Usage example:
$(".button").addClassOnScrollVisible("in");