This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function NewProto() {}; | |
NewProto.prototype = { | |
pull: function(data) { | |
return $.ajax("ajax.php", { | |
data: data, | |
type: "POST", | |
context: this.el, | |
}); | |
}, | |
fill: function(params) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// var items = <?=CUtil::PhpToJSObject($arResult["ITEMS"])?>; | |
function Parser(formname) { | |
this.formname = formname; | |
this.init = function() { | |
var instarr = $("#"+this.formname).serializeArray(); | |
var base = {}; | |
for (var i in instarr) { | |
base[instarr[i].name] = instarr[i].value; | |
} | |
this.base = base; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.decide = function(options){ | |
this.each(function(){ | |
var settings = $.extend({str: "default"}, options); | |
var decision = $(this); | |
var getdata = $.ajax(decision.attr('href'), { | |
type: 'POST', dataType: 'json', data: decision.data('params') | |
}); | |
decision.on('click', function(e){ | |
e.preventDefault(); | |
getdata.done(function(result){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
if (CModule::IncludeModule("iblock") && CModule::IncludeModule("catalog")){ | |
$arParams["IBLOCK_ID"] = IntVal(2); | |
$arResult = Array(); | |
$prices = CIBlockPriceTools::GetCatalogPrices($arParams["IBLOCK_ID"], Array(0=>"BASE")); | |
$arrk = array_keys($prices); | |
$res = CIBlockElement::GetList(Array("SORT"=>"ASC"), Array("IBLOCK_TYPE"=>"catalog", "IBLOCK_ID"=>$arParams["IBLOCK_ID"], "ACTIVE"=>"Y", "GLOBAL_ACTIVE" => "Y"), false, false, Array("ID", "NAME", "IBLOCK_ID", "IBLOCK_SECTION_ID", "XML_ID", "CATALOG_GROUP_".$prices[$arrk[0]]["ID"])); | |
while ($ob = $res->GetNextElement()) { | |
$arFields = $ob->GetFields(); | |
$arResult["ITEMS"][] = Array($arFields["XML_ID"], $arFields["CATALOG_PRICE_".$prices[$arrk[0]]["ID"]]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stp = "<?=SITE_TEMPLATE_PATH?>", | |
ids = [], | |
globalStop = false; | |
function collectId(){ | |
while(ids.length) { ids.pop(); } | |
$("ul.contacts-list").children("li").each(function(){ | |
ids.push($(this).attr("data-id")); | |
}); | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = $("#map_wrapper"), editorParams = { | |
wayPointFinishDraggable: false, | |
addWayPoints: false, | |
editorDrawOver: false, | |
wayPointFinishIconLayout: "default#image", | |
wayPointFinishIconImageHref: '/new/include/img/footer-map-point.png', | |
wayPointFinishIconImageSize: [171, 48], | |
wayPointFinishIconImageOffset: [-55, -48], | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function throttle(method, context) | |
{ | |
clearTimeout(method.tId); | |
method.tId = setTimeout(function(){ | |
method.call(context); | |
}, 100); | |
} | |
//usage example | |
window.onresize = function() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.config(function($provide){ | |
$provide.decorator("$exceptionHandler", ["$delegate", function($delegate){ | |
return function(exception, cause) | |
{ | |
exception.message = "Some exception message"; | |
$delegate(exception, cause); //call out basic implementation | |
alert(exception.message); //our custom alert | |
} | |
}]); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#logger.js | |
module.exports = function(request, response, next) | |
{ | |
var start = +new Date(), | |
stream = process.stdout, | |
url = request.url, | |
method = request.method; | |
response.on("finish", function(){ | |
var duration = +new Date() - start, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var events = require('events'), | |
net = require('net'), | |
channel = new events.EventEmitter(); | |
channel.clients = {}; | |
channel.subscriptions = {}; | |
// Add listener on join event | |
// we save client user object and send | |
channel.on('join', function(id, client) { |
OlderNewer