helios 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +82 -37
- data/README.md +16 -0
- data/bin/helios +4 -0
- data/example/Gemfile +7 -0
- data/example/Gemfile.lock +149 -0
- data/example/Procfile +1 -0
- data/example/Sample.xcdatamodeld/Sample.xcdatamodel/contents +23 -0
- data/example/config.ru +6 -0
- data/helios.gemspec +17 -7
- data/lib/helios.rb +15 -1
- data/lib/helios/backend.rb +46 -0
- data/lib/helios/backend/data.rb +36 -0
- data/lib/helios/backend/in-app-purchase.rb +33 -0
- data/lib/helios/backend/passbook.rb +25 -0
- data/lib/helios/backend/push-notification.rb +90 -0
- data/lib/helios/commands.rb +1 -0
- data/lib/helios/commands/new.rb +27 -0
- data/lib/helios/frontend.rb +56 -0
- data/lib/helios/frontend/images/data.png +0 -0
- data/lib/helios/frontend/images/data.svg +1 -0
- data/lib/helios/frontend/images/in-app-purchase.png +0 -0
- data/lib/helios/frontend/images/in-app-purchase.svg +1 -0
- data/lib/helios/frontend/images/passbook.png +0 -0
- data/lib/helios/frontend/images/passbook.svg +1 -0
- data/lib/helios/frontend/images/push-notification.png +0 -0
- data/lib/helios/frontend/images/push-notification.svg +1 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.alerts.js +50 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.clearing.js +478 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.cookie.js +74 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.dropdown.js +122 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.forms.js +403 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.joyride.js +613 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.js +331 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.magellan.js +130 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.orbit.js +355 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.placeholder.js +159 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.reveal.js +272 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.section.js +183 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.tooltips.js +195 -0
- data/lib/helios/frontend/javascripts/foundation/foundation.topbar.js +208 -0
- data/lib/helios/frontend/javascripts/helios.coffee +48 -0
- data/lib/helios/frontend/javascripts/helios/collections.coffee +30 -0
- data/lib/helios/frontend/javascripts/helios/models.coffee +23 -0
- data/lib/helios/frontend/javascripts/helios/router.coffee +52 -0
- data/lib/helios/frontend/javascripts/helios/views.coffee +92 -0
- data/lib/helios/frontend/javascripts/vendor/backbone.datagrid.js +662 -0
- data/lib/helios/frontend/javascripts/vendor/backbone.js +1487 -0
- data/lib/helios/frontend/javascripts/vendor/jquery.js +9597 -0
- data/lib/helios/frontend/javascripts/vendor/underscore.js +1227 -0
- data/lib/helios/frontend/stylesheets/_settings.scss +988 -0
- data/lib/helios/frontend/stylesheets/screen.sass +98 -0
- data/lib/helios/frontend/templates/data/entities.hbs +7 -0
- data/lib/helios/frontend/templates/data/entity.hbs +17 -0
- data/lib/helios/frontend/templates/in-app-purchase/receipt.hbs +53 -0
- data/lib/helios/frontend/templates/in-app-purchase/receipts.hbs +39 -0
- data/lib/helios/frontend/templates/passbook/passes.hbs +25 -0
- data/lib/helios/frontend/templates/push-notification/device.hbs +35 -0
- data/lib/helios/frontend/templates/push-notification/devices.hbs +37 -0
- data/lib/helios/frontend/views/devices.jst.tpl +3 -0
- data/lib/helios/frontend/views/entities.jst.tpl +9 -0
- data/lib/helios/frontend/views/index.haml +30 -0
- data/lib/helios/frontend/views/passes.jst.tpl +3 -0
- data/lib/helios/frontend/views/receipts.jst.tpl +3 -0
- data/lib/helios/templates/Gemfile.erb +7 -0
- data/lib/helios/templates/Procfile.erb +1 -0
- data/lib/helios/templates/README.md.erb +9 -0
- data/lib/helios/templates/config.ru.erb +6 -0
- data/lib/helios/version.rb +3 -0
- metadata +199 -26
data/lib/helios.rb
CHANGED
@@ -1,3 +1,17 @@
|
|
1
1
|
module Helios
|
2
|
-
|
2
|
+
class Helios::Application < Rack::Builder
|
3
|
+
def initialize(app = nil, options = {}, &block)
|
4
|
+
super(app, &block)
|
5
|
+
|
6
|
+
map = {}
|
7
|
+
map['/admin'] = Helios::Frontend.new if options.fetch(:frontend, true)
|
8
|
+
map['/'] = Helios::Backend.new(&block)
|
9
|
+
|
10
|
+
run Rack::URLMap.new map
|
11
|
+
end
|
12
|
+
end
|
3
13
|
end
|
14
|
+
|
15
|
+
require 'helios/backend'
|
16
|
+
require 'helios/frontend'
|
17
|
+
require 'helios/version'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rack'
|
2
|
+
|
3
|
+
module Helios
|
4
|
+
class Backend < Rack::Cascade
|
5
|
+
def initialize(&block)
|
6
|
+
@services = []
|
7
|
+
|
8
|
+
block = lambda { |app|
|
9
|
+
service :data, model: Dir['**/*.xcdatamodeld'].first
|
10
|
+
service :push_notification
|
11
|
+
service :in_app_purchase
|
12
|
+
service :passbook
|
13
|
+
} unless block_given?
|
14
|
+
|
15
|
+
instance_eval(&block)
|
16
|
+
|
17
|
+
super(@services)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def service(identifier, options = {}, &block)
|
23
|
+
middleware = case identifier
|
24
|
+
when :data
|
25
|
+
Helios::Backend::Data.new(options[:model]) if options[:model]
|
26
|
+
when :push_notification
|
27
|
+
Helios::Backend::PushNotification.new
|
28
|
+
when :in_app_purchase
|
29
|
+
Helios::Backend::InAppPurchase.new
|
30
|
+
when :passbook
|
31
|
+
Helios::Backend::Passbook.new
|
32
|
+
else
|
33
|
+
raise ArgumentError, "Unknown service #{identifer}"
|
34
|
+
end
|
35
|
+
|
36
|
+
# middleware.set :frontend, options.fetch(:frontend, true)
|
37
|
+
|
38
|
+
@services << middleware if middleware
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
require 'helios/backend/data'
|
44
|
+
require 'helios/backend/push-notification'
|
45
|
+
require 'helios/backend/in-app-purchase'
|
46
|
+
require 'helios/backend/passbook'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rack/core-data'
|
2
|
+
|
3
|
+
class Helios::Backend::Data < Sinatra::Base
|
4
|
+
use Rack::PostBodyContentTypeParser
|
5
|
+
|
6
|
+
def initialize(xcdatamodel)
|
7
|
+
super(Rack::CoreData(xcdatamodel))
|
8
|
+
|
9
|
+
@model = Rack::CoreData::DataModel.new(xcdatamodel)
|
10
|
+
end
|
11
|
+
|
12
|
+
before do
|
13
|
+
content_type :json
|
14
|
+
end
|
15
|
+
|
16
|
+
helpers Sinatra::Param
|
17
|
+
|
18
|
+
options '/' do
|
19
|
+
pass unless settings.frontend rescue false
|
20
|
+
|
21
|
+
links = []
|
22
|
+
@model.entities.each do |entity|
|
23
|
+
links << %{</#{entity.name.downcase.pluralize}>; rel="resource"}
|
24
|
+
end
|
25
|
+
|
26
|
+
response['Link'] = links.join("\n")
|
27
|
+
|
28
|
+
@model.entities.collect{ |entity|
|
29
|
+
{
|
30
|
+
name: entity.name,
|
31
|
+
url: "/#{entity.name.downcase.pluralize}",
|
32
|
+
attributes: Hash[entity.attributes.collect{|attribute| [attribute.name, attribute.type]}]
|
33
|
+
}
|
34
|
+
}.to_json
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rack/in-app-purchase'
|
2
|
+
|
3
|
+
class Helios::Backend::InAppPurchase < Rack::InAppPurchase
|
4
|
+
use Rack::PostBodyContentTypeParser
|
5
|
+
|
6
|
+
before do
|
7
|
+
content_type :json
|
8
|
+
end
|
9
|
+
|
10
|
+
helpers Sinatra::Param
|
11
|
+
|
12
|
+
get '/receipts' do
|
13
|
+
receipts = Rack::InAppPurchase::Receipt.dataset
|
14
|
+
|
15
|
+
if params[:page] or params[:per_page]
|
16
|
+
param :page, Integer, default: 1, min: 1
|
17
|
+
param :per_page, Integer, default: 100, in: (1..100)
|
18
|
+
|
19
|
+
{
|
20
|
+
receipts: receipts.limit(params[:per_page], (params[:page] - 1) * params[:per_page]).naked.all,
|
21
|
+
page: params[:page],
|
22
|
+
total: receipts.count
|
23
|
+
}.to_json
|
24
|
+
else
|
25
|
+
param :limit, Integer, default: 100, in: (1..100)
|
26
|
+
param :offset, Integer, default: 0, min: 0
|
27
|
+
|
28
|
+
{
|
29
|
+
receipts: receipts.limit(params[:limit], params[:offset]).naked.all
|
30
|
+
}.to_json
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rack/passbook'
|
2
|
+
|
3
|
+
class Helios::Backend::Passbook < Rack::Passbook
|
4
|
+
get '/passes' do
|
5
|
+
passes = Rack::Passbook::Pass.dataset
|
6
|
+
|
7
|
+
if params[:page] or params[:per_page]
|
8
|
+
param :page, Integer, default: 1, min: 1
|
9
|
+
param :per_page, Integer, default: 100, in: (1..100)
|
10
|
+
|
11
|
+
{
|
12
|
+
passes: passes.limit(params[:per_page], (params[:page] - 1) * params[:per_page]).naked.all,
|
13
|
+
page: params[:page],
|
14
|
+
total: passes.count
|
15
|
+
}.to_json
|
16
|
+
else
|
17
|
+
param :limit, Integer, default: 100, in: (1..100)
|
18
|
+
param :offset, Integer, default: 0, min: 0
|
19
|
+
|
20
|
+
{
|
21
|
+
passes: passes.limit(params[:limit], params[:offset]).naked.all
|
22
|
+
}.to_json
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'rack/push-notification'
|
2
|
+
|
3
|
+
class Helios::Backend::PushNotification < Rack::PushNotification
|
4
|
+
get '/devices/?' do
|
5
|
+
param :q, String
|
6
|
+
|
7
|
+
devices = ::Rack::PushNotification::Device.dataset
|
8
|
+
devices = devices.filter("tsv @@ to_tsquery('english', ?)", "#{params[:q]}:*") if params[:q] and not params[:q].empty?
|
9
|
+
|
10
|
+
if params[:page] or params[:per_page]
|
11
|
+
param :page, Integer, default: 1, min: 1
|
12
|
+
param :per_page, Integer, default: 100, in: (1..100)
|
13
|
+
|
14
|
+
{
|
15
|
+
devices: devices.limit(params[:per_page], (params[:page] - 1) * params[:per_page]),
|
16
|
+
page: params[:page],
|
17
|
+
total: devices.count
|
18
|
+
}.to_json
|
19
|
+
else
|
20
|
+
param :limit, Integer, default: 100, in: (1..100)
|
21
|
+
param :offset, Integer, default: 0, min: 0
|
22
|
+
|
23
|
+
{
|
24
|
+
devices: devices.limit(params[:limit], params[:offset])
|
25
|
+
}.to_json
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
get '/devices/:token/?' do
|
30
|
+
record = ::Rack::PushNotification::Device.find(token: params[:token])
|
31
|
+
|
32
|
+
if record
|
33
|
+
{device: record}.to_json
|
34
|
+
else
|
35
|
+
status 404
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
head '/message' do
|
40
|
+
status 503 and return unless client
|
41
|
+
|
42
|
+
status 204
|
43
|
+
end
|
44
|
+
|
45
|
+
post '/message' do
|
46
|
+
status 503 and return unless client
|
47
|
+
|
48
|
+
param :payload, String, empty: false
|
49
|
+
param :tokens, Array, empty: false
|
50
|
+
|
51
|
+
tokens = params[:tokens] || ::Rack::PushNotification::Device.all.collect(&:token)
|
52
|
+
|
53
|
+
options = JSON.parse(params[:payload])
|
54
|
+
options[:alert] = options["aps"]["alert"]
|
55
|
+
options[:badge] = options["aps"]["badge"]
|
56
|
+
options[:sound] = options["aps"]["sound"]
|
57
|
+
options.delete("aps")
|
58
|
+
|
59
|
+
begin
|
60
|
+
notifications = tokens.collect{|token| Houston::Notification.new(options.update({device: token}))}
|
61
|
+
client.push(*notifications)
|
62
|
+
|
63
|
+
status 204
|
64
|
+
rescue => error
|
65
|
+
status 500
|
66
|
+
|
67
|
+
{error: error}.to_json
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def client
|
74
|
+
begin
|
75
|
+
return nil unless settings.apn_certificate and ::File.exist?(settings.apn_certificate)
|
76
|
+
|
77
|
+
client = case settings.apn_environment.to_sym
|
78
|
+
when :development
|
79
|
+
Houston::Client.development
|
80
|
+
when :production
|
81
|
+
Houston::Client.production
|
82
|
+
end
|
83
|
+
client.certificate = ::File.read(settings.apn_certificate)
|
84
|
+
|
85
|
+
return client
|
86
|
+
rescue
|
87
|
+
return nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'helios/commands/new'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
command :new do |c|
|
4
|
+
c.syntax = 'helios new path/to/app'
|
5
|
+
c.summary = 'Creates a new Helios project'
|
6
|
+
c.description = ''
|
7
|
+
|
8
|
+
c.action do |args, options|
|
9
|
+
say_error "Missing argument" and abort if args.empty?
|
10
|
+
path = args.first
|
11
|
+
app_name = path.split(/\//).last
|
12
|
+
|
13
|
+
begin
|
14
|
+
FileUtils.mkdir_p(path) and Dir.chdir(path)
|
15
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../templates/") + "*.erb", File::FNM_DOTMATCH).each do |file|
|
16
|
+
template = ERB.new(File.read(file))
|
17
|
+
|
18
|
+
log "create", File.basename(file, ".erb")
|
19
|
+
File.open(File.basename(file, ".erb"), 'w') do |f|
|
20
|
+
f.puts template.result
|
21
|
+
end
|
22
|
+
end
|
23
|
+
rescue => exception
|
24
|
+
say_error exception.message and abort
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'sinatra/assetpack'
|
3
|
+
require 'sinatra/backbone'
|
4
|
+
require 'sinatra/support'
|
5
|
+
|
6
|
+
require 'compass'
|
7
|
+
require 'zurb-foundation'
|
8
|
+
|
9
|
+
module Helios
|
10
|
+
class Frontend < Sinatra::Base
|
11
|
+
set :root, File.join(File.dirname(__FILE__), "frontend")
|
12
|
+
|
13
|
+
register Sinatra::CompassSupport
|
14
|
+
register Sinatra::AssetPack
|
15
|
+
register Sinatra::JstPages
|
16
|
+
|
17
|
+
assets do
|
18
|
+
serve '/javascripts', from: '/javascripts'
|
19
|
+
serve '/stylesheets', from: '/stylesheets'
|
20
|
+
serve '/images', from: '/images'
|
21
|
+
|
22
|
+
js :application, '/javascripts/application.js', [
|
23
|
+
'javascripts/vendor/jquery.js',
|
24
|
+
'javascripts/vendor/underscore.js',
|
25
|
+
'javascripts/vendor/backbone.js',
|
26
|
+
'javascripts/vendor/backbone.datagrid.js',
|
27
|
+
'javascripts/foundation/foundation.js',
|
28
|
+
'javascripts/foundation/*',
|
29
|
+
#'/javascripts/templates.js',
|
30
|
+
'javascripts/helios.js',
|
31
|
+
#'/javascripts/helios/*'
|
32
|
+
'javascripts/helios/models.js',
|
33
|
+
'javascripts/helios/collections.js',
|
34
|
+
'javascripts/helios/templates.js',
|
35
|
+
'javascripts/helios/views.js',
|
36
|
+
'javascripts/helios/router.js',
|
37
|
+
]
|
38
|
+
|
39
|
+
css :application, '/screenshots/application.css', [
|
40
|
+
'stylesheets/screen.css'
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
serve_jst '/javascripts/helios/templates.js'
|
45
|
+
|
46
|
+
get '' do
|
47
|
+
redirect request.fullpath + "/"
|
48
|
+
end
|
49
|
+
|
50
|
+
get '*' do
|
51
|
+
content_type :html
|
52
|
+
|
53
|
+
haml :index
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="512" height="512" viewBox="0 0 512 512" fill="#000000"><g class="svgGrid" id="svgGrid"><line stroke-width="1" stroke="#B35047" x1="32" x2="32" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="64" x2="64" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="96" x2="96" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="128" x2="128" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="160" x2="160" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="192" x2="192" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="224" x2="224" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="256" x2="256" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="288" x2="288" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="320" x2="320" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="352" x2="352" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="384" x2="384" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="416" x2="416" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="448" x2="448" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="480" x2="480" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="32" y2="32"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="64" y2="64"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="96" y2="96"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="128" y2="128"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="160" y2="160"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="192" y2="192"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="224" y2="224"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="256" y2="256"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="288" y2="288"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="320" y2="320"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="352" y2="352"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="384" y2="384"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="416" y2="416"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="448" y2="448"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="480" y2="480"></line><rect x="0" y="0" width="512" height="512" fill="none" stroke-width="1" stroke="#B35047"></rect></g><path d="M 512.00,112.00c0.00-14.205-5.024-35.38-28.958-55.589c-14.22-12.006-33.695-22.475-57.888-31.115C 379.48,8.983, 319.407,0.00, 256.00,0.00 S 132.52,8.983, 86.845,25.295c-24.192,8.64-43.668,19.109-57.887,31.115C 5.024,76.62,0.00,97.795,0.00,112.00l-0.086,0.00 l0.00,144.00 L0.00,256.00 l0.00,0.00 l-0.086,0.00 l0.00,144.00 L0.00,400.00 c0.00,14.205, 5.024,35.381, 28.958,55.59c 14.219,12.006, 33.695,22.475, 57.887,31.115C 132.519,503.018, 192.593,512.00, 256.00,512.00 s 123.48-8.982, 169.154-25.295c 24.192-8.641, 43.669-19.109, 57.888-31.115C 506.976,435.381, 512.00,414.205, 512.00,400.00L 512.00,256.00 l0.00,0.00l0.00,0.00 L 512.00,112.00 z M 115.588,83.115C 153.728,70.789, 203.593,64.00, 256.00,64.00c 52.406,0.00, 102.272,6.789, 140.411,19.115 c 37.277,12.048, 49.46,24.998, 51.416,28.885c-1.956,3.887-14.139,16.837-51.416,28.885C 358.272,153.211, 308.406,160.00, 256.00,160.00 c-52.407,0.00-102.272-6.789-140.412-19.115C 78.312,128.837, 66.129,115.887, 64.173,112.00C 66.129,108.113, 78.312,95.163, 115.588,83.115z M 396.412,428.885C 358.272,441.213, 308.407,448.00, 256.00,448.00c-52.407,0.00-102.273-6.787-140.412-19.115 C 78.311,416.838, 66.129,403.887, 64.173,400.00l-0.087,0.00 l0.00-66.62 c 7.044,3.307, 14.628,6.421, 22.759,9.325 C 132.519,359.017, 192.593,368.00, 256.00,368.00s 123.48-8.983, 169.154-25.295c 8.097-2.892, 15.652-5.993, 22.673-9.284L 447.827,400.00 C 445.871,403.887, 433.689,416.838, 396.412,428.885z M 396.412,284.885C 358.272,297.212, 308.407,304.00, 256.00,304.00 c-52.407,0.00-102.273-6.788-140.412-19.115C 78.311,272.837, 66.129,259.887, 64.173,256.00l-0.087,0.00 l0.00-66.62 c 7.044,3.306, 14.628,6.421, 22.759,9.325C 132.52,215.017, 192.593,224.00, 256.00,224.00s 123.48-8.983, 169.154-25.295 c 8.097-2.892, 15.652-5.993, 22.673-9.284L 447.827,256.00 C 445.871,259.887, 433.689,272.837, 396.412,284.885z" ></path></svg>
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?> <!-- Generator: IcoMoon --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="512" height="512" viewBox="0 0 512 512" data-tags="tag, price" fill="#000000"><g class="svgGrid" id="svgGrid"><line stroke-width="1" stroke="#B35047" x1="32" x2="32" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="64" x2="64" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="96" x2="96" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="128" x2="128" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="160" x2="160" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="192" x2="192" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="224" x2="224" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="256" x2="256" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="288" x2="288" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="320" x2="320" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="352" x2="352" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="384" x2="384" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="416" x2="416" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="448" x2="448" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="480" x2="480" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="32" y2="32"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="64" y2="64"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="96" y2="96"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="128" y2="128"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="160" y2="160"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="192" y2="192"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="224" y2="224"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="256" y2="256"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="288" y2="288"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="320" y2="320"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="352" y2="352"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="384" y2="384"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="416" y2="416"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="448" y2="448"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="480" y2="480"></line><rect x="0" y="0" width="512" height="512" fill="none" stroke-width="1" stroke="#B35047"></rect></g><path d="M 288.00,0.00L0.00,288.00l 160.00,64.00l 64.00,160.00l 288.00-288.00L 512.00,0.00 L 288.00,0.00 z M 416.00,142.40c-25.626,0.00-46.399-20.773-46.399-46.40S 390.374,49.60, 416.00,49.60 s 46.40,20.773, 46.40,46.40S 441.626,142.40, 416.00,142.40z" ></path></svg>
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?> <!-- Generator: IcoMoon --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="512" height="512" viewBox="0 0 512 512" data-tags="ticket" fill="#000000"><g class="svgGrid" id="svgGrid"><line stroke-width="1" stroke="#B35047" x1="32" x2="32" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="64" x2="64" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="96" x2="96" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="128" x2="128" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="160" x2="160" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="192" x2="192" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="224" x2="224" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="256" x2="256" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="288" x2="288" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="320" x2="320" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="352" x2="352" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="384" x2="384" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="416" x2="416" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="448" x2="448" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="480" x2="480" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="32" y2="32"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="64" y2="64"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="96" y2="96"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="128" y2="128"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="160" y2="160"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="192" y2="192"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="224" y2="224"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="256" y2="256"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="288" y2="288"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="320" y2="320"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="352" y2="352"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="384" y2="384"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="416" y2="416"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="448" y2="448"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="480" y2="480"></line><rect x="0" y="0" width="512" height="512" fill="none" stroke-width="1" stroke="#B35047"></rect></g><path d="M 287.998,160.00L 351.997,223.999L 224.00,351.996L 160.001,287.997zM 500.763,148.752l-36.758-36.758l-16.004,16.004c-8.189,8.19-19.505,13.255-32.00,13.255 c-24.994,0.00-45.257-20.261-45.257-45.255c0.00-12.501, 5.07-23.819, 13.267-32.009l 15.994-15.993l-36.759-36.758 c-14.984-14.984-39.504-14.984-54.488,0.00L 11.238,308.757c-14.983,14.984-14.983,39.505,0.00,54.488l 36.76,36.759l 15.981-15.982 c 8.191-8.203, 19.515-13.276, 32.022-13.276c 24.994,0.00, 45.255,20.262, 45.255,45.255c0.00,12.503-5.07,23.82-13.267,32.011l-15.992,15.993 l 36.758,36.759c 14.983,14.983, 39.504,14.983, 54.488,0.00l 297.52-297.52C 515.745,188.256, 515.745,163.736, 500.763,148.752z M 224.001,415.998l-128.00-128.00l 192.00-192.00l 128.00,128.00L 224.001,415.998z" ></path></svg>
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?> <!-- Generator: IcoMoon --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="512" height="512" viewBox="0 0 512 512" data-tags="comments, chat, bubble, message, talk" fill="#000000"><g class="svgGrid" id="svgGrid"><line stroke-width="1" stroke="#B35047" x1="32" x2="32" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="64" x2="64" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="96" x2="96" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="128" x2="128" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="160" x2="160" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="192" x2="192" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="224" x2="224" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="256" x2="256" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="288" x2="288" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="320" x2="320" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="352" x2="352" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="384" x2="384" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="416" x2="416" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="448" x2="448" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="480" x2="480" y1="0" y2="512"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="32" y2="32"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="64" y2="64"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="96" y2="96"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="128" y2="128"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="160" y2="160"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="192" y2="192"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="224" y2="224"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="256" y2="256"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="288" y2="288"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="320" y2="320"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="352" y2="352"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="384" y2="384"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="416" y2="416"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="448" y2="448"></line><line stroke-width="1" stroke="#B35047" x1="0" x2="512" y1="480" y2="480"></line><rect x="0" y="0" width="512" height="512" fill="none" stroke-width="1" stroke="#B35047"></rect></g><path d="M 480.00,64.00L 32.00,64.00 C 14.40,64.00,0.00,78.40,0.00,96.00l0.00,224.00 c0.00,17.60, 14.40,32.00, 32.00,32.00l 64.00,0.00 l0.00,96.00 l 72.00-96.00l 312.00,0.00 c 17.60,0.00, 32.00-14.40, 32.00-32.00L 512.00,96.00 C 512.00,78.40, 497.60,64.00, 480.00,64.00z M 480.00,320.00L 152.00,320.00 l-24.00,32.00l0.00-32.00 L 32.00,320.00 L 32.00,96.00 l 448.00,0.00 L 480.00,320.00 zM 96.00,128.00L 416.00,128.00L 416.00,160.00L 96.00,160.00zM 96.00,192.00L 352.00,192.00L 352.00,224.00L 96.00,224.00zM 96.00,256.00L 288.00,256.00L 288.00,288.00L 96.00,288.00z" ></path></svg>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.alerts = {
|
7
|
+
name : 'alerts',
|
8
|
+
|
9
|
+
version : '4.0.0',
|
10
|
+
|
11
|
+
settings : {
|
12
|
+
speed: 300, // fade out speed
|
13
|
+
callback: function (){}
|
14
|
+
},
|
15
|
+
|
16
|
+
init : function (scope, method, options) {
|
17
|
+
this.scope = scope || this.scope;
|
18
|
+
|
19
|
+
if (typeof method === 'object') {
|
20
|
+
$.extend(true, this.settings, method);
|
21
|
+
}
|
22
|
+
|
23
|
+
if (typeof method != 'string') {
|
24
|
+
if (!this.settings.init) this.events();
|
25
|
+
|
26
|
+
return this.settings.init;
|
27
|
+
} else {
|
28
|
+
return this[method].call(this, options);
|
29
|
+
}
|
30
|
+
},
|
31
|
+
|
32
|
+
events : function () {
|
33
|
+
var self = this;
|
34
|
+
|
35
|
+
$(this.scope).on('click.fndtn.alerts', '[data-alert] a.close', function (e) {
|
36
|
+
e.preventDefault();
|
37
|
+
$(this).closest("[data-alert]").fadeOut(self.speed, function () {
|
38
|
+
$(this).remove();
|
39
|
+
self.settings.callback();
|
40
|
+
});
|
41
|
+
});
|
42
|
+
|
43
|
+
this.settings.init = true;
|
44
|
+
},
|
45
|
+
|
46
|
+
off : function () {
|
47
|
+
$(this.scope).off('.fndtn.alerts');
|
48
|
+
}
|
49
|
+
};
|
50
|
+
}(Foundation.zj, this, this.document));
|
@@ -0,0 +1,478 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.clearing = {
|
7
|
+
name : 'clearing',
|
8
|
+
|
9
|
+
version : '4.0.0',
|
10
|
+
|
11
|
+
settings : {
|
12
|
+
templates : {
|
13
|
+
viewing : '<a href="#" class="clearing-close">×</a>' +
|
14
|
+
'<div class="visible-img" style="display: none"><img src="//:0">' +
|
15
|
+
'<p class="clearing-caption"></p><a href="#" class="clearing-main-left"><span></span></a>' +
|
16
|
+
'<a href="#" class="clearing-main-right"><span></span></a></div>'
|
17
|
+
},
|
18
|
+
|
19
|
+
// comma delimited list of selectors that, on click, will close clearing,
|
20
|
+
// add 'div.clearing-blackout, div.visible-img' to close on background click
|
21
|
+
close_selectors : '.clearing-close',
|
22
|
+
|
23
|
+
// event initializers and locks
|
24
|
+
init : false,
|
25
|
+
locked : false
|
26
|
+
},
|
27
|
+
|
28
|
+
init : function (scope, method, options) {
|
29
|
+
this.scope = this.scope || scope;
|
30
|
+
Foundation.inherit(this, 'set_data get_data remove_data throttle');
|
31
|
+
|
32
|
+
if (typeof method === 'object') {
|
33
|
+
options = $.extend(true, this.settings, method);
|
34
|
+
}
|
35
|
+
|
36
|
+
if (typeof method != 'string') {
|
37
|
+
$(this.scope).find('ul[data-clearing]').each(function () {
|
38
|
+
var self = Foundation.libs.clearing,
|
39
|
+
$el = $(this),
|
40
|
+
options = options || {},
|
41
|
+
settings = self.get_data($el);
|
42
|
+
|
43
|
+
if (!settings) {
|
44
|
+
options.$parent = $el.parent();
|
45
|
+
|
46
|
+
self.set_data($el, $.extend(true, self.settings, options));
|
47
|
+
|
48
|
+
self.assemble($el.find('li'));
|
49
|
+
|
50
|
+
if (!self.settings.init) {
|
51
|
+
self.events().swipe_events();
|
52
|
+
}
|
53
|
+
}
|
54
|
+
});
|
55
|
+
|
56
|
+
return this.settings.init;
|
57
|
+
} else {
|
58
|
+
// fire method
|
59
|
+
return this[method].call(this, options);
|
60
|
+
}
|
61
|
+
},
|
62
|
+
|
63
|
+
// event binding and initial setup
|
64
|
+
|
65
|
+
events : function () {
|
66
|
+
var self = this;
|
67
|
+
|
68
|
+
$(this.scope)
|
69
|
+
.on('click.fndtn.clearing', 'ul[data-clearing] li',
|
70
|
+
function (e, current, target) {
|
71
|
+
var current = current || $(this),
|
72
|
+
target = target || current,
|
73
|
+
settings = self.get_data(current.parent());
|
74
|
+
|
75
|
+
e.preventDefault();
|
76
|
+
if (!settings) self.init();
|
77
|
+
|
78
|
+
// set current and target to the clicked li if not otherwise defined.
|
79
|
+
self.open($(e.target), current, target);
|
80
|
+
self.update_paddles(target);
|
81
|
+
})
|
82
|
+
|
83
|
+
.on('click.fndtn.clearing', '.clearing-main-right',
|
84
|
+
function (e) { this.nav(e, 'next') }.bind(this))
|
85
|
+
.on('click.fndtn.clearing', '.clearing-main-left',
|
86
|
+
function (e) { this.nav(e, 'prev') }.bind(this))
|
87
|
+
.on('click.fndtn.clearing', this.settings.close_selectors,
|
88
|
+
function (e) { Foundation.libs.clearing.close(e, this) })
|
89
|
+
.on('keydown.fndtn.clearing',
|
90
|
+
function (e) { this.keydown(e) }.bind(this));
|
91
|
+
|
92
|
+
$(window).on('resize.fndtn.clearing',
|
93
|
+
function (e) { this.resize() }.bind(this));
|
94
|
+
|
95
|
+
this.settings.init = true;
|
96
|
+
return this;
|
97
|
+
},
|
98
|
+
|
99
|
+
swipe_events : function () {
|
100
|
+
var self = this;
|
101
|
+
|
102
|
+
$(this.scope)
|
103
|
+
.on('touchstart.fndtn.clearing', '.visible-img', function(e) {
|
104
|
+
var data = {
|
105
|
+
start_page_x: e.touches[0].pageX,
|
106
|
+
start_page_y: e.touches[0].pageY,
|
107
|
+
start_time: (new Date()).getTime(),
|
108
|
+
delta_x: 0,
|
109
|
+
is_scrolling: undefined
|
110
|
+
};
|
111
|
+
|
112
|
+
$(this).data('swipe-transition', data);
|
113
|
+
e.stopPropagation();
|
114
|
+
})
|
115
|
+
.on('touchmove.fndtn.clearing', '.visible-img', function(e) {
|
116
|
+
// Ignore pinch/zoom events
|
117
|
+
if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
|
118
|
+
|
119
|
+
var data = $(this).data('swipe-transition');
|
120
|
+
|
121
|
+
if (typeof data === 'undefined') {
|
122
|
+
data = {};
|
123
|
+
}
|
124
|
+
|
125
|
+
data.delta_x = e.touches[0].pageX - data.start_page_x;
|
126
|
+
|
127
|
+
if ( typeof data.is_scrolling === 'undefined') {
|
128
|
+
data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
|
129
|
+
}
|
130
|
+
|
131
|
+
if (!data.is_scrolling && !data.active) {
|
132
|
+
e.preventDefault();
|
133
|
+
var direction = (data.delta_x < 0) ? 'next' : 'prev';
|
134
|
+
data.active = true;
|
135
|
+
self.nav(e, direction);
|
136
|
+
}
|
137
|
+
})
|
138
|
+
.on('touchend.fndtn.clearing', '.visible-img', function(e) {
|
139
|
+
$(this).data('swipe-transition', {});
|
140
|
+
e.stopPropagation();
|
141
|
+
});
|
142
|
+
},
|
143
|
+
|
144
|
+
assemble : function ($li) {
|
145
|
+
var $el = $li.parent(),
|
146
|
+
settings = this.get_data($el),
|
147
|
+
grid = $el.detach(),
|
148
|
+
data = {
|
149
|
+
grid: '<div class="carousel">' + this.outerHTML(grid[0]) + '</div>',
|
150
|
+
viewing: settings.templates.viewing
|
151
|
+
},
|
152
|
+
wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
|
153
|
+
data.grid + '</div></div>';
|
154
|
+
|
155
|
+
return settings.$parent.append(wrapper);
|
156
|
+
},
|
157
|
+
|
158
|
+
// event callbacks
|
159
|
+
|
160
|
+
open : function ($image, current, target) {
|
161
|
+
var root = target.closest('.clearing-assembled'),
|
162
|
+
container = root.find('div').first(),
|
163
|
+
visible_image = container.find('.visible-img'),
|
164
|
+
image = visible_image.find('img').not($image);
|
165
|
+
|
166
|
+
if (!this.locked()) {
|
167
|
+
// set the image to the selected thumbnail
|
168
|
+
image.attr('src', this.load($image));
|
169
|
+
|
170
|
+
this.loaded(image, function () {
|
171
|
+
// toggle the gallery
|
172
|
+
root.addClass('clearing-blackout');
|
173
|
+
container.addClass('clearing-container');
|
174
|
+
visible_image.show();
|
175
|
+
this.fix_height(target)
|
176
|
+
.caption(visible_image.find('.clearing-caption'), $image)
|
177
|
+
.center(image)
|
178
|
+
.shift(current, target, function () {
|
179
|
+
target.siblings().removeClass('visible');
|
180
|
+
target.addClass('visible');
|
181
|
+
});
|
182
|
+
}.bind(this));
|
183
|
+
}
|
184
|
+
},
|
185
|
+
|
186
|
+
close : function (e, el) {
|
187
|
+
e.preventDefault();
|
188
|
+
|
189
|
+
var root = (function (target) {
|
190
|
+
if (/blackout/.test(target.selector)) {
|
191
|
+
return target;
|
192
|
+
} else {
|
193
|
+
return target.closest('.clearing-blackout');
|
194
|
+
}
|
195
|
+
}($(el))), container, visible_image;
|
196
|
+
|
197
|
+
if (el === e.target && root) {
|
198
|
+
container = root.find('div').first(),
|
199
|
+
visible_image = container.find('.visible-img');
|
200
|
+
this.settings.prev_index = 0;
|
201
|
+
root.find('ul[data-clearing]')
|
202
|
+
.attr('style', '').closest('.clearing-blackout')
|
203
|
+
.removeClass('clearing-blackout');
|
204
|
+
container.removeClass('clearing-container');
|
205
|
+
visible_image.hide();
|
206
|
+
}
|
207
|
+
|
208
|
+
return false;
|
209
|
+
},
|
210
|
+
|
211
|
+
keydown : function (e) {
|
212
|
+
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
|
213
|
+
|
214
|
+
if (e.which === 39) this.go(clearing, 'next');
|
215
|
+
if (e.which === 37) this.go(clearing, 'prev');
|
216
|
+
if (e.which === 27) $('a.clearing-close').trigger('click');
|
217
|
+
},
|
218
|
+
|
219
|
+
nav : function (e, direction) {
|
220
|
+
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
|
221
|
+
|
222
|
+
e.preventDefault();
|
223
|
+
this.go(clearing, direction);
|
224
|
+
},
|
225
|
+
|
226
|
+
resize : function () {
|
227
|
+
var image = $('.clearing-blackout .visible-img').find('img');
|
228
|
+
|
229
|
+
if (image.length) {
|
230
|
+
this.center(image);
|
231
|
+
}
|
232
|
+
},
|
233
|
+
|
234
|
+
// visual adjustments
|
235
|
+
fix_height : function (target) {
|
236
|
+
var lis = target.parent().children(),
|
237
|
+
self = this;
|
238
|
+
|
239
|
+
lis.each(function () {
|
240
|
+
var li = $(this),
|
241
|
+
image = li.find('img');
|
242
|
+
|
243
|
+
if (li.height() > self.outerHeight(image)) {
|
244
|
+
li.addClass('fix-height');
|
245
|
+
}
|
246
|
+
})
|
247
|
+
.closest('ul')
|
248
|
+
.width(lis.length * 100 + '%');
|
249
|
+
|
250
|
+
return this;
|
251
|
+
},
|
252
|
+
|
253
|
+
update_paddles : function (target) {
|
254
|
+
var visible_image = target
|
255
|
+
.closest('.carousel')
|
256
|
+
.siblings('.visible-img');
|
257
|
+
|
258
|
+
if (target.next().length) {
|
259
|
+
visible_image
|
260
|
+
.find('.clearing-main-right')
|
261
|
+
.removeClass('disabled');
|
262
|
+
} else {
|
263
|
+
visible_image
|
264
|
+
.find('.clearing-main-right')
|
265
|
+
.addClass('disabled');
|
266
|
+
}
|
267
|
+
|
268
|
+
if (target.prev().length) {
|
269
|
+
visible_image
|
270
|
+
.find('.clearing-main-left')
|
271
|
+
.removeClass('disabled');
|
272
|
+
} else {
|
273
|
+
visible_image
|
274
|
+
.find('.clearing-main-left')
|
275
|
+
.addClass('disabled');
|
276
|
+
}
|
277
|
+
},
|
278
|
+
|
279
|
+
center : function (target) {
|
280
|
+
target.css({
|
281
|
+
marginLeft : -(this.outerWidth(target) / 2),
|
282
|
+
marginTop : -(this.outerHeight(target) / 2)
|
283
|
+
});
|
284
|
+
return this;
|
285
|
+
},
|
286
|
+
|
287
|
+
// image loading and preloading
|
288
|
+
|
289
|
+
load : function ($image) {
|
290
|
+
var href = $image.parent().attr('href');
|
291
|
+
|
292
|
+
this.preload($image);
|
293
|
+
|
294
|
+
if (href) return href;
|
295
|
+
return $image.attr('src');
|
296
|
+
},
|
297
|
+
|
298
|
+
preload : function ($image) {
|
299
|
+
this
|
300
|
+
.img($image.closest('li').next())
|
301
|
+
.img($image.closest('li').prev());
|
302
|
+
},
|
303
|
+
|
304
|
+
loaded : function (image, callback) {
|
305
|
+
// based on jquery.imageready.js
|
306
|
+
// @weblinc, @jsantell, (c) 2012
|
307
|
+
|
308
|
+
function loaded () {
|
309
|
+
callback();
|
310
|
+
}
|
311
|
+
|
312
|
+
function bindLoad () {
|
313
|
+
this.one('load', loaded);
|
314
|
+
|
315
|
+
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
|
316
|
+
var src = this.attr( 'src' ),
|
317
|
+
param = src.match( /\?/ ) ? '&' : '?';
|
318
|
+
|
319
|
+
param += 'random=' + (new Date()).getTime();
|
320
|
+
this.attr('src', src + param);
|
321
|
+
}
|
322
|
+
}
|
323
|
+
|
324
|
+
if (!image.attr('src')) {
|
325
|
+
loaded();
|
326
|
+
return;
|
327
|
+
}
|
328
|
+
|
329
|
+
if (this.complete || this.readyState === 4) {
|
330
|
+
loaded();
|
331
|
+
} else {
|
332
|
+
bindLoad.call(image);
|
333
|
+
}
|
334
|
+
},
|
335
|
+
|
336
|
+
img : function (img) {
|
337
|
+
if (img.length) {
|
338
|
+
var new_img = new Image(),
|
339
|
+
new_a = img.find('a');
|
340
|
+
|
341
|
+
if (new_a.length) {
|
342
|
+
new_img.src = new_a.attr('href');
|
343
|
+
} else {
|
344
|
+
new_img.src = img.find('img').attr('src');
|
345
|
+
}
|
346
|
+
}
|
347
|
+
return this;
|
348
|
+
},
|
349
|
+
|
350
|
+
// image caption
|
351
|
+
|
352
|
+
caption : function (container, $image) {
|
353
|
+
var caption = $image.data('caption');
|
354
|
+
|
355
|
+
if (caption) {
|
356
|
+
container
|
357
|
+
.text(caption)
|
358
|
+
.show();
|
359
|
+
} else {
|
360
|
+
container
|
361
|
+
.text('')
|
362
|
+
.hide();
|
363
|
+
}
|
364
|
+
return this;
|
365
|
+
},
|
366
|
+
|
367
|
+
// directional methods
|
368
|
+
|
369
|
+
go : function ($ul, direction) {
|
370
|
+
var current = $ul.find('.visible'),
|
371
|
+
target = current[direction]();
|
372
|
+
|
373
|
+
if (target.length) {
|
374
|
+
target
|
375
|
+
.find('img')
|
376
|
+
.trigger('click', [current, target]);
|
377
|
+
}
|
378
|
+
},
|
379
|
+
|
380
|
+
shift : function (current, target, callback) {
|
381
|
+
var clearing = target.parent(),
|
382
|
+
old_index = this.settings.prev_index || target.index(),
|
383
|
+
direction = this.direction(clearing, current, target),
|
384
|
+
left = parseInt(clearing.css('left'), 10),
|
385
|
+
width = this.outerWidth(target),
|
386
|
+
skip_shift;
|
387
|
+
|
388
|
+
// we use jQuery animate instead of CSS transitions because we
|
389
|
+
// need a callback to unlock the next animation
|
390
|
+
if (target.index() !== old_index && !/skip/.test(direction)){
|
391
|
+
if (/left/.test(direction)) {
|
392
|
+
this.lock();
|
393
|
+
clearing.animate({left : left + width}, 300, this.unlock());
|
394
|
+
} else if (/right/.test(direction)) {
|
395
|
+
this.lock();
|
396
|
+
clearing.animate({left : left - width}, 300, this.unlock());
|
397
|
+
}
|
398
|
+
} else if (/skip/.test(direction)) {
|
399
|
+
// the target image is not adjacent to the current image, so
|
400
|
+
// do we scroll right or not
|
401
|
+
skip_shift = target.index() - this.settings.up_count;
|
402
|
+
this.lock();
|
403
|
+
|
404
|
+
if (skip_shift > 0) {
|
405
|
+
clearing.animate({left : -(skip_shift * width)}, 300, this.unlock());
|
406
|
+
} else {
|
407
|
+
clearing.animate({left : 0}, 300, this.unlock());
|
408
|
+
}
|
409
|
+
}
|
410
|
+
|
411
|
+
callback();
|
412
|
+
},
|
413
|
+
|
414
|
+
direction : function ($el, current, target) {
|
415
|
+
var lis = $el.find('li'),
|
416
|
+
li_width = this.outerWidth(lis) + (this.outerWidth(lis) / 4),
|
417
|
+
up_count = Math.floor(this.outerWidth($('.clearing-container')) / li_width) - 1,
|
418
|
+
target_index = lis.index(target),
|
419
|
+
response;
|
420
|
+
|
421
|
+
this.settings.up_count = up_count;
|
422
|
+
|
423
|
+
if (this.adjacent(this.settings.prev_index, target_index)) {
|
424
|
+
if ((target_index > up_count)
|
425
|
+
&& target_index > this.settings.prev_index) {
|
426
|
+
response = 'right';
|
427
|
+
} else if ((target_index > up_count - 1)
|
428
|
+
&& target_index <= this.settings.prev_index) {
|
429
|
+
response = 'left';
|
430
|
+
} else {
|
431
|
+
response = false;
|
432
|
+
}
|
433
|
+
} else {
|
434
|
+
response = 'skip';
|
435
|
+
}
|
436
|
+
|
437
|
+
this.settings.prev_index = target_index;
|
438
|
+
|
439
|
+
return response;
|
440
|
+
},
|
441
|
+
|
442
|
+
adjacent : function (current_index, target_index) {
|
443
|
+
for (var i = target_index + 1; i >= target_index - 1; i--) {
|
444
|
+
if (i === current_index) return true;
|
445
|
+
}
|
446
|
+
return false;
|
447
|
+
},
|
448
|
+
|
449
|
+
// lock management
|
450
|
+
|
451
|
+
lock : function () {
|
452
|
+
this.settings.locked = true;
|
453
|
+
},
|
454
|
+
|
455
|
+
unlock : function () {
|
456
|
+
this.settings.locked = false;
|
457
|
+
},
|
458
|
+
|
459
|
+
locked : function () {
|
460
|
+
return this.settings.locked;
|
461
|
+
},
|
462
|
+
|
463
|
+
// plugin management/browser quirks
|
464
|
+
|
465
|
+
outerHTML : function (el) {
|
466
|
+
// support FireFox < 11
|
467
|
+
return el.outerHTML || new XMLSerializer().serializeToString(el);
|
468
|
+
},
|
469
|
+
|
470
|
+
off : function () {
|
471
|
+
$(this.scope).off('.fndtn.clearing');
|
472
|
+
$(window).off('.fndtn.clearing');
|
473
|
+
this.remove_data(); // empty settings cache
|
474
|
+
this.settings.init = false;
|
475
|
+
}
|
476
|
+
};
|
477
|
+
|
478
|
+
}(Foundation.zj, this, this.document));
|