// <b>VK</b>
<script type="text/javascript" src="http://userapi.com/js/api/openapi.js?49"></script>
<script type="text/javascript">
VK.init({ apiId: id_app, onlyWidgets: true });
</script>
// <b>FB</b>
<script src="//connect.facebook.net/en_US/all.js"></script>
// <b>Twitter</b>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
// <b>VK</b>
// LIKE
VK.Observer.subscribe('widgets.like.liked', function(likeCount) {
// do something
});
// SHARE
VK.Observer.subscribe('widgets.like.shared', function(likeCount) {
// do something
});
// <b>FB</b>
FB.Event.subscribe('edge.create', function(opt_target) {
// do something
});
// <b>Twitter</b>
trackTwitterHandler_ = function(intent_event) {
var opt_target;
if (intent_event && intent_event.type == 'tweet' || intent_event.type == 'click') {
var socialAction = intent_event.type + ((intent_event.type == 'click') ? '-' + intent_event.region : '');
if(socialAction =='tweet') {
// do something
}
}
};
intent_handler = function(intent_event) {
trackTwitterHandler_(intent_event);
};
twttr.events.bind('click', intent_handler);
twttr.events.bind('tweet', intent_handler);
// do something
заменить на нужное действие. $str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sollicitudin augue rutrum metus molestie laoreet. Praesent vulputate at erat quis tincidunt. Vivamus pretium diam sed euismod tempor.
[marker]
Quisque pretium efficitur purus, interdum pulvinar nunc viverra ac. Vestibulum sit amet lobortis ligula. Nulla a nunc eu risus faucibus auctor non at leo. Mauris fermentum, turpis eu feugiat semper, nulla turpis venenatis dui, at condimentum sapien ligula eget ante. Donec vulputate tristique rhoncus. Sed et volutpat elit, ut sollicitudin nibh.';
echo 'Full text:' . PHP_EOL . $str . PHP_EOL . PHP_EOL;
$beforeMarker = '';
if (preg_match('/^(.*?)\[marker\]/isu', $str, $match)) {
$beforeMarker = $match[1];
}
$withoutMarker = str_replace('[marker]', '', $str);
echo 'Before marker: ' . PHP_EOL . $beforeMarker . PHP_EOL;
echo 'Without marker: ' . PHP_EOL . $withoutMarker . PHP_EOL;
// Считаем кол-во элементов в data
$count = count($arr['two']['data]);
// Выводим нужные данные нам
for($i=0;$i <$count; $i++ ) {
echo $arr['two']['data'][$i] . ' ' . arr['two']['rate'][$i] . PHP_EOL;
}
Dale 345
Moon 456
Sun 567
foreach ($arr['two']['data'] as $key => $val) {
echo $val . ' ' . $arr['two']['rate'][$key], PHP_EOL;
}
var aNum = $('.answers .answer').length;
var aNum = $(this).closest('.answers').find('.answer').length;
var elems = document.querySelectorAll('.main');
[].forEach.call(elems, function(elem) {
console.log( elem.children.length );
});
$('.test').append('NEW BLOCK!');
$(this).closest('.test').append('NEW BLOCK!');