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
class watermark3{ | |
# given two images, return a blended watermarked image | |
function create_watermark( $main_img_obj, $watermark_img_obj, $alpha_level = 100 ) { | |
$alpha_level /= 100; # convert 0-100 (%) alpha to decimal | |
# calculate our images dimensions | |
$main_img_obj_w = imagesx( $main_img_obj ); | |
$main_img_obj_h = imagesy( $main_img_obj ); | |
$watermark_img_obj_w = imagesx( $watermark_img_obj ); |
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 SaveScreen = (function(){ | |
// Подключаем прослушку событий | |
function _setUpListners(){ | |
$('.save-button').on('click', _saveData); | |
} | |
function _saveData(e) { | |
e.preventDefault(); |
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
// константы для хранения подключения к БД | |
define('HOST', 'localhost'); | |
define('USER', 'admin'); | |
define('DBNAME', 'admin'); | |
define('PASSWORD', 'admin'); | |
// функция для получения объекта подключения к БД | |
function connectToDB(){ | |
setlocale(LC_CTYPE, array('ru_RU.utf8', 'ru_RU.utf8')); | |
setlocale(LC_ALL, array('ru_RU.utf8', 'ru_RU.utf8')); |
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
$(document).ready(function(){ | |
if($('.main-content')) { | |
ScreenChange.init(); | |
}; | |
}); | |
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
//шаблон наследования в javascript | |
//C - child, P - parent , F - empty function | |
//uber - original ancestor | |
// C.prototype.constructor = C - a pointer to the constructor | |
function inherit(C, P) { | |
var F = function () {}; | |
F.prototype = P.prototype; | |
C.prototype = new F(); | |
C.uber = P.prototype; | |
C.prototype.constructor = C; |
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
$('input[type="file"]').val().replace(/.+[\\\/]/, ""); |
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 validateThis(form) { | |
var | |
textType = form.find("[data-validation='text']"), | |
mailType = form.find("[data-validation='mail']"); | |
textType.each(function(){ | |
var | |
$this = $(this), | |
emptyField = $this.val() == ''; |
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.tooltip = function(options){ | |
options = { | |
position: options.position || 'right', | |
content : options.content || "i'am tooltip" | |
}; | |
var | |
markup = '<div class="tooltip tooltip_' + options.position + '">' + | |
'<div class="tooltip__inner">' + options.content + '</div>' + |
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 Popups = (function(){ | |
var | |
popups = $('.popup'); | |
function _close() { | |
popups.hide(); | |
} | |
return { |
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 postFormData(form, successCallback) { | |
var | |
host = form.attr('action'), | |
reqFields = form.find('[name]'), | |
dataObject = {}; | |
if (!host) { | |
console.log('set action attribute to your form, you fool!!'); | |
} |
OlderNewer