JavaScript
- 11 ответов
- 0 вопросов
10
Вклад в тег
;(function ($) {
$(".input").bind("paste", function(evt) {
var item = (evt.clipboardData || evt.originalEvent.clipboardData).items[0] || null;
if (item && item.kind === "file" && item.type.indexOf("image") !== -1) {
var file = item.getAsFile(),
data = new FormData();
data.append('file', file);
$.ajax({
url: "/upload",
type: "POST",
data: data,
contentType: false,
processData: false,
success: function (r) {
// ...
}
})
}
})
})(jQuery)
(async () => {
// ...
for(const element of elements) {
const text = await element.findElement(by.xpath('.//span')).getAttribute('innerText');
if(~'Бадминтон'.indexOf(text)) {
console.log(text);
break;
}
}
// ...
})()
All API requests MUST include a valid User-Agent header. Requests with no User-Agent header will be rejected.
<?
$context = stream_context_create([
'http' => [
'header' => 'User-Agent: Awesome-Octocat-App'
]
]);
$url = 'https://api.github.com/repos/modxcms/revolution/tags';
$json = file_get_contents($url, false, $context);
$releases = json_decode($json, true);
echo '<pre>';
var_dump($releases);
echo '</pre>';
<keep-alive>
<router-view />
</keep-alive>