Skip to content

Commit

Permalink
javascript jslinted partially,
Browse files Browse the repository at this point in the history
bug fixes and enhancements for mobile phone support,
updated directory paths in ckfinder config and htaccess,
updated email address
  • Loading branch information
Goszu committed Apr 14, 2013
1 parent fb1931e commit 4009360
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*/public/.*$
RewriteCond %{SCRIPT_FILENAME} !((\.(js|css|gif|jpg|png|html))|(connector.php))$ [NC]
RewriteRule ^(.*)$ /gerry/public/$1
RewriteRule ^(.*)$ /public/$1
4 changes: 2 additions & 2 deletions includes/ckfinder/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function CheckAuthentication()
// forget to add session_start() at the top of this file.

// TODO - use site Authentication (without duplicating code). For now temp solution
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."gerry".DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."initialise.php");
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."initialise.php");

if (!$session->is_logged_in()) {
return false;
Expand Down Expand Up @@ -70,7 +70,7 @@ function CheckAuthentication()
ATTENTION: The trailing slash is required.
*/

$baseUrl = DIRECTORY_SEPARATOR."gerry".DIRECTORY_SEPARATOR."public".DIRECTORY_SEPARATOR.'uploaded'.DIRECTORY_SEPARATOR;
$baseUrl = DIRECTORY_SEPARATOR."public".DIRECTORY_SEPARATOR.'uploaded'.DIRECTORY_SEPARATOR;

/*
$baseDir : the path to the local directory (in the server) which points to the
Expand Down
2 changes: 1 addition & 1 deletion includes/initialise.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// site root - needs to be configured properly
defined('SITE_ROOT') ? null :
define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT'].DS.'gerry');
define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']);

define('LIB_PATH', SITE_ROOT.DS.'includes');

Expand Down
17 changes: 14 additions & 3 deletions public/css/blocks.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ a:hover, #numbers span:hover, #numbers span.active {

#page-header {
overflow: hidden;
min-width: 690px;
}

#company {
Expand All @@ -83,7 +84,7 @@ a:hover, #numbers span:hover, #numbers span.active {
#social {
float: right;
padding-top: 12px;
width: 110px;
width: 68px;
text-align: right;
}

Expand Down Expand Up @@ -141,6 +142,11 @@ a:hover, #numbers span:hover, #numbers span.active {
cursor: pointer;
}

.item-text img, .slideshow img {
max-width: 420px;
height: auto !important;
}

/* slideshow */
.slideshow {
position:relative;
Expand Down Expand Up @@ -249,6 +255,7 @@ a:hover, #numbers span:hover, #numbers span.active {

#page-header {
padding: 10px;
min-width: 220px;
}

#company {
Expand All @@ -264,11 +271,15 @@ a:hover, #numbers span:hover, #numbers span.active {
}

#pane {
min-width: 230px;
width: 230px;
min-width: 220px;
width: 220px;
margin: 0 auto;
}

.block {
margin-right: 0;
}

.big-block {
padding: 10px;
width: 200px !important;
Expand Down
97 changes: 46 additions & 51 deletions public/js/boxmania.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ function boxmania(selector) {
"use strict";

var i,
colsNo,
boxNo,
boxWidth = 230,
boxHeight = 205,
expandedSize = 3,
boxBorder = 70,
debug = false,
debug = true,
expanded = false,
api = {},
windowWidth = $(window).width();
Expand All @@ -30,74 +31,68 @@ function boxmania(selector) {
$(this).insertAfter('#bl-' + ($(this).data("no") - 1));
}
});
//$('.item-text').remove();
$('#inner').remove();

$('.big-block').removeClass('big-block').addClass('block').removeAttr('style');
}

function getNumOfColumns() {
var colsNo,
bodyWidth = $('body').width();

if (bodyWidth >= 690) {
colsNo = Math.floor(bodyWidth / boxWidth);
}
if (bodyWidth < 690) { colsNo = 3; }
if ($('#pane').width() === 230) { colsNo = 1; }

return colsNo;
}

function checkClickedCol() {
var colIterator = 0,
colsNo = getNumOfColumns();
var colIterator = 0;
do {
colIterator += 1;
colIterator++;
if ((boxNo - colIterator) % colsNo === 0) {
return colIterator;
}
} while (colIterator < 8);
}

function checkColNo() {
var bodyWidth = $('body').width();

if (bodyWidth >= 690) {
colsNo = Math.floor(bodyWidth / boxWidth);
}
if (bodyWidth < 690) { colsNo = 3; }
if ($('#pane').width() === 220) { colsNo = 1; }
}

function alignRight(selector, adjust) {
var adj = adjust || 0,
colsNo = getNumOfColumns();
var adj = adjust || 0;

checkColNo();
$(selector).css('float', 'left');
if (colsNo > 3) {
$(selector).css('padding-left', (((colsNo * boxWidth) - $(selector).width() - 10) + adj));
} else if (colsNo === 3) {
$(selector).css('padding-left', (((3 * boxWidth) - $(selector).width() - 10) + adj));
} else {
$(selector).css({'float': 'right', 'padding-left': 0});
}
}

function fillGaps(expandedBox) {

if (colsNo === 1) { return; }

var leftOffset = 0,
topOffset = 0,
clickedCol = checkClickedCol(),
expandedHeightInBoxesNo = Math.ceil(($(expandedBox).height() + (boxBorder * 2)) / boxHeight),
colsNo = getNumOfColumns();

if (colsNo === 1) { return; }
expandedHeightInBoxesNo = Math.ceil(($(expandedBox).height() + (boxBorder * 2)) / boxHeight);

$(expandedBox).find('#inner').height(((expandedHeightInBoxesNo * boxHeight) - 10) - (boxBorder * 2));

if (clickedCol === 1) { return; }
if (clickedCol === 1) {return;}

if (clickedCol === colsNo) {
clickedCol -= 2;
clickedCol -=2;
$(expandedBox).insertBefore('.block:nth-child(' + (boxNo - 2) + ')').addClass('moved');
boxNo -= 2;
}
if (clickedCol === (colsNo - 1)) {
clickedCol -= 1;
clickedCol -=1;
$(expandedBox).insertBefore('.block:nth-child(' + (boxNo - 1) + ')').addClass('moved');
boxNo -= 1;
}
if (colsNo === expandedSize) { return; }
if (colsNo === expandedSize) {return;}

i = 1;
do {
Expand All @@ -106,15 +101,15 @@ function boxmania(selector) {
top: (topOffset * boxHeight) + (Math.ceil(boxNo / colsNo) * boxHeight),
left: leftOffset * boxWidth
}).addClass('moved');
leftOffset += 1;
leftOffset++;

if (i % (clickedCol - 1) === 0) {
leftOffset = 0;
topOffset += 1;
topOffset++;
}
i += 1;
i++;

} while (i <= (clickedCol - 1) * (expandedHeightInBoxesNo - 1));
} while (i <= (clickedCol - 1) * (expandedHeightInBoxesNo -1));
}

function expand(target) {
Expand All @@ -124,26 +119,24 @@ function boxmania(selector) {
}).removeClass('block').addClass('big-block');
}

function goToId(target) {
$('html,body').animate({scrollTop: $('#' + $(target).attr('id')).offset().top - 8}, 'slow');
function goToId(target){
$('html,body').animate({scrollTop: $('#' + $(target).attr('id')).offset().top -8},'slow');
}

function addExpandedMarkup(target) {
$(target).prepend('<div id="inner"><header id="header"><img src="images/close.png" id="close"/></header></div>');
$(target).find('.name').appendTo('#header');
$(target).find('.item-text').appendTo('#inner');
if ($(target).hasClass('slide')) { api.slideshow = slideshow($(target).attr('id')); }
if ($(target).hasClass('slide')) {api.slideshow = slideshow($(target).attr('id'));}
}

function getItemText(target, itemNo) {
var args = Array.prototype.slice.apply(arguments, [2]),
i;

var args = Array.prototype.slice.apply(arguments, [2]);
$.ajax({
url: "get_item_text.php",
type: "POST",
data: {item_id : $(target).data('id')},
success: function (html) {
success: function(html) {
function goOn(html_content, formPresent) {
var targetObj = $(target);
$('#loader').remove();
Expand All @@ -154,13 +147,14 @@ function boxmania(selector) {
targetObj.css('background-color', '#fff');
}



targetObj.find('div.image-container').fadeTo(0, 1).hide();
targetObj.append('<article class="item-text">' + html_content + '</article>');

for (i = 0; i < args.length; i += 1) {
//if (targetObj.hasClass('slide')) {api.slideshow = slideshow(itemNo)}
for( var i = 0; i < args.length; i++ ) {
args[i](target);
}

$(selector + ' .image-container').bind('click', function () {
clickBoxHandler(this);
});
Expand Down Expand Up @@ -194,6 +188,8 @@ function boxmania(selector) {
$(box).css('background-color', '#bbb').append('<img id="loader" src="images/loader.gif" alt="loading" />');
$(target).fadeTo(0, 0.4);

checkColNo();

boxNo = box.data('no');

$(selector + ' section').each(function () {
Expand Down Expand Up @@ -259,7 +255,7 @@ function boxmania(selector) {
slideshow.css('opacity', '0');
imagesArray.each(function () {
$(this).appendTo('#' + itemId + ' .slideshow');
$(this).load(function () {
$(this).load(function() {
imgLoaded += 1;
});
});
Expand All @@ -278,7 +274,7 @@ function boxmania(selector) {
//create navigation
slideshow.after('<div id="numbers"></div>');
numbers = $('#numbers');
for (i; i <= imgCount; i += 1) {
for(i; i <= imgCount; i +=1) {
numbers.append('<span>' + i + '</span>');
}

Expand All @@ -293,15 +289,14 @@ function boxmania(selector) {
if (debug === true) {
$('body').append('<div id="debug"></div>');
setInterval(function () {
$('#debug').html('<p>Number of columns: ' + getNumOfColumns() + '</p>' +
'<p>Body width: ' + $("body").width() + '</p>' +
'<p>Scrollbar presence: ' + checkScrollbar() + '</p>');
$('#debug').html('<p>Number of columns: ' + colsNo + '</p>' +
'<p>Scrollbar presence: ' + checkScrollbar() + '</p>');
}, 500);
}

setInterval(function () {
var body = $('body');
if (!checkScrollbar()) {
if(!checkScrollbar()) {
body.css('margin-right', '20px');
} else {
body.css('margin-right', (20 - $.getScrollbarWidth()) + 'px');
Expand All @@ -313,8 +308,8 @@ function boxmania(selector) {
alignRight('#social', -$('#company').width());
}, 300);

$(window).resize(function () {
if (expanded && windowWidth !== $(window).width()) {
$(window).resize(function() {
if(expanded && windowWidth !== $(window).width()) {
expanded = false;
getStateBack();
windowWidth = $(window).width();
Expand Down
4 changes: 2 additions & 2 deletions public/layouts/header.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.4" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Marcin Gosz Homepage</title>
<!--[if lt IE 9]><script src="js/ html5shiv.js" type="text/javascript"></script><![endif]-->
Expand All @@ -13,8 +14,7 @@
<header id="page-header">
<h1 id="company">Marcin<span>Gosz</span>Home</h1>
<div id="social">
<a href="#"><img src="../images/fb_ico.png" alt="facebook" /></a>
<a href="#"><img src="../images/twe_ico.png" alt="tweeter" /></a>
<a href="#"><img src="../images/in_ico.png" alt="linkedin" /></a>
<a href="#"><img src="../images/cs_ico.png" alt="tweeter" /></a>
</div>
</header>
2 changes: 1 addition & 1 deletion public/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email = "[email protected]";
$email = "[email protected]";
$mail = $_POST['mail'];
$subject = "e-mail from website";
$imie = $_POST['imie'];
Expand Down

0 comments on commit 4009360

Please sign in to comment.