<!doctype html>
<html>
<head>
<title></title>
<script type="text/javaSCRIPT" src="js/jquery-1.11.2.min.js"></script>
<script type="text/javaSCRIPT" src="js/background.js"></script>
</head>
<body></body>
</html>
$.ajax
({
url: "http://seasonvar.ru/jsonMark.php",
dataType: "json",
success: function( response )
{
console.log('old: ' + response.data.old);
console.log('noSeries: ' + response.data.noSeries);
}
});
"background" :
{
"page": "background.html"
},
"permissions":
[
"http://seasonvar.ru/*",
"tabs"
],
"content_security_policy":
"script-src 'self' 'unsafe-eval'; object-src 'self'"
<button class='change-color'>change color</button><br>"
<button class='remove'>remove</button>"
var $dialog = $("#dialog")
.dialog({
resizable: false
});
$('#dialog').parent().css({'z-index': '99999'});
.....
// If the touch interaction did not move, it should trigger a click
if (!this._touchMoved) {
// Simulate the click event
simulateMouseEvent(event, 'click');
}
....
.....
// If the touch interaction did not move, it should trigger a click
// if (!this._touchMoved) {
// Simulate the click event
simulateMouseEvent(event, 'click');
// }
// Unset the flag to allow other widgets to inherit the touch event
.....
$sourceStr = <<<EOD
<body>
<strong>Another text</strong>
<h1>Text!</h1>
<p><b>Bold text</b></p>
<p><a href="#">text link</a></p>
<table>
<tr><td>Text 1</td></tr>
<tr><td>Text 2</td></tr>
</table>
</body>
EOD;
$regExpWrapper = "#(?<=<)(?!td)(?!a)(?!tr)(?!th)(?!table)(?:.+?)>(.*?)(?:<)#si";
preg_match_all($regExpWrapper, $sourceStr, $matches);
print_r($matches);
<div class="textarea" contenteditable="true" spellcheck="true">Тестовая строка</div>
$('.textarea').html(
'<span class="mouseAnchor">' + $('.textarea').html() + '</span>'
);
$('.mouseAnchor').bind('click', function(event){alert('На мне щелкнули');});
var request = require('request');
var newRequest = request
(
{
method: 'GET',
url: //Ваш URL
}
);
newRequest.pause();
newRequest.on('response', function(resp)
{
if(resp.statusCode === 200)
{
newRequest.resume();
}
else
{
console.log('Что-то не так');
newRequest.end();
}
});
newRequest.on('data', function(chunk)
{
answer += chunk;
});
newRequest.on('end', function()
{
console.log('Получили данные');
});
var sourceStr =
'<data type="table"><table_field Title="Имя"><tableRow Value="Вася"/><tableRow Value="Коля"/><tableRow Value="Петя"/></table_field><table_field Title="Фамилия"><tableRow Value="Иванов"/> <tableRow Value="Петров"/><tableRow Value="Антонова"/></table_field><table_field Title="Телефон"><tableRow Value="02"/><tableRow Value="01"/><tableRow Value="03"/></table_field>';
var resultObj = {columns : new Array(), dataSource : {data : new Array()}}
var regExpCollumnWrapper = new RegExp('<table_field Title="(.*?)"(.*?)</table_field>', 'gim');
var regExpRowWrapper = new RegExp('tableRow Value="(.*?)"', 'gim');
var collumnIndex = 0;
while(currentCollumn = regExpCollumnWrapper.exec(sourceStr))
{
resultObj.columns.push({field: currentCollumn[1]});
var rowIndex = 0;
while(currentRow = regExpRowWrapper.exec(currentCollumn[2]))
{
if(collumnIndex == 0)
{
resultObj.dataSource.data.push({});
}
resultObj.dataSource.data[rowIndex][currentCollumn[1]] = currentRow[1];
rowIndex++;
}
collumnIndex++;
}
console.table(resultObj);
<script type="text/javascript" src="http://localhost/script/js/jquery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="http://localhost/script/js/MomentJS/moment-with-locales.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
var tarifs = new Array(100, 200, 300, 400, 500, 600, 700, 800);
$('.btn-info').bind('click', evalResult);
function evalResult()
{
var temp = $('.form-control1');
temp.css({'display': 'none'});
var payByMonth = tarifs[$('.form-control option:selected').val()];
var startDateInterval = moment($('#currentDay').val());
var endDateInteval = moment($('#targetDay').val());
var timeInterval = parseInt(startDateInterval.to(endDateInteval, true).split(' ')[0]) + 1;
var dayInCurrentMonth = moment($('#targetDay').val().substr(0, $('#targetDay').val().lastIndexOf('-')), "YYYY-MM").daysInMonth();
var payByDay = payByMonth / dayInCurrentMonth;
var totalAmount = timeInterval * payByDay - parseInt($('#currentBalance').val());
$('#sum').val(totalAmount.toFixed(2));
}
});
</script>
<tr>
<td><p class="text-right form-control-static" >До какого числа желают оплатить?</p></td>
<td>
<input class="form-control" id="lastDay" type="date" name="calendar" id="targetDay">
</td>
<tr>
<td><p class="text-right form-control-static">Тариф абонента:</p></td>
<td>
<select class="form-control" id="tarif">
<option value="0">Тариф "Мини"</option>
<option value="1">Тариф "Безлим 4"</option>
<option value="2">Тариф "Безлим 10"</option>
<option value="3">Тариф "Безлим 35"</option>
<option value="4">Тариф "Jump 5"</option>
<option value="5">Тариф "Jump 10"</option>
<option value="6">Тариф "Jump 35"</option>
<option value="7">Тариф "Jump 70"</option>
</select>
</td>
</tr>
$sourceText =
"1,игрушки,плюш,мишка
2,игрушки,плюш,кошка
3,игрушки,плюш,еж
4,игрушки,дерево,кубики
5,игрушки,дерево,кирпичики
6,игрушки,дерево,пентагондодекаэдры
7,одежда,дерево,макинтош
8,одежда,твид,пиджак
9,одежда,твид,брюки";
$sourceArray = array();
$resultArray = array();
$sourceText = explode("\n", $sourceText);
foreach($sourceText as $currentStr)
{
$currentStr = explode(",", $currentStr);
array_push($sourceArray, array
(
"type" => $currentStr[1],
"material" => $currentStr[2],
"name" => $currentStr[3]
));
if(array_key_exists($currentStr[1]."_".$currentStr[2], $resultArray))
{
$resultArray[$currentStr[1]."_".$currentStr[2]]++;
}
else
{
$resultArray[$currentStr[1]."_".$currentStr[2]] = 1;
}
}
arsort($resultArray);
$lastCategory = "";
foreach ($resultArray as $key => $value)
{
$currentKey = explode("_", $key);
if($lastCategory != $currentKey[0])
{
$lastCategory = $currentKey[0];
echo iconv("UTF-8", "CP866", "Категория: ".$lastCategory."\n");
}
echo iconv("UTF-8", "CP866", "\tПодкатегория: '".$currentKey[1]."' Всего: ".$value."\n");
}
<div id="answerPlaceHolder"></div>
var placeHolder = $('#answerPlaceHolder');
var url = 'https://api.vk.com/method/wall.get?owner_id=1&count=20&filter=all&v=5.45';
var answer;
$.ajax
({
url: url,
type: 'get',
crossDomain: true,
dataType: 'jsonp',
success: function(response)
{
answer = response;
answer.response.items.forEach(function(item)
{
var item2Append = $('<div class= "postWrapper"></div>');
if((item.text != 'undefined') && (item.text != ''))
{
item2Append.append('<div class="postText">' + item.text + '</div>');
console.log(item.text);
}
if(
(typeof(item.attachments) !== 'undefined') &&
(item.attachments[0].type == 'photo') &&
(typeof(item.attachments[0].photo.photo_604) !== 'undefined')
)
{
item2Append.append('<img class="postImage" src="' + item.attachments[0].photo.photo_604 + '">');
console.log(item.attachments[0].photo.photo_604);
}
console.log('******************************\n');
if(item2Append.children().length != 0)
{
item2Append = item2Append.add('<hr>');
placeHolder.append(item2Append);
}
});
},
error: function(error)
{
console.log('Ошибка');
console.log(error);
}
});
$testArr = array("0", "1", "2", "3", "4", "5", "6");
$counter = 0;
foreach($testArr as $currentItem)
{
if($counter > 2)
{
echo $currentItem."\n";
}
$counter++;
}
document.querySelector('.ytp-time-display span:nth-child(1)').innerHTML
$xls = PHPExcel_IOFactory::load("test.xlsx");
$xls->setActiveSheetIndex(0);
$sheet = $xls->getActiveSheet();
for($counter = 0; $counter < 10; $counter++)
{
$currentCellDate = date('d.m.Y', strtotime('+'.($counter).' day'));
echo $currentCellDate."\n";
$xls->getActiveSheet()->setCellValueByColumnAndRow(0, $counter + 1, $currentCellDate);
}
$objWriter = PHPExcel_IOFactory::createWriter($xls, 'Excel2007');
$objWriter->save("test.xlsx")
'one two three'.split(' ').reverse().join(' ')
<ul>
<li>Один Два Три</li>
<li>Четыре</li>
<li>1234567890</li>
</ul>
var list = $('ul li')
list.each(function(index, item)
{
currentItemText = $(item).html();
$('li:eq(' + index + ')').html(currentItemText.split('').reverse().join(''));
// console.log($(item).html());
});
function getFileSize($url)
{
$cURLsession = curl_init();
curl_setopt($cURLsession, CURLOPT_URL, $url);
curl_setopt($cURLsession, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($cURLsession, CURLOPT_HEADER, TRUE);
curl_setopt($cURLsession, CURLOPT_NOBODY, TRUE);
$data = curl_exec($cURLsession);
if(($curlResult = curl_exec($cURLsession)) === false)
{
echo "Ошибка при получении данных: ".curl_error($cURLsession).". С ".$url;
}
$responseType = curl_getinfo($cURLsession, CURLINFO_CONTENT_TYPE);
$fileSize = curl_getinfo($cURLsession, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($cURLsession);
return $fileSize;
}
function getEpscapeData($content)
{
$regExpDateWrapper =
"#".
"(?=<div class=\"epdate\">)(?:.*?)(\d{1,2}\s.*?)(?:</span>|</small></h5>)(?:</div>)".
"(?:(?:<div class=\"episode\">)(.*?)(?:</div></div></div>))+".
"#si";
$regExpMovieWrapper =
"#".
"(?:<div class=\"episode\">)(?:.*?)".
"(?:<a href=\")(.*?)\"(?:.*?)".
"(?:<div class=\"shrutitle\"><a(?:.*?)>)(.*?)(?:</a>)".
"(?:.*?)(?:class=\"shtitle\">)(.*?)</div>".
"(?:.*?)(?:class=\"eptitle\"><b>)(.*?)(?:</b>\s{0,})(.*?)".
"(?:</div></div></div>)".
"#si";
preg_match_all($regExpDateWrapper, $content, $dateMatches, PREG_SET_ORDER);
foreach($dateMatches as $currentDate)
{
echo iconv("UTF-8", "CP1251", $currentDate[1])."\n";
preg_match_all($regExpMovieWrapper, $currentDate[0], $movieMatches, PREG_SET_ORDER);
foreach($movieMatches as $currentMovie)
{
$movieInfo =
"Link: ".$currentMovie[1]."\n".
"Название сериала: ".$currentMovie[2]."\n".
"Оригинальное название: ".$currentMovie[3]."\n".
"Название эпизода: ".$currentMovie[4]." ".$currentMovie[5]."\n\n";
echo iconv("UTF-8", "CP1251", $movieInfo);
}
echo "*********************************\n";
}
}
var pageIndex=1;
$.ajax
({
url: 'путь к php файлу',
data: {pageIndex: pageIndex},
type: 'get',
success: function(answer)
{
// Добавляем результат на страницу
console.log(answer);
pageIndex += 3;
},
error: function(error)
{
console.log('Ошибка');
console.log(error);
}
});
$answer = "";
$url = "http://epscape.com/calendar/next/";
$pageIndex = $_REQUEST['pageIndex'];
for($counter = 0; $counter < 3; $counter++)
{
$answer .= getEpscapeData($url.($counter + 1));
}
echo $answer;
function getEpscapeData($url)
{
........
return recievedData;
}
var path = require('path');
var request = require('request');
var http = require('http');
var fs = require('fs');
var uploadDir = 'C:\/Node\/';
var urlPrefix = 'http://e-shuushuu.net/images/';
var regExpImageURLWrapper = new RegExp('(?:<img src="\/images\/thumbs\/)(.*?)"', 'gim');
var pageAmount = 2;
function getCurrentImage(imageUrl)
{
var fileName = path.join(uploadDir, imageUrl);
var newRequest = request(urlPrefix + imageUrl);
newRequest.pause();
newRequest.on('response', function(resp)
{
if((resp.statusCode === 200) && (resp.headers['content-type'].match('image')))
{
newRequest.pipe(fs.createWriteStream(fileName));
newRequest.resume();
console.log(`Загружаем: ${imageUrl}`);
}
else
{
var message =
'\n********************************************************\n' +
'Ошибка загрузки файла ' + urlPrefix + imageUrl + '\n' +
'Код ошибки: ' + resp.statusCode + ' ' + resp.statusMessage + '; ' +
'Mime-type: ' + resp.headers['content-type'] + '\n' +
'********************************************************\n';
console.log(`${message}`);
newRequest.end();
}
});
newRequest.on('end', function()
{
console.log(`Загрузка завершена: ${imageUrl}`);
});
}
for(var page_counter = 1; page_counter < pageAmount; page_counter++)
{
var newRequest = request
(
'http://e-shuushuu.net/?page=' + page_counter,
function (error, response, body)
{
if (!error && response.statusCode == 200)
{
while(match = regExpImageURLWrapper.exec(body))
{
getCurrentImage(match[1]);
// break;
}
}
}
);
}
<?php
require_once "e:\\MyWork\\web\\Script\\PHP\\PHP_SocketIO_Client\\socket.io.php";
// Create a socket.io connection and send a simple message
$socketio = new SocketIO();
echo iconv("UTF-8", "CP866", "exit для выхода\n");
while(true)
{
$input = fgets(STDIN);
if(trim($input) == "exit")
{
break;
}
if ($socketio->send("127.0.0.1", 8081, iconv("CP866", "UTF-8", trim($input))))
{
echo iconv("UTF-8", "CP866", "Сообщение отправлено. Можете продолжать:\n");
} else
{
echo iconv("UTF-8", "CP866", "Какой-то сбой :(\n");
}
}
exit("Jobe done");
?>