Skip to content

Instantly share code, notes, and snippets.

View a-ignatov-parc's full-sized avatar

Anton Ignatov a-ignatov-parc

View GitHub Profile
define('requirejs-sandbox', [
'requirejs-sandbox/logger',
'requirejs-sandbox/utils',
'requirejs-sandbox/plugins/css',
'requirejs-sandbox/plugins/transit'
], function(console, utils, cssPlugin, transitPlugin) {
$scope.highlightSearchResult = (->
highlightSearchResultIndex = 0
(entity) ->
$('.is-selected').removeClass 'is-selected'
entity
.find('.g-highlight')
.addClass('is-selected')
)()
function load(url, sectionHeaders, data) {
require(["events"], function(events) {
events.trigger("pageTransition:init", [url, sectionHeaders, "POST", data]);
});
}
load(url, 'pageView: #GlobalContent', {
serviceLogin: jData.login,
servicePassword: jData.password
});
.container {
top: -5000px;
width: 135px;
-webkit-transition: top 0ms ease-in-out 600ms, opacity 400ms ease-in-out 200ms;
-moz-transition: top 0ms ease-in-out 600ms, opacity 400ms ease-in-out 200ms;
-o-transition: top 0ms ease-in-out 600ms, opacity 400ms ease-in-out 200ms;
transition: top 0ms ease-in-out 600ms, opacity 400ms ease-in-out 200ms;
margin: 0 0 0 -68px;
position: absolute;
opacity: 0;
initialize: function() {
_.bindAll(this, 'subscribe', 'onAuth'); // Не правильно!
this.on('change:messenger', this.subscribe);
},
initialize: function() {
this.on('change:messenger', this.subscribe, this); // Правильно
},
// Original code
$('.__select-email .textfield')
.removeClass('__required __invalid')
.addClass('__' + error.type)
.find('input[name="email"]')
.after('<label class="error">' + error.text + '</label>');
// Short method
var input = $('.__select-email .textfield')
function Test(adapter, handlersCount, contextCount, eventNamesCount) {
var handlers = [],
contexts = [],
events = [],
i;
function generateNum(range) {
return Math.floor(Math.random() * (range || 1000));
}
$.extend(typeahead, {
show: function() {
var targetOffset = this.$element.offset(),
targetHeight = this.$element.outerHeight(),
containerOffset = container.offset();
// Корректируем позиционирование
targetOffset.top -= containerOffset.top;
targetOffset.top += targetHeight;
targetOffset.left -= containerOffset.left;
events: {
'blur input[placeholder], textarea[placeholder]': 'processPlaceholder',
'focus input[placeholder], textarea[placeholder]': 'processPlaceholder',
'change input[placeholder], textarea[placeholder]': 'processPlaceholder'
},
// Метод реализиующий правильное функционирование кастомного плейсхолдера в браузерах которые их
// не поддерживают
processPlaceholder: function(event) {
var alowedEvents = {
ul {
position: relative;
width: 230px;
height: 480px;
margin: 0;
padding: 0;
overflow-x: hidden;
overflow-y: scroll;
list-style: none;