The requested content cannot be loaded.
Please try again later.
The requested content cannot be loaded.
Please try again later.
'+s.intro_text+'
'; + var outro = ''+s.outro_text+'
'; + var loading = $(''+s.loading_text+'
'); + + if(s.username && typeof(s.username) == "string"){ + s.username = [s.username]; + } + + $(widget).unbind("tweet:load").bind("tweet:load", function(){ + if (s.loading_text) $(widget).empty().append(loading); + + $.ajax({ + dataType: "json", + type: "post", + async: false, + url: s.modpath || "/twitter/", + data: { request: build_api_request() }, + success: function(data, status) { + + if(data.message) { + console.log(data.message); + } + + var response = data.response; + $(widget).empty().append(list); + if (s.intro_text) list.before(intro); + list.empty(); + + if(response.statuses !== undefined) { + resp = response.statuses; + } else if(response.results !== undefined) { + resp = response.results; + } else { + resp = response; + } + + var tweets = $.map(resp, extract_template_data); + tweets = $.grep(tweets, s.filter).sort(s.comparator).slice(0, s.count); + + list.append($.map(tweets, function(o) { return "' + $(this.element).parent().find('img').attr('alt') + '
'; + }, + helpers : { + title : { type: 'inside' }, + } + }); + + $('.fancybox-media').fancybox({ + openEffect : 'none', + closeEffect : 'none', + helpers : { + media : {} + } + }); + } +} + + +/* ================================================== + Contact Form +================================================== */ + +BRUSHED.contactForm = function(){ + $("#contact-submit").on('click',function() { + $contact_form = $('#contact-form'); + + var fields = $contact_form.serialize(); + + $.ajax({ + type: "POST", + url: "_include/php/contact.php", + data: fields, + dataType: 'json', + success: function(response) { + + if(response.status){ + $('#contact-form input').val(''); + $('#contact-form textarea').val(''); + } + + $('#response').empty().html(response.html); + } + }); + return false; + }); +} + + +/* ================================================== + Twitter Feed +================================================== */ + +BRUSHED.tweetFeed = function(){ + + var valueTop = -64; // Margin Top Value + + $("#ticker").tweet({ + modpath: '_include/js/twitter/', + username: "Bluxart", // Change this with YOUR ID + page: 1, + avatar_size: 0, + count: 10, + template: "{text}{time}", + filter: function(t){ return ! /^@\w+/.test(t.tweet_raw_text); }, + loading_text: "loading ..." + }).bind("loaded", function() { + var ul = $(this).find(".tweet_list"); + var ticker = function() { + setTimeout(function() { + ul.find('li:first').animate( {marginTop: valueTop + 'px'}, 500, 'linear', function() { + $(this).detach().appendTo(ul).removeAttr('style'); + }); + ticker(); + }, 5000); + }; + ticker(); + }); + +} + + +/* ================================================== + Menu Highlight +================================================== */ + +BRUSHED.menu = function(){ + $('#menu-nav, #menu-nav-mobile').onePageNav({ + currentClass: 'current', + changeHash: false, + scrollSpeed: 750, + scrollOffset: 30, + scrollThreshold: 0.5, + easing: 'easeOutExpo', + filter: ':not(.external)' + }); +} + +/* ================================================== + Next Section +================================================== */ + +BRUSHED.goSection = function(){ + $('#nextsection').on('click', function(){ + $target = $($(this).attr('href')).offset().top-30; + + $('body, html').animate({scrollTop : $target}, 750, 'easeOutExpo'); + return false; + }); +} + +/* ================================================== + GoUp +================================================== */ + +BRUSHED.goUp = function(){ + $('#goUp').on('click', function(){ + $target = $($(this).attr('href')).offset().top-30; + + $('body, html').animate({scrollTop : $target}, 750, 'easeOutExpo'); + return false; + }); +} + + +/* ================================================== + Scroll to Top +================================================== */ + +BRUSHED.scrollToTop = function(){ + var windowWidth = $(window).width(), + didScroll = false; + + var $arrow = $('#back-to-top'); + + $arrow.click(function(e) { + $('body,html').animate({ scrollTop: "0" }, 750, 'easeOutExpo' ); + e.preventDefault(); + }) + + $(window).scroll(function() { + didScroll = true; + }); + + setInterval(function() { + if( didScroll ) { + didScroll = false; + + if( $(window).scrollTop() > 1000 ) { + $arrow.css('display', 'block'); + } else { + $arrow.css('display', 'none'); + } + } + }, 250); +} + +/* ================================================== + Thumbs / Social Effects +================================================== */ + +BRUSHED.utils = function(){ + + $('.item-thumbs').bind('touchstart', function(){ + $(".active").removeClass("active"); + $(this).addClass('active'); + }); + + $('.image-wrap').bind('touchstart', function(){ + $(".active").removeClass("active"); + $(this).addClass('active'); + }); + + $('#social ul li').bind('touchstart', function(){ + $(".active").removeClass("active"); + $(this).addClass('active'); + }); + +} + +/* ================================================== + Accordion +================================================== */ + +BRUSHED.accordion = function(){ + var accordion_trigger = $('.accordion-heading.accordionize'); + + accordion_trigger.delegate('.accordion-toggle','click', function(event){ + if($(this).hasClass('active')){ + $(this).removeClass('active'); + $(this).addClass('inactive'); + } + else{ + accordion_trigger.find('.active').addClass('inactive'); + accordion_trigger.find('.active').removeClass('active'); + $(this).removeClass('inactive'); + $(this).addClass('active'); + } + event.preventDefault(); + }); +} + +/* ================================================== + Toggle +================================================== */ + +BRUSHED.toggle = function(){ + var accordion_trigger_toggle = $('.accordion-heading.togglize'); + + accordion_trigger_toggle.delegate('.accordion-toggle','click', function(event){ + if($(this).hasClass('active')){ + $(this).removeClass('active'); + $(this).addClass('inactive'); + } + else{ + $(this).removeClass('inactive'); + $(this).addClass('active'); + } + event.preventDefault(); + }); +} + +/* ================================================== + Tooltip +================================================== */ + +BRUSHED.toolTip = function(){ + $('a[data-toggle=tooltip]').tooltip(); +} + + +/* ================================================== + Init +================================================== */ + +BRUSHED.slider(); + +$(document).ready(function(){ + Modernizr.load([ + { + test: Modernizr.placeholder, + nope: '_include/js/placeholder.js', + complete : function() { + if (!Modernizr.placeholder) { + Placeholders.init({ + live: true, + hideOnFocus: false, + className: "yourClass", + textColor: "#999" + }); + } + } + } + ]); + + // Preload the page with jPreLoader + $('body').jpreLoader({ + splashID: "#jSplash", + showSplash: true, + showPercentage: true, + autoClose: true, + splashFunction: function() { + $('#circle').delay(250).animate({'opacity' : 1}, 500, 'linear'); + } + }); + + BRUSHED.nav(); + BRUSHED.mobileNav(); + BRUSHED.listenerMenu(); + BRUSHED.menu(); + BRUSHED.goSection(); + BRUSHED.goUp(); + BRUSHED.filter(); + BRUSHED.fancyBox(); + BRUSHED.contactForm(); + BRUSHED.tweetFeed(); + BRUSHED.scrollToTop(); + BRUSHED.utils(); + BRUSHED.accordion(); + BRUSHED.toggle(); + BRUSHED.toolTip(); +}); + +$(window).resize(function(){ + BRUSHED.mobileNav(); +}); + +}); diff --git a/_include/js/modernizr.js b/_include/js/modernizr.js new file mode 100644 index 0000000..4f5135e --- /dev/null +++ b/_include/js/modernizr.js @@ -0,0 +1,4 @@ +/* Modernizr 2.5.3 (Custom Build) | MIT & BSD + * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexbox_legacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load + */ +;window.Modernizr=function(a,b,c){function C(a){j.cssText=a}function D(a,b){return C(n.join(a+";")+(b||""))}function E(a,b){return typeof a===b}function F(a,b){return!!~(""+a).indexOf(b)}function G(a,b){for(var d in a)if(j[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function H(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:E(f,"function")?f.bind(d||b):f}return!1}function I(a,b,c){var d=a.charAt(0).toUpperCase()+a.substr(1),e=(a+" "+p.join(d+" ")+d).split(" ");return E(b,"string")||E(b,"undefined")?G(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),H(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d'; + if ( is_object($obj) ) + print_r($obj); + elseif ( is_array($obj) ) + print_r($obj); + else + echo $obj; + if (!self::is_cli()) + echo ''; + } + + /** + * Make an HTTP request using this library. This method is different to 'request' + * because on a 401 error it will retry the request. + * + * When a 401 error is returned it is possible the timestamp of the client is + * too different to that of the API server. In this situation it is recommended + * the request is retried with the OAuth timestamp set to the same as the API + * server. This method will automatically try that technique. + * + * This method doesn't return anything. Instead the response should be + * inspected directly. + * + * @param string $method the HTTP method being used. e.g. POST, GET, HEAD etc + * @param string $url the request URL without query string parameters + * @param array $params the request parameters as an array of key=value pairs + * @param string $useauth whether to use authentication when making the request. Default true. + * @param string $multipart whether this request contains multipart data. Default false + */ + public static function auto_fix_time_request($tmhOAuth, $method, $url, $params=array(), $useauth=true, $multipart=false) { + $tmhOAuth->request($method, $url, $params, $useauth, $multipart); + + // if we're not doing auth the timestamp isn't important + if ( ! $useauth) + return; + + // some error that isn't a 401 + if ($tmhOAuth->response['code'] != 401) + return; + + // some error that is a 401 but isn't because the OAuth token and signature are incorrect + // TODO: this check is horrid but helps avoid requesting twice when the username and password are wrong + if (stripos($tmhOAuth->response['response'], 'password') !== false) + return; + + // force the timestamp to be the same as the Twitter servers, and re-request + $tmhOAuth->auto_fixed_time = true; + $tmhOAuth->config['force_timestamp'] = true; + $tmhOAuth->config['timestamp'] = strtotime($tmhOAuth->response['headers']['date']); + return $tmhOAuth->request($method, $url, $params, $useauth, $multipart); + } + + /** + * Asks the user for input and returns the line they enter + * + * @param string $prompt the text to display to the user + * @return the text entered by the user + */ + public static function read_input($prompt) { + echo $prompt; + $handle = fopen("php://stdin","r"); + $data = fgets($handle); + return trim($data); + } + + /** + * Get a password from the shell. + * + * This function works on *nix systems only and requires shell_exec and stty. + * + * @param boolean $stars Wether or not to output stars for given characters + * @return string + * @url http://www.dasprids.de/blog/2008/08/22/getting-a-password-hidden-from-stdin-with-php-cli + */ + public static function read_password($prompt, $stars=false) { + echo $prompt; + $style = shell_exec('stty -g'); + + if ($stars === false) { + shell_exec('stty -echo'); + $password = rtrim(fgets(STDIN), "\n"); + } else { + shell_exec('stty -icanon -echo min 1 time 0'); + $password = ''; + while (true) : + $char = fgetc(STDIN); + if ($char === "\n") : + break; + elseif (ord($char) === 127) : + if (strlen($password) > 0) { + fwrite(STDOUT, "\x08 \x08"); + $password = substr($password, 0, -1); + } + else + fwrite(STDOUT, "*"); + $password .= $char; + endif; + endwhile; + } + + // Reset + shell_exec('stty ' . $style); + echo PHP_EOL; + return $password; + } + + /** + * Check if one string ends with another + * + * @param string $haystack the string to check inside of + * @param string $needle the string to check $haystack ends with + * @return true if $haystack ends with $needle, false otherwise + */ + public static function endswith($haystack, $needle) { + $haylen = strlen($haystack); + $needlelen = strlen($needle); + if ($needlelen > $haylen) + return false; + + return substr_compare($haystack, $needle, -$needlelen) === 0; + } +} \ No newline at end of file diff --git a/_include/js/waypoints-sticky.js b/_include/js/waypoints-sticky.js new file mode 100644 index 0000000..44a435d --- /dev/null +++ b/_include/js/waypoints-sticky.js @@ -0,0 +1,52 @@ +/* +Sticky Elements Shortcut for jQuery Waypoints - v2.0.2 +Copyright (c) 2011-2013 Caleb Troughton +Dual licensed under the MIT license and GPL license. +https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt +*/ +(function() { + + (function(root, factory) { + if (typeof define === 'function' && define.amd) { + return define(['jquery', 'waypoints'], factory); + } else { + return factory(root.jQuery); + } + })(this, function($) { + var defaults, wrap; + defaults = { + wrapper: '', + stuckClass: 'stuck' + }; + wrap = function($elements, options) { + $elements.wrap(options.wrapper); + $elements.each(function() { + var $this; + $this = $(this); + $this.parent().height($this.outerHeight()); + return true; + }); + return $elements.parent(); + }; + return $.waypoints('extendFn', 'sticky', function(options) { + var $wrap, originalHandler; + options = $.extend({}, $.fn.waypoint.defaults, defaults, options); + $wrap = wrap(this, options); + originalHandler = options.handler; + options.handler = function(direction) { + var $sticky, shouldBeStuck; + $sticky = $(this).children(':first'); + shouldBeStuck = direction === 'down' || direction === 'right'; + $sticky.toggleClass(options.stuckClass, shouldBeStuck); + if (originalHandler != null) { + return originalHandler.call(this, direction); + } + }; + $wrap.waypoint(options); + return this; + }); + }); + +}).call(this); + + diff --git a/_include/js/waypoints.js b/_include/js/waypoints.js new file mode 100644 index 0000000..68879e6 --- /dev/null +++ b/_include/js/waypoints.js @@ -0,0 +1,498 @@ +/* +jQuery Waypoints - v2.0.2 +Copyright (c) 2011-2013 Caleb Troughton +Dual licensed under the MIT license and GPL license. +https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt +*/ + + +(function() { + var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = [].slice; + + (function(root, factory) { + if (typeof define === 'function' && define.amd) { + return define('waypoints', ['jquery'], function($) { + return factory($, root); + }); + } else { + return factory(root.jQuery, root); + } + })(this, function($, window) { + var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps; + $w = $(window); + isTouch = __indexOf.call(window, 'ontouchstart') >= 0; + allWaypoints = { + horizontal: {}, + vertical: {} + }; + contextCounter = 1; + contexts = {}; + contextKey = 'waypoints-context-id'; + resizeEvent = 'resize.waypoints'; + scrollEvent = 'scroll.waypoints'; + waypointCounter = 1; + waypointKey = 'waypoints-waypoint-ids'; + wp = 'waypoint'; + wps = 'waypoints'; + Context = (function() { + + function Context($element) { + var _this = this; + this.$element = $element; + this.element = $element[0]; + this.didResize = false; + this.didScroll = false; + this.id = 'context' + contextCounter++; + this.oldScroll = { + x: $element.scrollLeft(), + y: $element.scrollTop() + }; + this.waypoints = { + horizontal: {}, + vertical: {} + }; + $element.data(contextKey, this.id); + contexts[this.id] = this; + $element.bind(scrollEvent, function() { + var scrollHandler; + if (!(_this.didScroll || isTouch)) { + _this.didScroll = true; + scrollHandler = function() { + _this.doScroll(); + return _this.didScroll = false; + }; + return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle); + } + }); + $element.bind(resizeEvent, function() { + var resizeHandler; + if (!_this.didResize) { + _this.didResize = true; + resizeHandler = function() { + $[wps]('refresh'); + return _this.didResize = false; + }; + return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle); + } + }); + } + + Context.prototype.doScroll = function() { + var axes, + _this = this; + axes = { + horizontal: { + newScroll: this.$element.scrollLeft(), + oldScroll: this.oldScroll.x, + forward: 'right', + backward: 'left' + }, + vertical: { + newScroll: this.$element.scrollTop(), + oldScroll: this.oldScroll.y, + forward: 'down', + backward: 'up' + } + }; + if (isTouch && (!axes.vertical.oldScroll || !axes.vertical.newScroll)) { + $[wps]('refresh'); + } + $.each(axes, function(aKey, axis) { + var direction, isForward, triggered; + triggered = []; + isForward = axis.newScroll > axis.oldScroll; + direction = isForward ? axis.forward : axis.backward; + $.each(_this.waypoints[aKey], function(wKey, waypoint) { + var _ref, _ref1; + if ((axis.oldScroll < (_ref = waypoint.offset) && _ref <= axis.newScroll)) { + return triggered.push(waypoint); + } else if ((axis.newScroll < (_ref1 = waypoint.offset) && _ref1 <= axis.oldScroll)) { + return triggered.push(waypoint); + } + }); + triggered.sort(function(a, b) { + return a.offset - b.offset; + }); + if (!isForward) { + triggered.reverse(); + } + return $.each(triggered, function(i, waypoint) { + if (waypoint.options.continuous || i === triggered.length - 1) { + return waypoint.trigger([direction]); + } + }); + }); + return this.oldScroll = { + x: axes.horizontal.newScroll, + y: axes.vertical.newScroll + }; + }; + + Context.prototype.refresh = function() { + var axes, cOffset, isWin, + _this = this; + isWin = $.isWindow(this.element); + cOffset = this.$element.offset(); + this.doScroll(); + axes = { + horizontal: { + contextOffset: isWin ? 0 : cOffset.left, + contextScroll: isWin ? 0 : this.oldScroll.x, + contextDimension: this.$element.width(), + oldScroll: this.oldScroll.x, + forward: 'right', + backward: 'left', + offsetProp: 'left' + }, + vertical: { + contextOffset: isWin ? 0 : cOffset.top, + contextScroll: isWin ? 0 : this.oldScroll.y, + contextDimension: isWin ? $[wps]('viewportHeight') : this.$element.height(), + oldScroll: this.oldScroll.y, + forward: 'down', + backward: 'up', + offsetProp: 'top' + } + }; + return $.each(axes, function(aKey, axis) { + return $.each(_this.waypoints[aKey], function(i, waypoint) { + var adjustment, elementOffset, oldOffset, _ref, _ref1; + adjustment = waypoint.options.offset; + oldOffset = waypoint.offset; + elementOffset = $.isWindow(waypoint.element) ? 0 : waypoint.$element.offset()[axis.offsetProp]; + if ($.isFunction(adjustment)) { + adjustment = adjustment.apply(waypoint.element); + } else if (typeof adjustment === 'string') { + adjustment = parseFloat(adjustment); + if (waypoint.options.offset.indexOf('%') > -1) { + adjustment = Math.ceil(axis.contextDimension * adjustment / 100); + } + } + waypoint.offset = elementOffset - axis.contextOffset + axis.contextScroll - adjustment; + if ((waypoint.options.onlyOnScroll && (oldOffset != null)) || !waypoint.enabled) { + return; + } + if (oldOffset !== null && (oldOffset < (_ref = axis.oldScroll) && _ref <= waypoint.offset)) { + return waypoint.trigger([axis.backward]); + } else if (oldOffset !== null && (oldOffset > (_ref1 = axis.oldScroll) && _ref1 >= waypoint.offset)) { + return waypoint.trigger([axis.forward]); + } else if (oldOffset === null && axis.oldScroll >= waypoint.offset) { + return waypoint.trigger([axis.forward]); + } + }); + }); + }; + + Context.prototype.checkEmpty = function() { + if ($.isEmptyObject(this.waypoints.horizontal) && $.isEmptyObject(this.waypoints.vertical)) { + this.$element.unbind([resizeEvent, scrollEvent].join(' ')); + return delete contexts[this.id]; + } + }; + + return Context; + + })(); + Waypoint = (function() { + + function Waypoint($element, context, options) { + var idList, _ref; + options = $.extend({}, $.fn[wp].defaults, options); + if (options.offset === 'bottom-in-view') { + options.offset = function() { + var contextHeight; + contextHeight = $[wps]('viewportHeight'); + if (!$.isWindow(context.element)) { + contextHeight = context.$element.height(); + } + return contextHeight - $(this).outerHeight(); + }; + } + this.$element = $element; + this.element = $element[0]; + this.axis = options.horizontal ? 'horizontal' : 'vertical'; + this.callback = options.handler; + this.context = context; + this.enabled = options.enabled; + this.id = 'waypoints' + waypointCounter++; + this.offset = null; + this.options = options; + context.waypoints[this.axis][this.id] = this; + allWaypoints[this.axis][this.id] = this; + idList = (_ref = $element.data(waypointKey)) != null ? _ref : []; + idList.push(this.id); + $element.data(waypointKey, idList); + } + + Waypoint.prototype.trigger = function(args) { + if (!this.enabled) { + return; + } + if (this.callback != null) { + this.callback.apply(this.element, args); + } + if (this.options.triggerOnce) { + return this.destroy(); + } + }; + + Waypoint.prototype.disable = function() { + return this.enabled = false; + }; + + Waypoint.prototype.enable = function() { + this.context.refresh(); + return this.enabled = true; + }; + + Waypoint.prototype.destroy = function() { + delete allWaypoints[this.axis][this.id]; + delete this.context.waypoints[this.axis][this.id]; + return this.context.checkEmpty(); + }; + + Waypoint.getWaypointsByElement = function(element) { + var all, ids; + ids = $(element).data(waypointKey); + if (!ids) { + return []; + } + all = $.extend({}, allWaypoints.horizontal, allWaypoints.vertical); + return $.map(ids, function(id) { + return all[id]; + }); + }; + + return Waypoint; + + })(); + methods = { + init: function(f, options) { + var _ref; + if (options == null) { + options = {}; + } + if ((_ref = options.handler) == null) { + options.handler = f; + } + this.each(function() { + var $this, context, contextElement, _ref1; + $this = $(this); + contextElement = (_ref1 = options.context) != null ? _ref1 : $.fn[wp].defaults.context; + if (!$.isWindow(contextElement)) { + contextElement = $this.closest(contextElement); + } + contextElement = $(contextElement); + context = contexts[contextElement.data(contextKey)]; + if (!context) { + context = new Context(contextElement); + } + return new Waypoint($this, context, options); + }); + $[wps]('refresh'); + return this; + }, + disable: function() { + return methods._invoke(this, 'disable'); + }, + enable: function() { + return methods._invoke(this, 'enable'); + }, + destroy: function() { + return methods._invoke(this, 'destroy'); + }, + prev: function(axis, selector) { + return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) { + if (index > 0) { + return stack.push(waypoints[index - 1]); + } + }); + }, + next: function(axis, selector) { + return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) { + if (index < waypoints.length - 1) { + return stack.push(waypoints[index + 1]); + } + }); + }, + _traverse: function(axis, selector, push) { + var stack, waypoints; + if (axis == null) { + axis = 'vertical'; + } + if (selector == null) { + selector = window; + } + waypoints = jQMethods.aggregate(selector); + stack = []; + this.each(function() { + var index; + index = $.inArray(this, waypoints[axis]); + return push(stack, index, waypoints[axis]); + }); + return this.pushStack(stack); + }, + _invoke: function($elements, method) { + $elements.each(function() { + var waypoints; + waypoints = Waypoint.getWaypointsByElement(this); + return $.each(waypoints, function(i, waypoint) { + waypoint[method](); + return true; + }); + }); + return this; + } + }; + $.fn[wp] = function() { + var args, method; + method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if (methods[method]) { + return methods[method].apply(this, args); + } else if ($.isFunction(method)) { + return methods.init.apply(this, arguments); + } else if ($.isPlainObject(method)) { + return methods.init.apply(this, [null, method]); + } else if (!method) { + return $.error("jQuery Waypoints needs a callback function or handler option."); + } else { + return $.error("The " + method + " method does not exist in jQuery Waypoints."); + } + }; + $.fn[wp].defaults = { + context: window, + continuous: true, + enabled: true, + horizontal: false, + offset: 0, + triggerOnce: false + }; + jQMethods = { + refresh: function() { + return $.each(contexts, function(i, context) { + return context.refresh(); + }); + }, + viewportHeight: function() { + var _ref; + return (_ref = window.innerHeight) != null ? _ref : $w.height(); + }, + aggregate: function(contextSelector) { + var collection, waypoints, _ref; + collection = allWaypoints; + if (contextSelector) { + collection = (_ref = contexts[$(contextSelector).data(contextKey)]) != null ? _ref.waypoints : void 0; + } + if (!collection) { + return []; + } + waypoints = { + horizontal: [], + vertical: [] + }; + $.each(waypoints, function(axis, arr) { + $.each(collection[axis], function(key, waypoint) { + return arr.push(waypoint); + }); + arr.sort(function(a, b) { + return a.offset - b.offset; + }); + waypoints[axis] = $.map(arr, function(waypoint) { + return waypoint.element; + }); + return waypoints[axis] = $.unique(waypoints[axis]); + }); + return waypoints; + }, + above: function(contextSelector) { + if (contextSelector == null) { + contextSelector = window; + } + return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) { + return waypoint.offset <= context.oldScroll.y; + }); + }, + below: function(contextSelector) { + if (contextSelector == null) { + contextSelector = window; + } + return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) { + return waypoint.offset > context.oldScroll.y; + }); + }, + left: function(contextSelector) { + if (contextSelector == null) { + contextSelector = window; + } + return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) { + return waypoint.offset <= context.oldScroll.x; + }); + }, + right: function(contextSelector) { + if (contextSelector == null) { + contextSelector = window; + } + return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) { + return waypoint.offset > context.oldScroll.x; + }); + }, + enable: function() { + return jQMethods._invoke('enable'); + }, + disable: function() { + return jQMethods._invoke('disable'); + }, + destroy: function() { + return jQMethods._invoke('destroy'); + }, + extendFn: function(methodName, f) { + return methods[methodName] = f; + }, + _invoke: function(method) { + var waypoints; + waypoints = $.extend({}, allWaypoints.vertical, allWaypoints.horizontal); + return $.each(waypoints, function(key, waypoint) { + waypoint[method](); + return true; + }); + }, + _filter: function(selector, axis, test) { + var context, waypoints; + context = contexts[$(selector).data(contextKey)]; + if (!context) { + return []; + } + waypoints = []; + $.each(context.waypoints[axis], function(i, waypoint) { + if (test(context, waypoint)) { + return waypoints.push(waypoint); + } + }); + waypoints.sort(function(a, b) { + return a.offset - b.offset; + }); + return $.map(waypoints, function(waypoint) { + return waypoint.element; + }); + } + }; + $[wps] = function() { + var args, method; + method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if (jQMethods[method]) { + return jQMethods[method].apply(null, args); + } else { + return jQMethods.aggregate.call(null, method); + } + }; + $[wps].settings = { + resizeThrottle: 10, + scrollThrottle: 10 + }; + return $w.load(function() { + return $[wps]('refresh'); + }); + }); + +}).call(this); diff --git a/_include/php/.DS_Store b/_include/php/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/_include/php/.DS_Store differ diff --git a/_include/php/contact.php b/_include/php/contact.php new file mode 100644 index 0000000..01d9013 --- /dev/null +++ b/_include/php/contact.php @@ -0,0 +1,108 @@ +name = stripslashes($details['name']); + $this->email = trim($details['email']); + $this->subject = 'HPからのお問い合わせ'; // + $this->message = stripslashes($details['message']); + + $this->email_admin = $email_admin; + $this->message_min_length = $message_min_length; + + $this->response_status = 1; + $this->response_html = ''; + } + + + private function validateEmail(){ + $regex = '/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i'; + + if($this->email == '') { + return false; + } else { + $string = preg_replace($regex, '', $this->email); + } + + return empty($string) ? true : false; + } + + + private function validateFields(){ + // Check name + if(!$this->name) + { + $this->response_html .= '
お名前を入力してください。
'; + $this->response_status = 0; + } + + // Check email + if(!$this->email) + { + $this->response_html .= 'メールアドレスを入力してください。
'; + $this->response_status = 0; + } + + // Check valid email + if($this->email && !$this->validateEmail()) + { + $this->response_html .= 'Please enter a valid e-mail address
'; + $this->response_status = 0; + } + + // Check message length + if(!$this->message || strlen($this->message) < $this->message_min_length) + { + $this->response_html .= 'お問い合わせ内容を '.$this->message_min_length.' 文字以上入力してください。
'; + $this->response_status = 0; + } + } + + + private function sendEmail(){ + $mail = mail($this->email_admin, $this->subject, $this->message, + "From: ".$this->name." <".$this->email.">\r\n" + ."Reply-To: ".$this->email."\r\n" + ."X-Mailer: PHP/" . phpversion()); + + if($mail) + { + $this->response_status = 1; + $this->response_html = 'Thank You!
'; + } + } + + + function sendRequest(){ + $this->validateFields(); + if($this->response_status) + { + $this->sendEmail(); + } + + $response = array(); + $response['status'] = $this->response_status; + $response['html'] = $this->response_html; + + echo json_encode($response); + } +} + + +$contact_form = new Contact_Form($_POST, $admin_email, $message_min_length); +$contact_form->sendRequest(); + +?> \ No newline at end of file