diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index cd55ed0158fb..53ef1345dcc1 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -519,7 +519,8 @@ class AccountController extends \BaseController { { return "taken"; } - else { + else + { return "available"; } } @@ -537,7 +538,7 @@ class AccountController extends \BaseController { if ($validator->fails()) { - return Redirect::to(Input::get('path')); + return ''; } $user = Auth::user(); @@ -556,15 +557,6 @@ class AccountController extends \BaseController { $activity->save(); } - /* - Mail::send(array('html'=>'emails.welcome_html','text'=>'emails.welcome_text'), $data, function($message) use ($user) - { - $message->from('hillelcoren@gmail.com', 'Hillel Coren'); - $message->to($user->email); - }); - */ - - Session::flash('message', 'Successfully registered'); - return Redirect::to(Input::get('path'))->with('clearGuestKey', true); + return "{$user->first_name} {$user->last_name}"; } } \ No newline at end of file diff --git a/app/handlers/UserEventHandler.php b/app/handlers/UserEventHandler.php index 92e97c8c26bd..31753f6a0157 100755 --- a/app/handlers/UserEventHandler.php +++ b/app/handlers/UserEventHandler.php @@ -12,7 +12,7 @@ class UserEventHandler public function onSignup() { - dd('user signed up'); + } public function onLogin() diff --git a/app/libraries/utils.php b/app/libraries/utils.php index 903d383ea4a2..7b4e8e8052c6 100755 --- a/app/libraries/utils.php +++ b/app/libraries/utils.php @@ -23,6 +23,7 @@ class Utils $data = [ 'context' => $context, 'user_id' => Auth::check() ? Auth::user()->id : 0, + 'user_name' => Auth::check() ? Auth::user()->getDisplayName() : '', 'url' => Input::get('url', Request::url()), 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', 'ip' => Request::getClientIp(), diff --git a/app/ninja/mailers/ContactMailer.php b/app/ninja/mailers/ContactMailer.php index 82530d3d72c9..d1c1fed440fb 100755 --- a/app/ninja/mailers/ContactMailer.php +++ b/app/ninja/mailers/ContactMailer.php @@ -54,7 +54,7 @@ class ContactMailer extends Mailer { public function sendPaymentConfirmation(Payment $payment) { $view = 'payment_confirmation'; - $subject = 'Payment confirmation'; + $subject = 'Payment Received ' . $payment->invoice->invoice_number; $data = [ 'accountName' => $payment->account->getDisplayName(), diff --git a/app/ninja/mailers/UserMailer.php b/app/ninja/mailers/UserMailer.php index 3ae01e140713..42e6f1b56281 100755 --- a/app/ninja/mailers/UserMailer.php +++ b/app/ninja/mailers/UserMailer.php @@ -31,8 +31,20 @@ class UserMailer extends Mailer { $data['paymentAmount'] = Utils::formatMoney($payment->amount, $invoice->client->currency_id); } - $prep = $type == 'sent' ? 'to' : 'by'; - $subject = "Invoice {$invoice->invoice_number} was $type $prep {$invoice->client->getDisplayName()}"; + if ($type == 'paid') + { + $action = 'paid by'; + } + else if ($type == 'sent') + { + $subject = 'sent to'; + } + else + { + $subject = 'viewed by'; + } + + $subject = "Invoice {$invoice->invoice_number} was $action {$invoice->client->getDisplayName()}"; $this->sendTo($user->email, CONTACT_EMAIL, $subject, $view, $data); } diff --git a/app/routes.php b/app/routes.php index d4048b4d54d7..69b21350fd0f 100755 --- a/app/routes.php +++ b/app/routes.php @@ -12,6 +12,7 @@ */ //apc_clear_cache(); +//Cache::flush(); //dd(DB::getQueryLog()); //dd(Client::getPrivateId(1)); diff --git a/app/views/accounts/settings.blade.php b/app/views/accounts/settings.blade.php index 262624222206..2cc5d71ffd6f 100755 --- a/app/views/accounts/settings.blade.php +++ b/app/views/accounts/settings.blade.php @@ -5,9 +5,9 @@ {{ Former::open()->addClass('col-md-8 col-md-offset-2') }} {{ Former::populate($account) }} - {{ Former::populateField('notify_sent', Auth::user()->notify_sent) }} - {{ Former::populateField('notify_viewed', Auth::user()->notify_viewed) }} - {{ Former::populateField('notify_paid', Auth::user()->notify_paid) }} + {{ Former::populateField('notify_sent', intval(Auth::user()->notify_sent)) }} + {{ Former::populateField('notify_viewed', intval(Auth::user()->notify_viewed)) }} + {{ Former::populateField('notify_paid', intval(Auth::user()->notify_paid)) }} {{ Former::legend('Payment Gateway') }} diff --git a/app/views/header.blade.php b/app/views/header.blade.php index 0d9eb173a451..97076a396ae3 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -1,9 +1,8 @@ @extends('master') - + @section('head') - @@ -33,12 +32,10 @@ @@ -56,8 +53,6 @@ return accounting.formatMoney(value, hide_symbol ? '' : currency.symbol, currency.precision, currency.thousand_separator, currency.decimal_separator); } - - @stop @section('body') @@ -89,17 +84,19 @@ + + + + @@ -289,7 +294,7 @@ return isFormValid; } - function submitSignUp() + function validateServerSignUp() { if (!validateSignUp(true)) { return; @@ -298,36 +303,58 @@ $('#signUpDiv, #signUpFooter').hide(); $('#working').show(); - $.ajax({ - type: 'POST', - url: '{{ URL::to('signup/validate') }}', - data: 'email=' + $('form.signUpForm #new_email').val() + '&path={{ Request::path() }}', - success: function(result) { - if (result == 'available') { - $('.signUpForm').submit(); - } else { - $('#errorTaken').show(); - $('form.signUpForm #new_email').closest('div.form-group').removeClass('has-success').addClass('has-error'); - $('#signUpDiv, #signUpFooter').show(); - $('#working').hide(); - } - } - }); + $.ajax({ + type: 'POST', + url: '{{ URL::to('signup/validate') }}', + data: 'email=' + $('form.signUpForm #new_email').val(), + success: function(result) { + if (result == 'available') { + submitSignUp(); + } else { + $('#errorTaken').show(); + $('form.signUpForm #new_email').closest('div.form-group').removeClass('has-success').addClass('has-error'); + $('#signUpDiv, #signUpFooter').show(); + $('#working').hide(); + } + } + }); } + function submitSignUp() { + $.ajax({ + type: 'POST', + url: '{{ URL::to('signup/submit') }}', + data: 'new_email=' + $('form.signUpForm #new_email').val() + + '&new_password=' + $('form.signUpForm #new_password').val() + + '&new_first_name=' + $('form.signUpForm #new_first_name').val() + + '&new_last_name=' + $('form.signUpForm #new_last_name').val(), + success: function(result) { + if (result) { + localStorage.setItem('guest_key', ''); + isRegistered = true; + $('#signUpButton').hide(); + $('#myAccountButton').html(result); + } + $('#signUpSuccessDiv, #signUpFooter').show(); + $('#working, #saveSignUpButton').hide(); + } + }); + } + function checkForEnter(event) { if (event.keyCode === 13){ event.preventDefault(); - submitSignUp(); + validateServerSignUp(); return false; } } @endif + window.isRegistered = {{ Auth::check() && Auth::user()->registered ? 'true' : 'false' }}; function logout(force) { - if (force || {{ !Auth::check() || Auth::user()->registered ? 'true' : 'false' }}) { + if (force || isRegistered) { window.location = '{{ URL::to('logout') }}'; } else { $('#logoutModal').modal('show'); @@ -365,8 +392,6 @@ if (isStorageSupported()) { @if (Auth::check() && !Auth::user()->registered) localStorage.setItem('guest_key', '{{ Auth::user()->password }}'); - @elseif (Session::get('clearGuestKey')) - localStorage.setItem('guest_key', ''); @endif } diff --git a/app/views/master.blade.php b/app/views/master.blade.php index 5f0c301d264d..b5b12dcf9b0f 100755 --- a/app/views/master.blade.php +++ b/app/views/master.blade.php @@ -4,6 +4,7 @@ + diff --git a/app/views/splash.blade.php b/app/views/splash.blade.php index ca90fd3b9b25..a34ce37f764a 100755 --- a/app/views/splash.blade.php +++ b/app/views/splash.blade.php @@ -1,95 +1,218 @@ @extends('master') -@section('body') - +@section('head') + + + + + + +@stop - -
-
-

Hello, world!

-

This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.

-

- {{ Form::open(array('url' => 'get_started')) }} - {{ Form::hidden('guest_key') }} - {{ Button::lg_primary_submit('Get Started »') }} - {{ Form::close() }} -

+@section('body') + +{{ Form::open(array('url' => 'get_started', 'id' => 'startForm')) }} +{{ Form::hidden('guest_key') }} +{{ Form::close() }} + + + + + +
+
- -
-
-

Heading

-

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

-

View details »

+
+
+
+

THE SIMPLE & + FREE WAY TO INVOICE + CLIENTS

+

It's just that easy. Stop spending time on + complicated and expensive invoicing.
+ No fuss, just get started and get paid.

+
+
+
-
-

Heading

-

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

-

View details »

-
-
-

Heading

-

Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

-

View details »

+ + -
+
-
+
+
+
+
+
+
+

100% free (ALWAYS)

+

Donec id elit non mi porta gravida at eget metus. + Fusce dapibus, tellus ac cursus commodo, tortor mauris + condimentum nibh, ut fermentum massa justo sit amet + risus. Etiam porta sem malesuada magna mollis euismod. + Donec sed odio dui.

+
+
-
-

© Company 2013

-
+
+
+
+

100% free (ALWAYS)

+

Donec id elit non mi porta gravida at eget metus. + Fusce dapibus, tellus ac cursus commodo, tortor mauris + condimentum nibh, ut fermentum massa justo sit amet + risus. Etiam porta sem malesuada magna mollis euismod. + Donec sed odio dui.

+
+
- +
+ +
+ + + @stop \ No newline at end of file diff --git a/public/css/splash.css b/public/css/splash.css new file mode 100644 index 000000000000..3a9634a414eb --- /dev/null +++ b/public/css/splash.css @@ -0,0 +1,357 @@ +body { + font-family: 'Roboto Slab', serif; + line-height: 1.6; +} + +.center-block { margin: 0 auto!; float: none; } + +h1, h2 { +font-family: 'Roboto', sans-serif; +font-weight: 900; +line-height: 1.1; +text-transform: uppercase; +color: #1a1818; +} +h1 { +font-size: 45px; +} +h2 { +font-size: 20px; +} +a, a .cta h2, .socicon { +-webkit-transition: all 0.3s ease-in-out; + -moz-transition: all 0.3s ease-in-out; + -o-transition: all 0.3s ease-in-out; + transition: all 0.3s ease-in-out; +} +a:hover { +text-decoration: none; +} + +.navbar { + background: #2e2b2b; + padding: 30px 0; +} +ul.navbar-list { + float: right; + list-style-type: none; + height: 26px; + margin: 0; + padding: 0; +} +ul.navbar-list li { + display: inline; + font-family: 'Roboto', sans-serif; + font-weight: 700; + margin: 40px 0; +} +ul.navbar-list li a { + color: #fff; + padding-left: 20px; + margin-left: 20px; + border-left: 1px solid #4f4b4b; +} +ul.navbar-list li:last-child a{ + color: #ebbe09; +} +ul.navbar-list li:first-child a{ + border-left: none; + margin: 0; + padding: 0; +} +ul.navbar-list li a:hover { + color: #ebbe09; + text-decoration: none; +} + +a .cta h2 { + width: 100%; + height: 63px; + line-height: 63px; + background: #edd71e; + display: inline-block; + color: #1a1818; + text-align: center; + float: left; + margin: 0; +} +a .cta h2 span { + width: 63px; + height: 63px; + line-height: 63px; + color: #fff; + background: #ebbe09; + text-align: center; + float: right; + font-weight: 700; + font-size: 20px; + font-family: 'Roboto', sans-serif; + -webkit-transition: all 0.1s ease-in-out; + -moz-transition: all 0.1s ease-in-out; + -o-transition: all 0.1s ease-in-out; + transition: all 0.1s ease-in-out; +} +a .cta:hover span { + font-size: 40px; + background: #f2c40a; +} + +.hero { + background-image: url(/images/hero-bg-1.jpg); +} +.hero .caption-side { + background: #fff; + width: 50%; + padding-right: 15px; + position: absolute; + left: 0; + height: 212px; + margin-top: 100px; +} + +.hero .caption { + width: 61.5%; + background: #fff; + padding-right: 15px; + position: relative; + padding: 10px 35px 20px 35px; + height: 212px; + border-left: 1px dotted #ccc; + margin-top: 100px; +} +.hero2 { + text-align: center; + background-image: url(/images/hero-bg-2.jpg); + padding: 225px 0; + background-repeat: no-repeat; + background-position: bottom center; + background-size: cover; +} +.hero2 h1 { + color: #fff; + margin: 0; +} +.background { + background-repeat: no-repeat; + background-position: top center; + background-attachment: fixed; + background-size: cover; + min-height: 500px; +} +section.features, section.upper-footer { +margin: 60px 0; +} + +section.features .col-md-3 .box{ + padding: 20px; + background: #ebbe09; + text-align: center; + color: #fff; +} +section.features .col-md-3.two .box{ background: #36c157; } +section.features .col-md-3.three .box{ background: #e27329; } +section.features .col-md-3.four .box{ background: #2299c0; } +section.features h2 { +margin: 30px 0 15px; +color: #fff; +} +section.features .col-md-3 .box .icon { +margin-left: -20px; +margin-top: -20px; + +text-align: left; +} +section.blue { + background: #2299c0; + color: #fff; +} +section.blue .col-md-6 { + text-align: center; +} +section.blue .col-md-6:last-child h1 { + border-left: none; +} +section.blue .col-md-6 h1 { + border-left: 1px dotted #46b9df; + border-right: 1px dotted #46b9df; + color: #fff; + line-height: 1.2; + padding: 100px 0; + margin: 0; +} +section.blue .col-md-6 h1 span { + font-size: 36px; + font-weight: 100; + display: block; + text-transform: lowercase; +} + +footer .navbar-inner { + float: right; +} +footer ul.navbar-list { + clear: both; +} +footer ul.navbar-list:last-child { + margin-top: 5px; +} +footer ul.navbar-list:last-child li { + font-size: 12px; +} +footer ul.navbar-list:last-child li { + font-size: 12px; +} +footer ul.navbar-list:last-child li:last-child a{ + color: #fff; +} +footer .social { + float: left; +} +footer .social .socicon { + font-family: 'socicon' !important; + font-size: 25px; + margin-right: 8px; +} +footer .social .socicon { + color: #fff; +} +footer .social .socicon:hover { + color: #edd71e; +} +footer .social p { + font-size: 12px; + font-family: 'Roboto', sans-serif; + margin: 0; +} + +@media (min-width: 768px) and (max-width: 1200px) { + .hero .caption-side { + background: #fff; + width: 50%; + padding-right: 15px; + position: absolute; + left: 0; + height: 283px; + margin-top: 70px; +} + +.hero .caption { + width: 61.3%; + background: #fff; + padding-right: 15px; + position: relative; + padding: 10px 35px 20px 35px; + height: 283px; + border-left: 1px dotted #ccc; + margin-top: 70px; +} +} + +@media (min-width: 768px) and (max-width: 992px) { +.features .col-md-3 { +width: 50%; +float: left; +margin-bottom: 10px; +} +.hero .caption-side { + display:none; + } + .hero .caption { + width: 100%; + background: #fff; + padding: 10px 35px 20px 35px; + height: auto; + border-left: none; + margin-bottom: 10px; + text-align: center; + } +} + + +@media (max-width: 768px) { + + h1 { + font-size: 30px; + } + + .navbar { + text-align: center; + padding: 25px 0 18px 0; + } + ul.navbar-list { + float: none; + margin-top: 10px; + } + + .hero .caption-side { + display:none; + } + .hero .caption { + width: 100%; + background: #fff; + padding: 10px 35px 20px 35px; + height: auto; + border-left: none; + margin-top: 0px; + margin-bottom: 10px; + text-align: center; + } + .hero2 { + padding: 50px 0; +} + .background { + background-attachment: scroll; + background-size: cover; + background-position: bottom center; + background-repeat: repeat; + min-height: 1px; + padding: 50px 0; + } + section.features, section.upper-footer { +margin: 30px 0; +} + +section.features .col-md-3 .box{ +margin-bottom: 10px; +} +section.blue .col-md-6 h1 { + border-left: none; + border-right: none; + border-top: 1px dotted #46b9df; + padding: 30px 0; +} +section.blue .col-md-6 h1 span { + font-size: 25px; + font-weight: 100; + display: block; + text-transform: lowercase; +} +footer .navbar-inner { + float: none; +} +footer ul.navbar-list:last-child { + height: auto; +} +footer .social { + float: none; + margin-bottom: 10px; +} +footer .social .socicon { + margin-right: 8px; +} + +} + +@font-face { + font-family: 'socicon'; + src: url('/fonts/socicon-webfont.eot'); + src: url('/fonts/socicon-webfont.eot?#iefix') format('embedded-opentype'), + url('/fonts/socicon-webfont.woff') format('woff'), + url('/fonts/socicon-webfont.ttf') format('truetype'), + url('/fonts/socicon-webfont.svg#sociconregular') format('svg'); + font-weight: normal; + font-style: normal; +} + +::selection {color:#fff;background:#2e2b2b;} +::-moz-selection {color:#fff;background:#2e2b2b;} \ No newline at end of file diff --git a/public/fonts/socicon-webfont.eot b/public/fonts/socicon-webfont.eot new file mode 100644 index 000000000000..aa40e699afa2 Binary files /dev/null and b/public/fonts/socicon-webfont.eot differ diff --git a/public/fonts/socicon-webfont.svg b/public/fonts/socicon-webfont.svg new file mode 100644 index 000000000000..c4e6e372acf3 --- /dev/null +++ b/public/fonts/socicon-webfont.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/fonts/socicon-webfont.ttf b/public/fonts/socicon-webfont.ttf new file mode 100644 index 000000000000..379d1e43d378 Binary files /dev/null and b/public/fonts/socicon-webfont.ttf differ diff --git a/public/fonts/socicon-webfont.woff b/public/fonts/socicon-webfont.woff new file mode 100644 index 000000000000..9beda4d27051 Binary files /dev/null and b/public/fonts/socicon-webfont.woff differ diff --git a/public/images/apple-touch-icon-114x114-precomposed.png b/public/images/apple-touch-icon-114x114-precomposed.png new file mode 100644 index 000000000000..5e5d7b05bd3a Binary files /dev/null and b/public/images/apple-touch-icon-114x114-precomposed.png differ diff --git a/public/images/apple-touch-icon-144x144-precomposed.png b/public/images/apple-touch-icon-144x144-precomposed.png new file mode 100644 index 000000000000..629bd15eeea4 Binary files /dev/null and b/public/images/apple-touch-icon-144x144-precomposed.png differ diff --git a/public/images/apple-touch-icon-57x57-precomposed.png b/public/images/apple-touch-icon-57x57-precomposed.png new file mode 100644 index 000000000000..8d00a6088391 Binary files /dev/null and b/public/images/apple-touch-icon-57x57-precomposed.png differ diff --git a/public/images/apple-touch-icon-72x72-precomposed.png b/public/images/apple-touch-icon-72x72-precomposed.png new file mode 100644 index 000000000000..d52590a6ac25 Binary files /dev/null and b/public/images/apple-touch-icon-72x72-precomposed.png differ diff --git a/public/images/apple-touch-icon.png b/public/images/apple-touch-icon.png new file mode 100644 index 000000000000..be2bee4ca5a9 Binary files /dev/null and b/public/images/apple-touch-icon.png differ diff --git a/public/images/favicon.ico b/public/images/favicon.ico new file mode 100644 index 000000000000..59e144e025aa Binary files /dev/null and b/public/images/favicon.ico differ diff --git a/public/images/hero-bg-1.jpg b/public/images/hero-bg-1.jpg new file mode 100644 index 000000000000..ff2c8854a334 Binary files /dev/null and b/public/images/hero-bg-1.jpg differ diff --git a/public/images/hero-bg-2.jpg b/public/images/hero-bg-2.jpg new file mode 100644 index 000000000000..e8f65e04adf2 Binary files /dev/null and b/public/images/hero-bg-2.jpg differ diff --git a/public/images/icon-free.png b/public/images/icon-free.png new file mode 100644 index 000000000000..a58f6989daab Binary files /dev/null and b/public/images/icon-free.png differ diff --git a/public/images/icon-free@2x.png b/public/images/icon-free@2x.png new file mode 100644 index 000000000000..a933cb1e3b5a Binary files /dev/null and b/public/images/icon-free@2x.png differ diff --git a/public/images/icon-opensource.png b/public/images/icon-opensource.png new file mode 100644 index 000000000000..652e90eefa37 Binary files /dev/null and b/public/images/icon-opensource.png differ diff --git a/public/images/icon-opensource@2x.png b/public/images/icon-opensource@2x.png new file mode 100644 index 000000000000..3997bbab1bc1 Binary files /dev/null and b/public/images/icon-opensource@2x.png differ diff --git a/public/images/icon-payment.png b/public/images/icon-payment.png new file mode 100644 index 000000000000..be1ddfc42614 Binary files /dev/null and b/public/images/icon-payment.png differ diff --git a/public/images/icon-payment@2x.png b/public/images/icon-payment@2x.png new file mode 100644 index 000000000000..f2df51330aae Binary files /dev/null and b/public/images/icon-payment@2x.png differ diff --git a/public/images/icon-pdf.png b/public/images/icon-pdf.png new file mode 100644 index 000000000000..93424d33b229 Binary files /dev/null and b/public/images/icon-pdf.png differ diff --git a/public/images/icon-pdf@2x.png b/public/images/icon-pdf@2x.png new file mode 100644 index 000000000000..ae578dbf19c5 Binary files /dev/null and b/public/images/icon-pdf@2x.png differ diff --git a/public/images/invoiceninja-logo.png b/public/images/invoiceninja-logo.png new file mode 100644 index 000000000000..ffa6cfdee246 Binary files /dev/null and b/public/images/invoiceninja-logo.png differ diff --git a/public/images/invoiceninja-logo@2x.png b/public/images/invoiceninja-logo@2x.png new file mode 100644 index 000000000000..a464e0df34b6 Binary files /dev/null and b/public/images/invoiceninja-logo@2x.png differ diff --git a/public/js/retina-1.1.0.min.js b/public/js/retina-1.1.0.min.js new file mode 100644 index 000000000000..ba702b82ed72 --- /dev/null +++ b/public/js/retina-1.1.0.min.js @@ -0,0 +1,10 @@ +/*! + * Retina.js v1.1.0 + * + * Copyright 2013 Imulus, LLC + * Released under the MIT license + * + * Retina.js is an open source script that makes it easy to serve + * high-resolution images to devices with retina displays. + */ +(function(){var root=typeof exports=="undefined"?window:exports;var config={check_mime_type:true};root.Retina=Retina;function Retina(){}Retina.configure=function(options){if(options==null)options={};for(var prop in options)config[prop]=options[prop]};Retina.init=function(context){if(context==null)context=root;var existing_onload=context.onload||new Function;context.onload=function(){var images=document.getElementsByTagName("img"),retinaImages=[],i,image;for(i=0;i1)return true;if(root.matchMedia&&root.matchMedia(mediaQuery).matches)return true;return false};root.RetinaImagePath=RetinaImagePath;function RetinaImagePath(path,at_2x_path){this.path=path;if(typeof at_2x_path!=="undefined"&&at_2x_path!==null){this.at_2x_path=at_2x_path;this.perform_check=false}else{this.at_2x_path=path.replace(/\.\w+$/,function(match){return"@2x"+match});this.perform_check=true}}RetinaImagePath.confirmed_paths=[];RetinaImagePath.prototype.is_external=function(){return!!(this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain))};RetinaImagePath.prototype.check_2x_variant=function(callback){var http,that=this;if(this.is_external()){return callback(false)}else if(!this.perform_check&&typeof this.at_2x_path!=="undefined"&&this.at_2x_path!==null){return callback(true)}else if(this.at_2x_path in RetinaImagePath.confirmed_paths){return callback(true)}else{http=new XMLHttpRequest;http.open("HEAD",this.at_2x_path);http.onreadystatechange=function(){if(http.readyState!=4){return callback(false)}if(http.status>=200&&http.status<=399){if(config.check_mime_type){var type=http.getResponseHeader("Content-Type");if(type==null||!type.match(/^image/i)){return callback(false)}}RetinaImagePath.confirmed_paths.push(that.at_2x_path);return callback(true)}else{return callback(false)}};http.send()}};function RetinaImage(el){this.el=el;this.path=new RetinaImagePath(this.el.getAttribute("src"),this.el.getAttribute("data-at2x"));var that=this;this.path.check_2x_variant(function(hasVariant){if(hasVariant)that.swap()})}root.RetinaImage=RetinaImage;RetinaImage.prototype.swap=function(path){if(typeof path=="undefined")path=this.path.at_2x_path;var that=this;function load(){if(!that.el.complete){setTimeout(load,5)}else{that.el.setAttribute("width",that.el.offsetWidth);that.el.setAttribute("height",that.el.offsetHeight);that.el.setAttribute("src",path)}}load()};if(Retina.isRetina()){Retina.init(root)}})(); \ No newline at end of file