var canvas_down = false;
var canvas = document.getElementById('area');
var ctx = canvas.getContext("2d");
//resize to be sure that pixels == width
window.addEventListener('resize', resizeCanvas, false);
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
resizeCanvas();
ctx.fillStyle = "rgba(255,255,255, 0.9)";
ctx.fillRect(0, 0, $("#area").width(),$("#area").height());
canvas.addEventListener('mousedown', function (e) {
canvas_down = true;
}, false);
canvas.addEventListener('mouseup', function (e) {
canvas_down = false;
}, false);
canvas.addEventListener('mousemove', function (e) {
if (canvas_down)
eraser(e, 25);
}, false);
function eraser(e, radius) {
ctx.beginPath();
var x2 = e.pageX - (radius/2);
var y2 = e.pageY- (radius/2);
ctx.clearRect(x2, y2, radius, radius);
ctx.closePath();
}
if (переменная < 10) {
переменная = '0' + переменная
}
EditText inputField = (EditText) findViewById(R.id.inputfield);
inputField.addTextChangedListener(new PhoneNumberFormattingTextWatcher());
<com.example.conponents.mycomponents ...
$('#places_filters').on('click', '#a_link', function(){
var link = $(this);
window.location.href = window.location.href.replace(/#!.*/g, '') + '#!' + link.attr('href');
$sort = link.attr('sort_id');
$.get('/ajax/places?sort='+$sort, function(data) {
$('#places_filters').html(data);
});
return false;
})
app.directive("watchAutofill", [
'$timeout',
function ($timeout) {
var INTERVAL_MS = 500;
return {
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
var timer;
function startTimer() {
timer = $timeout(function () {
var value = element.val();
if (value && ngModel.$viewValue !== value) {
ngModel.$setViewValue(value);
}
startTimer();
}, INTERVAL_MS);
}
scope.$on('$destroy', function () {
$timeout.cancel(timer);
});
startTimer();
}
};
}
]);