Skip to content

Instantly share code, notes, and snippets.

View victorpavlenko's full-sized avatar
🎯
Focusing

React victorpavlenko

🎯
Focusing
View GitHub Profile
function initViewPostEvents() {
var addedCommentCount = 0;
var $postCommentMessage = $('#postCommentMessage');
$postCommentMessage.autosize();
$('.clearTextArea').off('click').on('click', function () {
$postCommentMessage.val('').trigger('autosize.resize');
});
$('#submitPostComment').off('click').on('click', function () {
function dispatchAction(action, onComplete) {
var reqType = 'GET';
if (
action['action'] == 'addPost' ||
action['action'] == 'addReview' ||
action['action'] == 'addReviewPhoto' ||
action['action'] == 'addRepost'
) reqType = 'POST';
$.ajax(
var app = (function() {
'use strict';
var app = {
dom: {
ready: $.Deferred()
}
};
$(function() {
window.__GLOBALS = {};
function popupScroll() {
var t = $(window).scrollTop();
var h = $(window).height();
var fix = 'elementFixed';
var tail = 'elementTailed';
if (t > 32) $('#popupsContainer .jsPopupRightColumn').addClass(fix); else $('#popupsContainer .jsPopupRightColumn').removeClass(fix);
if ($('#leftScrollableContainer1').length) {
var gH = document.getElementById('leftScrollableContainer1');
var HandlebarsService = (function(){
const PATH_TO_TEMPLATE = '/js/templates/';
var HandlebarsService = function() {
};
$.extend(HandlebarsService.prototype, {
get: function(templateName, data) {
$(function(){
var ProfileEdit = (function(){
var ProfileEdit = function($element) {
if (typeof($element) === 'string') {
this.$element = $($element);
} else if ($element) {
this.$element = $element;
}
var superScrollMaxY;
var disableAllScrollEffects = false;
var refreshWindowHeight = function () {
superScrollMaxY = document.body.scrollHeight - window.innerHeight;
};
// делает из элемента супер-скролл
var makeSuperScroll = function (elem, elTop, scrollElem) {
var w;
var scrollTop;
$(function(){
if ($('.sidebar-catalog-filter').length) {
var win = $(window),
winHeight = win.height(),
sb = $('.sidebar-catalog-filter'),
sbHeight,
hpHeight,
currScroll,
scrollTop,
@victorpavlenko
victorpavlenko / bracket
Created May 2, 2015 13:49
1 Задача
if (process.argv.length !== 3) {
console.error('Введено:\n\t' + process.argv[0] + ' ' + process.argv[1] + ' [аргуенты для функции]')
process.exit(1);
}
var str = process.argv[2];
if (checkBrackets(str)) {
console.log('Все верно!');
} else {
@victorpavlenko
victorpavlenko / ko_index.js
Created May 4, 2015 15:16
Задание 2 JSON to table
var jsn = require('./json.json');
function Table(jsn){
this.colWidths = function(jsn){
return jsn.map(function(arr, i) {
var mass = [];
return arr.reduce(function(max, row, item, ar) {
row = row.toString().length;