Easy Facebook Like Box (Facebook Page Plugin) – Custom Facebook Feed – Auto PopUp - Version 3.0

Version Description

  • Added another great feature of Auto PopUp. Now you can display easy facebook like box in PopUp.
  • Tested upto WordPress 4.1
Download this release

Release Info

Developer sjaved
Plugin Icon 128x128 Easy Facebook Like Box (Facebook Page Plugin) – Custom Facebook Feed – Auto PopUp
Version 3.0
Comparing to
See all releases

Code changes from version 2.1.0 to 3.0

Files changed (49) hide show
  1. README.txt +142 -115
  2. admin/assets/css/admin.css +62 -12
  3. admin/easy-facebook-likebox-admin.php +475 -269
  4. admin/views/admin.php +68 -77
  5. admin/views/instructinos.php +41 -0
  6. admin/views/popup-settings.php +25 -0
  7. admin/views/support-us.php +29 -0
  8. easy-facebook-likebox.php +92 -92
  9. includes/easy-facebook-likebox-widget.php +3 -2
  10. public/assets/css/popup_close.png +0 -0
  11. public/assets/css/public.css +29 -9
  12. public/assets/js/public.js +9 -9
  13. public/assets/popup/blank.gif +0 -0
  14. public/assets/popup/fancy_close.png +0 -0
  15. public/assets/popup/fancy_loading.png +0 -0
  16. public/assets/popup/fancy_nav_left.png +0 -0
  17. public/assets/popup/fancy_nav_right.png +0 -0
  18. public/assets/popup/fancy_shadow_e.png +0 -0
  19. public/assets/popup/fancy_shadow_n.png +0 -0
  20. public/assets/popup/fancy_shadow_ne.png +0 -0
  21. public/assets/popup/fancy_shadow_nw.png +0 -0
  22. public/assets/popup/fancy_shadow_s.png +0 -0
  23. public/assets/popup/fancy_shadow_se.png +0 -0
  24. public/assets/popup/fancy_shadow_sw.png +0 -0
  25. public/assets/popup/fancy_shadow_w.png +0 -0
  26. public/assets/popup/fancy_title_left.png +0 -0
  27. public/assets/popup/fancy_title_main.png +0 -0
  28. public/assets/popup/fancy_title_over.png +0 -0
  29. public/assets/popup/fancy_title_right.png +0 -0
  30. public/assets/popup/fancybox-x.png +0 -0
  31. public/assets/popup/fancybox-y.png +0 -0
  32. public/assets/popup/fancybox.png +0 -0
  33. public/assets/popup/fancybox_loading.gif +0 -0
  34. public/assets/popup/fancybox_loading@2x.gif +0 -0
  35. public/assets/popup/fancybox_overlay.png +0 -0
  36. public/assets/popup/fancybox_sprite.png +0 -0
  37. public/assets/popup/fancybox_sprite@2x.png +0 -0
  38. public/assets/popup/jquery.fancybox-1.3.7.css +385 -0
  39. public/assets/popup/jquery.fancybox-1.3.7.js +1190 -0
  40. public/assets/popup/jquery.fancybox-1.3.7.min.css +1 -0
  41. public/assets/popup/jquery.fancybox-1.3.7.min.js +43 -0
  42. public/assets/popup/jquery.fancybox.css +274 -0
  43. public/assets/popup/jquery.fancybox.js +2020 -0
  44. public/assets/popup/jquery.fancybox.pack.js +46 -0
  45. public/assets/popup/jquery.magnific-popup.js +2064 -0
  46. public/assets/popup/jquery.magnific-popup.min.js +4 -0
  47. public/assets/popup/magnific-popup.css +374 -0
  48. public/easy-facebook-likebox.php +379 -369
  49. public/views/public.php +63 -1
README.txt CHANGED
@@ -1,116 +1,143 @@
1
- === Easy Facebook Like Box ===
2
- Contributors: sjaved
3
- Tags: facebook, facebook likebox, likebox, like box, facebook like box, facebook like box widget, facebook like box shortcode, shortcode, facebook like box plugin, facebook like box wordpress plugin, plugin, responsive facebook like box, responsive, facebook like box in 75 locales, facebook like box in 75 languages
4
- Requires at least: 3.3
5
- Tested up to: 4.0
6
- Stable tag: 2.1.0
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- Easy facebook like box WordPress plugin allows you to display fan page posts, like button, and connections on your website using widget or shortcode.
11
-
12
- == Description ==
13
-
14
- Displays a Facebook Like Box. The Facebook Like Box is a social plugin that enables Facebook Page owners to attract and gain Likes from their own website. Easy facebook like box display fan page posts, like button, and connections on your website using widget or shortcode.
15
-
16
- [Fixed width demo](http://jwebsol.com/easy-facebook-like-box-plugin-demo/ "See this plugin in action (Fixed width)") | [Responsive demo](http://jwebsol.com/easy-facebook-like-box-responsive-demo/ "See this plugin in action (Responsive)")
17
-
18
- **Options:**
19
-
20
-
21
- 1. Facebook Page URL - enter an URL address to the Facebook fan page
22
- 1. Width - set the width of the module in pixels. The default width is 250px
23
- 1. Height - With the stream displayed and 8 connections the default height is 556px. With no stream displayed and 8 connections the default height is 271px. With no connections and no stream the default height is 63px
24
- 1. Language/Locale - choose your locale for the like box from 75 languages
25
- 1. Responsive - enable/disable responsive mode of like box (1 enalbe and 0 for disable to use in shortcode)
26
- 1. Color Scheme - choose the color scheme for the like box (light/dark)
27
- 1. Show Faces - show/hide profile photos (1 for show and 0 for hide to use in shortcode)
28
- 1. Stream - show/hide the latest wall posts (1 for show and 0 for hide to use in shortcode)
29
- 1. Header - show/hide the Facebook header (1 for show and 0 for hide to use in shortcode)
30
- 1. Border - show/hide the border around the like box (1 for show and 0 for hide to use in shortcode)
31
-
32
-
33
-
34
- You can use easy facebook like box in number of ways:
35
-
36
- * Display facebook like box in sidebar using widget.
37
-
38
- * Display facebook like box in posts or pages using shortcode. Genraete shortcode using widget or add this shortcode and modify the values manually.
39
- `[efb_likebox fanpage_url="YOUR_FB_FANPAGE_URL" fb_appid="OPTIONAL_SEE_FAQ" box_width="WIDTH_OF_BOX_IN_PIXELS" box_height="HEIGHT_OF_BOX_IN_PIXELS" locale="NAME_OF_YOUR_LANGUAGE_LOCAE(default en_US)" responsive="RESPONSIVE_FOR_MOBILE(1/0)" colorscheme="CHOSEN_COLOSCHEME(light/dark)" show_faces="SHOW_CONNECTIONS(1/0)" show_header="SHOW_HEADER(1/0)" show_stream="SHOW_STREAM_POSTS(1/0)" show_border="DISPLAY_BORDER(1/0)"]`
40
-
41
- * Want to display in a template paste below code along with your optional settings.
42
- `<?php echo do_shortcode( '[efb_likebox fanpage_url="YOUR_FB_FANPAGE_URL" fb_appid="OPTIONAL_SEE_FAQ" box_width="WIDTH_OF_BOX_IN_PIXELS" box_height="HEIGHT_OF_BOX_IN_PIXELS" locale="NAME_OF_YOUR_LANGUAGE_LOCAE(default en_US)" responsive="RESPONSIVE_FOR_MOBILE(1/0)" colorscheme="CHOSEN_COLOSCHEME(light/dark)" show_faces="SHOW_CONNECTIONS(1/0)" show_header="SHOW_HEADER(1/0)" show_stream="SHOW_STREAM_POSTS(1/0)" show_border="DISPLAY_BORDER(1/0)"]' ); ?>`
43
-
44
- Features:
45
-
46
- 1. Now support optional **responsive** layout
47
- 1. Support 75 different locales
48
- 1. Extended optional settings to personalize in widget and shortcode
49
- 1. Generate shortcode using widget form
50
- 1. Likebox in PopUp (Modal window) and responsive likebox option is coming soon...
51
-
52
-
53
- == Installation ==
54
- 1. Upload "easy-facebook-likebox" to the "/wp-content/plugins/" directory.
55
- 2. Activate the plugin through the "Plugins" menu in WordPress.
56
- 3. Navigate to "Appearance > Widgets" and drag and drop "Easy Facebook Likebox" in desired widget area or use the shortcode in page/post generated by widget.
57
-
58
- == Upgrade Notice ==
59
- = 2.0.0 =
60
- Update the plugin if you can not find your locale in list
61
-
62
- = 1.0.2 =
63
- Updated the plugin with instructions and major bug fix. Must update.
64
-
65
- =1.0.1=
66
- Updated the plugin to avoid possible conflict with other plugins. Must update.
67
-
68
- =1.0.0=
69
- Initial release.
70
-
71
-
72
- == Frequently Asked Questions ==
73
- = Width not working =
74
- If width parameter is not working then it could be due to facebook responsive styling.
75
-
76
- = Loading slow =
77
- If like box loading slow and taking time to populate then make sure you have given right APP ID and url is correct in app settings.
78
-
79
- To submit your feedback, suggestions and features request follow the below link.
80
- http://wordpress.org/support/topic/need-feed-back-on-plugin-feature/
81
-
82
- == Screenshots ==
83
- 1. Facebook like box in light color scheme.
84
- 2. Facebook like box in dark color scheme.
85
- 3. Facebook like box with posts and faces.
86
- 4. Facebook like box with posts only.
87
- 5. Facebook like box in page using shortcode with all options.
88
- 6. Facebook like box backend view with options description.
89
-
90
-
91
-
92
- == Changelog ==
93
- = 2.0.0 =
94
-
95
- * Added other feild for locale. Input your locale name if you can not find yours in the list.
96
-
97
- = 1.2.0 =
98
-
99
- * Added other feild for locale. Input your locale name if you can not find yours in the list.
100
-
101
- = 1.1.0 =
102
-
103
- * Optional responsive like box option is added in this version
104
- * Multilingual support. Now you can display the like box in over 75 languages by simply selecting from drop down.
105
-
106
- = 1.0.2 =
107
-
108
- * Updated the plugin with instructions and major bug fix. Must update.
109
-
110
- = 1.0.1 =
111
-
112
- * Updated the plugin to avoid possible conflict with other plugins. Must update.
113
-
114
- = 1.0.0 =
115
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  * Initial release.
1
+ === Easy Facebook Like Box ===
2
+ Contributors: sjaved
3
+ Tags: facebook, facebook likebox, likebox, like box, facebook like box, facebook like box widget, facebook like box shortcode, shortcode, facebook like box plugin, facebook like box wordpress plugin, plugin, responsive facebook like box, responsive, facebook like box in 75 locales, facebook like box in 75 languages, facebook like box in PopUp, PopUp, Auto PopUp, like box in PopUp
4
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sjaved786%40gmail%2ecom&lc=US&item_name=Easy%20Facebook%20Like%20Box%20WordPress%20Plugin&item_number=efbl&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
+ Requires at least: 3.3
6
+ Tested up to: 4.1
7
+ Stable tag: 3.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Easy facebook like box WordPress plugin allows you to display fan page posts, like button, and connections on your website using widget, shortcode or in Auto PopUp.
12
+
13
+ == Description ==
14
+
15
+ Displays a Facebook Like Box. The Facebook Like Box is a social plugin that enables Facebook Page owners to attract and gain Likes from their own website. Easy facebook like box display fan page posts, like button, and connections on your website using widget, shortcode or in AutoPop.
16
+
17
+ [Fixed width demo](http://jwebsol.com/easy-facebook-like-box-plugin-demo/ "See this plugin in action (Fixed width)") | [Responsive demo](http://jwebsol.com/easy-facebook-like-box-responsive-demo/ "See this plugin in action (Responsive)") |
18
+ [Auto PopUp demo](http://jwebsol.com/easy-facebook-like-box-auto-popup-demo/ "See this plugin in action (Auto PopUp)")
19
+
20
+ **Options:**
21
+
22
+
23
+ 1. Facebook Page URL - enter an URL address to the Facebook fan page
24
+ 1. Width - set the width of the module in pixels. The default width is 250px
25
+ 1. Height - With the stream displayed and 8 connections the default height is 556px. With no stream displayed and 8 connections the default height is 271px. With no connections and no stream the default height is 63px
26
+ 1. Language/Locale - choose your locale for the like box from 75 languages
27
+ 1. Responsive - enable/disable responsive mode of like box (1 enalbe and 0 for disable to use in shortcode)
28
+ 1. Color Scheme - choose the color scheme for the like box (light/dark)
29
+ 1. Show Faces - show/hide profile photos (1 for show and 0 for hide to use in shortcode)
30
+ 1. Stream - show/hide the latest wall posts (1 for show and 0 for hide to use in shortcode)
31
+ 1. Header - show/hide the Facebook header (1 for show and 0 for hide to use in shortcode)
32
+ 1. Border - show/hide the border around the like box (1 for show and 0 for hide to use in shortcode)
33
+
34
+
35
+
36
+ You can use easy facebook like box in number of ways:
37
+
38
+ * Display facebook like box in auto PopUp (New).
39
+
40
+ * Display facebook like box in sidebar using widget.
41
+
42
+ * Display facebook like box in posts or pages using shortcode. Genraete shortcode using widget or add this shortcode and modify the values manually.
43
+ `[efb_likebox fanpage_url="YOUR_FB_FANPAGE_URL" fb_appid="OPTIONAL_SEE_FAQ" box_width="WIDTH_OF_BOX_IN_PIXELS" box_height="HEIGHT_OF_BOX_IN_PIXELS" locale="NAME_OF_YOUR_LANGUAGE_LOCAE(default en_US)" responsive="RESPONSIVE_FOR_MOBILE(1/0)" colorscheme="CHOSEN_COLOSCHEME(light/dark)" show_faces="SHOW_CONNECTIONS(1/0)" show_header="SHOW_HEADER(1/0)" show_stream="SHOW_STREAM_POSTS(1/0)" show_border="DISPLAY_BORDER(1/0)"]`
44
+
45
+ * Want to display in a template paste below code along with your optional settings.
46
+ `<?php echo do_shortcode( '[efb_likebox fanpage_url="YOUR_FB_FANPAGE_URL" fb_appid="OPTIONAL_SEE_FAQ" box_width="WIDTH_OF_BOX_IN_PIXELS" box_height="HEIGHT_OF_BOX_IN_PIXELS" locale="NAME_OF_YOUR_LANGUAGE_LOCAE(default en_US)" responsive="RESPONSIVE_FOR_MOBILE(1/0)" colorscheme="CHOSEN_COLOSCHEME(light/dark)" show_faces="SHOW_CONNECTIONS(1/0)" show_header="SHOW_HEADER(1/0)" show_stream="SHOW_STREAM_POSTS(1/0)" show_border="DISPLAY_BORDER(1/0)"]' ); ?>`
47
+
48
+ Features:
49
+
50
+
51
+ 1. Likebox in responsive PopUp/Modal window (New feature)
52
+ 1. Now support optional **responsive** layout
53
+ 1. Support 75 different locales
54
+ 1. Extended optional settings to personalize in widget and shortcode
55
+ 1. Generate shortcode using widget form
56
+
57
+
58
+ **Pro Features:**
59
+
60
+
61
+ 1. Pro version support all WordPress shortcodes and even html in PopUp.
62
+ 1. Set PopUp delay from Back-end.
63
+ 1. Show PopUp on home page only.
64
+ 1. Show PopUp if visitors are logged in
65
+ 1. Show PopUp if visitors are not logged in.
66
+ 1. Close button act as never show again
67
+ 1. Hide on mobile devices
68
+ 1. Premium Support on priority basis.
69
+
70
+ [GoPro](http://jwebsol.com/product/easy-facebook-like-box-pro/ "GoPro")
71
+
72
+ == Installation ==
73
+ 1. Upload "easy-facebook-likebox" to the "/wp-content/plugins/" directory.
74
+ 2. Activate the plugin through the "Plugins" menu in WordPress.
75
+ 3. Navigate to "Appearance > Widgets" and drag and drop "Easy Facebook Likebox" in desired widget area or use the shortcode in page/post generated by widget.
76
+
77
+ == Upgrade Notice ==
78
+ = 3.0.0 =
79
+ Major realease! Must Update the plugin if you were missing the facebook like box in PopUp. Now display like box in auto display PopUp (Auto PopUp).
80
+
81
+ = 2.0.0 =
82
+ Update the plugin if you can not find your locale in list
83
+
84
+ = 1.0.2 =
85
+ Updated the plugin with instructions and major bug fix. Must update.
86
+
87
+ =1.0.1=
88
+ Updated the plugin to avoid possible conflict with other plugins. Must update.
89
+
90
+ =1.0.0=
91
+ Initial release.
92
+
93
+
94
+ == Frequently Asked Questions ==
95
+ = Width not working =
96
+ If width parameter is not working then it could be due to facebook responsive styling.
97
+
98
+ = Loading slow =
99
+ If like box loading slow and taking time to populate then make sure you have given right APP ID and url is correct in app settings.
100
+
101
+ To submit your feedback, suggestions and features request follow the below link.
102
+ http://wordpress.org/support/topic/need-feed-back-on-plugin-feature/
103
+
104
+ == Screenshots ==
105
+ 1. Facebook like box in light color scheme.
106
+ 2. Facebook like box in dark color scheme.
107
+ 3. Facebook like box with posts and faces.
108
+ 4. Facebook like box with posts only.
109
+ 5. Facebook like box in page using shortcode with all options.
110
+ 6. Facebook like box backend view with options description.
111
+
112
+
113
+
114
+ == Changelog ==
115
+ = 3.0 =
116
+
117
+ * Added another great feature of Auto PopUp. Now you can display easy facebook like box in PopUp.
118
+ * Tested upto WordPress 4.1
119
+
120
+ = 2.0.0 =
121
+
122
+ * Added other feild for locale. Input your locale name if you can not find yours in the list.
123
+
124
+ = 1.2.0 =
125
+
126
+ * Added other feild for locale. Input your locale name if you can not find yours in the list.
127
+
128
+ = 1.1.0 =
129
+
130
+ * Optional responsive like box option is added in this version
131
+ * Multilingual support. Now you can display the like box in over 75 languages by simply selecting from drop down.
132
+
133
+ = 1.0.2 =
134
+
135
+ * Updated the plugin with instructions and major bug fix. Must update.
136
+
137
+ = 1.0.1 =
138
+
139
+ * Updated the plugin to avoid possible conflict with other plugins. Must update.
140
+
141
+ = 1.0.0 =
142
+
143
  * Initial release.
admin/assets/css/admin.css CHANGED
@@ -1,13 +1,63 @@
1
- /* This stylesheet is used to style the admin option form of the plugin. */
2
-
3
- .widget-half {
4
- width: 49%;
5
- float: left;
6
- margin-bottom: 0px;
7
- }
8
- .widget-half select{
9
- width:95%;
10
- }
11
- .clearfix {
12
- clear: both;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
1
+ /* This stylesheet is used to style the admin option form of the plugin. */
2
+
3
+ .widget-half {
4
+ width: 49%;
5
+ float: left;
6
+ margin-bottom: 0px;
7
+ }
8
+ .widget-half select{
9
+ width:95%;
10
+ }
11
+ .clearfix {
12
+ clear: both;
13
+ }
14
+
15
+ .form-table th {
16
+ width: 400px;
17
+ }
18
+ .button_container{
19
+ float:left;
20
+ width:49%;
21
+ }
22
+ div#easy-facebook-likebox_popup {
23
+ float: left;
24
+ width: 100%;
25
+ }
26
+ .button_container p.submit{
27
+ margin-bottom: 25px !important;
28
+ }
29
+ .go_pro_ad{
30
+ font-size:26px;
31
+ text-decoration:none;
32
+ padding:25px;
33
+ background: #7cc68d;
34
+ text-shadow: 0 -1px 0 rgba(0,0,0,0.2);
35
+ -moz-border-radius: 6px;
36
+ -webkit-border-radius: 6px;
37
+ border-radius: 6px;
38
+ color:#FFF;
39
+ position:fixed;
40
+ right:50px;
41
+ top:70px;
42
+ z-index:99999;
43
+ }
44
+ .go_pro_ad:hover, .buy_button:hover{
45
+ color:#FFF;
46
+ background:#67BD7B;
47
+ }
48
+ .promotional_text{
49
+ display:inline-block;
50
+ }
51
+
52
+ .buy_button{
53
+ font-size:26px;
54
+ text-decoration:none;
55
+ padding:100px;
56
+ background: #7cc68d;
57
+ text-shadow: 0 -1px 0 rgba(0,0,0,0.2);
58
+ -moz-border-radius: 6px;
59
+ -webkit-border-radius: 6px;
60
+ border-radius: 6px;
61
+ color:#FFF;
62
+ float:right;
63
  }
admin/easy-facebook-likebox-admin.php CHANGED
@@ -1,269 +1,475 @@
1
- <?php
2
- /**
3
- * Plugin Name.
4
- *
5
- * @package Easy_Facebook_Likebox_Admin
6
- * @author Sajid Javed <email@example.com>
7
- * @license GPL-2.0+
8
- * @link http://example.com
9
- * @copyright 2014 Your Name or Company Name
10
- */
11
-
12
- /**
13
- * Plugin class. This class should ideally be used to work with the
14
- * administrative side of the WordPress site.
15
- *
16
- * If you're interested in introducing public-facing
17
- * functionality, then refer to `class-plugin-name.php`
18
- *
19
- * @TODO: Rename this class to a proper name for your plugin.
20
- *
21
- * @package Plugin_Name_Admin
22
- * @author Your Name <email@example.com>
23
- */
24
- class Easy_Facebook_Likebox_Admin {
25
-
26
- /**
27
- * Instance of this class.
28
- *
29
- * @since 1.0.0
30
- *
31
- * @var object
32
- */
33
- protected static $instance = null;
34
-
35
- /**
36
- * Slug of the plugin screen.
37
- *
38
- * @since 1.0.0
39
- *
40
- * @var string
41
- */
42
- protected $plugin_screen_hook_suffix = null;
43
-
44
- /**
45
- * Initialize the plugin by loading admin scripts & styles and adding a
46
- * settings page and menu.
47
- *
48
- * @since 1.0.0
49
- */
50
- private function __construct() {
51
-
52
- /*
53
- * @TODO :
54
- *
55
- * - Uncomment following lines if the admin class should only be available for super admins
56
- */
57
- /* if( ! is_super_admin() ) {
58
- return;
59
- } */
60
-
61
- /*
62
- * Call $plugin_slug from public plugin class.
63
- *
64
- * @TODO:
65
- *
66
- * - Rename "Plugin_Name" to the name of your initial plugin class
67
- *
68
- */
69
- $plugin = Easy_Facebook_Likebox::get_instance();
70
- $this->plugin_slug = $plugin->get_plugin_slug();
71
-
72
- // Load admin style sheet and JavaScript.
73
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
74
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
75
-
76
- // Add the options page and menu item.
77
- add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
78
-
79
- // Add an action link pointing to the options page.
80
- $plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . $this->plugin_slug . '.php' );
81
- add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) );
82
-
83
- add_action( 'admin_init', array( $this, 'i_have_supported_efbl') );
84
-
85
- //if ( get_option('I_HAVE_SUPPORTED_THE_EFBL_PLUGIN') != 1 )
86
- add_action( 'admin_notices', array( $this, 'post_installtion_upgrade_nag') );
87
-
88
- }
89
-
90
- /**
91
- * Return an instance of this class.
92
- *
93
- * @since 1.0.0
94
- *
95
- * @return object A single instance of this class.
96
- */
97
- public static function get_instance() {
98
-
99
- /*
100
- * @TODO :
101
- *
102
- * - Uncomment following lines if the admin class should only be available for super admins
103
- */
104
- /* if( ! is_super_admin() ) {
105
- return;
106
- } */
107
-
108
- // If the single instance hasn't been set, set it now.
109
- if ( null == self::$instance ) {
110
- self::$instance = new self;
111
- }
112
-
113
- return self::$instance;
114
- }
115
-
116
- /**
117
- * Register and enqueue admin-specific style sheet.
118
- *
119
- * @TODO:
120
- *
121
- * - Rename "Plugin_Name" to the name your plugin
122
- *
123
- * @since 1.0.0
124
- *
125
- * @return null Return early if no settings page is registered.
126
- */
127
- public function enqueue_admin_styles() {
128
-
129
- /*if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
130
- return;
131
- }
132
-
133
- $screen = get_current_screen();
134
- if ( $this->plugin_screen_hook_suffix == $screen->id ) {
135
-
136
- }*/
137
-
138
- wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), Easy_Facebook_Likebox::VERSION );
139
-
140
- }
141
-
142
- /**
143
- * Register and enqueue admin-specific JavaScript.
144
- *
145
- * @TODO:
146
- *
147
- * - Rename "Plugin_Name" to the name your plugin
148
- *
149
- * @since 1.0.0
150
- *
151
- * @return null Return early if no settings page is registered.
152
- */
153
- public function enqueue_admin_scripts() {
154
-
155
- if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
156
- return;
157
- }
158
-
159
- $screen = get_current_screen();
160
- if ( $this->plugin_screen_hook_suffix == $screen->id ) {
161
- wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), Easy_Facebook_Likebox::VERSION );
162
- }
163
-
164
- }
165
-
166
- /**
167
- * Register the administration menu for this plugin into the WordPress Dashboard menu.
168
- *
169
- * @since 1.0.0
170
- */
171
- public function add_plugin_admin_menu() {
172
-
173
- /*
174
- * Add a settings page for this plugin to the Settings menu.
175
- *
176
- * NOTE: Alternative menu locations are available via WordPress administration menu functions.
177
- *
178
- * Administration Menus: http://codex.wordpress.org/Administration_Menus
179
- *
180
- * @TODO:
181
- *
182
- * - Change 'Page Title' to the title of your plugin admin page
183
- * - Change 'Menu Text' to the text for menu item for the plugin settings page
184
- * - Change 'manage_options' to the capability you see fit
185
- * For reference: http://codex.wordpress.org/Roles_and_Capabilities
186
- */
187
- $this->plugin_screen_hook_suffix = add_options_page(
188
- __( 'Easy Facebook Likebox', $this->plugin_slug ),
189
- __( 'Easy Facebook Likebox', $this->plugin_slug ),
190
- 'manage_options',
191
- $this->plugin_slug,
192
- array( $this, 'display_plugin_admin_page' )
193
- );
194
-
195
- }
196
-
197
- /**
198
- * Render the settings page for this plugin.
199
- *
200
- * @since 1.0.0
201
- */
202
- public function display_plugin_admin_page() {
203
- include_once( 'views/admin.php' );
204
- }
205
-
206
- /**
207
- * Add settings action link to the plugins page.
208
- *
209
- * @since 1.0.0
210
- */
211
- public function add_action_links( $links ) {
212
-
213
- return array_merge(
214
- array(
215
- 'settings' => '<a href="' . admin_url( 'options-general.php?page=' . $this->plugin_slug ) . '">' . __( 'Settings', $this->plugin_slug ) . '</a>'
216
- ),
217
- $links
218
- );
219
-
220
- }
221
-
222
- /**
223
- * Display a thank you nag when the plugin has been installed/upgraded.
224
- */
225
- public function post_installtion_upgrade_nag() {
226
- if ( !current_user_can('install_plugins') ) return;
227
-
228
- $plugin_verstion = Easy_Facebook_Likebox::VERSION;
229
-
230
- $version_key = '_efbl_version';
231
- $notice_key = 'I_HAVE_SUPPORTED_THE_EFBL_PLUGIN';
232
-
233
- if ( get_site_option( $version_key ) == $plugin_verstion && get_site_option( $notice_key ) == 1 ) return;
234
-
235
- $msg = sprintf(__('Thanks for installting/upgrading the Easy Facebook Likebox Plugin! If you like this plugin, please consider some <a href="%s" target="_blank">donation</a> and/or <a href="%s" target="_blank">rating it</a>!
236
- Support us by liking our facebook fan page!
237
-
238
- <div id="fb-root"></div>
239
- <script>(function(d, s, id) {
240
- var js, fjs = d.getElementsByTagName(s)[0];
241
- if (d.getElementById(id)) return;
242
- js = d.createElement(s); js.id = id;
243
- js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=517129121754984&version=v2.0";
244
- fjs.parentNode.insertBefore(js, fjs);
245
- }(document, \'script\', \'facebook-jssdk\'));</script>
246
-
247
- <div class="fb-like" data-href="https://facebook.com/jwebsol" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
248
- <br /><br />
249
- <a href="%s" class="button button-primary">I have supported already</a>
250
- ', 'efbl'),
251
- 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sjaved786%40gmail%2ecom&lc=US&item_name=Easy%20Facebook%20Like%20Box%20WordPress%20Plugin&item_number=efbl&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted',
252
- 'http://wordpress.org/plugins/easy-facebook-likebox/',
253
- get_admin_url().'?efbl_supported=1'
254
- );
255
- echo "<div class='update-nag'>$msg</div>";
256
-
257
- update_site_option( $version_key, $plugin_verstion );
258
- }
259
-
260
- function i_have_supported_efbl(){
261
-
262
- if(isset($_GET['efbl_supported'])) {
263
- update_site_option( 'I_HAVE_SUPPORTED_THE_EFBL_PLUGIN', 1 );
264
- }
265
-
266
- /*echo I_HAVE_SUPPORTED_THE_EFBL_PLUGIN;
267
- exit; */
268
- }
269
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name.
4
+ *
5
+ * @package Easy_Facebook_Likebox_Admin
6
+ * @author Sajid Javed <email@example.com>
7
+ * @license GPL-2.0+
8
+ * @link http://example.com
9
+ * @copyright 2014 Your Name or Company Name
10
+ */
11
+
12
+ /**
13
+ * Plugin class. This class should ideally be used to work with the
14
+ * administrative side of the WordPress site.
15
+ *
16
+ * If you're interested in introducing public-facing
17
+ * functionality, then refer to `class-plugin-name.php`
18
+ *
19
+ * @TODO: Rename this class to a proper name for your plugin.
20
+ *
21
+ * @package Plugin_Name_Admin
22
+ * @author Your Name <email@example.com>
23
+ */
24
+ class Easy_Facebook_Likebox_Admin {
25
+
26
+ /**
27
+ * Instance of this class.
28
+ *
29
+ * @since 1.0.0
30
+ *
31
+ * @var object
32
+ */
33
+ protected static $instance = null;
34
+
35
+ /**
36
+ * Slug of the plugin screen.
37
+ *
38
+ * @since 1.0.0
39
+ *
40
+ * @var string
41
+ */
42
+ protected $plugin_screen_hook_suffix = null;
43
+
44
+ /**
45
+ * Initialize the plugin by loading admin scripts & styles and adding a
46
+ * settings page and menu.
47
+ *
48
+ * @since 1.0.0
49
+ */
50
+ private function __construct() {
51
+
52
+ /*
53
+ * @TODO :
54
+ *
55
+ * - Uncomment following lines if the admin class should only be available for super admins
56
+ */
57
+ /* if( ! is_super_admin() ) {
58
+ return;
59
+ } */
60
+
61
+ /*
62
+ * Call $plugin_slug from public plugin class.
63
+ *
64
+ * @TODO:
65
+ *
66
+ * - Rename "Plugin_Name" to the name of your initial plugin class
67
+ *
68
+ */
69
+ $plugin = Easy_Facebook_Likebox::get_instance();
70
+ $this->plugin_slug = $plugin->get_plugin_slug();
71
+
72
+ // Load admin style sheet and JavaScript.
73
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
74
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
75
+
76
+ // Add the options page and menu item.
77
+ add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
78
+
79
+ // Add an action link pointing to the options page.
80
+ $plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . $this->plugin_slug . '.php' );
81
+ add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) );
82
+
83
+ add_action( 'admin_init', array( $this, 'i_have_supported_efbl') );
84
+
85
+ //if ( get_option('I_HAVE_SUPPORTED_THE_EFBL_PLUGIN') != 1 )
86
+ add_action( 'admin_notices', array( $this, 'post_installtion_upgrade_nag') );
87
+
88
+ }
89
+
90
+ /**
91
+ * Return an instance of this class.
92
+ *
93
+ * @since 1.0.0
94
+ *
95
+ * @return object A single instance of this class.
96
+ */
97
+ public static function get_instance() {
98
+
99
+ /*
100
+ * @TODO :
101
+ *
102
+ * - Uncomment following lines if the admin class should only be available for super admins
103
+ */
104
+ /* if( ! is_super_admin() ) {
105
+ return;
106
+ } */
107
+
108
+ // If the single instance hasn't been set, set it now.
109
+ if ( null == self::$instance ) {
110
+ self::$instance = new self;
111
+ }
112
+
113
+ return self::$instance;
114
+ }
115
+
116
+ /**
117
+ * Register and enqueue admin-specific style sheet.
118
+ *
119
+ * @TODO:
120
+ *
121
+ * - Rename "Plugin_Name" to the name your plugin
122
+ *
123
+ * @since 1.0.0
124
+ *
125
+ * @return null Return early if no settings page is registered.
126
+ */
127
+ public function enqueue_admin_styles() {
128
+
129
+ /*if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
130
+ return;
131
+ }
132
+
133
+ $screen = get_current_screen();
134
+ if ( $this->plugin_screen_hook_suffix == $screen->id ) {
135
+
136
+ }*/
137
+
138
+ wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), Easy_Facebook_Likebox::VERSION );
139
+
140
+ }
141
+
142
+ /**
143
+ * Register and enqueue admin-specific JavaScript.
144
+ *
145
+ * @TODO:
146
+ *
147
+ * - Rename "Plugin_Name" to the name your plugin
148
+ *
149
+ * @since 1.0.0
150
+ *
151
+ * @return null Return early if no settings page is registered.
152
+ */
153
+ public function enqueue_admin_scripts() {
154
+
155
+ if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
156
+ return;
157
+ }
158
+
159
+
160
+
161
+
162
+ $screen = get_current_screen();
163
+ if ( $this->plugin_screen_hook_suffix == $screen->id ) {
164
+ wp_enqueue_script('common');
165
+ wp_enqueue_script('wp-lists');
166
+ wp_enqueue_script('postbox');
167
+ wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), Easy_Facebook_Likebox::VERSION );
168
+ }
169
+
170
+ }
171
+
172
+ /**
173
+ * Register the administration menu for this plugin into the WordPress Dashboard menu.
174
+ *
175
+ * @since 1.0.0
176
+ */
177
+ public function add_plugin_admin_menu() {
178
+
179
+ /*
180
+ * Add a settings page for this plugin to the Settings menu.
181
+ *
182
+ * NOTE: Alternative menu locations are available via WordPress administration menu functions.
183
+ *
184
+ * Administration Menus: http://codex.wordpress.org/Administration_Menus
185
+ *
186
+ * @TODO:
187
+ *
188
+ * - Change 'Page Title' to the title of your plugin admin page
189
+ * - Change 'Menu Text' to the text for menu item for the plugin settings page
190
+ * - Change 'manage_options' to the capability you see fit
191
+ * For reference: http://codex.wordpress.org/Roles_and_Capabilities
192
+ */
193
+ $this->plugin_screen_hook_suffix = add_options_page(
194
+ __( 'Easy Fcebook Likebox', $this->plugin_slug ),
195
+ __( 'Easy Fcebook Likebox', $this->plugin_slug ),
196
+ 'manage_options',
197
+ $this->plugin_slug,
198
+ array( $this, 'display_plugin_admin_page' )
199
+ );
200
+
201
+ add_action('load-'.$this->plugin_screen_hook_suffix, array(&$this, 'on_load_page'));
202
+
203
+ }
204
+
205
+ //will be executed if wordpress core detects this page has to be rendered
206
+ function on_load_page() {
207
+
208
+ //add several metaboxes now, all metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore
209
+ add_meta_box('easy-facebook-how_to', __('How to use this plugin', 'easy-facebook-likebox'), array(&$this, 'on_how_to_use'), $this->plugin_screen_hook_suffix, 'normal', 'core');
210
+ add_meta_box('easy-facebook-likebox_popup', __('Like box pup up settings', 'easy-facebook-likebox'), array(&$this, 'on_popup_settings'), $this->plugin_screen_hook_suffix, 'additional', 'core');
211
+
212
+
213
+ }
214
+
215
+ /*
216
+ * Display first metabox with special instructions.
217
+ *
218
+ */
219
+
220
+ function on_how_to_use( $data ){
221
+ include_once( 'views/instructinos.php' );
222
+ }
223
+
224
+ /*
225
+ * Display promotion block
226
+ *
227
+ */
228
+ function on_support_us( $data ){
229
+ include_once( 'views/support-us.php' );
230
+ }
231
+
232
+ /*
233
+ * Display popup settings block
234
+ *
235
+ */
236
+ function on_popup_settings( $data ){
237
+ include_once( 'views/popup-settings.php' );
238
+ }
239
+
240
+
241
+ /**
242
+ * Render the settings page for this plugin.
243
+ *
244
+ * @since 1.0.0
245
+ */
246
+ public function display_plugin_admin_page() {
247
+ add_meta_box('efbl-support_us_box', __( 'Support us by liking our fan page!' , 'easy-facebook-likebox'), array(&$this, 'on_support_us'), $this->pagehook, 'side', 'core');
248
+ include_once( 'views/admin.php' );
249
+ }
250
+
251
+
252
+
253
+ /**
254
+ * Add settings action link to the plugins page.
255
+ *
256
+ * @since 1.0.0
257
+ */
258
+ public function add_action_links( $links ) {
259
+
260
+ return array_merge(
261
+ array(
262
+ 'settings' => '<a href="' . admin_url( 'options-general.php?page=' . $this->plugin_slug ) . '">' . __( 'Settings', $this->plugin_slug ) . '</a>'
263
+ ),
264
+ $links
265
+ );
266
+
267
+ }
268
+
269
+ /**
270
+ * Display a thank you nag when the plugin has been installed/upgraded.
271
+ */
272
+ public function post_installtion_upgrade_nag() {
273
+ if ( !current_user_can('install_plugins') ) return;
274
+
275
+ $plugin_verstion = Easy_Facebook_Likebox::VERSION;
276
+
277
+ $version_key = '_efbl_version';
278
+ $notice_key = 'I_HAVE_SUPPORTED_THE_EFBL_PLUGIN';
279
+
280
+ if ( get_site_option( $version_key ) == $plugin_verstion && get_site_option( $notice_key ) == 1 ) return;
281
+
282
+ $msg = sprintf(__('Thanks for installing/upgrading the Easy Facebook Like Box Plugin! If you like this plugin, please consider some <a href="%s" target="_blank">donation</a> or <a href="%s" target="_blank">Purchase the pro Version</a>!<br />
283
+ Support us by liking our facebook fan page!
284
+
285
+ <div id="fb-root"></div>
286
+ <script>(function(d, s, id) {
287
+ var js, fjs = d.getElementsByTagName(s)[0];
288
+ if (d.getElementById(id)) return;
289
+ js = d.createElement(s); js.id = id;
290
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=517129121754984&version=v2.0";
291
+ fjs.parentNode.insertBefore(js, fjs);
292
+ }(document, \'script\', \'facebook-jssdk\'));</script>
293
+
294
+ <div class="fb-like" data-href="https://facebook.com/jwebsol" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
295
+ <br /><br />
296
+ <a href="%s" class="button button-primary">I have supported already</a>
297
+ ', 'efbl'),
298
+ 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sjaved786%40gmail%2ecom&lc=US&item_name=Easy%20Facebook%20Like%20Box%20WordPress%20Plugin&item_number=efbl&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted',
299
+ 'http://wordpress.org/plugins/easy-facebook-likebox/',
300
+ get_admin_url('', 'options-general.php?page=easy-facebook-likebox&efbl_supported=1')
301
+ );
302
+ echo "<div class='update-nag'>$msg</div>";
303
+
304
+ update_site_option( $version_key, $plugin_verstion );
305
+ }
306
+
307
+ /**
308
+ * Provides default values for the Social Options.
309
+ */
310
+ function efbl_default_options() {
311
+
312
+ $defaults = array(
313
+ 'efbl_enable_popup' => '',
314
+ 'efbl_popup_interval' => 5000,
315
+ 'efbl_popup_width' => 400,
316
+ 'efbl_popup_height' => 300,
317
+ 'efbl_popup_shortcode' => '',
318
+ );
319
+
320
+ return apply_filters( 'efbl_default_options', $defaults );
321
+
322
+ } // end sandbox_theme_default_social_options
323
+
324
+
325
+ function i_have_supported_efbl(){
326
+
327
+ if( false == get_option( 'efbl_settings_display_options' ) ) {
328
+ add_option( 'efbl_settings_display_options', apply_filters( 'efbl_default_options', self::efbl_default_options() ) );
329
+ } // end if
330
+
331
+ // First, we register a section. This is necessary since all future options must belong to a
332
+ add_settings_section(
333
+ 'efbl_general_settings_section', // ID used to identify this section and with which to register options
334
+ __( '', 'easy-facebook-likebox' ), // Title to be displayed on the administration page
335
+ array($this, 'efbl_options_callback'), // Callback used to render the description of the section
336
+ 'efbl_settings_display_options' // Page on which to add this section of options
337
+ );
338
+
339
+ // Next, we'll introduce the fields for toggling the visibility of content elements.
340
+ add_settings_field(
341
+ 'efbl_enable_popup', // ID used to identify the field throughout the theme
342
+ __( 'Enable PopUp', 'easy-facebook-likebox' ), // The label to the left of the option interface element
343
+ array($this, 'efbl_display_enable_check'), // The name of the function responsible for rendering the option interface
344
+ 'efbl_settings_display_options', // The page on which this option will be displayed
345
+ 'efbl_general_settings_section', // The name of the section to which this field belongs
346
+ array( // The array of arguments to pass to the callback. In this case, just a description.
347
+ __( 'Activate this setting to display the header.', 'sandbox' ),
348
+ )
349
+ );
350
+
351
+
352
+
353
+
354
+ // Next, we'll introduce the fields for toggling the visibility of content elements.
355
+ add_settings_field(
356
+ 'efbl_popup_width', // ID used to identify the field throughout the theme
357
+ __( 'PopUp Width', 'easy-facebook-likebox' ), // The label to the left of the option interface element
358
+ array($this, 'efbl_display_popup_width'), // The name of the function responsible for rendering the option interface
359
+ 'efbl_settings_display_options', // The page on which this option will be displayed
360
+ 'efbl_general_settings_section', // The name of the section to which this field belongs
361
+ array( // The array of arguments to pass to the callback. In this case, just a description.
362
+ __( 'Width in pixels.', 'easy-facebook-likebox' ),
363
+ )
364
+ );
365
+
366
+ // Next, we'll introduce the fields for toggling the visibility of content elements.
367
+ add_settings_field(
368
+ 'efbl_popup_height', // ID used to identify the field throughout the theme
369
+ __( 'PopUp height', 'easy-facebook-likebox' ), // The label to the left of the option interface element
370
+ array($this, 'efbl_display_popup_height'), // The name of the function responsible for rendering the option interface
371
+ 'efbl_settings_display_options', // The page on which this option will be displayed
372
+ 'efbl_general_settings_section', // The name of the section to which this field belongs
373
+ array( // The array of arguments to pass to the callback. In this case, just a description.
374
+ __( 'Height in pixels.', 'easy-facebook-likebox' ),
375
+ )
376
+ );
377
+
378
+ add_settings_field(
379
+ 'efbl_popup_shortcode', // ID used to identify the field throughout the theme
380
+ __( 'Enter shortcode of Eeasy facebook like box', 'easy-facebook-likebox' ), // The label to the left of the option interface element
381
+ array($this, 'efbl_display_popup_shortcode'), // The name of the function responsible for rendering the option interface
382
+ 'efbl_settings_display_options', // The page on which this option will be displayed
383
+ 'efbl_general_settings_section', // The name of the section to which this field belongs
384
+ array( // The array of arguments to pass to the callback. In this case, just a description.
385
+ __( 'Activate this setting to display the header.', 'sandbox' ),
386
+ )
387
+ );
388
+
389
+
390
+
391
+ // Finally, we register the fields with WordPress
392
+ register_setting(
393
+ 'efbl_settings_display_options',
394
+ 'efbl_settings_display_options'
395
+ );
396
+
397
+ if(isset($_GET['efbl_supported'])) {
398
+ update_site_option( 'I_HAVE_SUPPORTED_THE_EFBL_PLUGIN', 1 );
399
+ }
400
+
401
+ /*echo I_HAVE_SUPPORTED_THE_EFBL_PLUGIN;
402
+ exit; */
403
+ }
404
+
405
+ function efbl_options_callback(){
406
+
407
+ //Do nothing for now
408
+
409
+ }
410
+
411
+ //Enable pupup
412
+ function efbl_display_enable_check(){
413
+
414
+ $options = get_option( 'efbl_settings_display_options' );
415
+
416
+ $html = '<input type="checkbox" id="efbl_enable_popup" name="efbl_settings_display_options[efbl_enable_popup]" value="1"' . checked( 1, $options['efbl_enable_popup'], false ) . '/>';
417
+ $html .= '&nbsp;';
418
+
419
+ echo $html;
420
+
421
+ }
422
+
423
+ //Interval
424
+ function efbl_display_popup_interval() {
425
+
426
+ $options = get_option( 'efbl_settings_display_options' );
427
+
428
+ // Render the output
429
+ echo '<input type="text" id="efbl_popup_interval" name="efbl_settings_display_options[efbl_popup_interval]" value="' . $options['efbl_popup_interval'] . '" />';
430
+
431
+ echo '&nbsp;<label for="efbl_popup_interval">Delay in miliseconds. 1000 ms = 1 second.</label>';
432
+
433
+ } // end sandbox_input_element_callback
434
+
435
+ //Width
436
+ function efbl_display_popup_width() {
437
+
438
+ $options = get_option( 'efbl_settings_display_options' );
439
+
440
+ // Render the output
441
+ echo '<input type="text" id="efbl_popup_width" name="efbl_settings_display_options[efbl_popup_width]" value="' . $options['efbl_popup_width'] . '" />';
442
+
443
+ echo '&nbsp;<label for="efbl_popup_width">Width in pixels.</label>';
444
+
445
+ } // end sandbox_input_element_callback
446
+
447
+ //Height
448
+ function efbl_display_popup_height() {
449
+
450
+ $options = get_option( 'efbl_settings_display_options' );
451
+
452
+ // Render the output
453
+ echo '<input type="text" id="efbl_popup_height" name="efbl_settings_display_options[efbl_popup_height]" value="' . $options['efbl_popup_height'] . '" />';
454
+
455
+ echo '&nbsp;<label for="efbl_popup_height">Height in pixels.</label>';
456
+
457
+ } // end sandbox_input_element_callback
458
+
459
+
460
+ function efbl_display_popup_shortcode(){
461
+
462
+ $options = get_option( 'efbl_settings_display_options' );
463
+ /*echo "<pre>";
464
+ print_r($options);
465
+ echo "</pre>";*/
466
+
467
+ echo '<textarea id="efbl_popup_shortcode" name="efbl_settings_display_options[efbl_popup_shortcode]" rows="5" cols="50" placeholder="Generate shortcode from Appearance > Widgets > Easy Facebook Likebox">' . $options['efbl_popup_shortcode'] . '</textarea>';
468
+
469
+
470
+ echo $html;
471
+
472
+ }
473
+
474
+
475
+ }
admin/views/admin.php CHANGED
@@ -1,77 +1,68 @@
1
- <?php
2
- /**
3
- * Represents the view for the administration dashboard.
4
- *
5
- * This includes the header, options, and other information that should provide
6
- * The User Interface to the end user.
7
- *
8
- * @package Plugin_Name
9
- * @author Your Name <email@example.com>
10
- * @license GPL-2.0+
11
- * @link http://example.com
12
- * @copyright 2014 Your Name or Company Name
13
- */
14
- ?>
15
-
16
- <div class="wrap" id="dashboard-widgets">
17
-
18
- <div id="postbox-container-1" class="postbox-container">
19
- <div id="normal-sortables" class="meta-box-sortables ui-sortable"><div id="dashboard_right_now" class="postbox ">
20
- <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php echo esc_html( get_admin_page_title() ); ?></span></h3>
21
- <div class="inside">
22
- <div class="main">
23
-
24
- <p>Thanks for installing the plugin.</p>
25
-
26
- <p>Here are steps and ways you can use this plugin.
27
- <ol>
28
- <li> Add the "Easy Facebook Likebox" widget in sidebar to show the like box in your website sidebar</li>
29
- <li> Add widget in sidebar and generate shortcode by saving the widgets optiosn to show likebox somewhere else on your website.</li>
30
- <li> You can also directly add below shortcode (without quotes) in post/page editor and change default values with your custom one according to your needs and requirments.
31
- "[efb_likebox fanpage_url="YOUR_FB_FANPAGE_NAME_OR_ID" fb_appid="" box_width="300" box_height="" colorscheme="light" show_faces="1" show_header="1" show_stream="0" show_border="1" ]"
32
- </li>
33
- </ol>
34
- </p>
35
- <p>I am working on the betterment and improvement of this plugin so stay tuned.</p> </div>
36
- </div>
37
- </div>
38
-
39
- </div> </div>
40
-
41
-
42
- <div id="postbox-container-1" class="postbox-container">
43
- <div id="normal-sortables" class="meta-box-sortables ui-sortable"><div id="dashboard_right_now" class="postbox ">
44
- <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span> Support us by liking our fan page!</span></h3>
45
- <div class="inside">
46
- <div class="main">
47
-
48
- <div class="fb-like-box" data-href="https://www.facebook.com/jwebsol" data-colorscheme="light" data-show-faces="true" data-header="false" data-stream="false" data-show-border="true"></div>
49
- <div id="fb-root"></div>
50
- <script>(function(d, s, id) {
51
- var js, fjs = d.getElementsByTagName(s)[0];
52
- if (d.getElementById(id)) return;
53
- js = d.createElement(s); js.id = id;
54
- js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=517129121754984&version=v2.0";
55
- fjs.parentNode.insertBefore(js, fjs);
56
- }(document, 'script', 'facebook-jssdk'));</script>
57
-
58
- </div>
59
- </div>
60
- </div>
61
-
62
- </div> </div>
63
-
64
-
65
-
66
-
67
-
68
-
69
- </div>
70
- <style type="text/css">
71
- #dashboard_right_now li{
72
- width:100%;
73
- }
74
- .hndle{
75
- padding: 10px;
76
- }
77
- </style>
1
+ <?php
2
+ /**
3
+ * Represents the view for the administration dashboard.
4
+ *
5
+ * This includes the header, options, and other information that should provide
6
+ * The User Interface to the end user.
7
+ *
8
+ * @package Plugin_Name
9
+ * @author Your Name <email@example.com>
10
+ * @license GPL-2.0+
11
+ * @link http://example.com
12
+ * @copyright 2014 Your Name or Company Name
13
+ */
14
+ ?>
15
+
16
+
17
+
18
+
19
+ <div class="wrap efbl" id="dashboard-widgets">
20
+ <a target="_blank" class="go_pro_ad" href="http://jwebsol.com/product/easy-facebook-like-box-pro/" title="GoPro">GoPro</a>
21
+ <h2>&nbsp;</h2>
22
+ <form method="post" action="<?php echo admin_url('options.php')?>">
23
+
24
+
25
+
26
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
27
+
28
+ <?php do_meta_boxes($this->plugin_screen_hook_suffix, 'normal', $data); ?>
29
+
30
+
31
+ </div>
32
+
33
+
34
+
35
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
36
+
37
+ <?php do_meta_boxes($this->plugin_screen_hook_suffix, 'additional', $data); ?>
38
+ </div>
39
+ <div class="clearfix"></div>
40
+
41
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
42
+ <?php do_meta_boxes($this->plugin_screen_hook_suffix, 'side', $data); ?>
43
+
44
+ </div>
45
+
46
+ </form>
47
+ </div>
48
+
49
+ <script type="text/javascript">
50
+ //<![CDATA[
51
+ jQuery(document).ready( function($) {
52
+ // close postboxes that should be closed
53
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
54
+ // postboxes setup
55
+ postboxes.add_postbox_toggles('<?php echo $this->plugin_screen_hook_suffix; ?>');
56
+ });
57
+ //]]>
58
+ </script>
59
+
60
+ <style type="text/css">
61
+ #dashboard_right_now li{
62
+ width:100%;
63
+ }
64
+ .hndle{
65
+ padding: 10px;
66
+ margin:0px;
67
+ }
68
+ </style>
 
 
 
 
 
 
 
 
 
admin/views/instructinos.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Represents the view for the administration of instructinos and how tos
4
+ *
5
+ * This includes the header, options, and other information that should provide
6
+ * The User Interface to the end user.
7
+ *
8
+ * @package Plugin_Name
9
+ * @author Your Name <email@example.com>
10
+ * @license GPL-2.0+
11
+ * @link http://example.com
12
+ * @copyright 2014 Your Name or Company Name
13
+ */
14
+
15
+ ?>
16
+ <p><?php _e('Thanks for installing the plugin.', 'easy-facebook-likebox');?></p>
17
+
18
+ <h3><?php _e('Widget or shortcode usage instructions.', 'easy-facebook-likebox');?></h3>
19
+
20
+ <p><?php _e('Here are easy steps to use this plugin.', 'easy-facebook-likebox');?>
21
+ <ol>
22
+ <li> <?php _e('Add the "Easy Facebook Likebox" widget in sidebar to show the like box in your website sidebar', 'easy-facebook-likebox');?></li>
23
+ <li> <?php _e('Add widget in sidebar and generate shortcode by saving the widgets optiosn to show likebox somewhere else on your website.', 'easy-facebook-likebox');?> </li>
24
+ <li> <?php _e('You can also directly add below shortcode (without quotes) in post/page editor and change default values with your custom one according to your needs and requirments.
25
+ "[efb_likebox fanpage_url="YOUR_FB_FANPAGE_NAME_OR_ID" fb_appid="" box_width="300" box_height="" colorscheme="light" show_faces="1" show_header="1" show_stream="0" show_border="1" ]"', 'easy-facebook-likebox');?>
26
+ </li>
27
+ </ol>
28
+ </p>
29
+
30
+ <h3><?php _e('AutoPopUp usage instructions.', 'easy-facebook-likebox');?></h3>
31
+
32
+ <p><?php _e('Here are easy steps to use/configure AutoPopUp this plugin.', 'easy-facebook-likebox');?>
33
+ <ol>
34
+ <li> <?php _e('Enable or disable the AutoPopUp', 'easy-facebook-likebox');?></li>
35
+ <li> <?php _e('Set width and height. Shoule be same as facebook like box.', 'easy-facebook-likebox');?> </li>
36
+ <li> <?php _e('Generate shortcode from Appearance > Widgets > Easy Facebook Likebox and add it in "Enter shortcode of Eeasy facebook like box" text box below.', 'easy-facebook-likebox');?>
37
+ </li>
38
+ </ol>
39
+ </p>
40
+
41
+ <p><?php _e('I am constantly working on the betterment and improvement of this plugin so stay tuned.', 'easy-facebook-likebox');?></p><strong></strong>
admin/views/popup-settings.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Represents the view for the administration of popup settings.
4
+ *
5
+ * This includes the header, options, and other information that should provide
6
+ * The User Interface to the end user.
7
+ *
8
+ * @package Plugin_Name
9
+ * @author Your Name <email@example.com>
10
+ * @license GPL-2.0+
11
+ * @link http://example.com
12
+ * @copyright 2014 Your Name or Company Name
13
+ */
14
+
15
+ settings_fields( 'efbl_settings_display_options' );
16
+ do_settings_sections( 'efbl_settings_display_options' );
17
+
18
+ //settings_fields( 'sandbox_theme_display_options' );
19
+ //do_settings_sections( 'sandbox_theme_display_options' );
20
+ ?>
21
+ <div class="button_container">
22
+ <?php
23
+ submit_button();
24
+ ?></div>
25
+ <h2 class="promotional_text">Want more control over PopUp? Try our premimum version! <a target="_blank" class="" href="http://jwebsol.com/product/easy-facebook-like-box-pro/" title="GoPro">Click here for pricing & details</a></h2>
admin/views/support-us.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Represents the view for the administration of support us section.
4
+ *
5
+ * This includes the header, options, and other information that should provide
6
+ * The User Interface to the end user.
7
+ *
8
+ * @package Plugin_Name
9
+ * @author Your Name <email@example.com>
10
+ * @license GPL-2.0+
11
+ * @link http://example.com
12
+ * @copyright 2014 Your Name or Company Name
13
+ */
14
+
15
+ ?>
16
+ <div class="" style="width:50%; display: inline-block;">
17
+ <div class="fb-like-box" data-href="https://www.facebook.com/jwebsol" data-colorscheme="light" data-show-faces="true" data-header="false" data-stream="false" data-show-border="true"></div>
18
+ <div id="fb-root"></div>
19
+ <script>(function(d, s, id) {
20
+ var js, fjs = d.getElementsByTagName(s)[0];
21
+ if (d.getElementById(id)) return;
22
+ js = d.createElement(s); js.id = id;
23
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=517129121754984&version=v2.0";
24
+ fjs.parentNode.insertBefore(js, fjs);
25
+ }(document, 'script', 'facebook-jssdk'));</script>
26
+ </div>
27
+ <div class="" style="width:49%; display: inline;">
28
+ <a target="_blank" class="buy_button" href="http://jwebsol.com/product/easy-facebook-like-box-pro/" title="GoPro">Buy Pro Versio of this plugin</a>
29
+ </div>
easy-facebook-likebox.php CHANGED
@@ -1,93 +1,93 @@
1
- <?php
2
- /**
3
- * Plugin Name: Easy Facebook Likebox
4
- * Plugin URI: httt://wordpress.org/plugins/easy-facebook-likebox
5
- * Description: Easy Facebook like box WordPress plugin allows you to easly display facebook like box fan page on your website using either widget or shortcode to increase facbook fan page likes. You can use the shortcode generated after saving the facebook like box widget. Its completely customizable with lots of optional settings. Its also responsive facebook like box at the same time.
6
- * Version: 2.1.0
7
- * Author: Sajid Javed
8
- * Author URI: http://jwebsol.com
9
- * Text Domain: easy-facebook-likebox
10
- * License: GPL-2.0+
11
- * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12
- * Domain Path: /languages
13
- */
14
-
15
- // If this file is called directly, abort.
16
- if ( ! defined( 'WPINC' ) ) {
17
- die;
18
- }
19
-
20
- /*----------------------------------------------------------------------------*
21
- * Public-Facing Functionality
22
- *----------------------------------------------------------------------------*/
23
-
24
- /*
25
- * @TODO:
26
- *
27
- * - replace `class-plugin-name.php` with the name of the plugin's class file
28
- *
29
- */
30
- require_once( plugin_dir_path( __FILE__ ) . 'public/easy-facebook-likebox.php' );
31
-
32
- /*
33
- * Register hooks that are fired when the plugin is activated or deactivated.
34
- * When the plugin is deleted, the uninstall.php file is loaded.
35
- *
36
- * @TODO:
37
- *
38
- * - replace Plugin_Name with the name of the class defined in
39
- * `class-plugin-name.php`
40
- */
41
- register_activation_hook( __FILE__, array( 'Easy_Facebook_Likebox', 'activate' ) );
42
- register_deactivation_hook( __FILE__, array( 'Easy_Facebook_Likebox', 'deactivate' ) );
43
-
44
- /*
45
- * @TODO:
46
- *
47
- * - replace Plugin_Name with the name of the class defined in
48
- * `class-plugin-name.php`
49
- */
50
- add_action( 'plugins_loaded', array( 'Easy_Facebook_Likebox', 'get_instance' ) );
51
-
52
- /*----------------------------------------------------------------------------*
53
- * Dashboard and Administrative Functionality
54
- *----------------------------------------------------------------------------*/
55
-
56
- /*
57
- * @TODO:
58
- *
59
- * - replace `class-plugin-name-admin.php` with the name of the plugin's admin file
60
- * - replace Plugin_Name_Admin with the name of the class defined in
61
- * `class-plugin-name-admin.php`
62
- *
63
- * If you want to include Ajax within the dashboard, change the following
64
- * conditional to:
65
- *
66
- * if ( is_admin() ) {
67
- * ...
68
- * }
69
- *
70
- * The code below is intended to give the lightest footprint possible.
71
- */
72
- if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
73
-
74
- require_once( plugin_dir_path( __FILE__ ) . 'admin/easy-facebook-likebox-admin.php' );
75
- add_action( 'plugins_loaded', array( 'Easy_Facebook_Likebox_Admin', 'get_instance' ) );
76
-
77
- }
78
-
79
-
80
- /*----------------------------------------------------------------------------*
81
- * Dashboard and Administrative Functionality
82
- *----------------------------------------------------------------------------*/
83
-
84
- /*
85
- * Including widget class.
86
- */
87
-
88
- require_once( plugin_dir_path( __FILE__ ) . 'includes/easy-facebook-likebox-widget.php' );
89
- // register Foo_Widget widget
90
- function register_fblx_widget() {
91
- register_widget( 'Easy_Facebook_Like_Box_Widget' );
92
- }
93
  add_action( 'widgets_init', 'register_fblx_widget' );
1
+ <?php
2
+ /**
3
+ * Plugin Name: Easy Facebook Likebox
4
+ * Plugin URI: httt://wordpress.org/plugins/easy-facebook-likebox
5
+ * Description: Easy Facebook like box WordPress plugin allows you to easly display facebook like box fan page on your website using either widget or shortcode to increase facbook fan page likes. You can use the shortcode generated after saving the facebook like box widget. Its completely customizable with lots of optional settings. Its also responsive facebook like box at the same time.
6
+ * Version: 3.0
7
+ * Author: Sajid Javed
8
+ * Author URI: http://jwebsol.com
9
+ * Text Domain: easy-facebook-likebox
10
+ * License: GPL-2.0+
11
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12
+ * Domain Path: /languages
13
+ */
14
+
15
+ // If this file is called directly, abort.
16
+ if ( ! defined( 'WPINC' ) ) {
17
+ die;
18
+ }
19
+
20
+ /*----------------------------------------------------------------------------*
21
+ * Public-Facing Functionality
22
+ *----------------------------------------------------------------------------*/
23
+
24
+ /*
25
+ * @TODO:
26
+ *
27
+ * - replace `class-plugin-name.php` with the name of the plugin's class file
28
+ *
29
+ */
30
+ require_once( plugin_dir_path( __FILE__ ) . 'public/easy-facebook-likebox.php' );
31
+
32
+ /*
33
+ * Register hooks that are fired when the plugin is activated or deactivated.
34
+ * When the plugin is deleted, the uninstall.php file is loaded.
35
+ *
36
+ * @TODO:
37
+ *
38
+ * - replace Plugin_Name with the name of the class defined in
39
+ * `class-plugin-name.php`
40
+ */
41
+ register_activation_hook( __FILE__, array( 'Easy_Facebook_Likebox', 'activate' ) );
42
+ register_deactivation_hook( __FILE__, array( 'Easy_Facebook_Likebox', 'deactivate' ) );
43
+
44
+ /*
45
+ * @TODO:
46
+ *
47
+ * - replace Plugin_Name with the name of the class defined in
48
+ * `class-plugin-name.php`
49
+ */
50
+ add_action( 'plugins_loaded', array( 'Easy_Facebook_Likebox', 'get_instance' ) );
51
+
52
+ /*----------------------------------------------------------------------------*
53
+ * Dashboard and Administrative Functionality
54
+ *----------------------------------------------------------------------------*/
55
+
56
+ /*
57
+ * @TODO:
58
+ *
59
+ * - replace `class-plugin-name-admin.php` with the name of the plugin's admin file
60
+ * - replace Plugin_Name_Admin with the name of the class defined in
61
+ * `class-plugin-name-admin.php`
62
+ *
63
+ * If you want to include Ajax within the dashboard, change the following
64
+ * conditional to:
65
+ *
66
+ * if ( is_admin() ) {
67
+ * ...
68
+ * }
69
+ *
70
+ * The code below is intended to give the lightest footprint possible.
71
+ */
72
+ if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
73
+
74
+ require_once( plugin_dir_path( __FILE__ ) . 'admin/easy-facebook-likebox-admin.php' );
75
+ add_action( 'plugins_loaded', array( 'Easy_Facebook_Likebox_Admin', 'get_instance' ) );
76
+
77
+ }
78
+
79
+
80
+ /*----------------------------------------------------------------------------*
81
+ * Dashboard and Administrative Functionality
82
+ *----------------------------------------------------------------------------*/
83
+
84
+ /*
85
+ * Including widget class.
86
+ */
87
+
88
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/easy-facebook-likebox-widget.php' );
89
+ // register Foo_Widget widget
90
+ function register_fblx_widget() {
91
+ register_widget( 'Easy_Facebook_Like_Box_Widget' );
92
+ }
93
  add_action( 'widgets_init', 'register_fblx_widget' );
includes/easy-facebook-likebox-widget.php CHANGED
@@ -1,6 +1,7 @@
1
- <?php
 
2
  class Easy_Facebook_Like_Box_Widget extends WP_Widget {
3
-
4
  /**
5
  * Register widget with WordPress.
6
  */
1
+ <?php
2
+ ini_set('display_errors','Off');
3
  class Easy_Facebook_Like_Box_Widget extends WP_Widget {
4
+
5
  /**
6
  * Register widget with WordPress.
7
  */
public/assets/css/popup_close.png ADDED
Binary file
public/assets/css/public.css CHANGED
@@ -1,10 +1,30 @@
1
- /* This stylesheet is used to style the public-facing components of the plugin. */
2
- #fb-root {
3
- display: none;
4
- }
5
-
6
- /* To fill the container and nothing else */
7
-
8
- .responsive , .responsive span, .responsive span iframe[style], .responsive span img {
9
- width: 100% !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  }
1
+ /* This stylesheet is used to style the public-facing components of the plugin. */
2
+ #fb-root {
3
+ display: none;
4
+ }
5
+
6
+ /* To fill the container and nothing else */
7
+
8
+ .responsive , .responsive span, .responsive span iframe[style], .responsive span img {
9
+ width: 100% !important;
10
+ }
11
+
12
+ .white-popup {
13
+ position: relative;
14
+ background: #FFF;
15
+ width: auto;
16
+ max-width: 500px;
17
+ margin: 20px auto;
18
+ }
19
+ .mfp-close {
20
+ top: -18px !important;
21
+ right: -18px !important;
22
+ background:url('popup_close.png') !important;
23
+ width: 36px !important;
24
+ height: 37px !important;
25
+ font-size:0px !important;
26
+ background:transparent;
27
+ }
28
+ .mfp-close:hover, .mfp-close:active, .mfp-close:focus{
29
+ background:transparent;
30
  }
public/assets/js/public.js CHANGED
@@ -1,10 +1,10 @@
1
- (function ( $ ) {
2
- "use strict";
3
-
4
- $(function () {
5
-
6
- // Place your public-facing JavaScript here
7
-
8
- });
9
-
10
  }(jQuery));
1
+ (function ( $ ) {
2
+ "use strict";
3
+
4
+ $(function () {
5
+
6
+ // Place your public-facing JavaScript here
7
+
8
+ });
9
+
10
  }(jQuery));
public/assets/popup/blank.gif ADDED
Binary file
public/assets/popup/fancy_close.png ADDED
Binary file
public/assets/popup/fancy_loading.png ADDED
Binary file
public/assets/popup/fancy_nav_left.png ADDED
Binary file
public/assets/popup/fancy_nav_right.png ADDED
Binary file
public/assets/popup/fancy_shadow_e.png ADDED
Binary file
public/assets/popup/fancy_shadow_n.png ADDED
Binary file
public/assets/popup/fancy_shadow_ne.png ADDED
Binary file
public/assets/popup/fancy_shadow_nw.png ADDED
Binary file
public/assets/popup/fancy_shadow_s.png ADDED
Binary file
public/assets/popup/fancy_shadow_se.png ADDED
Binary file
public/assets/popup/fancy_shadow_sw.png ADDED
Binary file
public/assets/popup/fancy_shadow_w.png ADDED
Binary file
public/assets/popup/fancy_title_left.png ADDED
Binary file
public/assets/popup/fancy_title_main.png ADDED
Binary file
public/assets/popup/fancy_title_over.png ADDED
Binary file
public/assets/popup/fancy_title_right.png ADDED
Binary file
public/assets/popup/fancybox-x.png ADDED
Binary file
public/assets/popup/fancybox-y.png ADDED
Binary file
public/assets/popup/fancybox.png ADDED
Binary file
public/assets/popup/fancybox_loading.gif ADDED
Binary file
public/assets/popup/fancybox_loading@2x.gif ADDED
Binary file
public/assets/popup/fancybox_overlay.png ADDED
Binary file
public/assets/popup/fancybox_sprite.png ADDED
Binary file
public/assets/popup/fancybox_sprite@2x.png ADDED
Binary file
public/assets/popup/jquery.fancybox-1.3.7.css ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
+ *
10
+ * Version: 1.3.4 (11/11/2010) patched : box-sizing: content-box;
11
+ * Requires: jQuery v1.3+
12
+ *
13
+ * Dual licensed under the MIT and GPL licenses:
14
+ * http://www.opensource.org/licenses/mit-license.php
15
+ * http://www.gnu.org/licenses/gpl.html
16
+ */
17
+
18
+ #fancybox-loading {
19
+ position: fixed;
20
+ top: 50%;
21
+ left: 50%;
22
+ width: 40px;
23
+ height: 40px;
24
+ margin-top: -20px;
25
+ margin-left: -20px;
26
+ cursor: pointer;
27
+ overflow: hidden;
28
+ z-index:11104;
29
+ display: none;
30
+ box-sizing: content-box;
31
+ -moz-box-sizing: content-box;
32
+ }
33
+
34
+ #fancybox-loading div {
35
+ position: absolute;
36
+ top: 0;
37
+ left: 0;
38
+ width: 40px;
39
+ height: 480px;
40
+ background-image: url('fancybox.png');
41
+ box-sizing: content-box;
42
+ -moz-box-sizing: content-box;
43
+ }
44
+
45
+ #fancybox-overlay {
46
+ position: absolute;
47
+ top: 0;
48
+ left: 0;
49
+ width: 100%;
50
+ z-index:11100;
51
+ display: none;
52
+ box-sizing: content-box;
53
+ -moz-box-sizing: content-box;
54
+ }
55
+
56
+ #fancybox-tmp {
57
+ padding: 0;
58
+ margin: 0;
59
+ border: 0;
60
+ overflow: auto;
61
+ display: none;
62
+ }
63
+
64
+ #fancybox-wrap {
65
+ position: absolute;
66
+ top: 0;
67
+ left: 0;
68
+ padding: 20px;
69
+ z-index:11101;
70
+ outline: none;
71
+ display: none;
72
+ box-sizing: content-box;
73
+ -moz-box-sizing: content-box;
74
+ }
75
+
76
+ #fancybox-wrap div {
77
+ box-sizing: content-box;
78
+ -moz-box-sizing: content-box;
79
+ }
80
+
81
+ #fancybox-outer {
82
+ position: relative;
83
+ width: 100%;
84
+ height: 100%;
85
+ background: #fff;
86
+ }
87
+
88
+ #fancybox-content {
89
+ width: 0;
90
+ height: 0;
91
+ padding: 0;
92
+ outline: none;
93
+ position: relative;
94
+ overflow: hidden;
95
+ z-index:11102;
96
+ border: 0px solid #fff;
97
+ background: #fff;
98
+ -moz-background-clip: padding; /* Firefox 3.6 */
99
+ -webkit-background-clip: padding; /* Safari 4? Chrome 6? */
100
+ background-clip: padding-box; /* IE9+, Firefox 4+, Opera, Chrome */
101
+ }
102
+
103
+ #fancybox-hide-sel-frame {
104
+ position: absolute;
105
+ top: 0;
106
+ left: 0;
107
+ width: 100%;
108
+ height: 100%;
109
+ background: transparent;
110
+ z-index:11101;
111
+ }
112
+
113
+ #fancybox-close {
114
+ position: absolute;
115
+ top: -15px;
116
+ right: -15px;
117
+ width: 30px;
118
+ height: 30px;
119
+ background: transparent url('fancybox.png') -40px 0px;
120
+ cursor: pointer;
121
+ z-index:11103;
122
+ display: none;
123
+ }
124
+
125
+ #fancybox-error {
126
+ color: #444;
127
+ font: normal 12px/20px Arial;
128
+ padding: 14px;
129
+ margin: 0;
130
+ }
131
+
132
+ #fancybox-img {
133
+ width: 100%;
134
+ height: 100%;
135
+ padding: 0;
136
+ margin: 0;
137
+ border: none;
138
+ outline: none;
139
+ line-height: 0;
140
+ vertical-align: top;
141
+ max-width:none !important;
142
+ max-height:none !important
143
+ }
144
+
145
+ #fancybox-frame {
146
+ width: 100%;
147
+ height: 100%;
148
+ border: none;
149
+ display: block;
150
+ -webkit-overflow-scrolling: touch;
151
+ z-index:0; /* z-index bug with -webkit-overflow-scrolling */
152
+ }
153
+
154
+ #fancybox-left, #fancybox-right {
155
+ position: absolute;
156
+ bottom: 0px;
157
+ height: 100%;
158
+ width: 35%;
159
+ cursor: pointer;
160
+ outline: none;
161
+ background: transparent url('blank.gif');
162
+ z-index:11102;
163
+ display: none;
164
+ }
165
+
166
+ #fancybox-left {
167
+ left: 0px;
168
+ }
169
+
170
+ .rtl #fancybox-left {
171
+ left:auto;
172
+ right:0px
173
+ }
174
+
175
+ #fancybox-right {
176
+ right: 0px;
177
+ }
178
+
179
+ .rtl #fancybox-right {
180
+ left:0px;
181
+ right:auto
182
+ }
183
+
184
+ #fancybox-left-ico, #fancybox-right-ico {
185
+ position: absolute;
186
+ top: 50%;
187
+ left: -9999px;
188
+ width: 30px;
189
+ height: 30px;
190
+ margin-top: -15px;
191
+ cursor: pointer;
192
+ z-index:11102;
193
+ display: block;
194
+ }
195
+
196
+ #fancybox-left-ico {
197
+ background-image: url('fancybox.png');
198
+ background-position: -40px -30px;
199
+ }
200
+
201
+ .rtl #fancybox-left-ico{
202
+ background-position:-40px -60px;
203
+ right:-9999px
204
+ }
205
+
206
+ #fancybox-right-ico {
207
+ background-image: url('fancybox.png');
208
+ background-position: -40px -60px;
209
+ }
210
+
211
+ .rtl #fancybox-right-ico{
212
+ background-position:-40px -30px;
213
+ right:-9999px
214
+ }
215
+
216
+ #fancybox-left:hover, #fancybox-right:hover {
217
+ visibility: visible; /* IE6 */
218
+ }
219
+
220
+ #fancybox-left:hover span {
221
+ left: 20px;
222
+ }
223
+
224
+ .rtl #fancybox-left:hover span {
225
+ right:20px
226
+ }
227
+
228
+ #fancybox-right:hover span {
229
+ left: auto;
230
+ right: 20px;
231
+ }
232
+
233
+ .rtl #fancybox-right:hover span {
234
+ right:auto;
235
+ left:20px
236
+ }
237
+
238
+ .fancybox-bg {
239
+ position: absolute;
240
+ padding: 0;
241
+ margin: 0;
242
+ border: 0;
243
+ width: 20px;
244
+ height: 20px;
245
+ z-index:11001;
246
+ }
247
+
248
+ #fancybox-bg-n {
249
+ top: -20px;
250
+ left: 0;
251
+ width: 100%;
252
+ background-image: url('fancybox-x.png');
253
+ }
254
+
255
+ #fancybox-bg-ne {
256
+ top: -20px;
257
+ right: -20px;
258
+ background-image: url('fancybox.png');
259
+ background-position: -40px -162px;
260
+ }
261
+
262
+ #fancybox-bg-e {
263
+ top: 0;
264
+ right: -20px;
265
+ height: 100%;
266
+ background-image: url('fancybox-y.png');
267
+ background-position: -20px 0px;
268
+ }
269
+
270
+ #fancybox-bg-se {
271
+ bottom: -20px;
272
+ right: -20px;
273
+ background-image: url('fancybox.png');
274
+ background-position: -40px -182px;
275
+ }
276
+
277
+ #fancybox-bg-s {
278
+ bottom: -20px;
279
+ left: 0;
280
+ width: 100%;
281
+ background-image: url('fancybox-x.png');
282
+ background-position: 0px -20px;
283
+ }
284
+
285
+ #fancybox-bg-sw {
286
+ bottom: -20px;
287
+ left: -20px;
288
+ background-image: url('fancybox.png');
289
+ background-position: -40px -142px;
290
+ }
291
+
292
+ #fancybox-bg-w {
293
+ top: 0;
294
+ left: -20px;
295
+ height: 100%;
296
+ background-image: url('fancybox-y.png');
297
+ }
298
+
299
+ #fancybox-bg-nw {
300
+ top: -20px;
301
+ left: -20px;
302
+ background-image: url('fancybox.png');
303
+ background-position: -40px -122px;
304
+ }
305
+
306
+ #fancybox-title {
307
+ font-family: Helvetica;
308
+ font-size: 12px;
309
+ z-index:11102;
310
+ }
311
+
312
+ .fancybox-title-inside {
313
+ padding-bottom: 10px;
314
+ text-align: center;
315
+ color: #333;
316
+ position: relative;
317
+ }
318
+
319
+ .fancybox-title-outside {
320
+ padding-top: 10px;
321
+ color: #fff;
322
+ }
323
+
324
+ .fancybox-title-over {
325
+ position: absolute;
326
+ bottom: 0;
327
+ left: 0;
328
+ color: #FFF;
329
+ text-align: left;
330
+ }
331
+
332
+ .rtl .fancybox-title-over {
333
+ text-align:right
334
+ }
335
+
336
+ #fancybox-title-over {
337
+ padding: 10px;
338
+ background-image: url('fancy_title_over.png');
339
+ display: block;
340
+ }
341
+
342
+ .fancybox-title-float {
343
+ position: absolute;
344
+ left: 0;
345
+ bottom: -20px;
346
+ height: 32px;
347
+ }
348
+
349
+ #fancybox-title-float-wrap {
350
+ border: none;
351
+ border-collapse: collapse;
352
+ width: auto;
353
+ }
354
+
355
+ #fancybox-title-float-wrap td {
356
+ border: none;
357
+ white-space: nowrap;
358
+ }
359
+
360
+ #fancybox-title-float-left {
361
+ padding: 0 0 0 15px;
362
+ background: url('fancybox.png') -40px -90px no-repeat;
363
+ }
364
+
365
+ #fancybox-title-float-main {
366
+ color: #FFF;
367
+ line-height: 29px;
368
+ font-weight: bold;
369
+ padding: 0 0 3px 0;
370
+ background: url('fancybox-x.png') 0px -40px;
371
+ }
372
+
373
+ #fancybox-title-float-right {
374
+ padding: 0 0 0 15px;
375
+ background: url('fancybox.png') -55px -90px no-repeat;
376
+ }
377
+
378
+ .fancybox-hidden{
379
+ display:none
380
+ }
381
+
382
+ /* IE */
383
+ .fancybox-ie .fancybox-bg{
384
+ background: transparent !important
385
+ }
public/assets/popup/jquery.fancybox-1.3.7.js ADDED
@@ -0,0 +1,1190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
+ *
10
+ * Version: 1.3.4 (11/11/2010) patched and appended to 1.3.7
11
+ * Requires: jQuery v1.7+
12
+ *
13
+ * Dual licensed under the MIT and GPL licenses:
14
+ * http://www.opensource.org/licenses/mit-license.php
15
+ * http://www.gnu.org/licenses/gpl.html
16
+ *
17
+ * Patches applied:
18
+ * Removed/replaced non-HTML5 attributes
19
+ * Added parameter allowfullscreen for iframe, RavanH ravanhagen@gmail.com
20
+ * Line 309, 714: patches for better centering on ipad etc.
21
+ * Line 645: Check type = image for mousewheel
22
+ * Line 820: qouted attribute selector, RavanH ravanhagen@gmail.com
23
+ * Line 41, 622 and 1125: added isTouch variable and autoResize parameter, RavanH ravanhagen@gmail.com
24
+ * Line 34: WebP image support, RavanH ravanhagen@gmail.com
25
+ * Line 126, 677, 686: 'image' class forces image type, RavanH ravanhagen@gmail.com
26
+ * Patched for jQuery 1.9+ compat by Sabel http://sabel.bluegfx.de/wordpress/wp-content/uploads/2013/03/jquery.fancybox-1.3.4.js
27
+ *
28
+ * Added SVG support by Simon Maillard simon@ogesta.fr
29
+ */
30
+ ;(function($) {
31
+ var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
32
+
33
+ selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
34
+
35
+ ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg|webp)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i, svgRegExp = /[^\.]\.(svg)\s*$/i,
36
+
37
+ loadingTimer, loadingFrame = 1,
38
+
39
+ titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
40
+
41
+ isIE6 = navigator.userAgent.match(/msie [6]/i) && !window.XMLHttpRequest,
42
+
43
+ isTouch = document.createTouch !== undefined,
44
+
45
+ /*
46
+ * Private methods
47
+ */
48
+
49
+ _abort = function() {
50
+ loading.hide();
51
+
52
+ imgPreloader.onerror = imgPreloader.onload = null;
53
+
54
+ if (ajaxLoader) {
55
+ ajaxLoader.abort();
56
+ }
57
+
58
+ tmp.empty();
59
+ },
60
+
61
+ _error = function() {
62
+ if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
63
+ loading.hide();
64
+ busy = false;
65
+ return;
66
+ }
67
+
68
+ selectedOpts.titleShow = false;
69
+
70
+ selectedOpts.width = 'auto';
71
+ selectedOpts.height = 'auto';
72
+
73
+ tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
74
+
75
+ _process_inline();
76
+ },
77
+
78
+ _start = function() {
79
+ var obj = selectedArray[ selectedIndex ],
80
+ href,
81
+ type,
82
+ title,
83
+ str,
84
+ emb,
85
+ ret;
86
+
87
+ _abort();
88
+
89
+ selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
90
+
91
+ ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
92
+
93
+ if (ret === false) {
94
+ busy = false;
95
+ return;
96
+ } else if (typeof ret == 'object') {
97
+ selectedOpts = $.extend(selectedOpts, ret);
98
+ }
99
+
100
+ title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
101
+
102
+ if (obj.nodeName && !selectedOpts.orig) {
103
+ selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
104
+ }
105
+
106
+ if (title === '' && selectedOpts.orig) {
107
+ title = selectedOpts.titleFromAlt ? selectedOpts.orig.attr('alt') : selectedOpts.orig.attr('title');
108
+ }
109
+
110
+ href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
111
+
112
+ if ((/^(?:javascript)/i).test(href) || href == '#') {
113
+ href = null;
114
+ }
115
+
116
+ if (selectedOpts.type) {
117
+ type = selectedOpts.type;
118
+
119
+ if (!href) {
120
+ href = selectedOpts.content;
121
+ }
122
+
123
+ } else if (selectedOpts.content) {
124
+ type = 'html';
125
+
126
+ } else if (href) {
127
+ if (href.match(imgRegExp) || $(obj).hasClass("image")) {
128
+ type = 'image';
129
+
130
+ } else if (href.match(swfRegExp)) {
131
+ type = 'swf';
132
+
133
+ } else if (href.match(svgRegExp)) {
134
+ type = 'svg';
135
+
136
+ } else if ($(obj).hasClass("iframe")) {
137
+ type = 'iframe';
138
+
139
+ } else if (href.indexOf("#") === 0) {
140
+ type = 'inline';
141
+
142
+ } else {
143
+ type = 'ajax';
144
+ }
145
+ }
146
+
147
+ if (!type) {
148
+ _error();
149
+ return;
150
+ }
151
+
152
+ if (type == 'inline') {
153
+ obj = href.substr(href.indexOf("#"));
154
+ type = $(obj).length > 0 ? 'inline' : 'ajax';
155
+ }
156
+
157
+ selectedOpts.type = type;
158
+ selectedOpts.href = href;
159
+ selectedOpts.title = title;
160
+
161
+ if (selectedOpts.autoDimensions) {
162
+ if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
163
+ selectedOpts.width = 'auto';
164
+ selectedOpts.height = 'auto';
165
+ } else {
166
+ selectedOpts.autoDimensions = false;
167
+ }
168
+ }
169
+
170
+ if (selectedOpts.modal) {
171
+ selectedOpts.overlayShow = true;
172
+ selectedOpts.hideOnOverlayClick = false;
173
+ selectedOpts.hideOnContentClick = false;
174
+ selectedOpts.enableEscapeButton = false;
175
+ selectedOpts.showCloseButton = false;
176
+ }
177
+
178
+ selectedOpts.padding = parseInt(selectedOpts.padding, 10);
179
+ selectedOpts.margin = parseInt(selectedOpts.margin, 10);
180
+
181
+ tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
182
+
183
+ $('.fancybox-inline-tmp').off('fancybox-cancel').on('fancybox-change', function() {
184
+ $(this).replaceWith(content.children());
185
+ });
186
+
187
+ switch (type) {
188
+ case 'html' :
189
+ tmp.html( selectedOpts.content );
190
+ _process_inline();
191
+ break;
192
+
193
+ case 'inline' :
194
+ if ( $(obj).parent().is('#fancybox-content') === true) {
195
+ busy = false;
196
+ return;
197
+ }
198
+
199
+ $('<div class="fancybox-inline-tmp" />')
200
+ .hide()
201
+ .insertBefore( $(obj) )
202
+ .on('fancybox-cleanup', function() {
203
+ $(this).replaceWith(content.children());
204
+ }).on('fancybox-cancel', function() {
205
+ $(this).replaceWith(tmp.children());
206
+ });
207
+
208
+ $(obj).appendTo(tmp);
209
+
210
+ _process_inline();
211
+ break;
212
+
213
+ case 'image':
214
+ busy = false;
215
+
216
+ $.fancybox.showActivity();
217
+
218
+ imgPreloader = new Image();
219
+
220
+ imgPreloader.onerror = function() {
221
+ _error();
222
+ };
223
+
224
+ imgPreloader.onload = function() {
225
+ busy = true;
226
+
227
+ imgPreloader.onerror = imgPreloader.onload = null;
228
+
229
+ _process_image();
230
+ };
231
+
232
+ imgPreloader.src = href;
233
+ break;
234
+
235
+ case 'swf':
236
+ selectedOpts.scrolling = 'no';
237
+
238
+ str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
239
+ emb = '';
240
+
241
+ $.each(selectedOpts.swf, function(name, val) {
242
+ str += '<param name="' + name + '" value="' + val + '"></param>';
243
+ emb += ' ' + name + '="' + val + '"';
244
+ });
245
+
246
+ str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
247
+
248
+ tmp.html(str);
249
+
250
+ _process_inline();
251
+ break;
252
+
253
+ case 'svg':
254
+ selectedOpts.scrolling = 'no';
255
+
256
+ str = '<object width="' + selectedOpts.width + '" height="' + selectedOpts.height + '" data="' + href + '"></object>';
257
+
258
+ tmp.html(str);
259
+
260
+ _process_inline();
261
+ break;
262
+
263
+ case 'ajax':
264
+ busy = false;
265
+
266
+ $.fancybox.showActivity();
267
+
268
+ selectedOpts.ajax.win = selectedOpts.ajax.success;
269
+
270
+ ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
271
+ url : href,
272
+ data : selectedOpts.ajax.data || {},
273
+ error : function(XMLHttpRequest, textStatus, errorThrown) {
274
+ if ( XMLHttpRequest.status > 0 ) {
275
+ _error();
276
+ }
277
+ },
278
+ success : function(data, textStatus, XMLHttpRequest) {
279
+ var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
280
+ if (o.status == 200) {
281
+ if ( typeof selectedOpts.ajax.win == 'function' ) {
282
+ ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
283
+
284
+ if (ret === false) {
285
+ loading.hide();
286
+ return;
287
+ } else if (typeof ret == 'string' || typeof ret == 'object') {
288
+ data = ret;
289
+ }
290
+ }
291
+
292
+ tmp.html( data );
293
+ _process_inline();
294
+ }
295
+ }
296
+ }));
297
+
298
+ break;
299
+
300
+ case 'iframe':
301
+ _show();
302
+ break;
303
+ }
304
+ },
305
+
306
+ _process_inline = function() {
307
+ var
308
+ w = selectedOpts.width,
309
+ h = selectedOpts.height,
310
+ ww = $(window).width() == 0 ? window.innerWidth : $(window).width(),
311
+ wh = $(window).height() == 0 ? window.innerHeight : $(window).height();
312
+
313
+ if (w.toString().indexOf('%') > -1) {
314
+ w = parseInt( (ww - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';
315
+
316
+ } else {
317
+ w = w == 'auto' ? 'auto' : w + 'px';
318
+ }
319
+
320
+ if (h.toString().indexOf('%') > -1) {
321
+ h = parseInt( (wh - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';
322
+
323
+ } else {
324
+ h = h == 'auto' ? 'auto' : h + 'px';
325
+ }
326
+
327
+ tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');
328
+
329
+ selectedOpts.width = tmp.width();
330
+ selectedOpts.height = tmp.height();
331
+
332
+ _show();
333
+ },
334
+
335
+ _process_image = function() {
336
+ selectedOpts.width = imgPreloader.width;
337
+ selectedOpts.height = imgPreloader.height;
338
+
339
+ $("<img />").attr({
340
+ 'id' : 'fancybox-img',
341
+ 'src' : imgPreloader.src,
342
+ 'alt' : selectedOpts.title
343
+ }).appendTo( tmp );
344
+
345
+ _show();
346
+ },
347
+
348
+ _show = function() {
349
+ var pos, equal;
350
+
351
+ loading.hide();
352
+
353
+ if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
354
+ $('.fancybox-inline-tmp').trigger('fancybox-cancel');
355
+
356
+ busy = false;
357
+ return;
358
+ }
359
+
360
+ busy = true;
361
+
362
+ $(content.add( overlay )).off();
363
+
364
+ $(window).off("resize.fb scroll.fb");
365
+ $(document).off('keydown.fb');
366
+
367
+ if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
368
+ wrap.css('height', wrap.height());
369
+ }
370
+
371
+ currentArray = selectedArray;
372
+ currentIndex = selectedIndex;
373
+ currentOpts = selectedOpts;
374
+
375
+ if (currentOpts.overlayShow) {
376
+ overlay.css({
377
+ 'background-color' : currentOpts.overlayColor,
378
+ 'opacity' : currentOpts.overlayOpacity,
379
+ 'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
380
+ 'height' : $(document).height()
381
+ });
382
+
383
+ if (!overlay.is(':visible')) {
384
+ if (isIE6) {
385
+ $('select:not(#fancybox-tmp select)').filter(function() {
386
+ return this.style.visibility !== 'hidden';
387
+ }).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
388
+ this.style.visibility = 'inherit';
389
+ });
390
+ }
391
+
392
+ overlay.show();
393
+ }
394
+ } else {
395
+ overlay.hide();
396
+ }
397
+
398
+ final_pos = _get_zoom_to();
399
+
400
+ _process_title();
401
+
402
+ if (wrap.is(":visible")) {
403
+ $( close.add( nav_left ).add( nav_right ) ).hide();
404
+
405
+ pos = wrap.position(),
406
+
407
+ start_pos = {
408
+ top : pos.top,
409
+ left : pos.left,
410
+ width : wrap.width(),
411
+ height : wrap.height()
412
+ };
413
+
414
+ equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
415
+
416
+ content.fadeTo(currentOpts.changeFade, 0.3, function() {
417
+ var finish_resizing = function() {
418
+ content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
419
+ };
420
+
421
+ $('.fancybox-inline-tmp').trigger('fancybox-change');
422
+
423
+ content
424
+ .empty()
425
+ .removeAttr('filter')
426
+ .css({
427
+ 'border-width' : currentOpts.padding,
428
+ 'width' : final_pos.width - currentOpts.padding * 2,
429
+ 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
430
+ });
431
+
432
+ if (equal) {
433
+ finish_resizing();
434
+
435
+ } else {
436
+ fx.prop = 0;
437
+
438
+ $(fx).animate({prop: 1}, {
439
+ duration : currentOpts.changeSpeed,
440
+ easing : currentOpts.easingChange,
441
+ step : _draw,
442
+ complete : finish_resizing
443
+ });
444
+ }
445
+ });
446
+
447
+ return;
448
+ }
449
+
450
+ wrap.removeAttr("style");
451
+
452
+ content.css('border-width', currentOpts.padding);
453
+
454
+ if (currentOpts.transitionIn == 'elastic') {
455
+ start_pos = _get_zoom_from();
456
+
457
+ content.html( tmp.contents() );
458
+
459
+ wrap.show();
460
+
461
+ if (currentOpts.opacity) {
462
+ final_pos.opacity = 0;
463
+ }
464
+
465
+ fx.prop = 0;
466
+
467
+ $(fx).animate({prop: 1}, {
468
+ duration : currentOpts.speedIn,
469
+ easing : currentOpts.easingIn,
470
+ step : _draw,
471
+ complete : _finish
472
+ });
473
+
474
+ return;
475
+ }
476
+
477
+ if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
478
+ title.show();
479
+ }
480
+
481
+ content
482
+ .css({
483
+ 'width' : final_pos.width - currentOpts.padding * 2,
484
+ 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
485
+ })
486
+ .html( tmp.contents() );
487
+
488
+ wrap
489
+ .css(final_pos)
490
+ .fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
491
+ },
492
+
493
+ _format_title = function(title) {
494
+ if (title && title.length) {
495
+ if (currentOpts.titlePosition == 'float') {
496
+ return '<table id="fancybox-title-float-wrap" style="border-spacing:0;border-collapse:collapse"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
497
+ }
498
+
499
+ return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
500
+ }
501
+
502
+ return false;
503
+ },
504
+
505
+ _process_title = function() {
506
+ titleStr = currentOpts.title || '';
507
+ titleHeight = 0;
508
+
509
+ title
510
+ .empty()
511
+ .removeAttr('style')
512
+ .removeClass();
513
+
514
+ if (currentOpts.titleShow === false) {
515
+ title.hide();
516
+ return;
517
+ }
518
+
519
+ titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
520
+
521
+ if (!titleStr || titleStr === '') {
522
+ title.hide();
523
+ return;
524
+ }
525
+
526
+ title
527
+ .addClass('fancybox-title-' + currentOpts.titlePosition)
528
+ .html( titleStr )
529
+ .appendTo( 'body' )
530
+ .show();
531
+
532
+ switch (currentOpts.titlePosition) {
533
+ case 'inside':
534
+ title
535
+ .css({
536
+ 'width' : final_pos.width - (currentOpts.padding * 2),
537
+ 'marginLeft' : currentOpts.padding,
538
+ 'marginRight' : currentOpts.padding
539
+ });
540
+
541
+ titleHeight = title.outerHeight(true);
542
+
543
+ title.appendTo( outer );
544
+
545
+ final_pos.height += titleHeight;
546
+ break;
547
+
548
+ case 'over':
549
+ title
550
+ .css({
551
+ 'marginLeft' : currentOpts.padding,
552
+ 'width' : final_pos.width - (currentOpts.padding * 2),
553
+ 'bottom' : currentOpts.padding
554
+ })
555
+ .appendTo( outer );
556
+ break;
557
+
558
+ case 'float':
559
+ title
560
+ .css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
561
+ .appendTo( wrap );
562
+ break;
563
+
564
+ default:
565
+ title
566
+ .css({
567
+ 'width' : final_pos.width - (currentOpts.padding * 2),
568
+ 'paddingLeft' : currentOpts.padding,
569
+ 'paddingRight' : currentOpts.padding
570
+ })
571
+ .appendTo( wrap );
572
+ break;
573
+ }
574
+
575
+ title.hide();
576
+ },
577
+
578
+ _set_navigation = function() {
579
+ if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
580
+ $(document).on('keydown.fb', function(e) {
581
+ if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
582
+ e.preventDefault();
583
+ $.fancybox.close();
584
+
585
+ } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
586
+ e.preventDefault();
587
+ $.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
588
+ }
589
+ });
590
+ }
591
+
592
+ if (!currentOpts.showNavArrows) {
593
+ nav_left.hide();
594
+ nav_right.hide();
595
+ return;
596
+ }
597
+
598
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
599
+ nav_left.show();
600
+ }
601
+
602
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
603
+ nav_right.show();
604
+ }
605
+ },
606
+
607
+ _finish = function () {
608
+ if (!$.support.opacity) {
609
+ content.get(0).style.removeAttribute('filter');
610
+ wrap.get(0).style.removeAttribute('filter');
611
+ }
612
+
613
+ if (selectedOpts.autoDimensions) {
614
+ content.css('height', 'auto');
615
+ }
616
+
617
+ wrap.css('height', 'auto');
618
+
619
+ if (titleStr && titleStr.length) {
620
+ title.show();
621
+ }
622
+
623
+ if (currentOpts.showCloseButton) {
624
+ close.show();
625
+ }
626
+
627
+ _set_navigation();
628
+
629
+ if (currentOpts.hideOnContentClick) {
630
+ content.on('click', $.fancybox.close);
631
+ }
632
+
633
+ if (currentOpts.hideOnOverlayClick) {
634
+ overlay.on('click', $.fancybox.close);
635
+ }
636
+
637
+ if (currentOpts.autoResize) {
638
+ $(window).on("resize.fb", $.fancybox.resize);
639
+ }
640
+
641
+ if (currentOpts.centerOnScroll) {
642
+ $(window).on("scroll.fb", $.fancybox.center);
643
+ }
644
+
645
+ if ($.fn.mousewheel) {
646
+ wrap.on('mousewheel.fb', function(e, delta) {
647
+ if (busy) {
648
+ e.preventDefault();
649
+ } else if ( currentOpts.type == 'image' && ( $(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight ) ) {
650
+ e.preventDefault();
651
+ $.fancybox[ delta > 0 ? 'prev' : 'next']();
652
+ }
653
+ });
654
+ }
655
+
656
+ if (currentOpts.type == 'iframe') {
657
+ $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '"' + (navigator.userAgent.match(/msie [6]/i) ? ' allowtransparency="true""' : '') + ' style="border:0;margin:0;overflow:' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + '" src="' + currentOpts.href + '"' + (false === selectedOpts.allowfullscreen ? '' : ' allowfullscreen') + '></iframe>').appendTo(content);
658
+ }
659
+
660
+ wrap.show();
661
+
662
+ busy = false;
663
+
664
+ $.fancybox.center();
665
+
666
+ currentOpts.onComplete(currentArray, currentIndex, currentOpts);
667
+
668
+ _preload_images();
669
+ },
670
+
671
+ _preload_images = function() {
672
+ var href,
673
+ objNext;
674
+
675
+ if ((currentArray.length -1) > currentIndex) {
676
+ href = currentArray[ currentIndex + 1 ].href;
677
+
678
+ if (typeof href !== 'undefined' && (href.match(imgRegExp) || $(obj).hasClass("image")) ) {
679
+ objNext = new Image();
680
+ objNext.src = href;
681
+ }
682
+ }
683
+
684
+ if (currentIndex > 0) {
685
+ href = currentArray[ currentIndex - 1 ].href;
686
+
687
+ if (typeof href !== 'undefined' && (href.match(imgRegExp) || $(obj).hasClass("image")) ) {
688
+ objNext = new Image();
689
+ objNext.src = href;
690
+ }
691
+ }
692
+ },
693
+
694
+ _draw = function(pos) {
695
+ var dim = {
696
+ width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
697
+ height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
698
+
699
+ top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
700
+ left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
701
+ };
702
+
703
+ if (typeof final_pos.opacity !== 'undefined') {
704
+ dim.opacity = pos < 0.5 ? 0.5 : pos;
705
+ }
706
+
707
+ wrap.css(dim);
708
+
709
+ content.css({
710
+ 'width' : dim.width - currentOpts.padding * 2,
711
+ 'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
712
+ });
713
+ },
714
+
715
+ _get_viewport = function() {
716
+ return [
717
+ $(window).width() == 0 ? window.innerWidth : $(window).width() - (currentOpts.margin * 2),
718
+ $(window).height() == 0 ? window.innerHeight : $(window).height() - (currentOpts.margin * 2),
719
+ $(document).scrollLeft() + currentOpts.margin,
720
+ $(document).scrollTop() + currentOpts.margin
721
+ ];
722
+ },
723
+
724
+ _get_zoom_to = function () {
725
+ var view = _get_viewport(),
726
+ to = {},
727
+ resize = currentOpts.autoScale,
728
+ double_padding = currentOpts.padding * 2,
729
+ ratio;
730
+
731
+ if (currentOpts.width.toString().indexOf('%') > -1) {
732
+ to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
733
+ } else {
734
+ to.width = currentOpts.width + double_padding;
735
+ }
736
+
737
+ if (currentOpts.height.toString().indexOf('%') > -1) {
738
+ to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
739
+ } else {
740
+ to.height = currentOpts.height + double_padding;
741
+ }
742
+
743
+ if (resize && (to.width > view[0] || to.height > view[1])) {
744
+ if (selectedOpts.type == 'image' || selectedOpts.type == 'svg'|| selectedOpts.type == 'swf') {
745
+ ratio = (currentOpts.width ) / (currentOpts.height );
746
+
747
+ if ((to.width ) > view[0]) {
748
+ to.width = view[0];
749
+ to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
750
+ }
751
+
752
+ if ((to.height) > view[1]) {
753
+ to.height = view[1];
754
+ to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
755
+ }
756
+
757
+ } else {
758
+ to.width = Math.min(to.width, view[0]);
759
+ to.height = Math.min(to.height, view[1]);
760
+ }
761
+ }
762
+
763
+ to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
764
+ to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
765
+
766
+ return to;
767
+ },
768
+
769
+ _get_obj_pos = function(obj) {
770
+ var pos = obj.offset();
771
+
772
+ pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
773
+ pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
774
+
775
+ pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
776
+ pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
777
+
778
+ pos.width = obj.width();
779
+ pos.height = obj.height();
780
+
781
+ return pos;
782
+ },
783
+
784
+ _get_zoom_from = function() {
785
+ var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
786
+ from = {},
787
+ pos,
788
+ view;
789
+
790
+ if (orig && orig.length) {
791
+ pos = _get_obj_pos(orig);
792
+
793
+ from = {
794
+ width : pos.width + (currentOpts.padding * 2),
795
+ height : pos.height + (currentOpts.padding * 2),
796
+ top : pos.top - currentOpts.padding - 20,
797
+ left : pos.left - currentOpts.padding - 20
798
+ };
799
+
800
+ } else {
801
+ view = _get_viewport();
802
+
803
+ from = {
804
+ width : currentOpts.padding * 2,
805
+ height : currentOpts.padding * 2,
806
+ top : parseInt(view[3] + view[1] * 0.5, 10),
807
+ left : parseInt(view[2] + view[0] * 0.5, 10)
808
+ };
809
+ }
810
+
811
+ return from;
812
+ },
813
+
814
+ _animate_loading = function() {
815
+ if (!loading.is(':visible')){
816
+ clearInterval(loadingTimer);
817
+ return;
818
+ }
819
+
820
+ $('div', loading).css('top', (loadingFrame * -40) + 'px');
821
+
822
+ loadingFrame = (loadingFrame + 1) % 12;
823
+ };
824
+
825
+ /*
826
+ * Public methods
827
+ */
828
+
829
+ $.fn.fancybox = function(options) {
830
+ if (!$(this).length) {
831
+ return this;
832
+ }
833
+
834
+ $(this)
835
+ .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
836
+ .off('click.fb')
837
+ .on('click.fb', function(e) {
838
+ e.preventDefault();
839
+
840
+ if (busy) {
841
+ return;
842
+ }
843
+
844
+ busy = true;
845
+
846
+ $(this).blur();
847
+
848
+ selectedArray = [];
849
+ selectedIndex = 0;
850
+
851
+ var rel = $(this).attr('rel') || '';
852
+
853
+ if (!rel || rel == '' || rel === 'nofollow') {
854
+ selectedArray.push(this);
855
+
856
+ } else {
857
+ selectedArray = $('a[rel="' + rel + '"], area[rel="' + rel + '"]');
858
+ selectedIndex = selectedArray.index( this );
859
+ }
860
+
861
+ _start();
862
+
863
+ return;
864
+ });
865
+
866
+ return this;
867
+ };
868
+
869
+ $.fancybox = function(obj) {
870
+ var opts;
871
+
872
+ if (busy) {
873
+ return;
874
+ }
875
+
876
+ busy = true;
877
+ opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
878
+
879
+ selectedArray = [];
880
+ selectedIndex = parseInt(opts.index, 10) || 0;
881
+
882
+ if ($.isArray(obj)) {
883
+ for (var i = 0, j = obj.length; i < j; i++) {
884
+ if (typeof obj[i] == 'object') {
885
+ $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
886
+ } else {
887
+ obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
888
+ }
889
+ }
890
+
891
+ selectedArray = jQuery.merge(selectedArray, obj);
892
+
893
+ } else {
894
+ if (typeof obj == 'object') {
895
+ $(obj).data('fancybox', $.extend({}, opts, obj));
896
+ } else {
897
+ obj = $({}).data('fancybox', $.extend({content : obj}, opts));
898
+ }
899
+
900
+ selectedArray.push(obj);
901
+ }
902
+
903
+ if (selectedIndex > selectedArray.length || selectedIndex < 0) {
904
+ selectedIndex = 0;
905
+ }
906
+
907
+ _start();
908
+ };
909
+
910
+ $.fancybox.showActivity = function() {
911
+ clearInterval(loadingTimer);
912
+
913
+ loading.show();
914
+ loadingTimer = setInterval(_animate_loading, 66);
915
+ };
916
+
917
+ $.fancybox.hideActivity = function() {
918
+ loading.hide();
919
+ };
920
+
921
+ $.fancybox.next = function() {
922
+ return $.fancybox.pos( currentIndex + 1);
923
+ };
924
+
925
+ $.fancybox.prev = function() {
926
+ return $.fancybox.pos( currentIndex - 1);
927
+ };
928
+
929
+ $.fancybox.pos = function(pos) {
930
+ if (busy) {
931
+ return;
932
+ }
933
+
934
+ pos = parseInt(pos);
935
+
936
+ selectedArray = currentArray;
937
+
938
+ if (pos > -1 && pos < currentArray.length) {
939
+ selectedIndex = pos;
940
+ _start();
941
+
942
+ } else if (currentOpts.cyclic && currentArray.length > 1) {
943
+ selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
944
+ _start();
945
+ }
946
+
947
+ return;
948
+ };
949
+
950
+ $.fancybox.cancel = function() {
951
+ if (busy) {
952
+ return;
953
+ }
954
+
955
+ busy = true;
956
+
957
+ $('.fancybox-inline-tmp').trigger('fancybox-cancel');
958
+
959
+ _abort();
960
+
961
+ selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
962
+
963
+ busy = false;
964
+ };
965
+
966
+ // Note: within an iframe use - parent.$.fancybox.close();
967
+ $.fancybox.close = function() {
968
+ if (busy || wrap.is(':hidden')) {
969
+ return;
970
+ }
971
+
972
+ busy = true;
973
+
974
+ if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
975
+ busy = false;
976
+ return;
977
+ }
978
+
979
+ _abort();
980
+
981
+ $(close.add( nav_left ).add( nav_right )).hide();
982
+
983
+ $(content.add( overlay )).off();
984
+
985
+ $(window).off("resize.fb scroll.fb mousewheel.fb");
986
+ $(document).off('keydown.fb');
987
+
988
+ content.find('iframe#fancybox-frame').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
989
+
990
+ if (currentOpts.titlePosition !== 'inside') {
991
+ title.empty();
992
+ }
993
+
994
+ wrap.stop();
995
+
996
+ function _cleanup() {
997
+ overlay.fadeOut('fast');
998
+
999
+ title.empty().hide();
1000
+ wrap.hide();
1001
+
1002
+ $('.fancybox-inline-tmp').trigger('fancybox-cleanup');
1003
+
1004
+ content.empty();
1005
+
1006
+ currentOpts.onClosed(currentArray, currentIndex, currentOpts);
1007
+
1008
+ currentArray = selectedOpts = [];
1009
+ currentIndex = selectedIndex = 0;
1010
+ currentOpts = selectedOpts = {};
1011
+
1012
+ busy = false;
1013
+ }
1014
+
1015
+ if (currentOpts.transitionOut == 'elastic') {
1016
+ start_pos = _get_zoom_from();
1017
+
1018
+ var pos = wrap.position();
1019
+
1020
+ final_pos = {
1021
+ top : pos.top ,
1022
+ left : pos.left,
1023
+ width : wrap.width(),
1024
+ height : wrap.height()
1025
+ };
1026
+
1027
+ if (currentOpts.opacity) {
1028
+ final_pos.opacity = 1;
1029
+ }
1030
+
1031
+ title.empty().hide();
1032
+
1033
+ fx.prop = 1;
1034
+
1035
+ $(fx).animate({ prop: 0 }, {
1036
+ duration : currentOpts.speedOut,
1037
+ easing : currentOpts.easingOut,
1038
+ step : _draw,
1039
+ complete : _cleanup
1040
+ });
1041
+
1042
+ } else {
1043
+ wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
1044
+ }
1045
+ };
1046
+
1047
+ $.fancybox.resize = function() {
1048
+ if (overlay.is(':visible')) {
1049
+ overlay.css('height', $(document).height());
1050
+ }
1051
+
1052
+ $.fancybox.center(true);
1053
+ };
1054
+
1055
+ $.fancybox.center = function() {
1056
+ var view, align;
1057
+
1058
+ if (busy) {
1059
+ return;
1060
+ }
1061
+
1062
+ align = arguments[0] === true ? 1 : 0;
1063
+ view = _get_viewport();
1064
+
1065
+ if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
1066
+ return;
1067
+ }
1068
+
1069
+ wrap
1070
+ .stop()
1071
+ .animate({
1072
+ 'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
1073
+ 'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
1074
+ }, typeof arguments[0] == 'number' ? arguments[0] : 200);
1075
+ };
1076
+
1077
+ $.fancybox.init = function() {
1078
+ if ($("#fancybox-wrap").length) {
1079
+ return;
1080
+ }
1081
+
1082
+ $('body').append(
1083
+ tmp = $('<div id="fancybox-tmp"></div>'),
1084
+ loading = $('<div id="fancybox-loading"><div></div></div>'),
1085
+ overlay = $('<div id="fancybox-overlay"></div>'),
1086
+ wrap = $('<div id="fancybox-wrap"></div>')
1087
+ );
1088
+
1089
+ outer = $('<div id="fancybox-outer"></div>')
1090
+ .append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
1091
+ .appendTo( wrap );
1092
+
1093
+ outer.append(
1094
+ content = $('<div id="fancybox-content"></div>'),
1095
+ close = $('<a id="fancybox-close"></a>'),
1096
+ title = $('<div id="fancybox-title"></div>'),
1097
+
1098
+ nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
1099
+ nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
1100
+ );
1101
+
1102
+ close.click($.fancybox.close);
1103
+ loading.click($.fancybox.cancel);
1104
+
1105
+ nav_left.click(function(e) {
1106
+ e.preventDefault();
1107
+ $.fancybox.prev();
1108
+ });
1109
+
1110
+ nav_right.click(function(e) {
1111
+ e.preventDefault();
1112
+ $.fancybox.next();
1113
+ });
1114
+
1115
+ if (!$.support.opacity) {
1116
+ wrap.addClass('fancybox-ie');
1117
+ }
1118
+
1119
+ if (isIE6) {
1120
+ loading.addClass('fancybox-ie6');
1121
+ wrap.addClass('fancybox-ie6');
1122
+
1123
+ $('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" style="overflow:hidden;border:0" tabindex="-1"></iframe>').prependTo(outer);
1124
+ }
1125
+ };
1126
+
1127
+ $.fn.fancybox.defaults = {
1128
+ padding : 10,
1129
+ margin : 40,
1130
+ opacity : false,
1131
+ modal : false,
1132
+ cyclic : false,
1133
+ allowfullscreen : false,
1134
+ scrolling : 'auto', // 'auto', 'yes' or 'no'
1135
+
1136
+ width : 560,
1137
+ height : 340,
1138
+
1139
+ autoScale : true,
1140
+ autoDimensions : true,
1141
+ centerOnScroll : !isTouch,
1142
+ autoResize : true, //!isTouch
1143
+
1144
+ ajax : {},
1145
+ swf : { wmode: 'transparent' },
1146
+ svg : { wmode: 'transparent' },
1147
+
1148
+ hideOnOverlayClick : true,
1149
+ hideOnContentClick : false,
1150
+
1151
+ overlayShow : true,
1152
+ overlayOpacity : 0.7,
1153
+ overlayColor : '#777',
1154
+
1155
+ titleShow : true,
1156
+ titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
1157
+ titleFormat : null,
1158
+ titleFromAlt : false,
1159
+
1160
+ transitionIn : 'fade', // 'elastic', 'fade' or 'none'
1161
+ transitionOut : 'fade', // 'elastic', 'fade' or 'none'
1162
+
1163
+ speedIn : 300,
1164
+ speedOut : 300,
1165
+
1166
+ changeSpeed : 300,
1167
+ changeFade : 'fast',
1168
+
1169
+ easingIn : 'swing',
1170
+ easingOut : 'swing',
1171
+
1172
+ showCloseButton : true,
1173
+ showNavArrows : true,
1174
+ enableEscapeButton : true,
1175
+ enableKeyboardNav : true,
1176
+
1177
+ onStart : function(){},
1178
+ onCancel : function(){},
1179
+ onComplete : function(){},
1180
+ onCleanup : function(){},
1181
+ onClosed : function(){},
1182
+ onError : function(){}
1183
+ };
1184
+
1185
+ $(document).ready(function() {
1186
+ $.fancybox.init();
1187
+ });
1188
+
1189
+ })(jQuery);
1190
+
public/assets/popup/jquery.fancybox-1.3.7.min.css ADDED
@@ -0,0 +1 @@
 
1
+ #fancybox-loading{position:fixed;top:50%;left:50%;width:40px;height:40px;margin-top:-20px;margin-left:-20px;cursor:pointer;overflow:hidden;z-index:11104;display:none;box-sizing:content-box;-moz-box-sizing:content-box}#fancybox-loading div{position:absolute;top:0;left:0;width:40px;height:480px;background-image:url(fancybox.png);box-sizing:content-box;-moz-box-sizing:content-box}#fancybox-overlay{position:absolute;top:0;left:0;width:100%;z-index:11100;display:none;box-sizing:content-box;-moz-box-sizing:content-box}#fancybox-tmp{padding:0;margin:0;border:0;overflow:auto;display:none}#fancybox-wrap{position:absolute;top:0;left:0;padding:20px;z-index:11101;outline:0;display:none;box-sizing:content-box;-moz-box-sizing:content-box}#fancybox-wrap div{box-sizing:content-box;-moz-box-sizing:content-box}#fancybox-outer{position:relative;width:100%;height:100%;background:#fff}#fancybox-content{width:0;height:0;padding:0;outline:0;position:relative;overflow:hidden;z-index:11102;border:0 solid #fff;background:#fff;-moz-background-clip:padding;-webkit-background-clip:padding;background-clip:padding-box}#fancybox-hide-sel-frame{position:absolute;top:0;left:0;width:100%;height:100%;background:0 0;z-index:11101}#fancybox-close{position:absolute;top:-15px;right:-15px;width:30px;height:30px;background:url(fancybox.png) -40px 0;cursor:pointer;z-index:11103;display:none}#fancybox-error{color:#444;font:400 12px/20px Arial;padding:14px;margin:0}#fancybox-img{width:100%;height:100%;padding:0;margin:0;border:none;outline:0;line-height:0;vertical-align:top;max-width:none!important;max-height:none!important}#fancybox-frame{width:100%;height:100%;border:none;display:block;-webkit-overflow-scrolling:touch;z-index:0}#fancybox-left,#fancybox-right{position:absolute;bottom:0;height:100%;width:35%;cursor:pointer;outline:0;background:url(blank.gif);z-index:11102;display:none}#fancybox-left{left:0}.rtl #fancybox-left{left:auto;right:0}#fancybox-right{right:0}.rtl #fancybox-right{left:0;right:auto}#fancybox-left-ico,#fancybox-right-ico{position:absolute;top:50%;left:-9999px;width:30px;height:30px;margin-top:-15px;cursor:pointer;z-index:11102;display:block}#fancybox-left-ico{background-image:url(fancybox.png);background-position:-40px -30px}.rtl #fancybox-left-ico{background-position:-40px -60px;right:-9999px}#fancybox-right-ico{background-image:url(fancybox.png);background-position:-40px -60px}.rtl #fancybox-right-ico{background-position:-40px -30px;right:-9999px}#fancybox-left:hover,#fancybox-right:hover{visibility:visible}#fancybox-left:hover span{left:20px}.rtl #fancybox-left:hover span{right:20px}#fancybox-right:hover span{left:auto;right:20px}.rtl #fancybox-right:hover span{right:auto;left:20px}.fancybox-bg{position:absolute;padding:0;margin:0;border:0;width:20px;height:20px;z-index:11001}#fancybox-bg-n{top:-20px;left:0;width:100%;background-image:url(fancybox-x.png)}#fancybox-bg-ne{top:-20px;right:-20px;background-image:url(fancybox.png);background-position:-40px -162px}#fancybox-bg-e{top:0;right:-20px;height:100%;background-image:url(fancybox-y.png);background-position:-20px 0}#fancybox-bg-se{bottom:-20px;right:-20px;background-image:url(fancybox.png);background-position:-40px -182px}#fancybox-bg-s{bottom:-20px;left:0;width:100%;background-image:url(fancybox-x.png);background-position:0 -20px}#fancybox-bg-sw{bottom:-20px;left:-20px;background-image:url(fancybox.png);background-position:-40px -142px}#fancybox-bg-w{top:0;left:-20px;height:100%;background-image:url(fancybox-y.png)}#fancybox-bg-nw{top:-20px;left:-20px;background-image:url(fancybox.png);background-position:-40px -122px}#fancybox-title{font-family:Helvetica;font-size:12px;z-index:11102}.fancybox-title-inside{padding-bottom:10px;text-align:center;color:#333;position:relative}.fancybox-title-outside{padding-top:10px;color:#fff}.fancybox-title-over{position:absolute;bottom:0;left:0;color:#FFF;text-align:left}.rtl .fancybox-title-over{text-align:right}#fancybox-title-over{padding:10px;background-image:url(fancy_title_over.png);display:block}.fancybox-title-float{position:absolute;left:0;bottom:-20px;height:32px}#fancybox-title-float-wrap{border:none;border-collapse:collapse;width:auto}#fancybox-title-float-wrap td{border:none;white-space:nowrap}#fancybox-title-float-left{padding:0 0 0 15px;background:url(fancybox.png) -40px -90px no-repeat}#fancybox-title-float-main{color:#FFF;line-height:29px;font-weight:700;padding:0 0 3px;background:url(fancybox-x.png) 0 -40px}#fancybox-title-float-right{padding:0 0 0 15px;background:url(fancybox.png) -55px -90px no-repeat}.fancybox-hidden{display:none}.fancybox-ie .fancybox-bg{background:0 0!important}
public/assets/popup/jquery.fancybox-1.3.7.min.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !function(t){var e,i,n,a,o,d,c,r,s,h,l,f,p,g=0,b={},u=[],y=0,w={},m=[],v=null,x=new Image,I=/\.(jpg|gif|png|bmp|jpeg|webp)(.*)?$/i,C=/[^\.]\.(swf)\s*$/i,k=/[^\.]\.(svg)\s*$/i,j=1,O=0,T="",A=!1,D=t.extend(t("<div/>")[0],{prop:0}),S=navigator.userAgent.match(/msie [6]/i)&&!window.XMLHttpRequest,F=void 0!==document.createTouch,E=function(){i.hide(),x.onerror=x.onload=null,v&&v.abort(),e.empty()},N=function(){return!1===b.onError(u,g,b)?(i.hide(),void(A=!1)):(b.titleShow=!1,b.width="auto",b.height="auto",e.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>'),void P())},B=function(){var n,a,o,c,r,s,h=u[g]
2
+ if(E(),b=t.extend({},t.fn.fancybox.defaults,void 0===t(h).data("fancybox")?b:t(h).data("fancybox")),s=b.onStart(u,g,b),s===!1)return void(A=!1)
3
+ if("object"==typeof s&&(b=t.extend(b,s)),o=b.title||(h.nodeName?t(h).attr("title"):h.title)||"",h.nodeName&&!b.orig&&(b.orig=t(h).children("img:first").length?t(h).children("img:first"):t(h)),""===o&&b.orig&&(o=b.orig.attr(b.titleFromAlt?"alt":"title")),n=b.href||(h.nodeName?t(h).attr("href"):h.href)||null,(/^(?:javascript)/i.test(n)||"#"==n)&&(n=null),b.type?(a=b.type,n||(n=b.content)):b.content?a="html":n&&(a=n.match(I)||t(h).hasClass("image")?"image":n.match(C)?"swf":n.match(k)?"svg":t(h).hasClass("iframe")?"iframe":0===n.indexOf("#")?"inline":"ajax"),!a)return void N()
4
+ switch("inline"==a&&(h=n.substr(n.indexOf("#")),a=t(h).length>0?"inline":"ajax"),b.type=a,b.href=n,b.title=o,b.autoDimensions&&("html"==b.type||"inline"==b.type||"ajax"==b.type?(b.width="auto",b.height="auto"):b.autoDimensions=!1),b.modal&&(b.overlayShow=!0,b.hideOnOverlayClick=!1,b.hideOnContentClick=!1,b.enableEscapeButton=!1,b.showCloseButton=!1),b.padding=parseInt(b.padding,10),b.margin=parseInt(b.margin,10),e.css("padding",b.padding+b.margin),t(".fancybox-inline-tmp").off("fancybox-cancel").on("fancybox-change",function(){t(this).replaceWith(d.children())}),a){case"html":e.html(b.content),P()
5
+ break
6
+ case"inline":if(t(h).parent().is("#fancybox-content")===!0)return void(A=!1)
7
+ t('<div class="fancybox-inline-tmp" />').hide().insertBefore(t(h)).on("fancybox-cleanup",function(){t(this).replaceWith(d.children())}).on("fancybox-cancel",function(){t(this).replaceWith(e.children())}),t(h).appendTo(e),P()
8
+ break
9
+ case"image":A=!1,t.fancybox.showActivity(),x=new Image,x.onerror=function(){N()},x.onload=function(){A=!0,x.onerror=x.onload=null,z()},x.src=n
10
+ break
11
+ case"swf":b.scrolling="no",c='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+b.width+'" height="'+b.height+'"><param name="movie" value="'+n+'"></param>',r="",t.each(b.swf,function(t,e){c+='<param name="'+t+'" value="'+e+'"></param>',r+=" "+t+'="'+e+'"'}),c+='<embed src="'+n+'" type="application/x-shockwave-flash" width="'+b.width+'" height="'+b.height+'"'+r+"></embed></object>",e.html(c),P()
12
+ break
13
+ case"svg":b.scrolling="no",c='<object width="'+b.width+'" height="'+b.height+'" data="'+n+'"></object>',e.html(c),P()
14
+ break
15
+ case"ajax":A=!1,t.fancybox.showActivity(),b.ajax.win=b.ajax.success,v=t.ajax(t.extend({},b.ajax,{url:n,data:b.ajax.data||{},error:function(t){t.status>0&&N()},success:function(t,a,o){var d="object"==typeof o?o:v
16
+ if(200==d.status){if("function"==typeof b.ajax.win){if(s=b.ajax.win(n,t,a,o),s===!1)return void i.hide();("string"==typeof s||"object"==typeof s)&&(t=s)}e.html(t),P()}}}))
17
+ break
18
+ case"iframe":H()}},P=function(){var i=b.width,n=b.height,a=0==t(window).width()?window.innerWidth:t(window).width(),o=0==t(window).height()?window.innerHeight:t(window).height()
19
+ i=(""+i).indexOf("%")>-1?parseInt((a-2*b.margin)*parseFloat(i)/100,10)+"px":"auto"==i?"auto":i+"px",n=(""+n).indexOf("%")>-1?parseInt((o-2*b.margin)*parseFloat(n)/100,10)+"px":"auto"==n?"auto":n+"px",e.wrapInner('<div style="width:'+i+";height:"+n+";overflow: "+("auto"==b.scrolling?"auto":"yes"==b.scrolling?"scroll":"hidden")+';position:relative;"></div>'),b.width=e.width(),b.height=e.height(),H()},z=function(){b.width=x.width,b.height=x.height,t("<img />").attr({id:"fancybox-img",src:x.src,alt:b.title}).appendTo(e),H()},H=function(){var o,l
20
+ return i.hide(),a.is(":visible")&&!1===w.onCleanup(m,y,w)?(t(".fancybox-inline-tmp").trigger("fancybox-cancel"),void(A=!1)):(A=!0,t(d.add(n)).off(),t(window).off("resize.fb scroll.fb"),t(document).off("keydown.fb"),a.is(":visible")&&"outside"!==w.titlePosition&&a.css("height",a.height()),m=u,y=g,w=b,w.overlayShow?(n.css({"background-color":w.overlayColor,opacity:w.overlayOpacity,cursor:w.hideOnOverlayClick?"pointer":"auto",height:t(document).height()}),n.is(":visible")||(S&&t("select:not(#fancybox-tmp select)").filter(function(){return"hidden"!==this.style.visibility}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}),n.show())):n.hide(),p=Q(),M(),a.is(":visible")?(t(c.add(s).add(h)).hide(),o=a.position(),f={top:o.top,left:o.left,width:a.width(),height:a.height()},l=f.width==p.width&&f.height==p.height,void d.fadeTo(w.changeFade,.3,function(){var i=function(){d.html(e.contents()).fadeTo(w.changeFade,1,W)}
21
+ t(".fancybox-inline-tmp").trigger("fancybox-change"),d.empty().removeAttr("filter").css({"border-width":w.padding,width:p.width-2*w.padding,height:b.autoDimensions?"auto":p.height-O-2*w.padding}),l?i():(D.prop=0,t(D).animate({prop:1},{duration:w.changeSpeed,easing:w.easingChange,step:$,complete:i}))})):(a.removeAttr("style"),d.css("border-width",w.padding),"elastic"==w.transitionIn?(f=U(),d.html(e.contents()),a.show(),w.opacity&&(p.opacity=0),D.prop=0,void t(D).animate({prop:1},{duration:w.speedIn,easing:w.easingIn,step:$,complete:W})):("inside"==w.titlePosition&&O>0&&r.show(),d.css({width:p.width-2*w.padding,height:b.autoDimensions?"auto":p.height-O-2*w.padding}).html(e.contents()),void a.css(p).fadeIn("none"==w.transitionIn?0:w.speedIn,W))))},L=function(t){return t&&t.length?"float"==w.titlePosition?'<table id="fancybox-title-float-wrap" style="border-spacing:0;border-collapse:collapse"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+t+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+w.titlePosition+'">'+t+"</div>":!1},M=function(){if(T=w.title||"",O=0,r.empty().removeAttr("style").removeClass(),w.titleShow===!1)return void r.hide()
22
+ if(T=t.isFunction(w.titleFormat)?w.titleFormat(T,m,y,w):L(T),!T||""===T)return void r.hide()
23
+ switch(r.addClass("fancybox-title-"+w.titlePosition).html(T).appendTo("body").show(),w.titlePosition){case"inside":r.css({width:p.width-2*w.padding,marginLeft:w.padding,marginRight:w.padding}),O=r.outerHeight(!0),r.appendTo(o),p.height+=O
24
+ break
25
+ case"over":r.css({marginLeft:w.padding,width:p.width-2*w.padding,bottom:w.padding}).appendTo(o)
26
+ break
27
+ case"float":r.css("left",-1*parseInt((r.width()-p.width-40)/2,10)).appendTo(a)
28
+ break
29
+ default:r.css({width:p.width-2*w.padding,paddingLeft:w.padding,paddingRight:w.padding}).appendTo(a)}r.hide()},R=function(){return(w.enableEscapeButton||w.enableKeyboardNav)&&t(document).on("keydown.fb",function(e){27==e.keyCode&&w.enableEscapeButton?(e.preventDefault(),t.fancybox.close()):37!=e.keyCode&&39!=e.keyCode||!w.enableKeyboardNav||"INPUT"===e.target.tagName||"TEXTAREA"===e.target.tagName||"SELECT"===e.target.tagName||(e.preventDefault(),t.fancybox[37==e.keyCode?"prev":"next"]())}),w.showNavArrows?((w.cyclic&&m.length>1||0!==y)&&s.show(),void((w.cyclic&&m.length>1||y!=m.length-1)&&h.show())):(s.hide(),void h.hide())},W=function(){t.support.opacity||(d.get(0).style.removeAttribute("filter"),a.get(0).style.removeAttribute("filter")),b.autoDimensions&&d.css("height","auto"),a.css("height","auto"),T&&T.length&&r.show(),w.showCloseButton&&c.show(),R(),w.hideOnContentClick&&d.on("click",t.fancybox.close),w.hideOnOverlayClick&&n.on("click",t.fancybox.close),w.autoResize&&t(window).on("resize.fb",t.fancybox.resize),w.centerOnScroll&&t(window).on("scroll.fb",t.fancybox.center),t.fn.mousewheel&&a.on("mousewheel.fb",function(e,i){A?e.preventDefault():"image"!=w.type||0!=t(e.target).get(0).clientHeight&&t(e.target).get(0).scrollHeight!==t(e.target).get(0).clientHeight||(e.preventDefault(),t.fancybox[i>0?"prev":"next"]())}),"iframe"==w.type&&t('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'"'+(navigator.userAgent.match(/msie [6]/i)?' allowtransparency="true""':"")+' style="border:0;margin:0;overflow:'+("auto"==b.scrolling?"auto":"yes"==b.scrolling?"scroll":"hidden")+'" src="'+w.href+'"'+(!1===b.allowfullscreen?"":" allowfullscreen")+"></iframe>").appendTo(d),a.show(),A=!1,t.fancybox.center(),w.onComplete(m,y,w),K()},K=function(){var e,i
30
+ m.length-1>y&&(e=m[y+1].href,void 0!==e&&(e.match(I)||t(obj).hasClass("image"))&&(i=new Image,i.src=e)),y>0&&(e=m[y-1].href,void 0!==e&&(e.match(I)||t(obj).hasClass("image"))&&(i=new Image,i.src=e))},$=function(t){var e={width:parseInt(f.width+(p.width-f.width)*t,10),height:parseInt(f.height+(p.height-f.height)*t,10),top:parseInt(f.top+(p.top-f.top)*t,10),left:parseInt(f.left+(p.left-f.left)*t,10)}
31
+ void 0!==p.opacity&&(e.opacity=.5>t?.5:t),a.css(e),d.css({width:e.width-2*w.padding,height:e.height-O*t-2*w.padding})},q=function(){return[0==t(window).width()?window.innerWidth:t(window).width()-2*w.margin,0==t(window).height()?window.innerHeight:t(window).height()-2*w.margin,t(document).scrollLeft()+w.margin,t(document).scrollTop()+w.margin]},Q=function(){var t,e=q(),i={},n=w.autoScale,a=2*w.padding
32
+ return i.width=(""+w.width).indexOf("%")>-1?parseInt(e[0]*parseFloat(w.width)/100,10):w.width+a,i.height=(""+w.height).indexOf("%")>-1?parseInt(e[1]*parseFloat(w.height)/100,10):w.height+a,n&&(i.width>e[0]||i.height>e[1])&&("image"==b.type||"svg"==b.type||"swf"==b.type?(t=w.width/w.height,i.width>e[0]&&(i.width=e[0],i.height=parseInt((i.width-a)/t+a,10)),i.height>e[1]&&(i.height=e[1],i.width=parseInt((i.height-a)*t+a,10))):(i.width=Math.min(i.width,e[0]),i.height=Math.min(i.height,e[1]))),i.top=parseInt(Math.max(e[3]-20,e[3]+.5*(e[1]-i.height-40)),10),i.left=parseInt(Math.max(e[2]-20,e[2]+.5*(e[0]-i.width-40)),10),i},X=function(t){var e=t.offset()
33
+ return e.top+=parseInt(t.css("paddingTop"),10)||0,e.left+=parseInt(t.css("paddingLeft"),10)||0,e.top+=parseInt(t.css("border-top-width"),10)||0,e.left+=parseInt(t.css("border-left-width"),10)||0,e.width=t.width(),e.height=t.height(),e},U=function(){var e,i,n=b.orig?t(b.orig):!1,a={}
34
+ return n&&n.length?(e=X(n),a={width:e.width+2*w.padding,height:e.height+2*w.padding,top:e.top-w.padding-20,left:e.left-w.padding-20}):(i=q(),a={width:2*w.padding,height:2*w.padding,top:parseInt(i[3]+.5*i[1],10),left:parseInt(i[2]+.5*i[0],10)}),a},G=function(){return i.is(":visible")?(t("div",i).css("top",-40*j+"px"),void(j=(j+1)%12)):void clearInterval(l)}
35
+ t.fn.fancybox=function(e){return t(this).length?(t(this).data("fancybox",t.extend({},e,t.metadata?t(this).metadata():{})).off("click.fb").on("click.fb",function(e){if(e.preventDefault(),!A){A=!0,t(this).blur(),u=[],g=0
36
+ var i=t(this).attr("rel")||""
37
+ i&&""!=i&&"nofollow"!==i?(u=t('a[rel="'+i+'"], area[rel="'+i+'"]'),g=u.index(this)):u.push(this),B()}}),this):this},t.fancybox=function(e){var i
38
+ if(!A){if(A=!0,i=void 0!==arguments[1]?arguments[1]:{},u=[],g=parseInt(i.index,10)||0,t.isArray(e)){for(var n=0,a=e.length;a>n;n++)"object"==typeof e[n]?t(e[n]).data("fancybox",t.extend({},i,e[n])):e[n]=t({}).data("fancybox",t.extend({content:e[n]},i))
39
+ u=jQuery.merge(u,e)}else"object"==typeof e?t(e).data("fancybox",t.extend({},i,e)):e=t({}).data("fancybox",t.extend({content:e},i)),u.push(e);(g>u.length||0>g)&&(g=0),B()}},t.fancybox.showActivity=function(){clearInterval(l),i.show(),l=setInterval(G,66)},t.fancybox.hideActivity=function(){i.hide()},t.fancybox.next=function(){return t.fancybox.pos(y+1)},t.fancybox.prev=function(){return t.fancybox.pos(y-1)},t.fancybox.pos=function(t){A||(t=parseInt(t),u=m,t>-1&&t<m.length?(g=t,B()):w.cyclic&&m.length>1&&(g=t>=m.length?0:m.length-1,B()))},t.fancybox.cancel=function(){A||(A=!0,t(".fancybox-inline-tmp").trigger("fancybox-cancel"),E(),b.onCancel(u,g,b),A=!1)},t.fancybox.close=function(){function e(){n.fadeOut("fast"),r.empty().hide(),a.hide(),t(".fancybox-inline-tmp").trigger("fancybox-cleanup"),d.empty(),w.onClosed(m,y,w),m=b=[],y=g=0,w=b={},A=!1}if(!A&&!a.is(":hidden")){if(A=!0,w&&!1===w.onCleanup(m,y,w))return void(A=!1)
40
+ if(E(),t(c.add(s).add(h)).hide(),t(d.add(n)).off(),t(window).off("resize.fb scroll.fb mousewheel.fb"),t(document).off("keydown.fb"),d.find("iframe#fancybox-frame").attr("src",S&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank"),"inside"!==w.titlePosition&&r.empty(),a.stop(),"elastic"==w.transitionOut){f=U()
41
+ var i=a.position()
42
+ p={top:i.top,left:i.left,width:a.width(),height:a.height()},w.opacity&&(p.opacity=1),r.empty().hide(),D.prop=1,t(D).animate({prop:0},{duration:w.speedOut,easing:w.easingOut,step:$,complete:e})}else a.fadeOut("none"==w.transitionOut?0:w.speedOut,e)}},t.fancybox.resize=function(){n.is(":visible")&&n.css("height",t(document).height()),t.fancybox.center(!0)},t.fancybox.center=function(){var t,e
43
+ A||(e=arguments[0]===!0?1:0,t=q(),(e||!(a.width()>t[0]||a.height()>t[1]))&&a.stop().animate({top:parseInt(Math.max(t[3]-20,t[3]+.5*(t[1]-d.height()-40)-w.padding)),left:parseInt(Math.max(t[2]-20,t[2]+.5*(t[0]-d.width()-40)-w.padding))},"number"==typeof arguments[0]?arguments[0]:200))},t.fancybox.init=function(){t("#fancybox-wrap").length||(t("body").append(e=t('<div id="fancybox-tmp"></div>'),i=t('<div id="fancybox-loading"><div></div></div>'),n=t('<div id="fancybox-overlay"></div>'),a=t('<div id="fancybox-wrap"></div>')),o=t('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(a),o.append(d=t('<div id="fancybox-content"></div>'),c=t('<a id="fancybox-close"></a>'),r=t('<div id="fancybox-title"></div>'),s=t('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),h=t('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')),c.click(t.fancybox.close),i.click(t.fancybox.cancel),s.click(function(e){e.preventDefault(),t.fancybox.prev()}),h.click(function(e){e.preventDefault(),t.fancybox.next()}),t.support.opacity||a.addClass("fancybox-ie"),S&&(i.addClass("fancybox-ie6"),a.addClass("fancybox-ie6"),t('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" style="overflow:hidden;border:0" tabindex="-1"></iframe>').prependTo(o)))},t.fn.fancybox.defaults={padding:10,margin:40,opacity:!1,modal:!1,cyclic:!1,allowfullscreen:!1,scrolling:"auto",width:560,height:340,autoScale:!0,autoDimensions:!0,centerOnScroll:!F,autoResize:!0,ajax:{},swf:{wmode:"transparent"},svg:{wmode:"transparent"},hideOnOverlayClick:!0,hideOnContentClick:!1,overlayShow:!0,overlayOpacity:.7,overlayColor:"#777",titleShow:!0,titlePosition:"float",titleFormat:null,titleFromAlt:!1,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:!0,showNavArrows:!0,enableEscapeButton:!0,enableKeyboardNav:!0,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}},t(document).ready(function(){t.fancybox.init()})}(jQuery)
public/assets/popup/jquery.fancybox.css ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
2
+ .fancybox-wrap,
3
+ .fancybox-skin,
4
+ .fancybox-outer,
5
+ .fancybox-inner,
6
+ .fancybox-image,
7
+ .fancybox-wrap iframe,
8
+ .fancybox-wrap object,
9
+ .fancybox-nav,
10
+ .fancybox-nav span,
11
+ .fancybox-tmp
12
+ {
13
+ padding: 0;
14
+ margin: 0;
15
+ border: 0;
16
+ outline: none;
17
+ vertical-align: top;
18
+ }
19
+
20
+ .fancybox-wrap {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ z-index: 8020;
25
+ }
26
+
27
+ .fancybox-skin {
28
+ position: relative;
29
+ background: #f9f9f9;
30
+ color: #444;
31
+ text-shadow: none;
32
+ /*-webkit-border-radius: 4px;
33
+ -moz-border-radius: 4px;
34
+ border-radius: 4px;*/
35
+ }
36
+
37
+ .fancybox-opened {
38
+ z-index: 8030;
39
+ }
40
+
41
+ .fancybox-opened .fancybox-skin {
42
+ -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
43
+ -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
44
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
45
+ }
46
+
47
+ .fancybox-outer, .fancybox-inner {
48
+ position: relative;
49
+ }
50
+
51
+ .fancybox-inner {
52
+ overflow: hidden;
53
+ }
54
+
55
+ .fancybox-type-iframe .fancybox-inner {
56
+ -webkit-overflow-scrolling: touch;
57
+ }
58
+
59
+ .fancybox-error {
60
+ color: #444;
61
+ font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
62
+ margin: 0;
63
+ padding: 15px;
64
+ white-space: nowrap;
65
+ }
66
+
67
+ .fancybox-image, .fancybox-iframe {
68
+ display: block;
69
+ width: 100%;
70
+ height: 100%;
71
+ }
72
+
73
+ .fancybox-image {
74
+ max-width: 100%;
75
+ max-height: 100%;
76
+ }
77
+
78
+ #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
79
+ background-image: url('fancybox_sprite.png');
80
+ }
81
+
82
+ #fancybox-loading {
83
+ position: fixed;
84
+ top: 50%;
85
+ left: 50%;
86
+ margin-top: -22px;
87
+ margin-left: -22px;
88
+ background-position: 0 -108px;
89
+ opacity: 0.8;
90
+ cursor: pointer;
91
+ z-index: 8060;
92
+ }
93
+
94
+ #fancybox-loading div {
95
+ width: 44px;
96
+ height: 44px;
97
+ background: url('fancybox_loading.gif') center center no-repeat;
98
+ }
99
+
100
+ .fancybox-close {
101
+ position: absolute;
102
+ top: -18px;
103
+ right: -18px;
104
+ width: 36px;
105
+ height: 36px;
106
+ cursor: pointer;
107
+ z-index: 8040;
108
+ }
109
+
110
+ .fancybox-nav {
111
+ position: absolute;
112
+ top: 0;
113
+ width: 40%;
114
+ height: 100%;
115
+ cursor: pointer;
116
+ text-decoration: none;
117
+ background: transparent url('blank.gif'); /* helps IE */
118
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
119
+ z-index: 8040;
120
+ }
121
+
122
+ .fancybox-prev {
123
+ left: 0;
124
+ }
125
+
126
+ .fancybox-next {
127
+ right: 0;
128
+ }
129
+
130
+ .fancybox-nav span {
131
+ position: absolute;
132
+ top: 50%;
133
+ width: 36px;
134
+ height: 34px;
135
+ margin-top: -18px;
136
+ cursor: pointer;
137
+ z-index: 8040;
138
+ visibility: hidden;
139
+ }
140
+
141
+ .fancybox-prev span {
142
+ left: 10px;
143
+ background-position: 0 -36px;
144
+ }
145
+
146
+ .fancybox-next span {
147
+ right: 10px;
148
+ background-position: 0 -72px;
149
+ }
150
+
151
+ .fancybox-nav:hover span {
152
+ visibility: visible;
153
+ }
154
+
155
+ .fancybox-tmp {
156
+ position: absolute;
157
+ top: -99999px;
158
+ left: -99999px;
159
+ visibility: hidden;
160
+ max-width: 99999px;
161
+ max-height: 99999px;
162
+ overflow: visible !important;
163
+ }
164
+
165
+ /* Overlay helper */
166
+
167
+ .fancybox-lock {
168
+ overflow: hidden !important;
169
+ width: auto;
170
+ }
171
+
172
+ .fancybox-lock body {
173
+ overflow: hidden !important;
174
+ }
175
+
176
+ .fancybox-lock-test {
177
+ overflow-y: hidden !important;
178
+ }
179
+
180
+ .fancybox-overlay {
181
+ position: absolute;
182
+ top: 0;
183
+ left: 0;
184
+ overflow: hidden;
185
+ display: none;
186
+ z-index: 8010;
187
+ background: url('fancybox_overlay.png');
188
+ }
189
+
190
+ .fancybox-overlay-fixed {
191
+ position: fixed;
192
+ bottom: 0;
193
+ right: 0;
194
+ }
195
+
196
+ .fancybox-lock .fancybox-overlay {
197
+ overflow: auto;
198
+ overflow-y: scroll;
199
+ }
200
+
201
+ /* Title helper */
202
+
203
+ .fancybox-title {
204
+ visibility: hidden;
205
+ font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
206
+ position: relative;
207
+ text-shadow: none;
208
+ z-index: 8050;
209
+ }
210
+
211
+ .fancybox-opened .fancybox-title {
212
+ visibility: visible;
213
+ }
214
+
215
+ .fancybox-title-float-wrap {
216
+ position: absolute;
217
+ bottom: 0;
218
+ right: 50%;
219
+ margin-bottom: -35px;
220
+ z-index: 8050;
221
+ text-align: center;
222
+ }
223
+
224
+ .fancybox-title-float-wrap .child {
225
+ display: inline-block;
226
+ margin-right: -100%;
227
+ padding: 2px 20px;
228
+ background: transparent; /* Fallback for web browsers that doesn't support RGBa */
229
+ background: rgba(0, 0, 0, 0.8);
230
+ -webkit-border-radius: 15px;
231
+ -moz-border-radius: 15px;
232
+ border-radius: 15px;
233
+ text-shadow: 0 1px 2px #222;
234
+ color: #FFF;
235
+ font-weight: bold;
236
+ line-height: 24px;
237
+ white-space: nowrap;
238
+ }
239
+
240
+ .fancybox-title-outside-wrap {
241
+ position: relative;
242
+ margin-top: 10px;
243
+ color: #fff;
244
+ }
245
+
246
+ .fancybox-title-inside-wrap {
247
+ padding-top: 10px;
248
+ }
249
+
250
+ .fancybox-title-over-wrap {
251
+ position: absolute;
252
+ bottom: 0;
253
+ left: 0;
254
+ color: #fff;
255
+ padding: 10px;
256
+ background: #000;
257
+ background: rgba(0, 0, 0, .8);
258
+ }
259
+
260
+ /*Retina graphics!*/
261
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
262
+ only screen and (min--moz-device-pixel-ratio: 1.5),
263
+ only screen and (min-device-pixel-ratio: 1.5){
264
+
265
+ #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
266
+ background-image: url('fancybox_sprite@2x.png');
267
+ background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/
268
+ }
269
+
270
+ #fancybox-loading div {
271
+ background-image: url('fancybox_loading@2x.gif');
272
+ background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/
273
+ }
274
+ }
public/assets/popup/jquery.fancybox.js ADDED
@@ -0,0 +1,2020 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * fancyBox - jQuery Plugin
3
+ * version: 2.1.5 (Fri, 14 Jun 2013)
4
+ * @requires jQuery v1.6 or later
5
+ *
6
+ * Examples at http://fancyapps.com/fancybox/
7
+ * License: www.fancyapps.com/fancybox/#license
8
+ *
9
+ * Copyright 2012 Janis Skarnelis - janis@fancyapps.com
10
+ *
11
+ */
12
+
13
+ (function (window, document, $, undefined) {
14
+ "use strict";
15
+
16
+ var H = $("html"),
17
+ W = $(window),
18
+ D = $(document),
19
+ F = $.fancybox = function () {
20
+ F.open.apply( this, arguments );
21
+ },
22
+ IE = navigator.userAgent.match(/msie/i),
23
+ didUpdate = null,
24
+ isTouch = document.createTouch !== undefined,
25
+
26
+ isQuery = function(obj) {
27
+ return obj && obj.hasOwnProperty && obj instanceof $;
28
+ },
29
+ isString = function(str) {
30
+ return str && $.type(str) === "string";
31
+ },
32
+ isPercentage = function(str) {
33
+ return isString(str) && str.indexOf('%') > 0;
34
+ },
35
+ isScrollable = function(el) {
36
+ return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
37
+ },
38
+ getScalar = function(orig, dim) {
39
+ var value = parseInt(orig, 10) || 0;
40
+
41
+ if (dim && isPercentage(orig)) {
42
+ value = F.getViewport()[ dim ] / 100 * value;
43
+ }
44
+
45
+ return Math.ceil(value);
46
+ },
47
+ getValue = function(value, dim) {
48
+ return getScalar(value, dim) + 'px';
49
+ };
50
+
51
+ $.extend(F, {
52
+ // The current version of fancyBox
53
+ version: '2.1.5',
54
+
55
+ defaults: {
56
+ padding : 15,
57
+ margin : 20,
58
+
59
+ width : 800,
60
+ height : 600,
61
+ minWidth : 100,
62
+ minHeight : 100,
63
+ maxWidth : 9999,
64
+ maxHeight : 9999,
65
+ pixelRatio: 1, // Set to 2 for retina display support
66
+
67
+ autoSize : true,
68
+ autoHeight : false,
69
+ autoWidth : false,
70
+
71
+ autoResize : true,
72
+ autoCenter : !isTouch,
73
+ fitToView : true,
74
+ aspectRatio : false,
75
+ topRatio : 0.5,
76
+ leftRatio : 0.5,
77
+
78
+ scrolling : 'auto', // 'auto', 'yes' or 'no'
79
+ wrapCSS : '',
80
+
81
+ arrows : true,
82
+ closeBtn : true,
83
+ closeClick : false,
84
+ nextClick : false,
85
+ mouseWheel : true,
86
+ autoPlay : false,
87
+ playSpeed : 3000,
88
+ preload : 3,
89
+ modal : false,
90
+ loop : true,
91
+
92
+ ajax : {
93
+ dataType : 'html',
94
+ headers : { 'X-fancyBox': true }
95
+ },
96
+ iframe : {
97
+ scrolling : 'auto',
98
+ preload : true
99
+ },
100
+ swf : {
101
+ wmode: 'transparent',
102
+ allowfullscreen : 'true',
103
+ allowscriptaccess : 'always'
104
+ },
105
+
106
+ keys : {
107
+ next : {
108
+ 13 : 'left', // enter
109
+ 34 : 'up', // page down
110
+ 39 : 'left', // right arrow
111
+ 40 : 'up' // down arrow
112
+ },
113
+ prev : {
114
+ 8 : 'right', // backspace
115
+ 33 : 'down', // page up
116
+ 37 : 'right', // left arrow
117
+ 38 : 'down' // up arrow
118
+ },
119
+ close : [27], // escape key
120
+ play : [32], // space - start/stop slideshow
121
+ toggle : [70] // letter "f" - toggle fullscreen
122
+ },
123
+
124
+ direction : {
125
+ next : 'left',
126
+ prev : 'right'
127
+ },
128
+
129
+ scrollOutside : true,
130
+
131
+ // Override some properties
132
+ index : 0,
133
+ type : null,
134
+ href : null,
135
+ content : null,
136
+ title : null,
137
+
138
+ // HTML templates
139
+ tpl: {
140
+ wrap : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
141
+ image : '<img class="fancybox-image" src="{href}" alt="" />',
142
+ iframe : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
143
+ error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
144
+ closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
145
+ next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
146
+ prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
147
+ },
148
+
149
+ // Properties for each animation type
150
+ // Opening fancyBox
151
+ openEffect : 'fade', // 'elastic', 'fade' or 'none'
152
+ openSpeed : 250,
153
+ openEasing : 'swing',
154
+ openOpacity : true,
155
+ openMethod : 'zoomIn',
156
+
157
+ // Closing fancyBox
158
+ closeEffect : 'fade', // 'elastic', 'fade' or 'none'
159
+ closeSpeed : 250,
160
+ closeEasing : 'swing',
161
+ closeOpacity : true,
162
+ closeMethod : 'zoomOut',
163
+
164
+ // Changing next gallery item
165
+ nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
166
+ nextSpeed : 250,
167
+ nextEasing : 'swing',
168
+ nextMethod : 'changeIn',
169
+
170
+ // Changing previous gallery item
171
+ prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
172
+ prevSpeed : 250,
173
+ prevEasing : 'swing',
174
+ prevMethod : 'changeOut',
175
+
176
+ // Enable default helpers
177
+ helpers : {
178
+ overlay : true,
179
+ title : true
180
+ },
181
+
182
+ // Callbacks
183
+ onCancel : $.noop, // If canceling
184
+ beforeLoad : $.noop, // Before loading
185
+ afterLoad : $.noop, // After loading
186
+ beforeShow : $.noop, // Before changing in current item
187
+ afterShow : $.noop, // After opening
188
+ beforeChange : $.noop, // Before changing gallery item
189
+ beforeClose : $.noop, // Before closing
190
+ afterClose : $.noop // After closing
191
+ },
192
+
193
+ //Current state
194
+ group : {}, // Selected group
195
+ opts : {}, // Group options
196
+ previous : null, // Previous element
197
+ coming : null, // Element being loaded
198
+ current : null, // Currently loaded element
199
+ isActive : false, // Is activated
200
+ isOpen : false, // Is currently open
201
+ isOpened : false, // Have been fully opened at least once
202
+
203
+ wrap : null,
204
+ skin : null,
205
+ outer : null,
206
+ inner : null,
207
+
208
+ player : {
209
+ timer : null,
210
+ isActive : false
211
+ },
212
+
213
+ // Loaders
214
+ ajaxLoad : null,
215
+ imgPreload : null,
216
+
217
+ // Some collections
218
+ transitions : {},
219
+ helpers : {},
220
+
221
+ /*
222
+ * Static methods
223
+ */
224
+
225
+ open: function (group, opts) {
226
+ if (!group) {
227
+ return;
228
+ }
229
+
230
+ if (!$.isPlainObject(opts)) {
231
+ opts = {};
232
+ }
233
+
234
+ // Close if already active
235
+ if (false === F.close(true)) {
236
+ return;
237
+ }
238
+
239
+ // Normalize group
240
+ if (!$.isArray(group)) {
241
+ group = isQuery(group) ? $(group).get() : [group];
242
+ }
243
+
244
+ // Recheck if the type of each element is `object` and set content type (image, ajax, etc)
245
+ $.each(group, function(i, element) {
246
+ var obj = {},
247
+ href,
248
+ title,
249
+ content,
250
+ type,
251
+ rez,
252
+ hrefParts,
253
+ selector;
254
+
255
+ if ($.type(element) === "object") {
256
+ // Check if is DOM element
257
+ if (element.nodeType) {
258
+ element = $(element);
259
+ }
260
+
261
+ if (isQuery(element)) {
262
+ obj = {
263
+ href : element.data('fancybox-href') || element.attr('href'),
264
+ title : element.data('fancybox-title') || element.attr('title'),
265
+ isDom : true,
266
+ element : element
267
+ };
268
+
269
+ if ($.metadata) {
270
+ $.extend(true, obj, element.metadata());
271
+ }
272
+
273
+ } else {
274
+ obj = element;
275
+ }
276
+ }
277
+
278
+ href = opts.href || obj.href || (isString(element) ? element : null);
279
+ title = opts.title !== undefined ? opts.title : obj.title || '';
280
+
281
+ content = opts.content || obj.content;
282
+ type = content ? 'html' : (opts.type || obj.type);
283
+
284
+ if (!type && obj.isDom) {
285
+ type = element.data('fancybox-type');
286
+
287
+ if (!type) {
288
+ rez = element.prop('class').match(/fancybox\.(\w+)/);
289
+ type = rez ? rez[1] : null;
290
+ }
291
+ }
292
+
293
+ if (isString(href)) {
294
+ // Try to guess the content type
295
+ if (!type) {
296
+ if (F.isImage(href)) {
297
+ type = 'image';
298
+
299
+ } else if (F.isSWF(href)) {
300
+ type = 'swf';
301
+
302
+ } else if (href.charAt(0) === '#') {
303
+ type = 'inline';
304
+
305
+ } else if (isString(element)) {
306
+ type = 'html';
307
+ content = element;
308
+ }
309
+ }
310
+
311
+ // Split url into two pieces with source url and content selector, e.g,
312
+ // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
313
+ if (type === 'ajax') {
314
+ hrefParts = href.split(/\s+/, 2);
315
+ href = hrefParts.shift();
316
+ selector = hrefParts.shift();
317
+ }
318
+ }
319
+
320
+ if (!content) {
321
+ if (type === 'inline') {
322
+ if (href) {
323
+ content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
324
+
325
+ } else if (obj.isDom) {
326
+ content = element;
327
+ }
328
+
329
+ } else if (type === 'html') {
330
+ content = href;
331
+
332
+ } else if (!type && !href && obj.isDom) {
333
+ type = 'inline';
334
+ content = element;
335
+ }
336
+ }
337
+
338
+ $.extend(obj, {
339
+ href : href,
340
+ type : type,
341
+ content : content,
342
+ title : title,
343
+ selector : selector
344
+ });
345
+
346
+ group[ i ] = obj;
347
+ });
348
+
349
+ // Extend the defaults
350
+ F.opts = $.extend(true, {}, F.defaults, opts);
351
+
352
+ // All options are merged recursive except keys
353
+ if (opts.keys !== undefined) {
354
+ F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
355
+ }
356
+
357
+ F.group = group;
358
+
359
+ return F._start(F.opts.index);
360
+ },
361
+
362
+ // Cancel image loading or abort ajax request
363
+ cancel: function () {
364
+ var coming = F.coming;
365
+
366
+ if (!coming || false === F.trigger('onCancel')) {
367
+ return;
368
+ }
369
+
370
+ F.hideLoading();
371
+
372
+ if (F.ajaxLoad) {
373
+ F.ajaxLoad.abort();
374
+ }
375
+
376
+ F.ajaxLoad = null;
377
+
378
+ if (F.imgPreload) {
379
+ F.imgPreload.onload = F.imgPreload.onerror = null;
380
+ }
381
+
382
+ if (coming.wrap) {
383
+ coming.wrap.stop(true, true).trigger('onReset').remove();
384
+ }
385
+
386
+ F.coming = null;
387
+
388
+ // If the first item has been canceled, then clear everything
389
+ if (!F.current) {
390
+ F._afterZoomOut( coming );
391
+ }
392
+ },
393
+
394
+ // Start closing animation if is open; remove immediately if opening/closing
395
+ close: function (event) {
396
+ F.cancel();
397
+
398
+ if (false === F.trigger('beforeClose')) {
399
+ return;
400
+ }
401
+
402
+ F.unbindEvents();
403
+
404
+ if (!F.isActive) {
405
+ return;
406
+ }
407
+
408
+ if (!F.isOpen || event === true) {
409
+ $('.fancybox-wrap').stop(true).trigger('onReset').remove();
410
+
411
+ F._afterZoomOut();
412
+
413
+ } else {
414
+ F.isOpen = F.isOpened = false;
415
+ F.isClosing = true;
416
+
417
+ $('.fancybox-item, .fancybox-nav').remove();
418
+
419
+ F.wrap.stop(true, true).removeClass('fancybox-opened');
420
+
421
+ F.transitions[ F.current.closeMethod ]();
422
+ }
423
+ },
424
+
425
+ // Manage slideshow:
426
+ // $.fancybox.play(); - toggle slideshow
427
+ // $.fancybox.play( true ); - start
428
+ // $.fancybox.play( false ); - stop
429
+ play: function ( action ) {
430
+ var clear = function () {
431
+ clearTimeout(F.player.timer);
432
+ },
433
+ set = function () {
434
+ clear();
435
+
436
+ if (F.current && F.player.isActive) {
437
+ F.player.timer = setTimeout(F.next, F.current.playSpeed);
438
+ }
439
+ },
440
+ stop = function () {
441
+ clear();
442
+
443
+ D.unbind('.player');
444
+
445
+ F.player.isActive = false;
446
+
447
+ F.trigger('onPlayEnd');
448
+ },
449
+ start = function () {
450
+ if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
451
+ F.player.isActive = true;
452
+
453
+ D.bind({
454
+ 'onCancel.player beforeClose.player' : stop,
455
+ 'onUpdate.player' : set,
456
+ 'beforeLoad.player' : clear
457
+ });
458
+
459
+ set();
460
+
461
+ F.trigger('onPlayStart');
462
+ }
463
+ };
464
+
465
+ if (action === true || (!F.player.isActive && action !== false)) {
466
+ start();
467
+ } else {
468
+ stop();
469
+ }
470
+ },
471
+
472
+ // Navigate to next gallery item
473
+ next: function ( direction ) {
474
+ var current = F.current;
475
+
476
+ if (current) {
477
+ if (!isString(direction)) {
478
+ direction = current.direction.next;
479
+ }
480
+
481
+ F.jumpto(current.index + 1, direction, 'next');
482
+ }
483
+ },
484
+
485
+ // Navigate to previous gallery item
486
+ prev: function ( direction ) {
487
+ var current = F.current;
488
+
489
+ if (current) {
490
+ if (!isString(direction)) {
491
+ direction = current.direction.prev;
492
+ }
493
+
494
+ F.jumpto(current.index - 1, direction, 'prev');
495
+ }
496
+ },
497
+
498
+ // Navigate to gallery item by index
499
+ jumpto: function ( index, direction, router ) {
500
+ var current = F.current;
501
+
502
+ if (!current) {
503
+ return;
504
+ }
505
+
506
+ index = getScalar(index);
507
+
508
+ F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
509
+ F.router = router || 'jumpto';
510
+
511
+ if (current.loop) {
512
+ if (index < 0) {
513
+ index = current.group.length + (index % current.group.length);
514
+ }
515
+
516
+ index = index % current.group.length;
517
+ }
518
+
519
+ if (current.group[ index ] !== undefined) {
520
+ F.cancel();
521
+
522
+ F._start(index);
523
+ }
524
+ },
525
+
526
+ // Center inside viewport and toggle position type to fixed or absolute if needed
527
+ reposition: function (e, onlyAbsolute) {
528
+ var current = F.current,
529
+ wrap = current ? current.wrap : null,
530
+ pos;
531
+
532
+ if (wrap) {
533
+ pos = F._getPosition(onlyAbsolute);
534
+
535
+ if (e && e.type === 'scroll') {
536
+ delete pos.position;
537
+
538
+ wrap.stop(true, true).animate(pos, 200);
539
+
540
+ } else {
541
+ wrap.css(pos);
542
+
543
+ current.pos = $.extend({}, current.dim, pos);
544
+ }
545
+ }
546
+ },
547
+
548
+ update: function (e) {
549
+ var type = (e && e.type),
550
+ anyway = !type || type === 'orientationchange';
551
+
552
+ if (anyway) {
553
+ clearTimeout(didUpdate);
554
+
555
+ didUpdate = null;
556
+ }
557
+
558
+ if (!F.isOpen || didUpdate) {
559
+ return;
560
+ }
561
+
562
+ didUpdate = setTimeout(function() {
563
+ var current = F.current;
564
+
565
+ if (!current || F.isClosing) {
566
+ return;
567
+ }
568
+
569
+ F.wrap.removeClass('fancybox-tmp');
570
+
571
+ if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
572
+ F._setDimension();
573
+ }
574
+
575
+ if (!(type === 'scroll' && current.canShrink)) {
576
+ F.reposition(e);
577
+ }
578
+
579
+ F.trigger('onUpdate');
580
+
581
+ didUpdate = null;
582
+
583
+ }, (anyway && !isTouch ? 0 : 300));
584
+ },
585
+
586
+ // Shrink content to fit inside viewport or restore if resized
587
+ toggle: function ( action ) {
588
+ if (F.isOpen) {
589
+ F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
590
+
591
+ // Help browser to restore document dimensions
592
+ if (isTouch) {
593
+ F.wrap.removeAttr('style').addClass('fancybox-tmp');
594
+
595
+ F.trigger('onUpdate');
596
+ }
597
+
598
+ F.update();
599
+ }
600
+ },
601
+
602
+ hideLoading: function () {
603
+ D.unbind('.loading');
604
+
605
+ $('#fancybox-loading').remove();
606
+ },
607
+
608
+ showLoading: function () {
609
+ var el, viewport;
610
+
611
+ F.hideLoading();
612
+
613
+ el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
614
+
615
+ // If user will press the escape-button, the request will be canceled
616
+ D.bind('keydown.loading', function(e) {
617
+ if ((e.which || e.keyCode) === 27) {
618
+ e.preventDefault();
619
+
620
+ F.cancel();
621
+ }
622
+ });
623
+
624
+ if (!F.defaults.fixed) {
625
+ viewport = F.getViewport();
626
+
627
+ el.css({
628
+ position : 'absolute',
629
+ top : (viewport.h * 0.5) + viewport.y,
630
+ left : (viewport.w * 0.5) + viewport.x
631
+ });
632
+ }
633
+ },
634
+
635
+ getViewport: function () {
636
+ var locked = (F.current && F.current.locked) || false,
637
+ rez = {
638
+ x: W.scrollLeft(),
639
+ y: W.scrollTop()
640
+ };
641
+
642
+ if (locked) {
643
+ rez.w = locked[0].clientWidth;
644
+ rez.h = locked[0].clientHeight;
645
+
646
+ } else {
647
+ // See http://bugs.jquery.com/ticket/6724
648
+ rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width();
649
+ rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
650
+ }
651
+
652
+ return rez;
653
+ },
654
+
655
+ // Unbind the keyboard / clicking actions
656
+ unbindEvents: function () {
657
+ if (F.wrap && isQuery(F.wrap)) {
658
+ F.wrap.unbind('.fb');
659
+ }
660
+
661
+ D.unbind('.fb');
662
+ W.unbind('.fb');
663
+ },
664
+
665
+ bindEvents: function () {
666
+ var current = F.current,
667
+ keys;
668
+
669
+ if (!current) {
670
+ return;
671
+ }
672
+
673
+ // Changing document height on iOS devices triggers a 'resize' event,
674
+ // that can change document height... repeating infinitely
675
+ W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
676
+
677
+ keys = current.keys;
678
+
679
+ if (keys) {
680
+ D.bind('keydown.fb', function (e) {
681
+ var code = e.which || e.keyCode,
682
+ target = e.target || e.srcElement;
683
+
684
+ // Skip esc key if loading, because showLoading will cancel preloading
685
+ if (code === 27 && F.coming) {
686
+ return false;
687
+ }
688
+
689
+ // Ignore key combinations and key events within form elements
690
+ if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
691
+ $.each(keys, function(i, val) {
692
+ if (current.group.length > 1 && val[ code ] !== undefined) {
693
+ F[ i ]( val[ code ] );
694
+
695
+ e.preventDefault();
696
+ return false;
697
+ }
698
+
699
+ if ($.inArray(code, val) > -1) {
700
+ F[ i ] ();
701
+
702
+ e.preventDefault();
703
+ return false;
704
+ }
705
+ });
706
+ }
707
+ });
708
+ }
709
+
710
+ if ($.fn.mousewheel && current.mouseWheel) {
711
+ F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
712
+ var target = e.target || null,
713
+ parent = $(target),
714
+ canScroll = false;
715
+
716
+ while (parent.length) {
717
+ if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
718
+ break;
719
+ }
720
+
721
+ canScroll = isScrollable( parent[0] );
722
+ parent = $(parent).parent();
723
+ }
724
+
725
+ if (delta !== 0 && !canScroll) {
726
+ if (F.group.length > 1 && !current.canShrink) {
727
+ if (deltaY > 0 || deltaX > 0) {
728
+ F.prev( deltaY > 0 ? 'down' : 'left' );
729
+
730
+ } else if (deltaY < 0 || deltaX < 0) {
731
+ F.next( deltaY < 0 ? 'up' : 'right' );
732
+ }
733
+
734
+ e.preventDefault();
735
+ }
736
+ }
737
+ });
738
+ }
739
+ },
740
+
741
+ trigger: function (event, o) {
742
+ var ret, obj = o || F.coming || F.current;
743
+
744
+ if (!obj) {
745
+ return;
746
+ }
747
+
748
+ if ($.isFunction( obj[event] )) {
749
+ ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
750
+ }
751
+
752
+ if (ret === false) {
753
+ return false;
754
+ }
755
+
756
+ if (obj.helpers) {
757
+ $.each(obj.helpers, function (helper, opts) {
758
+ if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
759
+ F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj);
760
+ }
761
+ });
762
+ }
763
+
764
+ D.trigger(event);
765
+ },
766
+
767
+ isImage: function (str) {
768
+ return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
769
+ },
770
+
771
+ isSWF: function (str) {
772
+ return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
773
+ },
774
+
775
+ _start: function (index) {
776
+ var coming = {},
777
+ obj,
778
+ href,
779
+ type,
780
+ margin,
781
+ padding;
782
+
783
+ index = getScalar( index );
784
+ obj = F.group[ index ] || null;
785
+
786
+ if (!obj) {
787
+ return false;
788
+ }
789
+
790
+ coming = $.extend(true, {}, F.opts, obj);
791
+
792
+ // Convert margin and padding properties to array - top, right, bottom, left
793
+ margin = coming.margin;
794
+ padding = coming.padding;
795
+
796
+ if ($.type(margin) === 'number') {
797
+ coming.margin = [margin, margin, margin, margin];
798
+ }
799
+
800
+ if ($.type(padding) === 'number') {
801
+ coming.padding = [padding, padding, padding, padding];
802
+ }
803
+
804
+ // 'modal' propery is just a shortcut
805
+ if (coming.modal) {
806
+ $.extend(true, coming, {
807
+ closeBtn : false,
808
+ closeClick : false,
809
+ nextClick : false,
810
+ arrows : false,
811
+ mouseWheel : false,
812
+ keys : null,
813
+ helpers: {
814
+ overlay : {
815
+ closeClick : false
816
+ }
817
+ }
818
+ });
819
+ }
820
+
821
+ // 'autoSize' property is a shortcut, too
822
+ if (coming.autoSize) {
823
+ coming.autoWidth = coming.autoHeight = true;
824
+ }
825
+
826
+ if (coming.width === 'auto') {
827
+ coming.autoWidth = true;
828
+ }
829
+
830
+ if (coming.height === 'auto') {
831
+ coming.autoHeight = true;
832
+ }
833
+
834
+ /*
835
+ * Add reference to the group, so it`s possible to access from callbacks, example:
836
+ * afterLoad : function() {
837
+ * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
838
+ * }
839
+ */
840
+
841
+ coming.group = F.group;
842
+ coming.index = index;
843
+
844
+ // Give a chance for callback or helpers to update coming item (type, title, etc)
845
+ F.coming = coming;
846
+
847
+ if (false === F.trigger('beforeLoad')) {
848
+ F.coming = null;
849
+
850
+ return;
851
+ }
852
+
853
+ type = coming.type;
854
+ href = coming.href;
855
+
856
+ if (!type) {
857
+ F.coming = null;
858
+
859
+ //If we can not determine content type then drop silently or display next/prev item if looping through gallery
860
+ if (F.current && F.router && F.router !== 'jumpto') {
861
+ F.current.index = index;
862
+
863
+ return F[ F.router ]( F.direction );
864
+ }
865
+
866
+ return false;
867
+ }
868
+
869
+ F.isActive = true;
870
+
871
+ if (type === 'image' || type === 'swf') {
872
+ coming.autoHeight = coming.autoWidth = false;
873
+ coming.scrolling = 'visible';
874
+ }
875
+
876
+ if (type === 'image') {
877
+ coming.aspectRatio = true;
878
+ }
879
+
880
+ if (type === 'iframe' && isTouch) {
881
+ coming.scrolling = 'scroll';
882
+ }
883
+
884
+ // Build the neccessary markup
885
+ coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
886
+
887
+ $.extend(coming, {
888
+ skin : $('.fancybox-skin', coming.wrap),
889
+ outer : $('.fancybox-outer', coming.wrap),
890
+ inner : $('.fancybox-inner', coming.wrap)
891
+ });
892
+
893
+ $.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
894
+ coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
895
+ });
896
+
897
+ F.trigger('onReady');
898
+
899
+ // Check before try to load; 'inline' and 'html' types need content, others - href
900
+ if (type === 'inline' || type === 'html') {
901
+ if (!coming.content || !coming.content.length) {
902
+ return F._error( 'content' );
903
+ }
904
+
905
+ } else if (!href) {
906
+ return F._error( 'href' );
907
+ }
908
+
909
+ if (type === 'image') {
910
+ F._loadImage();
911
+
912
+ } else if (type === 'ajax') {
913
+ F._loadAjax();
914
+
915
+ } else if (type === 'iframe') {
916
+ F._loadIframe();
917
+
918
+ } else {
919
+ F._afterLoad();
920
+ }
921
+ },
922
+
923
+ _error: function ( type ) {
924
+ $.extend(F.coming, {
925
+ type : 'html',
926
+ autoWidth : true,
927
+ autoHeight : true,
928
+ minWidth : 0,
929
+ minHeight : 0,
930
+ scrolling : 'no',
931
+ hasError : type,
932
+ content : F.coming.tpl.error
933
+ });
934
+
935
+ F._afterLoad();
936
+ },
937
+
938
+ _loadImage: function () {
939
+ // Reset preload image so it is later possible to check "complete" property
940
+ var img = F.imgPreload = new Image();
941
+
942
+ img.onload = function () {
943
+ this.onload = this.onerror = null;
944
+
945
+ F.coming.width = this.width / F.opts.pixelRatio;
946
+ F.coming.height = this.height / F.opts.pixelRatio;
947
+
948
+ F._afterLoad();
949
+ };
950
+
951
+ img.onerror = function () {
952
+ this.onload = this.onerror = null;
953
+
954
+ F._error( 'image' );
955
+ };
956
+
957
+ img.src = F.coming.href;
958
+
959
+ if (img.complete !== true) {
960
+ F.showLoading();
961
+ }
962
+ },
963
+
964
+ _loadAjax: function () {
965
+ var coming = F.coming;
966
+
967
+ F.showLoading();
968
+
969
+ F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
970
+ url: coming.href,
971
+ error: function (jqXHR, textStatus) {
972
+ if (F.coming && textStatus !== 'abort') {
973
+ F._error( 'ajax', jqXHR );
974
+
975
+ } else {
976
+ F.hideLoading();
977
+ }
978
+ },
979
+ success: function (data, textStatus) {
980
+ if (textStatus === 'success') {
981
+ coming.content = data;
982
+
983
+ F._afterLoad();
984
+ }
985
+ }
986
+ }));
987
+ },
988
+
989
+ _loadIframe: function() {
990
+ var coming = F.coming,
991
+ iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
992
+ .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
993
+ .attr('src', coming.href);
994
+
995
+ // This helps IE
996
+ $(coming.wrap).bind('onReset', function () {
997
+ try {
998
+ $(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
999
+ } catch (e) {}
1000
+ });
1001
+
1002
+ if (coming.iframe.preload) {
1003
+ F.showLoading();
1004
+
1005
+ iframe.one('load', function() {
1006
+ $(this).data('ready', 1);
1007
+
1008
+ // iOS will lose scrolling if we resize
1009
+ if (!isTouch) {
1010
+ $(this).bind('load.fb', F.update);
1011
+ }
1012
+
1013
+ // Without this trick:
1014
+ // - iframe won't scroll on iOS devices
1015
+ // - IE7 sometimes displays empty iframe
1016
+ $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
1017
+
1018
+ F._afterLoad();
1019
+ });
1020
+ }
1021
+
1022
+ coming.content = iframe.appendTo( coming.inner );
1023
+
1024
+ if (!coming.iframe.preload) {
1025
+ F._afterLoad();
1026
+ }
1027
+ },
1028
+
1029
+ _preloadImages: function() {
1030
+ var group = F.group,
1031
+ current = F.current,
1032
+ len = group.length,
1033
+ cnt = current.preload ? Math.min(current.preload, len - 1) : 0,
1034
+ item,
1035
+ i;
1036
+
1037
+ for (i = 1; i <= cnt; i += 1) {
1038
+ item = group[ (current.index + i ) % len ];
1039
+
1040
+ if (item.type === 'image' && item.href) {
1041
+ new Image().src = item.href;
1042
+ }
1043
+ }
1044
+ },
1045
+
1046
+ _afterLoad: function () {
1047
+ var coming = F.coming,
1048
+ previous = F.current,
1049
+ placeholder = 'fancybox-placeholder',
1050
+ current,
1051
+ content,
1052
+ type,
1053
+ scrolling,
1054
+ href,
1055
+ embed;
1056
+
1057
+ F.hideLoading();
1058
+
1059
+ if (!coming || F.isActive === false) {
1060
+ return;
1061
+ }
1062
+
1063
+ if (false === F.trigger('afterLoad', coming, previous)) {
1064
+ coming.wrap.stop(true).trigger('onReset').remove();
1065
+
1066
+ F.coming = null;
1067
+
1068
+ return;
1069
+ }
1070
+
1071
+ if (previous) {
1072
+ F.trigger('beforeChange', previous);
1073
+
1074
+ previous.wrap.stop(true).removeClass('fancybox-opened')
1075
+ .find('.fancybox-item, .fancybox-nav')
1076
+ .remove();
1077
+ }
1078
+
1079
+ F.unbindEvents();
1080
+
1081
+ current = coming;
1082
+ content = coming.content;
1083
+ type = coming.type;
1084
+ scrolling = coming.scrolling;
1085
+
1086
+ $.extend(F, {
1087
+ wrap : current.wrap,
1088
+ skin : current.skin,
1089
+ outer : current.outer,
1090
+ inner : current.inner,
1091
+ current : current,
1092
+ previous : previous
1093
+ });
1094
+
1095
+ href = current.href;
1096
+
1097
+ switch (type) {
1098
+ case 'inline':
1099
+ case 'ajax':
1100
+ case 'html':
1101
+ if (current.selector) {
1102
+ content = $('<div>').html(content).find(current.selector);
1103
+
1104
+ } else if (isQuery(content)) {
1105
+ if (!content.data(placeholder)) {
1106
+ content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
1107
+ }
1108
+
1109
+ content = content.show().detach();
1110
+
1111
+ current.wrap.bind('onReset', function () {
1112
+ if ($(this).find(content).length) {
1113
+ content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
1114
+ }
1115
+ });
1116
+ }
1117
+ break;
1118
+
1119
+ case 'image':
1120
+ content = current.tpl.image.replace('{href}', href);
1121
+ break;
1122
+
1123
+ case 'swf':
1124
+ content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
1125
+ embed = '';
1126
+
1127
+ $.each(current.swf, function(name, val) {
1128
+ content += '<param name="' + name + '" value="' + val + '"></param>';
1129
+ embed += ' ' + name + '="' + val + '"';
1130
+ });
1131
+
1132
+ content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
1133
+ break;
1134
+ }
1135
+
1136
+ if (!(isQuery(content) && content.parent().is(current.inner))) {
1137
+ current.inner.append( content );
1138
+ }
1139
+
1140
+ // Give a chance for helpers or callbacks to update elements
1141
+ F.trigger('beforeShow');
1142
+
1143
+ // Set scrolling before calculating dimensions
1144
+ current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
1145
+
1146
+ // Set initial dimensions and start position
1147
+ F._setDimension();
1148
+
1149
+ F.reposition();
1150
+
1151
+ F.isOpen = false;
1152
+ F.coming = null;
1153
+
1154
+ F.bindEvents();
1155
+
1156
+ if (!F.isOpened) {
1157
+ $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
1158
+
1159
+ } else if (previous.prevMethod) {
1160
+ F.transitions[ previous.prevMethod ]();
1161
+ }
1162
+
1163
+ F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
1164
+
1165
+ F._preloadImages();
1166
+ },
1167
+
1168
+ _setDimension: function () {
1169
+ var viewport = F.getViewport(),
1170
+ steps = 0,
1171
+ canShrink = false,
1172
+ canExpand = false,
1173
+ wrap = F.wrap,
1174
+ skin = F.skin,
1175
+ inner = F.inner,
1176
+ current = F.current,
1177
+ width = current.width,
1178
+ height = current.height,
1179
+ minWidth = current.minWidth,
1180
+ minHeight = current.minHeight,
1181
+ maxWidth = current.maxWidth,
1182
+ maxHeight = current.maxHeight,
1183
+ scrolling = current.scrolling,
1184
+ scrollOut = current.scrollOutside ? current.scrollbarWidth : 0,
1185
+ margin = current.margin,
1186
+ wMargin = getScalar(margin[1] + margin[3]),
1187
+ hMargin = getScalar(margin[0] + margin[2]),
1188
+ wPadding,
1189
+ hPadding,
1190
+ wSpace,
1191
+ hSpace,
1192
+ origWidth,
1193
+ origHeight,
1194
+ origMaxWidth,
1195
+ origMaxHeight,
1196
+ ratio,
1197
+ width_,
1198
+ height_,
1199
+ maxWidth_,
1200
+ maxHeight_,
1201
+ iframe,
1202
+ body;
1203
+
1204
+ // Reset dimensions so we could re-check actual size
1205
+ wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
1206
+
1207
+ wPadding = getScalar(skin.outerWidth(true) - skin.width());
1208
+ hPadding = getScalar(skin.outerHeight(true) - skin.height());
1209
+
1210
+ // Any space between content and viewport (margin, padding, border, title)
1211
+ wSpace = wMargin + wPadding;
1212
+ hSpace = hMargin + hPadding;
1213
+
1214
+ origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width;
1215
+ origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
1216
+
1217
+ if (current.type === 'iframe') {
1218
+ iframe = current.content;
1219
+
1220
+ if (current.autoHeight && iframe.data('ready') === 1) {
1221
+ try {
1222
+ if (iframe[0].contentWindow.document.location) {
1223
+ inner.width( origWidth ).height(9999);
1224
+
1225
+ body = iframe.contents().find('body');
1226
+
1227
+ if (scrollOut) {
1228
+ body.css('overflow-x', 'hidden');
1229
+ }
1230
+
1231
+ origHeight = body.outerHeight(true);
1232
+ }
1233
+
1234
+ } catch (e) {}
1235
+ }
1236
+
1237
+ } else if (current.autoWidth || current.autoHeight) {
1238
+ inner.addClass( 'fancybox-tmp' );
1239
+
1240
+ // Set width or height in case we need to calculate only one dimension
1241
+ if (!current.autoWidth) {
1242
+ inner.width( origWidth );
1243
+ }
1244
+
1245
+ if (!current.autoHeight) {
1246
+ inner.height( origHeight );
1247
+ }
1248
+
1249
+ if (current.autoWidth) {
1250
+ origWidth = inner.width();
1251
+ }
1252
+
1253
+ if (current.autoHeight) {
1254
+ origHeight = inner.height();
1255
+ }
1256
+
1257
+ inner.removeClass( 'fancybox-tmp' );
1258
+ }
1259
+
1260
+ width = getScalar( origWidth );
1261
+ height = getScalar( origHeight );
1262
+
1263
+ ratio = origWidth / origHeight;
1264
+
1265
+ // Calculations for the content
1266
+ minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
1267
+ maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
1268
+
1269
+ minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
1270
+ maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
1271
+
1272
+ // These will be used to determine if wrap can fit in the viewport
1273
+ origMaxWidth = maxWidth;
1274
+ origMaxHeight = maxHeight;
1275
+
1276
+ if (current.fitToView) {
1277
+ maxWidth = Math.min(viewport.w - wSpace, maxWidth);
1278
+ maxHeight = Math.min(viewport.h - hSpace, maxHeight);
1279
+ }
1280
+
1281
+ maxWidth_ = viewport.w - wMargin;
1282
+ maxHeight_ = viewport.h - hMargin;
1283
+
1284
+ if (current.aspectRatio) {
1285
+ if (width > maxWidth) {
1286
+ width = maxWidth;
1287
+ height = getScalar(width / ratio);
1288
+ }
1289
+
1290
+ if (height > maxHeight) {
1291
+ height = maxHeight;
1292
+ width = getScalar(height * ratio);
1293
+ }
1294
+
1295
+ if (width < minWidth) {
1296
+ width = minWidth;
1297
+ height = getScalar(width / ratio);
1298
+ }
1299
+
1300
+ if (height < minHeight) {
1301
+ height = minHeight;
1302
+ width = getScalar(height * ratio);
1303
+ }
1304
+
1305
+ } else {
1306
+ width = Math.max(minWidth, Math.min(width, maxWidth));
1307
+
1308
+ if (current.autoHeight && current.type !== 'iframe') {
1309
+ inner.width( width );
1310
+
1311
+ height = inner.height();
1312
+ }
1313
+
1314
+ height = Math.max(minHeight, Math.min(height, maxHeight));
1315
+ }
1316
+
1317
+ // Try to fit inside viewport (including the title)
1318
+ if (current.fitToView) {
1319
+ inner.width( width ).height( height );
1320
+
1321
+ wrap.width( width + wPadding );
1322
+
1323
+ // Real wrap dimensions
1324
+ width_ = wrap.width();
1325
+ height_ = wrap.height();
1326
+
1327
+ if (current.aspectRatio) {
1328
+ while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
1329
+ if (steps++ > 19) {
1330
+ break;
1331
+ }
1332
+
1333
+ height = Math.max(minHeight, Math.min(maxHeight, height - 10));
1334
+ width = getScalar(height * ratio);
1335
+
1336
+ if (width < minWidth) {
1337
+ width = minWidth;
1338
+ height = getScalar(width / ratio);
1339
+ }
1340
+
1341
+ if (width > maxWidth) {
1342
+ width = maxWidth;
1343
+ height = getScalar(width / ratio);
1344
+ }
1345
+
1346
+ inner.width( width ).height( height );
1347
+
1348
+ wrap.width( width + wPadding );
1349
+
1350
+ width_ = wrap.width();
1351
+ height_ = wrap.height();
1352
+ }
1353
+
1354
+ } else {
1355
+ width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_)));
1356
+ height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
1357
+ }
1358
+ }
1359
+
1360
+ if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
1361
+ width += scrollOut;
1362
+ }
1363
+
1364
+ inner.width( width ).height( height );
1365
+
1366
+ wrap.width( width + wPadding );
1367
+
1368
+ width_ = wrap.width();
1369
+ height_ = wrap.height();
1370
+
1371
+ canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
1372
+ canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
1373
+
1374
+ $.extend(current, {
1375
+ dim : {
1376
+ width : getValue( width_ ),
1377
+ height : getValue( height_ )
1378
+ },
1379
+ origWidth : origWidth,
1380
+ origHeight : origHeight,
1381
+ canShrink : canShrink,
1382
+ canExpand : canExpand,
1383
+ wPadding : wPadding,
1384
+ hPadding : hPadding,
1385
+ wrapSpace : height_ - skin.outerHeight(true),
1386
+ skinSpace : skin.height() - height
1387
+ });
1388
+
1389
+ if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
1390
+ inner.height('auto');
1391
+ }
1392
+ },
1393
+
1394
+ _getPosition: function (onlyAbsolute) {
1395
+ var current = F.current,
1396
+ viewport = F.getViewport(),
1397
+ margin = current.margin,
1398
+ width = F.wrap.width() + margin[1] + margin[3],
1399
+ height = F.wrap.height() + margin[0] + margin[2],
1400
+ rez = {
1401
+ position: 'absolute',
1402
+ top : margin[0],
1403
+ left : margin[3]
1404
+ };
1405
+
1406
+ if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
1407
+ rez.position = 'fixed';
1408
+
1409
+ } else if (!current.locked) {
1410
+ rez.top += viewport.y;
1411
+ rez.left += viewport.x;
1412
+ }
1413
+
1414
+ rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio)));
1415
+ rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio)));
1416
+
1417
+ return rez;
1418
+ },
1419
+
1420
+ _afterZoomIn: function () {
1421
+ var current = F.current;
1422
+
1423
+ if (!current) {
1424
+ return;
1425
+ }
1426
+
1427
+ F.isOpen = F.isOpened = true;
1428
+
1429
+ F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
1430
+
1431
+ F.update();
1432
+
1433
+ // Assign a click event
1434
+ if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
1435
+ F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
1436
+ if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
1437
+ e.preventDefault();
1438
+
1439
+ F[ current.closeClick ? 'close' : 'next' ]();
1440
+ }
1441
+ });
1442
+ }
1443
+
1444
+ // Create a close button
1445
+ if (current.closeBtn) {
1446
+ $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) {
1447
+ e.preventDefault();
1448
+
1449
+ F.close();
1450
+ });
1451
+ }
1452
+
1453
+ // Create navigation arrows
1454
+ if (current.arrows && F.group.length > 1) {
1455
+ if (current.loop || current.index > 0) {
1456
+ $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
1457
+ }
1458
+
1459
+ if (current.loop || current.index < F.group.length - 1) {
1460
+ $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
1461
+ }
1462
+ }
1463
+
1464
+ F.trigger('afterShow');
1465
+
1466
+ // Stop the slideshow if this is the last item
1467
+ if (!current.loop && current.index === current.group.length - 1) {
1468
+ F.play( false );
1469
+
1470
+ } else if (F.opts.autoPlay && !F.player.isActive) {
1471
+ F.opts.autoPlay = false;
1472
+
1473
+ F.play();
1474
+ }
1475
+ },
1476
+
1477
+ _afterZoomOut: function ( obj ) {
1478
+ obj = obj || F.current;
1479
+
1480
+ $('.fancybox-wrap').trigger('onReset').remove();
1481
+
1482
+ $.extend(F, {
1483
+ group : {},
1484
+ opts : {},
1485
+ router : false,
1486
+ current : null,
1487
+ isActive : false,
1488
+ isOpened : false,
1489
+ isOpen : false,
1490
+ isClosing : false,
1491
+ wrap : null,
1492
+ skin : null,
1493
+ outer : null,
1494
+ inner : null
1495
+ });
1496
+
1497
+ F.trigger('afterClose', obj);
1498
+ }
1499
+ });
1500
+
1501
+ /*
1502
+ * Default transitions
1503
+ */
1504
+
1505
+ F.transitions = {
1506
+ getOrigPosition: function () {
1507
+ var current = F.current,
1508
+ element = current.element,
1509
+ orig = current.orig,
1510
+ pos = {},
1511
+ width = 50,
1512
+ height = 50,
1513
+ hPadding = current.hPadding,
1514
+ wPadding = current.wPadding,
1515
+ viewport = F.getViewport();
1516
+
1517
+ if (!orig && current.isDom && element.is(':visible')) {
1518
+ orig = element.find('img:first');
1519
+
1520
+ if (!orig.length) {
1521
+ orig = element;
1522
+ }
1523
+ }
1524
+
1525
+ if (isQuery(orig)) {
1526
+ pos = orig.offset();
1527
+
1528
+ if (orig.is('img')) {
1529
+ width = orig.outerWidth();
1530
+ height = orig.outerHeight();
1531
+ }
1532
+
1533
+ } else {
1534
+ pos.top = viewport.y + (viewport.h - height) * current.topRatio;
1535
+ pos.left = viewport.x + (viewport.w - width) * current.leftRatio;
1536
+ }
1537
+
1538
+ if (F.wrap.css('position') === 'fixed' || current.locked) {
1539
+ pos.top -= viewport.y;
1540
+ pos.left -= viewport.x;
1541
+ }
1542
+
1543
+ pos = {
1544
+ top : getValue(pos.top - hPadding * current.topRatio),
1545
+ left : getValue(pos.left - wPadding * current.leftRatio),
1546
+ width : getValue(width + wPadding),
1547
+ height : getValue(height + hPadding)
1548
+ };
1549
+
1550
+ return pos;
1551
+ },
1552
+
1553
+ step: function (now, fx) {
1554
+ var ratio,
1555
+ padding,
1556
+ value,
1557
+ prop = fx.prop,
1558
+ current = F.current,
1559
+ wrapSpace = current.wrapSpace,
1560
+ skinSpace = current.skinSpace;
1561
+
1562
+ if (prop === 'width' || prop === 'height') {
1563
+ ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
1564
+
1565
+ if (F.isClosing) {
1566
+ ratio = 1 - ratio;
1567
+ }
1568
+
1569
+ padding = prop === 'width' ? current.wPadding : current.hPadding;
1570
+ value = now - padding;
1571
+
1572
+ F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) );
1573
+ F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
1574
+ }
1575
+ },
1576
+
1577
+ zoomIn: function () {
1578
+ var current = F.current,
1579
+ startPos = current.pos,
1580
+ effect = current.openEffect,
1581
+ elastic = effect === 'elastic',
1582
+ endPos = $.extend({opacity : 1}, startPos);
1583
+
1584
+ // Remove "position" property that breaks older IE
1585
+ delete endPos.position;
1586
+
1587
+ if (elastic) {
1588
+ startPos = this.getOrigPosition();
1589
+
1590
+ if (current.openOpacity) {
1591
+ startPos.opacity = 0.1;
1592
+ }
1593
+
1594
+ } else if (effect === 'fade') {
1595
+ startPos.opacity = 0.1;
1596
+ }
1597
+
1598
+ F.wrap.css(startPos).animate(endPos, {
1599
+ duration : effect === 'none' ? 0 : current.openSpeed,
1600
+ easing : current.openEasing,
1601
+ step : elastic ? this.step : null,
1602
+ complete : F._afterZoomIn
1603
+ });
1604
+ },
1605
+
1606
+ zoomOut: function () {
1607
+ var current = F.current,
1608
+ effect = current.closeEffect,
1609
+ elastic = effect === 'elastic',
1610
+ endPos = {opacity : 0.1};
1611
+
1612
+ if (elastic) {
1613
+ endPos = this.getOrigPosition();
1614
+
1615
+ if (current.closeOpacity) {
1616
+ endPos.opacity = 0.1;
1617
+ }
1618
+ }
1619
+
1620
+ F.wrap.animate(endPos, {
1621
+ duration : effect === 'none' ? 0 : current.closeSpeed,
1622
+ easing : current.closeEasing,
1623
+ step : elastic ? this.step : null,
1624
+ complete : F._afterZoomOut
1625
+ });
1626
+ },
1627
+
1628
+ changeIn: function () {
1629
+ var current = F.current,
1630
+ effect = current.nextEffect,
1631
+ startPos = current.pos,
1632
+ endPos = { opacity : 1 },
1633
+ direction = F.direction,
1634
+ distance = 200,
1635
+ field;
1636
+
1637
+ startPos.opacity = 0.1;
1638
+
1639
+ if (effect === 'elastic') {
1640
+ field = direction === 'down' || direction === 'up' ? 'top' : 'left';
1641
+
1642
+ if (direction === 'down' || direction === 'right') {
1643
+ startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
1644
+ endPos[ field ] = '+=' + distance + 'px';
1645
+
1646
+ } else {
1647
+ startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
1648
+ endPos[ field ] = '-=' + distance + 'px';
1649
+ }
1650
+ }
1651
+
1652
+ // Workaround for http://bugs.jquery.com/ticket/12273
1653
+ if (effect === 'none') {
1654
+ F._afterZoomIn();
1655
+
1656
+ } else {
1657
+ F.wrap.css(startPos).animate(endPos, {
1658
+ duration : current.nextSpeed,
1659
+ easing : current.nextEasing,
1660
+ complete : F._afterZoomIn
1661
+ });
1662
+ }
1663
+ },
1664
+
1665
+ changeOut: function () {
1666
+ var previous = F.previous,
1667
+ effect = previous.prevEffect,
1668
+ endPos = { opacity : 0.1 },
1669
+ direction = F.direction,
1670
+ distance = 200;
1671
+
1672
+ if (effect === 'elastic') {
1673
+ endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
1674
+ }
1675
+
1676
+ previous.wrap.animate(endPos, {
1677
+ duration : effect === 'none' ? 0 : previous.prevSpeed,
1678
+ easing : previous.prevEasing,
1679
+ complete : function () {
1680
+ $(this).trigger('onReset').remove();
1681
+ }
1682
+ });
1683
+ }
1684
+ };
1685
+
1686
+ /*
1687
+ * Overlay helper
1688
+ */
1689
+
1690
+ F.helpers.overlay = {
1691
+ defaults : {
1692
+ closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay
1693
+ speedOut : 200, // duration of fadeOut animation
1694
+ showEarly : true, // indicates if should be opened immediately or wait until the content is ready
1695
+ css : {}, // custom CSS properties
1696
+ locked : !isTouch, // if true, the content will be locked into overlay
1697
+ fixed : true // if false, the overlay CSS position property will not be set to "fixed"
1698
+ },
1699
+
1700
+ overlay : null, // current handle
1701
+ fixed : false, // indicates if the overlay has position "fixed"
1702
+ el : $('html'), // element that contains "the lock"
1703
+
1704
+ // Public methods
1705
+ create : function(opts) {
1706
+ opts = $.extend({}, this.defaults, opts);
1707
+
1708
+ if (this.overlay) {
1709
+ this.close();
1710
+ }
1711
+
1712
+ this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent );
1713
+ this.fixed = false;
1714
+
1715
+ if (opts.fixed && F.defaults.fixed) {
1716
+ this.overlay.addClass('fancybox-overlay-fixed');
1717
+
1718
+ this.fixed = true;
1719
+ }
1720
+ },
1721
+
1722
+ open : function(opts) {
1723
+ var that = this;
1724
+
1725
+ opts = $.extend({}, this.defaults, opts);
1726
+
1727
+ if (this.overlay) {
1728
+ this.overlay.unbind('.overlay').width('auto').height('auto');
1729
+
1730
+ } else {
1731
+ this.create(opts);
1732
+ }
1733
+
1734
+ if (!this.fixed) {
1735
+ W.bind('resize.overlay', $.proxy( this.update, this) );
1736
+
1737
+ this.update();
1738
+ }
1739
+
1740
+ if (opts.closeClick) {
1741
+ this.overlay.bind('click.overlay', function(e) {
1742
+ if ($(e.target).hasClass('fancybox-overlay')) {
1743
+ if (F.isActive) {
1744
+ F.close();
1745
+ } else {
1746
+ that.close();
1747
+ }
1748
+
1749
+ return false;
1750
+ }
1751
+ });
1752
+ }
1753
+
1754
+ this.overlay.css( opts.css ).show();
1755
+ },
1756
+
1757
+ close : function() {
1758
+ var scrollV, scrollH;
1759
+
1760
+ W.unbind('resize.overlay');
1761
+
1762
+ if (this.el.hasClass('fancybox-lock')) {
1763
+ $('.fancybox-margin').removeClass('fancybox-margin');
1764
+
1765
+ scrollV = W.scrollTop();
1766
+ scrollH = W.scrollLeft();
1767
+
1768
+ this.el.removeClass('fancybox-lock');
1769
+
1770
+ W.scrollTop( scrollV ).scrollLeft( scrollH );
1771
+ }
1772
+
1773
+ $('.fancybox-overlay').remove().hide();
1774
+
1775
+ $.extend(this, {
1776
+ overlay : null,
1777
+ fixed : false
1778
+ });
1779
+ },
1780
+
1781
+ // Private, callbacks
1782
+
1783
+ update : function () {
1784
+ var width = '100%', offsetWidth;
1785
+
1786
+ // Reset width/height so it will not mess
1787
+ this.overlay.width(width).height('100%');
1788
+
1789
+ // jQuery does not return reliable result for IE
1790
+ if (IE) {
1791
+ offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
1792
+
1793
+ if (D.width() > offsetWidth) {
1794
+ width = D.width();
1795
+ }
1796
+
1797
+ } else if (D.width() > W.width()) {
1798
+ width = D.width();
1799
+ }
1800
+
1801
+ this.overlay.width(width).height(D.height());
1802
+ },
1803
+
1804
+ // This is where we can manipulate DOM, because later it would cause iframes to reload
1805
+ onReady : function (opts, obj) {
1806
+ var overlay = this.overlay;
1807
+
1808
+ $('.fancybox-overlay').stop(true, true);
1809
+
1810
+ if (!overlay) {
1811
+ this.create(opts);
1812
+ }
1813
+
1814
+ if (opts.locked && this.fixed && obj.fixed) {
1815
+ if (!overlay) {
1816
+ this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false;
1817
+ }
1818
+
1819
+ obj.locked = this.overlay.append( obj.wrap );
1820
+ obj.fixed = false;
1821
+ }
1822
+
1823
+ if (opts.showEarly === true) {
1824
+ this.beforeShow.apply(this, arguments);
1825
+ }
1826
+ },
1827
+
1828
+ beforeShow : function(opts, obj) {
1829
+ var scrollV, scrollH;
1830
+
1831
+ if (obj.locked) {
1832
+ if (this.margin !== false) {
1833
+ $('*').filter(function(){
1834
+ return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
1835
+ }).addClass('fancybox-margin');
1836
+
1837
+ this.el.addClass('fancybox-margin');
1838
+ }
1839
+
1840
+ scrollV = W.scrollTop();
1841
+ scrollH = W.scrollLeft();
1842
+
1843
+ this.el.addClass('fancybox-lock');
1844
+
1845
+ W.scrollTop( scrollV ).scrollLeft( scrollH );
1846
+ }
1847
+
1848
+ this.open(opts);
1849
+ },
1850
+
1851
+ onUpdate : function() {
1852
+ if (!this.fixed) {
1853
+ this.update();
1854
+ }
1855
+ },
1856
+
1857
+ afterClose: function (opts) {
1858
+ // Remove overlay if exists and fancyBox is not opening
1859
+ // (e.g., it is not being open using afterClose callback)
1860
+ //if (this.overlay && !F.isActive) {
1861
+ if (this.overlay && !F.coming) {
1862
+ this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
1863
+ }
1864
+ }
1865
+ };
1866
+
1867
+ /*
1868
+ * Title helper
1869
+ */
1870
+
1871
+ F.helpers.title = {
1872
+ defaults : {
1873
+ type : 'float', // 'float', 'inside', 'outside' or 'over',
1874
+ position : 'bottom' // 'top' or 'bottom'
1875
+ },
1876
+
1877
+ beforeShow: function (opts) {
1878
+ var current = F.current,
1879
+ text = current.title,
1880
+ type = opts.type,
1881
+ title,
1882
+ target;
1883
+
1884
+ if ($.isFunction(text)) {
1885
+ text = text.call(current.element, current);
1886
+ }
1887
+
1888
+ if (!isString(text) || $.trim(text) === '') {
1889
+ return;
1890
+ }
1891
+
1892
+ title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">' + text + '</div>');
1893
+
1894
+ switch (type) {
1895
+ case 'inside':
1896
+ target = F.skin;
1897
+ break;
1898
+
1899
+ case 'outside':
1900
+ target = F.wrap;
1901
+ break;
1902
+
1903
+ case 'over':
1904
+ target = F.inner;
1905
+ break;
1906
+
1907
+ default: // 'float'
1908
+ target = F.skin;
1909
+
1910
+ title.appendTo('body');
1911
+
1912
+ if (IE) {
1913
+ title.width( title.width() );
1914
+ }
1915
+
1916
+ title.wrapInner('<span class="child"></span>');
1917
+
1918
+ //Increase bottom margin so this title will also fit into viewport
1919
+ F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
1920
+ break;
1921
+ }
1922
+
1923
+ title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target);
1924
+ }
1925
+ };
1926
+
1927
+ // jQuery plugin initialization
1928
+ $.fn.fancybox = function (options) {
1929
+ var index,
1930
+ that = $(this),
1931
+ selector = this.selector || '',
1932
+ run = function(e) {
1933
+ var what = $(this).blur(), idx = index, relType, relVal;
1934
+
1935
+ if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
1936
+ relType = options.groupAttr || 'data-fancybox-group';
1937
+ relVal = what.attr(relType);
1938
+
1939
+ if (!relVal) {
1940
+ relType = 'rel';
1941
+ relVal = what.get(0)[ relType ];
1942
+ }
1943
+
1944
+ if (relVal && relVal !== '' && relVal !== 'nofollow') {
1945
+ what = selector.length ? $(selector) : that;
1946
+ what = what.filter('[' + relType + '="' + relVal + '"]');
1947
+ idx = what.index(this);
1948
+ }
1949
+
1950
+ options.index = idx;
1951
+
1952
+ // Stop an event from bubbling if everything is fine
1953
+ if (F.open(what, options) !== false) {
1954
+ e.preventDefault();
1955
+ }
1956
+ }
1957
+ };
1958
+
1959
+ options = options || {};
1960
+ index = options.index || 0;
1961
+
1962
+ if (!selector || options.live === false) {
1963
+ that.unbind('click.fb-start').bind('click.fb-start', run);
1964
+
1965
+ } else {
1966
+ D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
1967
+ }
1968
+
1969
+ this.filter('[data-fancybox-start=1]').trigger('click');
1970
+
1971
+ return this;
1972
+ };
1973
+
1974
+ // Tests that need a body at doc ready
1975
+ D.ready(function() {
1976
+ var w1, w2;
1977
+
1978
+ if ( $.scrollbarWidth === undefined ) {
1979
+ // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
1980
+ $.scrollbarWidth = function() {
1981
+ var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
1982
+ child = parent.children(),
1983
+ width = child.innerWidth() - child.height( 99 ).innerWidth();
1984
+
1985
+ parent.remove();
1986
+
1987
+ return width;
1988
+ };
1989
+ }
1990
+
1991
+ if ( $.support.fixedPosition === undefined ) {
1992
+ $.support.fixedPosition = (function() {
1993
+ var elem = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
1994
+ fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
1995
+
1996
+ elem.remove();
1997
+
1998
+ return fixed;
1999
+ }());
2000
+ }
2001
+
2002
+ $.extend(F.defaults, {
2003
+ scrollbarWidth : $.scrollbarWidth(),
2004
+ fixed : $.support.fixedPosition,
2005
+ parent : $('body')
2006
+ });
2007
+
2008
+ //Get real width of page scroll-bar
2009
+ w1 = $(window).width();
2010
+
2011
+ H.addClass('fancybox-lock-test');
2012
+
2013
+ w2 = $(window).width();
2014
+
2015
+ H.removeClass('fancybox-lock-test');
2016
+
2017
+ $("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head");
2018
+ });
2019
+
2020
+ }(window, document, jQuery));
public/assets/popup/jquery.fancybox.pack.js ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
2
+ (function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20,
3
+ width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},
4
+ keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+
5
+ (I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,
6
+ openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
7
+ isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,
8
+ c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&
9
+ k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||
10
+ b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=
11
+ setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current;
12
+ d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d=
13
+ a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")),
14
+ b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(),
15
+ y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement;
16
+ if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&&
17
+ (h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0,
18
+ {},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,
19
+ mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=
20
+ !0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");
21
+ "image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload=
22
+ this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);
23
+ f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,
24
+ e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,
25
+ outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}",
26
+ g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll":
27
+ "no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside?
28
+ h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth||
29
+ h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&&
30
+ "iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width();
31
+ y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&&
32
+ !a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(),
33
+ b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a=
34
+ a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):
35
+ (c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"===
36
+ f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c,
37
+ {duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=
38
+ b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay=
39
+ f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?
40
+ b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth),
41
+ p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"===
42
+ f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=
43
+ b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,
44
+ e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+
45
+ ":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20===
46
+ d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery);
public/assets/popup/jquery.magnific-popup.js ADDED
@@ -0,0 +1,2064 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! Magnific Popup - v1.0.0 - 2014-12-30
2
+ * http://dimsemenov.com/plugins/magnific-popup/
3
+ * Copyright (c) 2014 Dmitry Semenov; */
4
+ ;(function (factory) {
5
+ if (typeof define === 'function' && define.amd) {
6
+ // AMD. Register as an anonymous module.
7
+ define(['jquery'], factory);
8
+ } else if (typeof exports === 'object') {
9
+ // Node/CommonJS
10
+ factory(require('jquery'));
11
+ } else {
12
+ // Browser globals
13
+ factory(window.jQuery || window.Zepto);
14
+ }
15
+ }(function($) {
16
+
17
+ /*>>core*/
18
+ /**
19
+ *
20
+ * Magnific Popup Core JS file
21
+ *
22
+ */
23
+
24
+
25
+ /**
26
+ * Private static constants
27
+ */
28
+ var CLOSE_EVENT = 'Close',
29
+ BEFORE_CLOSE_EVENT = 'BeforeClose',
30
+ AFTER_CLOSE_EVENT = 'AfterClose',
31
+ BEFORE_APPEND_EVENT = 'BeforeAppend',
32
+ MARKUP_PARSE_EVENT = 'MarkupParse',
33
+ OPEN_EVENT = 'Open',
34
+ CHANGE_EVENT = 'Change',
35
+ NS = 'mfp',
36
+ EVENT_NS = '.' + NS,
37
+ READY_CLASS = 'mfp-ready',
38
+ REMOVING_CLASS = 'mfp-removing',
39
+ PREVENT_CLOSE_CLASS = 'mfp-prevent-close';
40
+
41
+
42
+ /**
43
+ * Private vars
44
+ */
45
+ /*jshint -W079 */
46
+ var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
47
+ MagnificPopup = function(){},
48
+ _isJQ = !!(window.jQuery),
49
+ _prevStatus,
50
+ _window = $(window),
51
+ _body,
52
+ _document,
53
+ _prevContentType,
54
+ _wrapClasses,
55
+ _currPopupType;
56
+
57
+
58
+ /**
59
+ * Private functions
60
+ */
61
+ var _mfpOn = function(name, f) {
62
+ mfp.ev.on(NS + name + EVENT_NS, f);
63
+ },
64
+ _getEl = function(className, appendTo, html, raw) {
65
+ var el = document.createElement('div');
66
+ el.className = 'mfp-'+className;
67
+ if(html) {
68
+ el.innerHTML = html;
69
+ }
70
+ if(!raw) {
71
+ el = $(el);
72
+ if(appendTo) {
73
+ el.appendTo(appendTo);
74
+ }
75
+ } else if(appendTo) {
76
+ appendTo.appendChild(el);
77
+ }
78
+ return el;
79
+ },
80
+ _mfpTrigger = function(e, data) {
81
+ mfp.ev.triggerHandler(NS + e, data);
82
+
83
+ if(mfp.st.callbacks) {
84
+ // converts "mfpEventName" to "eventName" callback and triggers it if it's present
85
+ e = e.charAt(0).toLowerCase() + e.slice(1);
86
+ if(mfp.st.callbacks[e]) {
87
+ mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
88
+ }
89
+ }
90
+ },
91
+ _getCloseBtn = function(type) {
92
+ if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
93
+ mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
94
+ _currPopupType = type;
95
+ }
96
+ return mfp.currTemplate.closeBtn;
97
+ },
98
+ // Initialize Magnific Popup only when called at least once
99
+ _checkInstance = function() {
100
+ if(!$.magnificPopup.instance) {
101
+ /*jshint -W020 */
102
+ mfp = new MagnificPopup();
103
+ mfp.init();
104
+ $.magnificPopup.instance = mfp;
105
+ }
106
+ },
107
+ // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
108
+ supportsTransitions = function() {
109
+ var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
110
+ v = ['ms','O','Moz','Webkit']; // 'v' for vendor
111
+
112
+ if( s['transition'] !== undefined ) {
113
+ return true;
114
+ }
115
+
116
+ while( v.length ) {
117
+ if( v.pop() + 'Transition' in s ) {
118
+ return true;
119
+ }
120
+ }
121
+
122
+ return false;
123
+ };
124
+
125
+
126
+
127
+ /**
128
+ * Public functions
129
+ */
130
+ MagnificPopup.prototype = {
131
+
132
+ constructor: MagnificPopup,
133
+
134
+ /**
135
+ * Initializes Magnific Popup plugin.
136
+ * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
137
+ */
138
+ init: function() {
139
+ var appVersion = navigator.appVersion;
140
+ mfp.isIE7 = appVersion.indexOf("MSIE 7.") !== -1;
141
+ mfp.isIE8 = appVersion.indexOf("MSIE 8.") !== -1;
142
+ mfp.isLowIE = mfp.isIE7 || mfp.isIE8;
143
+ mfp.isAndroid = (/android/gi).test(appVersion);
144
+ mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
145
+ mfp.supportsTransition = supportsTransitions();
146
+
147
+ // We disable fixed positioned lightbox on devices that don't handle it nicely.
148
+ // If you know a better way of detecting this - let me know.
149
+ mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
150
+ _document = $(document);
151
+
152
+ mfp.popupsCache = {};
153
+ },
154
+
155
+ /**
156
+ * Opens popup
157
+ * @param data [description]
158
+ */
159
+ open: function(data) {
160
+
161
+ if(!_body) {
162
+ _body = $(document.body);
163
+ }
164
+
165
+ var i;
166
+
167
+ if(data.isObj === false) {
168
+ // convert jQuery collection to array to avoid conflicts later
169
+ mfp.items = data.items.toArray();
170
+
171
+ mfp.index = 0;
172
+ var items = data.items,
173
+ item;
174
+ for(i = 0; i < items.length; i++) {
175
+ item = items[i];
176
+ if(item.parsed) {
177
+ item = item.el[0];
178
+ }
179
+ if(item === data.el[0]) {
180
+ mfp.index = i;
181
+ break;
182
+ }
183
+ }
184
+ } else {
185
+ mfp.items = $.isArray(data.items) ? data.items : [data.items];
186
+ mfp.index = data.index || 0;
187
+ }
188
+
189
+ // if popup is already opened - we just update the content
190
+ if(mfp.isOpen) {
191
+ mfp.updateItemHTML();
192
+ return;
193
+ }
194
+
195
+ mfp.types = [];
196
+ _wrapClasses = '';
197
+ if(data.mainEl && data.mainEl.length) {
198
+ mfp.ev = data.mainEl.eq(0);
199
+ } else {
200
+ mfp.ev = _document;
201
+ }
202
+
203
+ if(data.key) {
204
+ if(!mfp.popupsCache[data.key]) {
205
+ mfp.popupsCache[data.key] = {};
206
+ }
207
+ mfp.currTemplate = mfp.popupsCache[data.key];
208
+ } else {
209
+ mfp.currTemplate = {};
210
+ }
211
+
212
+
213
+
214
+ mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data );
215
+ mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
216
+
217
+ if(mfp.st.modal) {
218
+ mfp.st.closeOnContentClick = false;
219
+ mfp.st.closeOnBgClick = false;
220
+ mfp.st.showCloseBtn = false;
221
+ mfp.st.enableEscapeKey = false;
222
+ }
223
+
224
+
225
+ // Building markup
226
+ // main containers are created only once
227
+ if(!mfp.bgOverlay) {
228
+
229
+ // Dark overlay
230
+ mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
231
+ mfp.close();
232
+ });
233
+
234
+ mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
235
+ if(mfp._checkIfClose(e.target)) {
236
+ mfp.close();
237
+ }
238
+ });
239
+
240
+ mfp.container = _getEl('container', mfp.wrap);
241
+ }
242
+
243
+ mfp.contentContainer = _getEl('content');
244
+ if(mfp.st.preloader) {
245
+ mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading);
246
+ }
247
+
248
+
249
+ // Initializing modules
250
+ var modules = $.magnificPopup.modules;
251
+ for(i = 0; i < modules.length; i++) {
252
+ var n = modules[i];
253
+ n = n.charAt(0).toUpperCase() + n.slice(1);
254
+ mfp['init'+n].call(mfp);
255
+ }
256
+ _mfpTrigger('BeforeOpen');
257
+
258
+
259
+ if(mfp.st.showCloseBtn) {
260
+ // Close button
261
+ if(!mfp.st.closeBtnInside) {
262
+ mfp.wrap.append( _getCloseBtn() );
263
+ } else {
264
+ _mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) {
265
+ values.close_replaceWith = _getCloseBtn(item.type);
266
+ });
267
+ _wrapClasses += ' mfp-close-btn-in';
268
+ }
269
+ }
270
+
271
+ if(mfp.st.alignTop) {
272
+ _wrapClasses += ' mfp-align-top';
273
+ }
274
+
275
+
276
+
277
+ if(mfp.fixedContentPos) {
278
+ mfp.wrap.css({
279
+ overflow: mfp.st.overflowY,
280
+ overflowX: 'hidden',
281
+ overflowY: mfp.st.overflowY
282
+ });
283
+ } else {
284
+ mfp.wrap.css({
285
+ top: _window.scrollTop(),
286
+ position: 'absolute'
287
+ });
288
+ }
289
+ if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) {
290
+ mfp.bgOverlay.css({
291
+ height: _document.height(),
292
+ position: 'absolute'
293
+ });
294
+ }
295
+
296
+
297
+
298
+ if(mfp.st.enableEscapeKey) {
299
+ // Close on ESC key
300
+ _document.on('keyup' + EVENT_NS, function(e) {
301
+ if(e.keyCode === 27) {
302
+ mfp.close();
303
+ }
304
+ });
305
+ }
306
+
307
+ _window.on('resize' + EVENT_NS, function() {
308
+ mfp.updateSize();
309
+ });
310
+
311
+
312
+ if(!mfp.st.closeOnContentClick) {
313
+ _wrapClasses += ' mfp-auto-cursor';
314
+ }
315
+
316
+ if(_wrapClasses)
317
+ mfp.wrap.addClass(_wrapClasses);
318
+
319
+
320
+ // this triggers recalculation of layout, so we get it once to not to trigger twice
321
+ var windowHeight = mfp.wH = _window.height();
322
+
323
+
324
+ var windowStyles = {};
325
+
326
+ if( mfp.fixedContentPos ) {
327
+ if(mfp._hasScrollBar(windowHeight)){
328
+ var s = mfp._getScrollbarSize();
329
+ if(s) {
330
+ windowStyles.marginRight = s;
331
+ }
332
+ }
333
+ }
334
+
335
+ if(mfp.fixedContentPos) {
336
+ if(!mfp.isIE7) {
337
+ windowStyles.overflow = 'hidden';
338
+ } else {
339
+ // ie7 double-scroll bug
340
+ $('body, html').css('overflow', 'hidden');
341
+ }
342
+ }
343
+
344
+
345
+
346
+ var classesToadd = mfp.st.mainClass;
347
+ if(mfp.isIE7) {
348
+ classesToadd += ' mfp-ie7';
349
+ }
350
+ if(classesToadd) {
351
+ mfp._addClassToMFP( classesToadd );
352
+ }
353
+
354
+ // add content
355
+ mfp.updateItemHTML();
356
+
357
+ _mfpTrigger('BuildControls');
358
+
359
+ // remove scrollbar, add margin e.t.c
360
+ $('html').css(windowStyles);
361
+
362
+ // add everything to DOM
363
+ mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || _body );
364
+
365
+ // Save last focused element
366
+ mfp._lastFocusedEl = document.activeElement;
367
+
368
+ // Wait for next cycle to allow CSS transition
369
+ setTimeout(function() {
370
+
371
+ if(mfp.content) {
372
+ mfp._addClassToMFP(READY_CLASS);
373
+ mfp._setFocus();
374
+ } else {
375
+ // if content is not defined (not loaded e.t.c) we add class only for BG
376
+ mfp.bgOverlay.addClass(READY_CLASS);
377
+ }
378
+
379
+ // Trap the focus in popup
380
+ _document.on('focusin' + EVENT_NS, mfp._onFocusIn);
381
+
382
+ }, 16);
383
+
384
+ mfp.isOpen = true;
385
+ mfp.updateSize(windowHeight);
386
+ _mfpTrigger(OPEN_EVENT);
387
+
388
+ return data;
389
+ },
390
+
391
+ /**
392
+ * Closes the popup
393
+ */
394
+ close: function() {
395
+ if(!mfp.isOpen) return;
396
+ _mfpTrigger(BEFORE_CLOSE_EVENT);
397
+
398
+ mfp.isOpen = false;
399
+ // for CSS3 animation
400
+ if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) {
401
+ mfp._addClassToMFP(REMOVING_CLASS);
402
+ setTimeout(function() {
403
+ mfp._close();
404
+ }, mfp.st.removalDelay);
405
+ } else {
406
+ mfp._close();
407
+ }
408
+ },
409
+
410
+ /**
411
+ * Helper for close() function
412
+ */
413
+ _close: function() {
414
+ _mfpTrigger(CLOSE_EVENT);
415
+
416
+ var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
417
+
418
+ mfp.bgOverlay.detach();
419
+ mfp.wrap.detach();
420
+ mfp.container.empty();
421
+
422
+ if(mfp.st.mainClass) {
423
+ classesToRemove += mfp.st.mainClass + ' ';
424
+ }
425
+
426
+ mfp._removeClassFromMFP(classesToRemove);
427
+
428
+ if(mfp.fixedContentPos) {
429
+ var windowStyles = {marginRight: ''};
430
+ if(mfp.isIE7) {
431
+ $('body, html').css('overflow', '');
432
+ } else {
433
+ windowStyles.overflow = '';
434
+ }
435
+ $('html').css(windowStyles);
436
+ }
437
+
438
+ _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
439
+ mfp.ev.off(EVENT_NS);
440
+
441
+ // clean up DOM elements that aren't removed
442
+ mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style');
443
+ mfp.bgOverlay.attr('class', 'mfp-bg');
444
+ mfp.container.attr('class', 'mfp-container');
445
+
446
+ // remove close button from target element
447
+ if(mfp.st.showCloseBtn &&
448
+ (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) {
449
+ if(mfp.currTemplate.closeBtn)
450
+ mfp.currTemplate.closeBtn.detach();
451
+ }
452
+
453
+
454
+ if(mfp._lastFocusedEl) {
455
+ $(mfp._lastFocusedEl).focus(); // put tab focus back
456
+ }
457
+ mfp.currItem = null;
458
+ mfp.content = null;
459
+ mfp.currTemplate = null;
460
+ mfp.prevHeight = 0;
461
+
462
+ _mfpTrigger(AFTER_CLOSE_EVENT);
463
+ },
464
+
465
+ updateSize: function(winHeight) {
466
+
467
+ if(mfp.isIOS) {
468
+ // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2
469
+ var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
470
+ var height = window.innerHeight * zoomLevel;
471
+ mfp.wrap.css('height', height);
472
+ mfp.wH = height;
473
+ } else {
474
+ mfp.wH = winHeight || _window.height();
475
+ }
476
+ // Fixes #84: popup incorrectly positioned with position:relative on body
477
+ if(!mfp.fixedContentPos) {
478
+ mfp.wrap.css('height', mfp.wH);
479
+ }
480
+
481
+ _mfpTrigger('Resize');
482
+
483
+ },
484
+
485
+ /**
486
+ * Set content of popup based on current index
487
+ */
488
+ updateItemHTML: function() {
489
+ var item = mfp.items[mfp.index];
490
+
491
+ // Detach and perform modifications
492
+ mfp.contentContainer.detach();
493
+
494
+ if(mfp.content)
495
+ mfp.content.detach();
496
+
497
+ if(!item.parsed) {
498
+ item = mfp.parseEl( mfp.index );
499
+ }
500
+
501
+ var type = item.type;
502
+
503
+ _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
504
+ // BeforeChange event works like so:
505
+ // _mfpOn('BeforeChange', function(e, prevType, newType) { });
506
+
507
+ mfp.currItem = item;
508
+
509
+
510
+
511
+
512
+
513
+ if(!mfp.currTemplate[type]) {
514
+ var markup = mfp.st[type] ? mfp.st[type].markup : false;
515
+
516
+ // allows to modify markup
517
+ _mfpTrigger('FirstMarkupParse', markup);
518
+
519
+ if(markup) {
520
+ mfp.currTemplate[type] = $(markup);
521
+ } else {
522
+ // if there is no markup found we just define that template is parsed
523
+ mfp.currTemplate[type] = true;
524
+ }
525
+ }
526
+
527
+ if(_prevContentType && _prevContentType !== item.type) {
528
+ mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
529
+ }
530
+
531
+ var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
532
+ mfp.appendContent(newContent, type);
533
+
534
+ item.preloaded = true;
535
+
536
+ _mfpTrigger(CHANGE_EVENT, item);
537
+ _prevContentType = item.type;
538
+
539
+ // Append container back after its content changed
540
+ mfp.container.prepend(mfp.contentContainer);
541
+
542
+ _mfpTrigger('AfterChange');
543
+ },
544
+
545
+
546
+ /**
547
+ * Set HTML content of popup
548
+ */
549
+ appendContent: function(newContent, type) {
550
+ mfp.content = newContent;
551
+
552
+ if(newContent) {
553
+ if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
554
+ mfp.currTemplate[type] === true) {
555
+ // if there is no markup, we just append close button element inside
556
+ if(!mfp.content.find('.mfp-close').length) {
557
+ mfp.content.append(_getCloseBtn());
558
+ }
559
+ } else {
560
+ mfp.content = newContent;
561
+ }
562
+ } else {
563
+ mfp.content = '';
564
+ }
565
+
566
+ _mfpTrigger(BEFORE_APPEND_EVENT);
567
+ mfp.container.addClass('mfp-'+type+'-holder');
568
+
569
+ mfp.contentContainer.append(mfp.content);
570
+ },
571
+
572
+
573
+
574
+
575
+ /**
576
+ * Creates Magnific Popup data object based on given data
577
+ * @param {int} index Index of item to parse
578
+ */
579
+ parseEl: function(index) {
580
+ var item = mfp.items[index],
581
+ type;
582
+
583
+ if(item.tagName) {
584
+ item = { el: $(item) };
585
+ } else {
586
+ type = item.type;
587
+ item = { data: item, src: item.src };
588
+ }
589
+
590
+ if(item.el) {
591
+ var types = mfp.types;
592
+
593
+ // check for 'mfp-TYPE' class
594
+ for(var i = 0; i < types.length; i++) {
595
+ if( item.el.hasClass('mfp-'+types[i]) ) {
596
+ type = types[i];
597
+ break;
598
+ }
599
+ }
600
+
601
+ item.src = item.el.attr('data-mfp-src');
602
+ if(!item.src) {
603
+ item.src = item.el.attr('href');
604
+ }
605
+ }
606
+
607
+ item.type = type || mfp.st.type || 'inline';
608
+ item.index = index;
609
+ item.parsed = true;
610
+ mfp.items[index] = item;
611
+ _mfpTrigger('ElementParse', item);
612
+
613
+ return mfp.items[index];
614
+ },
615
+
616
+
617
+ /**
618
+ * Initializes single popup or a group of popups
619
+ */
620
+ addGroup: function(el, options) {
621
+ var eHandler = function(e) {
622
+ e.mfpEl = this;
623
+ mfp._openClick(e, el, options);
624
+ };
625
+
626
+ if(!options) {
627
+ options = {};
628
+ }
629
+
630
+ var eName = 'click.magnificPopup';
631
+ options.mainEl = el;
632
+
633
+ if(options.items) {
634
+ options.isObj = true;
635
+ el.off(eName).on(eName, eHandler);
636
+ } else {
637
+ options.isObj = false;
638
+ if(options.delegate) {
639
+ el.off(eName).on(eName, options.delegate , eHandler);
640
+ } else {
641
+ options.items = el;
642
+ el.off(eName).on(eName, eHandler);
643
+ }
644
+ }
645
+ },
646
+ _openClick: function(e, el, options) {
647
+ var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
648
+
649
+
650
+ if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey ) ) {
651
+ return;
652
+ }
653
+
654
+ var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn;
655
+
656
+ if(disableOn) {
657
+ if($.isFunction(disableOn)) {
658
+ if( !disableOn.call(mfp) ) {
659
+ return true;
660
+ }
661
+ } else { // else it's number
662
+ if( _window.width() < disableOn ) {
663
+ return true;
664
+ }
665
+ }
666
+ }
667
+
668
+ if(e.type) {
669
+ e.preventDefault();
670
+
671
+ // This will prevent popup from closing if element is inside and popup is already opened
672
+ if(mfp.isOpen) {
673
+ e.stopPropagation();
674
+ }
675
+ }
676
+
677
+
678
+ options.el = $(e.mfpEl);
679
+ if(options.delegate) {
680
+ options.items = el.find(options.delegate);
681
+ }
682
+ mfp.open(options);
683
+ },
684
+
685
+
686
+ /**
687
+ * Updates text on preloader
688
+ */
689
+ updateStatus: function(status, text) {
690
+
691
+ if(mfp.preloader) {
692
+ if(_prevStatus !== status) {
693
+ mfp.container.removeClass('mfp-s-'+_prevStatus);
694
+ }
695
+
696
+ if(!text && status === 'loading') {
697
+ text = mfp.st.tLoading;
698
+ }
699
+
700
+ var data = {
701
+ status: status,
702
+ text: text
703
+ };
704
+ // allows to modify status
705
+ _mfpTrigger('UpdateStatus', data);
706
+
707
+ status = data.status;
708
+ text = data.text;
709
+
710
+ mfp.preloader.html(text);
711
+
712
+ mfp.preloader.find('a').on('click', function(e) {
713
+ e.stopImmediatePropagation();
714
+ });
715
+
716
+ mfp.container.addClass('mfp-s-'+status);
717
+ _prevStatus = status;
718
+ }
719
+ },
720
+
721
+
722
+ /*
723
+ "Private" helpers that aren't private at all
724
+ */
725
+ // Check to close popup or not
726
+ // "target" is an element that was clicked
727
+ _checkIfClose: function(target) {
728
+
729
+ if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
730
+ return;
731
+ }
732
+
733
+ var closeOnContent = mfp.st.closeOnContentClick;
734
+ var closeOnBg = mfp.st.closeOnBgClick;
735
+
736
+ if(closeOnContent && closeOnBg) {
737
+ return true;
738
+ } else {
739
+
740
+ // We close the popup if click is on close button or on preloader. Or if there is no content.
741
+ if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
742
+ return true;
743
+ }
744
+
745
+ // if click is outside the content
746
+ if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) {
747
+ if(closeOnBg) {
748
+ // last check, if the clicked element is in DOM, (in case it's removed onclick)
749
+ if( $.contains(document, target) ) {
750
+ return true;
751
+ }
752
+ }
753
+ } else if(closeOnContent) {
754
+ return true;
755
+ }
756
+
757
+ }
758
+ return false;
759
+ },
760
+ _addClassToMFP: function(cName) {
761
+ mfp.bgOverlay.addClass(cName);
762
+ mfp.wrap.addClass(cName);
763
+ },
764
+ _removeClassFromMFP: function(cName) {
765
+ this.bgOverlay.removeClass(cName);
766
+ mfp.wrap.removeClass(cName);
767
+ },
768
+ _hasScrollBar: function(winHeight) {
769
+ return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
770
+ },
771
+ _setFocus: function() {
772
+ (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
773
+ },
774
+ _onFocusIn: function(e) {
775
+ if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
776
+ mfp._setFocus();
777
+ return false;
778
+ }
779
+ },
780
+ _parseMarkup: function(template, values, item) {
781
+ var arr;
782
+ if(item.data) {
783
+ values = $.extend(item.data, values);
784
+ }
785
+ _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] );
786
+
787
+ $.each(values, function(key, value) {
788
+ if(value === undefined || value === false) {
789
+ return true;
790
+ }
791
+ arr = key.split('_');
792
+ if(arr.length > 1) {
793
+ var el = template.find(EVENT_NS + '-'+arr[0]);
794
+
795
+ if(el.length > 0) {
796
+ var attr = arr[1];
797
+ if(attr === 'replaceWith') {
798
+ if(el[0] !== value[0]) {
799
+ el.replaceWith(value);
800
+ }
801
+ } else if(attr === 'img') {
802
+ if(el.is('img')) {
803
+ el.attr('src', value);
804
+ } else {
805
+ el.replaceWith( '<img src="'+value+'" class="' + el.attr('class') + '" />' );
806
+ }
807
+ } else {
808
+ el.attr(arr[1], value);
809
+ }
810
+ }
811
+
812
+ } else {
813
+ template.find(EVENT_NS + '-'+key).html(value);
814
+ }
815
+ });
816
+ },
817
+
818
+ _getScrollbarSize: function() {
819
+ // thx David
820
+ if(mfp.scrollbarSize === undefined) {
821
+ var scrollDiv = document.createElement("div");
822
+ scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
823
+ document.body.appendChild(scrollDiv);
824
+ mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
825
+ document.body.removeChild(scrollDiv);
826
+ }
827
+ return mfp.scrollbarSize;
828
+ }
829
+
830
+ }; /* MagnificPopup core prototype end */
831
+
832
+
833
+
834
+
835
+ /**
836
+ * Public static functions
837
+ */
838
+ $.magnificPopup = {
839
+ instance: null,
840
+ proto: MagnificPopup.prototype,
841
+ modules: [],
842
+
843
+ open: function(options, index) {
844
+ _checkInstance();
845
+
846
+ if(!options) {
847
+ options = {};
848
+ } else {
849
+ options = $.extend(true, {}, options);
850
+ }
851
+
852
+
853
+ options.isObj = true;
854
+ options.index = index || 0;
855
+ return this.instance.open(options);
856
+ },
857
+
858
+ close: function() {
859
+ return $.magnificPopup.instance && $.magnificPopup.instance.close();
860
+ },
861
+
862
+ registerModule: function(name, module) {
863
+ if(module.options) {
864
+ $.magnificPopup.defaults[name] = module.options;
865
+ }
866
+ $.extend(this.proto, module.proto);
867
+ this.modules.push(name);
868
+ },
869
+
870
+ defaults: {
871
+
872
+ // Info about options is in docs:
873
+ // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
874
+
875
+ disableOn: 0,
876
+
877
+ key: null,
878
+
879
+ midClick: false,
880
+
881
+ mainClass: '',
882
+
883
+ preloader: true,
884
+
885
+ focus: '', // CSS selector of input to focus after popup is opened
886
+
887
+ closeOnContentClick: false,
888
+
889
+ closeOnBgClick: true,
890
+
891
+ closeBtnInside: true,
892
+
893
+ showCloseBtn: true,
894
+
895
+ enableEscapeKey: true,
896
+
897
+ modal: false,
898
+
899
+ alignTop: false,
900
+
901
+ removalDelay: 0,
902
+
903
+ prependTo: null,
904
+
905
+ fixedContentPos: 'auto',
906
+
907
+ fixedBgPos: 'auto',
908
+
909
+ overflowY: 'auto',
910
+
911
+ closeMarkup: '<button title="%title%" type="button" class="mfp-close">&times;</button>',
912
+
913
+ tClose: 'Close (Esc)',
914
+
915
+ tLoading: 'Loading...'
916
+
917
+ }
918
+ };
919
+
920
+
921
+
922
+ $.fn.magnificPopup = function(options) {
923
+ _checkInstance();
924
+
925
+ var jqEl = $(this);
926
+
927
+ // We call some API method of first param is a string
928
+ if (typeof options === "string" ) {
929
+
930
+ if(options === 'open') {
931
+ var items,
932
+ itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
933
+ index = parseInt(arguments[1], 10) || 0;
934
+
935
+ if(itemOpts.items) {
936
+ items = itemOpts.items[index];
937
+ } else {
938
+ items = jqEl;
939
+ if(itemOpts.delegate) {
940
+ items = items.find(itemOpts.delegate);
941
+ }
942
+ items = items.eq( index );
943
+ }
944
+ mfp._openClick({mfpEl:items}, jqEl, itemOpts);
945
+ } else {
946
+ if(mfp.isOpen)
947
+ mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
948
+ }
949
+
950
+ } else {
951
+ // clone options obj
952
+ options = $.extend(true, {}, options);
953
+
954
+ /*
955
+ * As Zepto doesn't support .data() method for objects
956
+ * and it works only in normal browsers
957
+ * we assign "options" object directly to the DOM element. FTW!
958
+ */
959
+ if(_isJQ) {
960
+ jqEl.data('magnificPopup', options);
961
+ } else {
962
+ jqEl[0].magnificPopup = options;
963
+ }
964
+
965
+ mfp.addGroup(jqEl, options);
966
+
967
+ }
968
+ return jqEl;
969
+ };
970
+
971
+
972
+ //Quick benchmark
973
+ /*
974
+ var start = performance.now(),
975
+ i,
976
+ rounds = 1000;
977
+
978
+ for(i = 0; i < rounds; i++) {
979
+
980
+ }
981
+ console.log('Test #1:', performance.now() - start);
982
+
983
+ start = performance.now();
984
+ for(i = 0; i < rounds; i++) {
985
+
986
+ }
987
+ console.log('Test #2:', performance.now() - start);
988
+ */
989
+
990
+
991
+ /*>>core*/
992
+
993
+ /*>>inline*/
994
+
995
+ var INLINE_NS = 'inline',
996
+ _hiddenClass,
997
+ _inlinePlaceholder,
998
+ _lastInlineElement,
999
+ _putInlineElementsBack = function() {
1000
+ if(_lastInlineElement) {
1001
+ _inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach();
1002
+ _lastInlineElement = null;
1003
+ }
1004
+ };
1005
+
1006
+ $.magnificPopup.registerModule(INLINE_NS, {
1007
+ options: {
1008
+ hiddenClass: 'hide', // will be appended with `mfp-` prefix
1009
+ markup: '',
1010
+ tNotFound: 'Content not found'
1011
+ },
1012
+ proto: {
1013
+
1014
+ initInline: function() {
1015
+ mfp.types.push(INLINE_NS);
1016
+
1017
+ _mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() {
1018
+ _putInlineElementsBack();
1019
+ });
1020
+ },
1021
+
1022
+ getInline: function(item, template) {
1023
+
1024
+ _putInlineElementsBack();
1025
+
1026
+ if(item.src) {
1027
+ var inlineSt = mfp.st.inline,
1028
+ el = $(item.src);
1029
+
1030
+ if(el.length) {
1031
+
1032
+ // If target element has parent - we replace it with placeholder and put it back after popup is closed
1033
+ var parent = el[0].parentNode;
1034
+ if(parent && parent.tagName) {
1035
+ if(!_inlinePlaceholder) {
1036
+ _hiddenClass = inlineSt.hiddenClass;
1037
+ _inlinePlaceholder = _getEl(_hiddenClass);
1038
+ _hiddenClass = 'mfp-'+_hiddenClass;
1039
+ }
1040
+ // replace target inline element with placeholder
1041
+ _lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass);
1042
+ }
1043
+
1044
+ mfp.updateStatus('ready');
1045
+ } else {
1046
+ mfp.updateStatus('error', inlineSt.tNotFound);
1047
+ el = $('<div>');
1048
+ }
1049
+
1050
+ item.inlineElement = el;
1051
+ return el;
1052
+ }
1053
+
1054
+ mfp.updateStatus('ready');
1055
+ mfp._parseMarkup(template, {}, item);
1056
+ return template;
1057
+ }
1058
+ }
1059
+ });
1060
+
1061
+ /*>>inline*/
1062
+
1063
+ /*>>ajax*/
1064
+ var AJAX_NS = 'ajax',
1065
+ _ajaxCur,
1066
+ _removeAjaxCursor = function() {
1067
+ if(_ajaxCur) {
1068
+ _body.removeClass(_ajaxCur);
1069
+ }
1070
+ },
1071
+ _destroyAjaxRequest = function() {
1072
+ _removeAjaxCursor();
1073
+ if(mfp.req) {
1074
+ mfp.req.abort();
1075
+ }
1076
+ };
1077
+
1078
+ $.magnificPopup.registerModule(AJAX_NS, {
1079
+
1080
+ options: {
1081
+ settings: null,
1082
+ cursor: 'mfp-ajax-cur',
1083
+ tError: '<a href="%url%">The content</a> could not be loaded.'
1084
+ },
1085
+
1086
+ proto: {
1087
+ initAjax: function() {
1088
+ mfp.types.push(AJAX_NS);
1089
+ _ajaxCur = mfp.st.ajax.cursor;
1090
+
1091
+ _mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest);
1092
+ _mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest);
1093
+ },
1094
+ getAjax: function(item) {
1095
+
1096
+ if(_ajaxCur)
1097
+ _body.addClass(_ajaxCur);
1098
+
1099
+ mfp.updateStatus('loading');
1100
+
1101
+ var opts = $.extend({
1102
+ url: item.src,
1103
+ success: function(data, textStatus, jqXHR) {
1104
+ var temp = {
1105
+ data:data,
1106
+ xhr:jqXHR
1107
+ };
1108
+
1109
+ _mfpTrigger('ParseAjax', temp);
1110
+
1111
+ mfp.appendContent( $(temp.data), AJAX_NS );
1112
+
1113
+ item.finished = true;
1114
+
1115
+ _removeAjaxCursor();
1116
+
1117
+ mfp._setFocus();
1118
+
1119
+ setTimeout(function() {
1120
+ mfp.wrap.addClass(READY_CLASS);
1121
+ }, 16);
1122
+
1123
+ mfp.updateStatus('ready');
1124
+
1125
+ _mfpTrigger('AjaxContentAdded');
1126
+ },
1127
+ error: function() {
1128
+ _removeAjaxCursor();
1129
+ item.finished = item.loadError = true;
1130
+ mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
1131
+ }
1132
+ }, mfp.st.ajax.settings);
1133
+
1134
+ mfp.req = $.ajax(opts);
1135
+
1136
+ return '';
1137
+ }
1138
+ }
1139
+ });
1140
+
1141
+
1142
+
1143
+
1144
+
1145
+
1146
+
1147
+ /*>>ajax*/
1148
+
1149
+ /*>>image*/
1150
+ var _imgInterval,
1151
+ _getTitle = function(item) {
1152
+ if(item.data && item.data.title !== undefined)
1153
+ return item.data.title;
1154
+
1155
+ var src = mfp.st.image.titleSrc;
1156
+
1157
+ if(src) {
1158
+ if($.isFunction(src)) {
1159
+ return src.call(mfp, item);
1160
+ } else if(item.el) {
1161
+ return item.el.attr(src) || '';
1162
+ }
1163
+ }
1164
+ return '';
1165
+ };
1166
+
1167
+ $.magnificPopup.registerModule('image', {
1168
+
1169
+ options: {
1170
+ markup: '<div class="mfp-figure">'+
1171
+ '<div class="mfp-close"></div>'+
1172
+ '<figure>'+
1173
+ '<div class="mfp-img"></div>'+
1174
+ '<figcaption>'+
1175
+ '<div class="mfp-bottom-bar">'+
1176
+ '<div class="mfp-title"></div>'+
1177
+ '<div class="mfp-counter"></div>'+
1178
+ '</div>'+
1179
+ '</figcaption>'+
1180
+ '</figure>'+
1181
+ '</div>',
1182
+ cursor: 'mfp-zoom-out-cur',
1183
+ titleSrc: 'title',
1184
+ verticalFit: true,
1185
+ tError: '<a href="%url%">The image</a> could not be loaded.'
1186
+ },
1187
+
1188
+ proto: {
1189
+ initImage: function() {
1190
+ var imgSt = mfp.st.image,
1191
+ ns = '.image';
1192
+
1193
+ mfp.types.push('image');
1194
+
1195
+ _mfpOn(OPEN_EVENT+ns, function() {
1196
+ if(mfp.currItem.type === 'image' && imgSt.cursor) {
1197
+ _body.addClass(imgSt.cursor);
1198
+ }
1199
+ });
1200
+
1201
+ _mfpOn(CLOSE_EVENT+ns, function() {
1202
+ if(imgSt.cursor) {
1203
+ _body.removeClass(imgSt.cursor);
1204
+ }
1205
+ _window.off('resize' + EVENT_NS);
1206
+ });
1207
+
1208
+ _mfpOn('Resize'+ns, mfp.resizeImage);
1209
+ if(mfp.isLowIE) {
1210
+ _mfpOn('AfterChange', mfp.resizeImage);
1211
+ }
1212
+ },
1213
+ resizeImage: function() {
1214
+ var item = mfp.currItem;
1215
+ if(!item || !item.img) return;
1216
+
1217
+ if(mfp.st.image.verticalFit) {
1218
+ var decr = 0;
1219
+ // fix box-sizing in ie7/8
1220
+ if(mfp.isLowIE) {
1221
+ decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10);
1222
+ }
1223
+ item.img.css('max-height', mfp.wH-decr);
1224
+ }
1225
+ },
1226
+ _onImageHasSize: function(item) {
1227
+ if(item.img) {
1228
+
1229
+ item.hasSize = true;
1230
+
1231
+ if(_imgInterval) {
1232
+ clearInterval(_imgInterval);
1233
+ }
1234
+
1235
+ item.isCheckingImgSize = false;
1236
+
1237
+ _mfpTrigger('ImageHasSize', item);
1238
+
1239
+ if(item.imgHidden) {
1240
+ if(mfp.content)
1241
+ mfp.content.removeClass('mfp-loading');
1242
+
1243
+ item.imgHidden = false;
1244
+ }
1245
+
1246
+ }
1247
+ },
1248
+
1249
+ /**
1250
+ * Function that loops until the image has size to display elements that rely on it asap
1251
+ */
1252
+ findImageSize: function(item) {
1253
+
1254
+ var counter = 0,
1255
+ img = item.img[0],
1256
+ mfpSetInterval = function(delay) {
1257
+
1258
+ if(_imgInterval) {
1259
+ clearInterval(_imgInterval);
1260
+ }
1261
+ // decelerating interval that checks for size of an image
1262
+ _imgInterval = setInterval(function() {
1263
+ if(img.naturalWidth > 0) {
1264
+ mfp._onImageHasSize(item);
1265
+ return;
1266
+ }
1267
+
1268
+ if(counter > 200) {
1269
+ clearInterval(_imgInterval);
1270
+ }
1271
+
1272
+ counter++;
1273
+ if(counter === 3) {
1274
+ mfpSetInterval(10);
1275
+ } else if(counter === 40) {
1276
+ mfpSetInterval(50);
1277
+ } else if(counter === 100) {
1278
+ mfpSetInterval(500);
1279
+ }
1280
+ }, delay);
1281
+ };
1282
+
1283
+ mfpSetInterval(1);
1284
+ },
1285
+
1286
+ getImage: function(item, template) {
1287
+
1288
+ var guard = 0,
1289
+
1290
+ // image load complete handler
1291
+ onLoadComplete = function() {
1292
+ if(item) {
1293
+ if (item.img[0].complete) {
1294
+ item.img.off('.mfploader');
1295
+
1296
+ if(item === mfp.currItem){
1297
+ mfp._onImageHasSize(item);
1298
+
1299
+ mfp.updateStatus('ready');
1300
+ }
1301
+
1302
+ item.hasSize = true;
1303
+ item.loaded = true;
1304
+
1305
+ _mfpTrigger('ImageLoadComplete');
1306
+
1307
+ }
1308
+ else {
1309
+ // if image complete check fails 200 times (20 sec), we assume that there was an error.
1310
+ guard++;
1311
+ if(guard < 200) {
1312
+ setTimeout(onLoadComplete,100);
1313
+ } else {
1314
+ onLoadError();
1315
+ }
1316
+ }
1317
+ }
1318
+ },
1319
+
1320
+ // image error handler
1321
+ onLoadError = function() {
1322
+ if(item) {
1323
+ item.img.off('.mfploader');
1324
+ if(item === mfp.currItem){
1325
+ mfp._onImageHasSize(item);
1326
+ mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
1327
+ }
1328
+
1329
+ item.hasSize = true;
1330
+ item.loaded = true;
1331
+ item.loadError = true;
1332
+ }
1333
+ },
1334
+ imgSt = mfp.st.image;
1335
+
1336
+
1337
+ var el = template.find('.mfp-img');
1338
+ if(el.length) {
1339
+ var img = document.createElement('img');
1340
+ img.className = 'mfp-img';
1341
+ if(item.el && item.el.find('img').length) {
1342
+ img.alt = item.el.find('img').attr('alt');
1343
+ }
1344
+ item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError);
1345
+ img.src = item.src;
1346
+
1347
+ // without clone() "error" event is not firing when IMG is replaced by new IMG
1348
+ // TODO: find a way to avoid such cloning
1349
+ if(el.is('img')) {
1350
+ item.img = item.img.clone();
1351
+ }
1352
+
1353
+ img = item.img[0];
1354
+ if(img.naturalWidth > 0) {
1355
+ item.hasSize = true;
1356
+ } else if(!img.width) {
1357
+ item.hasSize = false;
1358
+ }
1359
+ }
1360
+
1361
+ mfp._parseMarkup(template, {
1362
+ title: _getTitle(item),
1363
+ img_replaceWith: item.img
1364
+ }, item);
1365
+
1366
+ mfp.resizeImage();
1367
+
1368
+ if(item.hasSize) {
1369
+ if(_imgInterval) clearInterval(_imgInterval);
1370
+
1371
+ if(item.loadError) {
1372
+ template.addClass('mfp-loading');
1373
+ mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
1374
+ } else {
1375
+ template.removeClass('mfp-loading');
1376
+ mfp.updateStatus('ready');
1377
+ }
1378
+ return template;
1379
+ }
1380
+
1381
+ mfp.updateStatus('loading');
1382
+ item.loading = true;
1383
+
1384
+ if(!item.hasSize) {
1385
+ item.imgHidden = true;
1386
+ template.addClass('mfp-loading');
1387
+ mfp.findImageSize(item);
1388
+ }
1389
+
1390
+ return template;
1391
+ }
1392
+ }
1393
+ });
1394
+
1395
+
1396
+
1397
+ /*>>image*/
1398
+
1399
+ /*>>zoom*/
1400
+ var hasMozTransform,
1401
+ getHasMozTransform = function() {
1402
+ if(hasMozTransform === undefined) {
1403
+ hasMozTransform = document.createElement('p').style.MozTransform !== undefined;
1404
+ }
1405
+ return hasMozTransform;
1406
+ };
1407
+
1408
+ $.magnificPopup.registerModule('zoom', {
1409
+
1410
+ options: {
1411
+ enabled: false,
1412
+ easing: 'ease-in-out',
1413
+ duration: 300,
1414
+ opener: function(element) {
1415
+ return element.is('img') ? element : element.find('img');
1416
+ }
1417
+ },
1418
+
1419
+ proto: {
1420
+
1421
+ initZoom: function() {
1422
+ var zoomSt = mfp.st.zoom,
1423
+ ns = '.zoom',
1424
+ image;
1425
+
1426
+ if(!zoomSt.enabled || !mfp.supportsTransition) {
1427
+ return;
1428
+ }
1429
+
1430
+ var duration = zoomSt.duration,
1431
+ getElToAnimate = function(image) {
1432
+ var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),
1433
+ transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing,
1434
+ cssObj = {
1435
+ position: 'fixed',
1436
+ zIndex: 9999,
1437
+ left: 0,
1438
+ top: 0,
1439
+ '-webkit-backface-visibility': 'hidden'
1440
+ },
1441
+ t = 'transition';
1442
+
1443
+ cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition;
1444
+
1445
+ newImg.css(cssObj);
1446
+ return newImg;
1447
+ },
1448
+ showMainContent = function() {
1449
+ mfp.content.css('visibility', 'visible');
1450
+ },
1451
+ openTimeout,
1452
+ animatedImg;
1453
+
1454
+ _mfpOn('BuildControls'+ns, function() {
1455
+ if(mfp._allowZoom()) {
1456
+
1457
+ clearTimeout(openTimeout);
1458
+ mfp.content.css('visibility', 'hidden');
1459
+
1460
+ // Basically, all code below does is clones existing image, puts in on top of the current one and animated it
1461
+
1462
+ image = mfp._getItemToZoom();
1463
+
1464
+ if(!image) {
1465
+ showMainContent();
1466
+ return;
1467
+ }
1468
+
1469
+ animatedImg = getElToAnimate(image);
1470
+
1471
+ animatedImg.css( mfp._getOffset() );
1472
+
1473
+ mfp.wrap.append(animatedImg);
1474
+
1475
+ openTimeout = setTimeout(function() {
1476
+ animatedImg.css( mfp._getOffset( true ) );
1477
+ openTimeout = setTimeout(function() {
1478
+
1479
+ showMainContent();
1480
+
1481
+ setTimeout(function() {
1482
+ animatedImg.remove();
1483
+ image = animatedImg = null;
1484
+ _mfpTrigger('ZoomAnimationEnded');
1485
+ }, 16); // avoid blink when switching images
1486
+
1487
+ }, duration); // this timeout equals animation duration
1488
+
1489
+ }, 16); // by adding this timeout we avoid short glitch at the beginning of animation
1490
+
1491
+
1492
+ // Lots of timeouts...
1493
+ }
1494
+ });
1495
+ _mfpOn(BEFORE_CLOSE_EVENT+ns, function() {
1496
+ if(mfp._allowZoom()) {
1497
+
1498
+ clearTimeout(openTimeout);
1499
+
1500
+ mfp.st.removalDelay = duration;
1501
+
1502
+ if(!image) {
1503
+ image = mfp._getItemToZoom();
1504
+ if(!image) {
1505
+ return;
1506
+ }
1507
+ animatedImg = getElToAnimate(image);
1508
+ }
1509
+
1510
+
1511
+ animatedImg.css( mfp._getOffset(true) );
1512
+ mfp.wrap.append(animatedImg);
1513
+ mfp.content.css('visibility', 'hidden');
1514
+
1515
+ setTimeout(function() {
1516
+ animatedImg.css( mfp._getOffset() );
1517
+ }, 16);
1518
+ }
1519
+
1520
+ });
1521
+
1522
+ _mfpOn(CLOSE_EVENT+ns, function() {
1523
+ if(mfp._allowZoom()) {
1524
+ showMainContent();
1525
+ if(animatedImg) {
1526
+ animatedImg.remove();
1527
+ }
1528
+ image = null;
1529
+ }
1530
+ });
1531
+ },
1532
+
1533
+ _allowZoom: function() {
1534
+ return mfp.currItem.type === 'image';
1535
+ },
1536
+
1537
+ _getItemToZoom: function() {
1538
+ if(mfp.currItem.hasSize) {
1539
+ return mfp.currItem.img;
1540
+ } else {
1541
+ return false;
1542
+ }
1543
+ },
1544
+
1545
+ // Get element postion relative to viewport
1546
+ _getOffset: function(isLarge) {
1547
+ var el;
1548
+ if(isLarge) {
1549
+ el = mfp.currItem.img;
1550
+ } else {
1551
+ el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
1552
+ }
1553
+
1554
+ var offset = el.offset();
1555
+ var paddingTop = parseInt(el.css('padding-top'),10);
1556
+ var paddingBottom = parseInt(el.css('padding-bottom'),10);
1557
+ offset.top -= ( $(window).scrollTop() - paddingTop );
1558
+
1559
+
1560
+ /*
1561
+
1562
+ Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa.
1563
+
1564
+ */
1565
+ var obj = {
1566
+ width: el.width(),
1567
+ // fix Zepto height+padding issue
1568
+ height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop
1569
+ };
1570
+
1571
+ // I hate to do this, but there is no another option
1572
+ if( getHasMozTransform() ) {
1573
+ obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)';
1574
+ } else {
1575
+ obj.left = offset.left;
1576
+ obj.top = offset.top;
1577
+ }
1578
+ return obj;
1579
+ }
1580
+
1581
+ }
1582
+ });
1583
+
1584
+
1585
+
1586
+ /*>>zoom*/
1587
+
1588
+ /*>>iframe*/
1589
+
1590
+ var IFRAME_NS = 'iframe',
1591
+ _emptyPage = '//about:blank',
1592
+
1593
+ _fixIframeBugs = function(isShowing) {
1594
+ if(mfp.currTemplate[IFRAME_NS]) {
1595
+ var el = mfp.currTemplate[IFRAME_NS].find('iframe');
1596
+ if(el.length) {
1597
+ // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
1598
+ if(!isShowing) {
1599
+ el[0].src = _emptyPage;
1600
+ }
1601
+
1602
+ // IE8 black screen bug fix
1603
+ if(mfp.isIE8) {
1604
+ el.css('display', isShowing ? 'block' : 'none');
1605
+ }
1606
+ }
1607
+ }
1608
+ };
1609
+
1610
+ $.magnificPopup.registerModule(IFRAME_NS, {
1611
+
1612
+ options: {
1613
+ markup: '<div class="mfp-iframe-scaler">'+
1614
+ '<div class="mfp-close"></div>'+
1615
+ '<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+
1616
+ '</div>',
1617
+
1618
+ srcAction: 'iframe_src',
1619
+
1620
+ // we don't care and support only one default type of URL by default
1621
+ patterns: {
1622
+ youtube: {
1623
+ index: 'youtube.com',
1624
+ id: 'v=',
1625
+ src: '//www.youtube.com/embed/%id%?autoplay=1'
1626
+ },
1627
+ vimeo: {
1628
+ index: 'vimeo.com/',
1629
+ id: '/',
1630
+ src: '//player.vimeo.com/video/%id%?autoplay=1'
1631
+ },
1632
+ gmaps: {
1633
+ index: '//maps.google.',
1634
+ src: '%id%&output=embed'
1635
+ }
1636
+ }
1637
+ },
1638
+
1639
+ proto: {
1640
+ initIframe: function() {
1641
+ mfp.types.push(IFRAME_NS);
1642
+
1643
+ _mfpOn('BeforeChange', function(e, prevType, newType) {
1644
+ if(prevType !== newType) {
1645
+ if(prevType === IFRAME_NS) {
1646
+ _fixIframeBugs(); // iframe if removed
1647
+ } else if(newType === IFRAME_NS) {
1648
+ _fixIframeBugs(true); // iframe is showing
1649
+ }
1650
+ }// else {
1651
+ // iframe source is switched, don't do anything
1652
+ //}
1653
+ });
1654
+
1655
+ _mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() {
1656
+ _fixIframeBugs();
1657
+ });
1658
+ },
1659
+
1660
+ getIframe: function(item, template) {
1661
+ var embedSrc = item.src;
1662
+ var iframeSt = mfp.st.iframe;
1663
+
1664
+ $.each(iframeSt.patterns, function() {
1665
+ if(embedSrc.indexOf( this.index ) > -1) {
1666
+ if(this.id) {
1667
+ if(typeof this.id === 'string') {
1668
+ embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
1669
+ } else {
1670
+ embedSrc = this.id.call( this, embedSrc );
1671
+ }
1672
+ }
1673
+ embedSrc = this.src.replace('%id%', embedSrc );
1674
+ return false; // break;
1675
+ }
1676
+ });
1677
+
1678
+ var dataObj = {};
1679
+ if(iframeSt.srcAction) {
1680
+ dataObj[iframeSt.srcAction] = embedSrc;
1681
+ }
1682
+ mfp._parseMarkup(template, dataObj, item);
1683
+
1684
+ mfp.updateStatus('ready');
1685
+
1686
+ return template;
1687
+ }
1688
+ }
1689
+ });
1690
+
1691
+
1692
+
1693
+ /*>>iframe*/
1694
+
1695
+ /*>>gallery*/
1696
+ /**
1697
+ * Get looped index depending on number of slides
1698
+ */
1699
+ var _getLoopedId = function(index) {
1700
+ var numSlides = mfp.items.length;
1701
+ if(index > numSlides - 1) {
1702
+ return index - numSlides;
1703
+ } else if(index < 0) {
1704
+ return numSlides + index;
1705
+ }
1706
+ return index;
1707
+ },
1708
+ _replaceCurrTotal = function(text, curr, total) {
1709
+ return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total);
1710
+ };
1711
+
1712
+ $.magnificPopup.registerModule('gallery', {
1713
+
1714
+ options: {
1715
+ enabled: false,
1716
+ arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
1717
+ preload: [0,2],
1718
+ navigateByImgClick: true,
1719
+ arrows: true,
1720
+
1721
+ tPrev: 'Previous (Left arrow key)',
1722
+ tNext: 'Next (Right arrow key)',
1723
+ tCounter: '%curr% of %total%'
1724
+ },
1725
+
1726
+ proto: {
1727
+ initGallery: function() {
1728
+
1729
+ var gSt = mfp.st.gallery,
1730
+ ns = '.mfp-gallery',
1731
+ supportsFastClick = Boolean($.fn.mfpFastClick);
1732
+
1733
+ mfp.direction = true; // true - next, false - prev
1734
+
1735
+ if(!gSt || !gSt.enabled ) return false;
1736
+
1737
+ _wrapClasses += ' mfp-gallery';
1738
+
1739
+ _mfpOn(OPEN_EVENT+ns, function() {
1740
+
1741
+ if(gSt.navigateByImgClick) {
1742
+ mfp.wrap.on('click'+ns, '.mfp-img', function() {
1743
+ if(mfp.items.length > 1) {
1744
+ mfp.next();
1745
+ return false;
1746
+ }
1747
+ });
1748
+ }
1749
+
1750
+ _document.on('keydown'+ns, function(e) {
1751
+ if (e.keyCode === 37) {
1752
+ mfp.prev();
1753
+ } else if (e.keyCode === 39) {
1754
+ mfp.next();
1755
+ }
1756
+ });
1757
+ });
1758
+
1759
+ _mfpOn('UpdateStatus'+ns, function(e, data) {
1760
+ if(data.text) {
1761
+ data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
1762
+ }
1763
+ });
1764
+
1765
+ _mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
1766
+ var l = mfp.items.length;
1767
+ values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
1768
+ });
1769
+
1770
+ _mfpOn('BuildControls' + ns, function() {
1771
+ if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
1772
+ var markup = gSt.arrowMarkup,
1773
+ arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
1774
+ arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
1775
+
1776
+ var eName = supportsFastClick ? 'mfpFastClick' : 'click';
1777
+ arrowLeft[eName](function() {
1778
+ mfp.prev();
1779
+ });
1780
+ arrowRight[eName](function() {
1781
+ mfp.next();
1782
+ });
1783
+
1784
+ // Polyfill for :before and :after (adds elements with classes mfp-a and mfp-b)
1785
+ if(mfp.isIE7) {
1786
+ _getEl('b', arrowLeft[0], false, true);
1787
+ _getEl('a', arrowLeft[0], false, true);
1788
+ _getEl('b', arrowRight[0], false, true);
1789
+ _getEl('a', arrowRight[0], false, true);
1790
+ }
1791
+
1792
+ mfp.container.append(arrowLeft.add(arrowRight));
1793
+ }
1794
+ });
1795
+
1796
+ _mfpOn(CHANGE_EVENT+ns, function() {
1797
+ if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
1798
+
1799
+ mfp._preloadTimeout = setTimeout(function() {
1800
+ mfp.preloadNearbyImages();
1801
+ mfp._preloadTimeout = null;
1802
+ }, 16);
1803
+ });
1804
+
1805
+
1806
+ _mfpOn(CLOSE_EVENT+ns, function() {
1807
+ _document.off(ns);
1808
+ mfp.wrap.off('click'+ns);
1809
+
1810
+ if(mfp.arrowLeft && supportsFastClick) {
1811
+ mfp.arrowLeft.add(mfp.arrowRight).destroyMfpFastClick();
1812
+ }
1813
+ mfp.arrowRight = mfp.arrowLeft = null;
1814
+ });
1815
+
1816
+ },
1817
+ next: function() {
1818
+ mfp.direction = true;
1819
+ mfp.index = _getLoopedId(mfp.index + 1);
1820
+ mfp.updateItemHTML();
1821
+ },
1822
+ prev: function() {
1823
+ mfp.direction = false;
1824
+ mfp.index = _getLoopedId(mfp.index - 1);
1825
+ mfp.updateItemHTML();
1826
+ },
1827
+ goTo: function(newIndex) {
1828
+ mfp.direction = (newIndex >= mfp.index);
1829
+ mfp.index = newIndex;
1830
+ mfp.updateItemHTML();
1831
+ },
1832
+ preloadNearbyImages: function() {
1833
+ var p = mfp.st.gallery.preload,
1834
+ preloadBefore = Math.min(p[0], mfp.items.length),
1835
+ preloadAfter = Math.min(p[1], mfp.items.length),
1836
+ i;
1837
+
1838
+ for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
1839
+ mfp._preloadItem(mfp.index+i);
1840
+ }
1841
+ for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
1842
+ mfp._preloadItem(mfp.index-i);
1843
+ }
1844
+ },
1845
+ _preloadItem: function(index) {
1846
+ index = _getLoopedId(index);
1847
+
1848
+ if(mfp.items[index].preloaded) {
1849
+ return;
1850
+ }
1851
+
1852
+ var item = mfp.items[index];
1853
+ if(!item.parsed) {
1854
+ item = mfp.parseEl( index );
1855
+ }
1856
+
1857
+ _mfpTrigger('LazyLoad', item);
1858
+
1859
+ if(item.type === 'image') {
1860
+ item.img = $('<img class="mfp-img" />').on('load.mfploader', function() {
1861
+ item.hasSize = true;
1862
+ }).on('error.mfploader', function() {
1863
+ item.hasSize = true;
1864
+ item.loadError = true;
1865
+ _mfpTrigger('LazyLoadError', item);
1866
+ }).attr('src', item.src);
1867
+ }
1868
+
1869
+
1870
+ item.preloaded = true;
1871
+ }
1872
+ }
1873
+ });
1874
+
1875
+ /*
1876
+ Touch Support that might be implemented some day
1877
+
1878
+ addSwipeGesture: function() {
1879
+ var startX,
1880
+ moved,
1881
+ multipleTouches;
1882
+
1883
+ return;
1884
+
1885
+ var namespace = '.mfp',
1886
+ addEventNames = function(pref, down, move, up, cancel) {
1887
+ mfp._tStart = pref + down + namespace;
1888
+ mfp._tMove = pref + move + namespace;
1889
+ mfp._tEnd = pref + up + namespace;
1890
+ mfp._tCancel = pref + cancel + namespace;
1891
+ };
1892
+
1893
+ if(window.navigator.msPointerEnabled) {
1894
+ addEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel');
1895
+ } else if('ontouchstart' in window) {
1896
+ addEventNames('touch', 'start', 'move', 'end', 'cancel');
1897
+ } else {
1898
+ return;
1899
+ }
1900
+ _window.on(mfp._tStart, function(e) {
1901
+ var oE = e.originalEvent;
1902
+ multipleTouches = moved = false;
1903
+ startX = oE.pageX || oE.changedTouches[0].pageX;
1904
+ }).on(mfp._tMove, function(e) {
1905
+ if(e.originalEvent.touches.length > 1) {
1906
+ multipleTouches = e.originalEvent.touches.length;
1907
+ } else {
1908
+ //e.preventDefault();
1909
+ moved = true;
1910
+ }
1911
+ }).on(mfp._tEnd + ' ' + mfp._tCancel, function(e) {
1912
+ if(moved && !multipleTouches) {
1913
+ var oE = e.originalEvent,
1914
+ diff = startX - (oE.pageX || oE.changedTouches[0].pageX);
1915
+
1916
+ if(diff > 20) {
1917
+ mfp.next();
1918
+ } else if(diff < -20) {
1919
+ mfp.prev();
1920
+ }
1921
+ }
1922
+ });
1923
+ },
1924
+ */
1925
+
1926
+
1927
+ /*>>gallery*/
1928
+
1929
+ /*>>retina*/
1930
+
1931
+ var RETINA_NS = 'retina';
1932
+
1933
+ $.magnificPopup.registerModule(RETINA_NS, {
1934
+ options: {
1935
+ replaceSrc: function(item) {
1936
+ return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
1937
+ },
1938
+ ratio: 1 // Function or number. Set to 1 to disable.
1939
+ },
1940
+ proto: {
1941
+ initRetina: function() {
1942
+ if(window.devicePixelRatio > 1) {
1943
+
1944
+ var st = mfp.st.retina,
1945
+ ratio = st.ratio;
1946
+
1947
+ ratio = !isNaN(ratio) ? ratio : ratio();
1948
+
1949
+ if(ratio > 1) {
1950
+ _mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
1951
+ item.img.css({
1952
+ 'max-width': item.img[0].naturalWidth / ratio,
1953
+ 'width': '100%'
1954
+ });
1955
+ });
1956
+ _mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
1957
+ item.src = st.replaceSrc(item, ratio);
1958
+ });
1959
+ }
1960
+ }
1961
+
1962
+ }
1963
+ }
1964
+ });
1965
+
1966
+ /*>>retina*/
1967
+
1968
+ /*>>fastclick*/
1969
+ /**
1970
+ * FastClick event implementation. (removes 300ms delay on touch devices)
1971
+ * Based on https://developers.google.com/mobile/articles/fast_buttons
1972
+ *
1973
+ * You may use it outside the Magnific Popup by calling just:
1974
+ *
1975
+ * $('.your-el').mfpFastClick(function() {
1976
+ * console.log('Clicked!');
1977
+ * });
1978
+ *
1979
+ * To unbind:
1980
+ * $('.your-el').destroyMfpFastClick();
1981
+ *
1982
+ *
1983
+ * Note that it's a very basic and simple implementation, it blocks ghost click on the same element where it was bound.
1984
+ * If you need something more advanced, use plugin by FT Labs https://github.com/ftlabs/fastclick
1985
+ *
1986
+ */
1987
+
1988
+ (function() {
1989
+ var ghostClickDelay = 1000,
1990
+ supportsTouch = 'ontouchstart' in window,
1991
+ unbindTouchMove = function() {
1992
+ _window.off('touchmove'+ns+' touchend'+ns);
1993
+ },
1994
+ eName = 'mfpFastClick',
1995
+ ns = '.'+eName;
1996
+
1997
+
1998
+ // As Zepto.js doesn't have an easy way to add custom events (like jQuery), so we implement it in this way
1999
+ $.fn.mfpFastClick = function(callback) {
2000
+
2001
+ return $(this).each(function() {
2002
+
2003
+ var elem = $(this),
2004
+ lock;
2005
+
2006
+ if( supportsTouch ) {
2007
+
2008
+ var timeout,
2009
+ startX,
2010
+ startY,
2011
+ pointerMoved,
2012
+ point,
2013
+ numPointers;
2014
+
2015
+ elem.on('touchstart' + ns, function(e) {
2016
+ pointerMoved = false;
2017
+ numPointers = 1;
2018
+
2019
+ point = e.originalEvent ? e.originalEvent.touches[0] : e.touches[0];
2020
+ startX = point.clientX;
2021
+ startY = point.clientY;
2022
+
2023
+ _window.on('touchmove'+ns, function(e) {
2024
+ point = e.originalEvent ? e.originalEvent.touches : e.touches;
2025
+ numPointers = point.length;
2026
+ point = point[0];
2027
+ if (Math.abs(point.clientX - startX) > 10 ||
2028
+ Math.abs(point.clientY - startY) > 10) {
2029
+ pointerMoved = true;
2030
+ unbindTouchMove();
2031
+ }
2032
+ }).on('touchend'+ns, function(e) {
2033
+ unbindTouchMove();
2034
+ if(pointerMoved || numPointers > 1) {
2035
+ return;
2036
+ }
2037
+ lock = true;
2038
+ e.preventDefault();
2039
+ clearTimeout(timeout);
2040
+ timeout = setTimeout(function() {
2041
+ lock = false;
2042
+ }, ghostClickDelay);
2043
+ callback();
2044
+ });
2045
+ });
2046
+
2047
+ }
2048
+
2049
+ elem.on('click' + ns, function() {
2050
+ if(!lock) {
2051
+ callback();
2052
+ }
2053
+ });
2054
+ });
2055
+ };
2056
+
2057
+ $.fn.destroyMfpFastClick = function() {
2058
+ $(this).off('touchstart' + ns + ' click' + ns);
2059
+ if(supportsTouch) _window.off('touchmove'+ns+' touchend'+ns);
2060
+ };
2061
+ })();
2062
+
2063
+ /*>>fastclick*/
2064
+ _checkInstance(); }));
public/assets/popup/jquery.magnific-popup.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*! Magnific Popup - v1.0.0 - 2014-12-30
2
+ * http://dimsemenov.com/plugins/magnific-popup/
3
+ * Copyright (c) 2014 Dmitry Semenov; */
4
+ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h,i="Close",j="BeforeClose",k="AfterClose",l="BeforeAppend",m="MarkupParse",n="Open",o="Change",p="mfp",q="."+p,r="mfp-ready",s="mfp-removing",t="mfp-prevent-close",u=function(){},v=!!window.jQuery,w=a(window),x=function(a,c){b.ev.on(p+a+q,c)},y=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},z=function(c,d){b.ev.triggerHandler(p+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},A=function(c){return c===h&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),h=c),b.currTemplate.closeBtn},B=function(){a.magnificPopup.instance||(b=new u,b.init(),a.magnificPopup.instance=b)},C=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};u.prototype={constructor:u,init:function(){var c=navigator.appVersion;b.isIE7=-1!==c.indexOf("MSIE 7."),b.isIE8=-1!==c.indexOf("MSIE 8."),b.isLowIE=b.isIE7||b.isIE8,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=C(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),e=a(document),b.popupsCache={}},open:function(c){d||(d=a(document.body));var f;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var h,i=c.items;for(f=0;f<i.length;f++)if(h=i[f],h.parsed&&(h=h.el[0]),h===c.el[0]){b.index=f;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],g="",b.ev=c.mainEl&&c.mainEl.length?c.mainEl.eq(0):e,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=y("bg").on("click"+q,function(){b.close()}),b.wrap=y("wrap").attr("tabindex",-1).on("click"+q,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=y("container",b.wrap)),b.contentContainer=y("content"),b.st.preloader&&(b.preloader=y("preloader",b.container,b.st.tLoading));var j=a.magnificPopup.modules;for(f=0;f<j.length;f++){var k=j[f];k=k.charAt(0).toUpperCase()+k.slice(1),b["init"+k].call(b)}z("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(x(m,function(a,b,c,d){c.close_replaceWith=A(d.type)}),g+=" mfp-close-btn-in"):b.wrap.append(A())),b.st.alignTop&&(g+=" mfp-align-top"),b.wrap.css(b.fixedContentPos?{overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.st.overflowY}:{top:w.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:e.height(),position:"absolute"}),b.st.enableEscapeKey&&e.on("keyup"+q,function(a){27===a.keyCode&&b.close()}),w.on("resize"+q,function(){b.updateSize()}),b.st.closeOnContentClick||(g+=" mfp-auto-cursor"),g&&b.wrap.addClass(g);var l=b.wH=w.height(),o={};if(b.fixedContentPos&&b._hasScrollBar(l)){var p=b._getScrollbarSize();p&&(o.marginRight=p)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):o.overflow="hidden");var s=b.st.mainClass;return b.isIE7&&(s+=" mfp-ie7"),s&&b._addClassToMFP(s),b.updateItemHTML(),z("BuildControls"),a("html").css(o),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||d),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(r),b._setFocus()):b.bgOverlay.addClass(r),e.on("focusin"+q,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(l),z(n),c},close:function(){b.isOpen&&(z(j),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(s),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){z(i);var c=s+" "+r+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var d={marginRight:""};b.isIE7?a("body, html").css("overflow",""):d.overflow="",a("html").css(d)}e.off("keyup"+q+" focusin"+q),b.ev.off(q),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,z(k)},updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||w.height();b.fixedContentPos||b.wrap.css("height",b.wH),z("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(z("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var e=b.st[d]?b.st[d].markup:!1;z("FirstMarkupParse",e),b.currTemplate[d]=e?a(e):!0}f&&f!==c.type&&b.container.removeClass("mfp-"+f+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,z(o,c),f=c.type,b.container.prepend(b.contentContainer),z("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(A()):b.content=a:b.content="",z(l),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,z("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||2!==c.which&&!c.ctrlKey&&!c.metaKey){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(w.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};z("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(t)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?e.height():document.body.scrollHeight)>(a||w.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),z(m,[b,c,d]),a.each(c,function(a,c){if(void 0===c||c===!1)return!0;if(e=a.split("_"),e.length>1){var d=b.find(q+"-"+e[0]);if(d.length>0){var f=e[1];"replaceWith"===f?d[0]!==c[0]&&d.replaceWith(c):"img"===f?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(e[1],c)}}else b.find(q+"-"+a).html(c)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:u.prototype,modules:[],open:function(b,c){return B(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(c){B();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=v?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),v?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var D,E,F,G="inline",H=function(){F&&(E.after(F.addClass(D)).detach(),F=null)};a.magnificPopup.registerModule(G,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(G),x(i+"."+G,function(){H()})},getInline:function(c,d){if(H(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(E||(D=e.hiddenClass,E=y(D),D="mfp-"+D),F=f.after(E).detach().removeClass(D)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var I,J="ajax",K=function(){I&&d.removeClass(I)},L=function(){K(),b.req&&b.req.abort()};a.magnificPopup.registerModule(J,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(J),I=b.st.ajax.cursor,x(i+"."+J,L),x("BeforeChange."+J,L)},getAjax:function(c){I&&d.addClass(I),b.updateStatus("loading");var e=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};z("ParseAjax",g),b.appendContent(a(g.data),J),c.finished=!0,K(),b._setFocus(),setTimeout(function(){b.wrap.addClass(r)},16),b.updateStatus("ready"),z("AjaxContentAdded")},error:function(){K(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(e),""}}});var M,N=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var a=b.st.image,c=".image";b.types.push("image"),x(n+c,function(){"image"===b.currItem.type&&a.cursor&&d.addClass(a.cursor)}),x(i+c,function(){a.cursor&&d.removeClass(a.cursor),w.off("resize"+q)}),x("Resize"+c,b.resizeImage),b.isLowIE&&x("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,M&&clearInterval(M),a.isCheckingImgSize=!1,z("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){M&&clearInterval(M),M=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(M),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,z("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:N(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(M&&clearInterval(M),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var O,P=function(){return void 0===O&&(O=void 0!==document.createElement("p").style.MozTransform),O};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,h=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};x("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=h(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,z("ZoomAnimationEnded")},16)},g)},16)}}),x(j+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=h(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),x(i+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(v?d.innerHeight():d[0].offsetHeight)-g-f};return P()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var Q="iframe",R="//about:blank",S=function(a){if(b.currTemplate[Q]){var c=b.currTemplate[Q].find("iframe");c.length&&(a||(c[0].src=R),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(Q,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(Q),x("BeforeChange",function(a,b,c){b!==c&&(b===Q?S():c===Q&&S(!0))}),x(i+"."+Q,function(){S()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var T=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},U=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,d=".mfp-gallery",f=Boolean(a.fn.mfpFastClick);return b.direction=!0,c&&c.enabled?(g+=" mfp-gallery",x(n+d,function(){c.navigateByImgClick&&b.wrap.on("click"+d,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),e.on("keydown"+d,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),x("UpdateStatus"+d,function(a,c){c.text&&(c.text=U(c.text,b.currItem.index,b.items.length))}),x(m+d,function(a,d,e,f){var g=b.items.length;e.counter=g>1?U(c.tCounter,f.index,g):""}),x("BuildControls"+d,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(t),g=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(t),h=f?"mfpFastClick":"click";e[h](function(){b.prev()}),g[h](function(){b.next()}),b.isIE7&&(y("b",e[0],!1,!0),y("a",e[0],!1,!0),y("b",g[0],!1,!0),y("a",g[0],!1,!0)),b.container.append(e.add(g))}}),x(o+d,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void x(i+d,function(){e.off(d),b.wrap.off("click"+d),b.arrowLeft&&f&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=T(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=T(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=T(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),z("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,z("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var V="retina";a.magnificPopup.registerModule(V,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(x("ImageHasSize."+V,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),x("ElementParse."+V,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){w.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,w.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&w.off("touchmove"+f+" touchend"+f)}}(),B()});
public/assets/popup/magnific-popup.css ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Magnific Popup CSS */
2
+ .mfp-bg {
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ z-index: 1042;
8
+ overflow: hidden;
9
+ position: fixed;
10
+ background: #0b0b0b;
11
+ opacity: 0.8;
12
+ filter: alpha(opacity=80); }
13
+
14
+ .mfp-wrap {
15
+ top: 0;
16
+ left: 0;
17
+ width: 100%;
18
+ height: 100%;
19
+ z-index: 1043;
20
+ position: fixed;
21
+ outline: none !important;
22
+ -webkit-backface-visibility: hidden; }
23
+
24
+ .mfp-container {
25
+ text-align: center;
26
+ position: absolute;
27
+ width: 100%;
28
+ height: 100%;
29
+ left: 0;
30
+ top: 0;
31
+ padding: 0 8px;
32
+ -webkit-box-sizing: border-box;
33
+ -moz-box-sizing: border-box;
34
+ box-sizing: border-box; }
35
+
36
+ .mfp-container:before {
37
+ content: '';
38
+ display: inline-block;
39
+ height: 100%;
40
+ vertical-align: middle; }
41
+
42
+ .mfp-align-top .mfp-container:before {
43
+ display: none; }
44
+
45
+ .mfp-content {
46
+ position: relative;
47
+ display: inline-block;
48
+ vertical-align: middle;
49
+ margin: 0 auto;
50
+ text-align: left;
51
+ z-index: 1045; }
52
+
53
+ .mfp-inline-holder .mfp-content, .mfp-ajax-holder .mfp-content {
54
+ width: 100%;
55
+ cursor: auto; }
56
+
57
+ .mfp-ajax-cur {
58
+ cursor: progress; }
59
+
60
+ .mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
61
+ cursor: -moz-zoom-out;
62
+ cursor: -webkit-zoom-out;
63
+ cursor: zoom-out; }
64
+
65
+ .mfp-zoom {
66
+ cursor: pointer;
67
+ cursor: -webkit-zoom-in;
68
+ cursor: -moz-zoom-in;
69
+ cursor: zoom-in; }
70
+
71
+ .mfp-auto-cursor .mfp-content {
72
+ cursor: auto; }
73
+
74
+ .mfp-close, .mfp-arrow, .mfp-preloader, .mfp-counter {
75
+ -webkit-user-select: none;
76
+ -moz-user-select: none;
77
+ user-select: none; }
78
+
79
+ .mfp-loading.mfp-figure {
80
+ display: none; }
81
+
82
+ .mfp-hide {
83
+ display: none !important; }
84
+
85
+ .mfp-preloader {
86
+ color: #CCC;
87
+ position: absolute;
88
+ top: 50%;
89
+ width: auto;
90
+ text-align: center;
91
+ margin-top: -0.8em;
92
+ left: 8px;
93
+ right: 8px;
94
+ z-index: 1044; }
95
+ .mfp-preloader a {
96
+ color: #CCC; }
97
+ .mfp-preloader a:hover {
98
+ color: #FFF; }
99
+
100
+ .mfp-s-ready .mfp-preloader {
101
+ display: none; }
102
+
103
+ .mfp-s-error .mfp-content {
104
+ display: none; }
105
+
106
+ button.mfp-close, button.mfp-arrow {
107
+ overflow: visible;
108
+ cursor: pointer;
109
+ background: transparent;
110
+ border: 0;
111
+ -webkit-appearance: none;
112
+ display: block;
113
+ outline: none;
114
+ padding: 0;
115
+ z-index: 1046;
116
+ -webkit-box-shadow: none;
117
+ box-shadow: none; }
118
+ button::-moz-focus-inner {
119
+ padding: 0;
120
+ border: 0; }
121
+
122
+ .mfp-close {
123
+ width: 44px;
124
+ height: 44px;
125
+ line-height: 44px;
126
+ position: absolute;
127
+ right: 0;
128
+ top: 0;
129
+ text-decoration: none;
130
+ text-align: center;
131
+ opacity: 0.65;
132
+ filter: alpha(opacity=65);
133
+ padding: 0 0 18px 10px;
134
+ color: #FFF;
135
+ font-style: normal;
136
+ font-size: 28px;
137
+ font-family: Arial, Baskerville, monospace; }
138
+ .mfp-close:hover, .mfp-close:focus {
139
+ opacity: 1;
140
+ filter: alpha(opacity=100); }
141
+ .mfp-close:active {
142
+ top: 1px; }
143
+
144
+ .mfp-close-btn-in .mfp-close {
145
+ color: #333; }
146
+
147
+ .mfp-image-holder .mfp-close, .mfp-iframe-holder .mfp-close {
148
+ color: #FFF;
149
+ right: -6px;
150
+ text-align: right;
151
+ padding-right: 6px;
152
+ width: 100%; }
153
+
154
+ .mfp-counter {
155
+ position: absolute;
156
+ top: 0;
157
+ right: 0;
158
+ color: #CCC;
159
+ font-size: 12px;
160
+ line-height: 18px;
161
+ white-space: nowrap; }
162
+
163
+ .mfp-arrow {
164
+ position: absolute;
165
+ opacity: 0.65;
166
+ filter: alpha(opacity=65);
167
+ margin: 0;
168
+ top: 50%;
169
+ margin-top: -55px;
170
+ padding: 0;
171
+ width: 90px;
172
+ height: 110px;
173
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
174
+ .mfp-arrow:active {
175
+ margin-top: -54px; }
176
+ .mfp-arrow:hover, .mfp-arrow:focus {
177
+ opacity: 1;
178
+ filter: alpha(opacity=100); }
179
+ .mfp-arrow:before, .mfp-arrow:after, .mfp-arrow .mfp-b, .mfp-arrow .mfp-a {
180
+ content: '';
181
+ display: block;
182
+ width: 0;
183
+ height: 0;
184
+ position: absolute;
185
+ left: 0;
186
+ top: 0;
187
+ margin-top: 35px;
188
+ margin-left: 35px;
189
+ border: medium inset transparent; }
190
+ .mfp-arrow:after, .mfp-arrow .mfp-a {
191
+ border-top-width: 13px;
192
+ border-bottom-width: 13px;
193
+ top: 8px; }
194
+ .mfp-arrow:before, .mfp-arrow .mfp-b {
195
+ border-top-width: 21px;
196
+ border-bottom-width: 21px;
197
+ opacity: 0.7; }
198
+
199
+ .mfp-arrow-left {
200
+ left: 0; }
201
+ .mfp-arrow-left:after, .mfp-arrow-left .mfp-a {
202
+ border-right: 17px solid #FFF;
203
+ margin-left: 31px; }
204
+ .mfp-arrow-left:before, .mfp-arrow-left .mfp-b {
205
+ margin-left: 25px;
206
+ border-right: 27px solid #3F3F3F; }
207
+
208
+ .mfp-arrow-right {
209
+ right: 0; }
210
+ .mfp-arrow-right:after, .mfp-arrow-right .mfp-a {
211
+ border-left: 17px solid #FFF;
212
+ margin-left: 39px; }
213
+ .mfp-arrow-right:before, .mfp-arrow-right .mfp-b {
214
+ border-left: 27px solid #3F3F3F; }
215
+
216
+ .mfp-iframe-holder {
217
+ padding-top: 40px;
218
+ padding-bottom: 40px; }
219
+ .mfp-iframe-holder .mfp-content {
220
+ line-height: 0;
221
+ width: 100%;
222
+ max-width: 900px; }
223
+ .mfp-iframe-holder .mfp-close {
224
+ top: -40px; }
225
+
226
+ .mfp-iframe-scaler {
227
+ width: 100%;
228
+ height: 0;
229
+ overflow: hidden;
230
+ padding-top: 56.25%; }
231
+ .mfp-iframe-scaler iframe {
232
+ position: absolute;
233
+ display: block;
234
+ top: 0;
235
+ left: 0;
236
+ width: 100%;
237
+ height: 100%;
238
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
239
+ background: #000; }
240
+
241
+ /* Main image in popup */
242
+ img.mfp-img {
243
+ width: auto;
244
+ max-width: 100%;
245
+ height: auto;
246
+ display: block;
247
+ line-height: 0;
248
+ -webkit-box-sizing: border-box;
249
+ -moz-box-sizing: border-box;
250
+ box-sizing: border-box;
251
+ padding: 40px 0 40px;
252
+ margin: 0 auto; }
253
+
254
+ /* The shadow behind the image */
255
+ .mfp-figure {
256
+ line-height: 0; }
257
+ .mfp-figure:after {
258
+ content: '';
259
+ position: absolute;
260
+ left: 0;
261
+ top: 40px;
262
+ bottom: 40px;
263
+ display: block;
264
+ right: 0;
265
+ width: auto;
266
+ height: auto;
267
+ z-index: -1;
268
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
269
+ background: #444; }
270
+ .mfp-figure small {
271
+ color: #BDBDBD;
272
+ display: block;
273
+ font-size: 12px;
274
+ line-height: 14px; }
275
+ .mfp-figure figure {
276
+ margin: 0; }
277
+
278
+ .mfp-bottom-bar {
279
+ margin-top: -36px;
280
+ position: absolute;
281
+ top: 100%;
282
+ left: 0;
283
+ width: 100%;
284
+ cursor: auto; }
285
+
286
+ .mfp-title {
287
+ text-align: left;
288
+ line-height: 18px;
289
+ color: #F3F3F3;
290
+ word-wrap: break-word;
291
+ padding-right: 36px; }
292
+
293
+ .mfp-image-holder .mfp-content {
294
+ max-width: 100%; }
295
+
296
+ .mfp-gallery .mfp-image-holder .mfp-figure {
297
+ cursor: pointer; }
298
+
299
+ @media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
300
+ /**
301
+ * Remove all paddings around the image on small screen
302
+ */
303
+ .mfp-img-mobile .mfp-image-holder {
304
+ padding-left: 0;
305
+ padding-right: 0; }
306
+ .mfp-img-mobile img.mfp-img {
307
+ padding: 0; }
308
+ .mfp-img-mobile .mfp-figure:after {
309
+ top: 0;
310
+ bottom: 0; }
311
+ .mfp-img-mobile .mfp-figure small {
312
+ display: inline;
313
+ margin-left: 5px; }
314
+ .mfp-img-mobile .mfp-bottom-bar {
315
+ background: rgba(0, 0, 0, 0.6);
316
+ bottom: 0;
317
+ margin: 0;
318
+ top: auto;
319
+ padding: 3px 5px;
320
+ position: fixed;
321
+ -webkit-box-sizing: border-box;
322
+ -moz-box-sizing: border-box;
323
+ box-sizing: border-box; }
324
+ .mfp-img-mobile .mfp-bottom-bar:empty {
325
+ padding: 0; }
326
+ .mfp-img-mobile .mfp-counter {
327
+ right: 5px;
328
+ top: 3px; }
329
+ .mfp-img-mobile .mfp-close {
330
+ top: 0;
331
+ right: 0;
332
+ width: 35px;
333
+ height: 35px;
334
+ line-height: 35px;
335
+ background: rgba(0, 0, 0, 0.6);
336
+ position: fixed;
337
+ text-align: center;
338
+ padding: 0; }
339
+ }
340
+
341
+ @media all and (max-width: 900px) {
342
+ .mfp-arrow {
343
+ -webkit-transform: scale(0.75);
344
+ transform: scale(0.75); }
345
+
346
+ .mfp-arrow-left {
347
+ -webkit-transform-origin: 0;
348
+ transform-origin: 0; }
349
+
350
+ .mfp-arrow-right {
351
+ -webkit-transform-origin: 100%;
352
+ transform-origin: 100%; }
353
+
354
+ .mfp-container {
355
+ padding-left: 6px;
356
+ padding-right: 6px; }
357
+ }
358
+
359
+ .mfp-ie7 .mfp-img {
360
+ padding: 0; }
361
+ .mfp-ie7 .mfp-bottom-bar {
362
+ width: 600px;
363
+ left: 50%;
364
+ margin-left: -300px;
365
+ margin-top: 5px;
366
+ padding-bottom: 5px; }
367
+ .mfp-ie7 .mfp-container {
368
+ padding: 0; }
369
+ .mfp-ie7 .mfp-content {
370
+ padding-top: 44px; }
371
+ .mfp-ie7 .mfp-close {
372
+ top: 0;
373
+ right: 0;
374
+ padding-top: 0; }
public/easy-facebook-likebox.php CHANGED
@@ -1,369 +1,379 @@
1
- <?php
2
- /**
3
- * Plugin Name.
4
- *
5
- * @package Plugin_Name
6
- * @author Your Name <email@example.com>
7
- * @license GPL-2.0+
8
- * @link http://example.com
9
- * @copyright 2014 Your Name or Company Name
10
- */
11
-
12
- /**
13
- * Plugin class. This class should ideally be used to work with the
14
- * public-facing side of the WordPress site.
15
- *
16
- * If you're interested in introducing administrative or dashboard
17
- * functionality, then refer to `class-plugin-name-admin.php`
18
- *
19
- * @TODO: Rename this class to a proper name for your plugin.
20
- *
21
- * @package Plugin_Name
22
- * @author Your Name <email@example.com>
23
- */
24
- class Easy_Facebook_Likebox {
25
-
26
- /**
27
- * Plugin version, used for cache-busting of style and script file references.
28
- *
29
- * @since 1.1.0
30
- *
31
- * @var string
32
- */
33
- const VERSION = '2.1.0';
34
-
35
- /**
36
- * @TODO - Rename "plugin-name" to the name your your plugin
37
- *
38
- * Unique identifier for your plugin.
39
- *
40
- *
41
- * The variable name is used as the text domain when internationalizing strings
42
- * of text. Its value should match the Text Domain file header in the main
43
- * plugin file.
44
- *
45
- * @since 1.1.0
46
- *
47
- * @var string
48
- */
49
- protected $plugin_slug = 'easy-facebook-likebox';
50
-
51
- /**
52
- * Instance of this class.
53
- *
54
- * @since 1.1.0
55
- *
56
- * @var object
57
- */
58
- protected static $instance = null;
59
-
60
- /**
61
- * Initialize the plugin by setting localization and loading public scripts
62
- * and styles.
63
- *
64
- * @since 1.1.0
65
- */
66
- private function __construct() {
67
-
68
- // Load plugin text domain
69
- add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
70
-
71
- // Activate plugin when new blog is added
72
- add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
73
-
74
- // Load public-facing style sheet and JavaScript.
75
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
76
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
77
-
78
- add_shortcode( 'efb_likebox', array( $this, 'efb_likebox_shortcode' ) );
79
-
80
- /* Define custom functionality.
81
- * Refer To http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
82
- */
83
- //add_action( '@TODO', array( $this, 'action_method_name' ) );
84
- //add_filter( '@TODO', array( $this, 'filter_method_name' ) );
85
-
86
- }
87
-
88
- /**
89
- * Return the plugin slug.
90
- *
91
- * @since 1.1.0
92
- *
93
- * @return Plugin slug variable.
94
- */
95
- public function get_plugin_slug() {
96
- return $this->plugin_slug;
97
- }
98
-
99
- /**
100
- * Return an instance of this class.
101
- *
102
- * @since 1.1.0
103
- *
104
- * @return object A single instance of this class.
105
- */
106
- public static function get_instance() {
107
-
108
- // If the single instance hasn't been set, set it now.
109
- if ( null == self::$instance ) {
110
- self::$instance = new self;
111
- }
112
-
113
- return self::$instance;
114
- }
115
-
116
- /**
117
- * Fired when the plugin is activated.
118
- *
119
- * @since 1.1.0
120
- *
121
- * @param boolean $network_wide True if WPMU superadmin uses
122
- * "Network Activate" action, false if
123
- * WPMU is disabled or plugin is
124
- * activated on an individual blog.
125
- */
126
- public static function activate( $network_wide ) {
127
-
128
- if ( function_exists( 'is_multisite' ) && is_multisite() ) {
129
-
130
- if ( $network_wide ) {
131
-
132
- // Get all blog ids
133
- $blog_ids = self::get_blog_ids();
134
-
135
- foreach ( $blog_ids as $blog_id ) {
136
-
137
- switch_to_blog( $blog_id );
138
- self::single_activate();
139
- }
140
-
141
- restore_current_blog();
142
-
143
- } else {
144
- self::single_activate();
145
- }
146
-
147
- } else {
148
- self::single_activate();
149
- }
150
-
151
- }
152
-
153
- /**
154
- * Fired when the plugin is deactivated.
155
- *
156
- * @since 1.1.0
157
- *
158
- * @param boolean $network_wide True if WPMU superadmin uses
159
- * "Network Deactivate" action, false if
160
- * WPMU is disabled or plugin is
161
- * deactivated on an individual blog.
162
- */
163
- public static function deactivate( $network_wide ) {
164
-
165
- if ( function_exists( 'is_multisite' ) && is_multisite() ) {
166
-
167
- if ( $network_wide ) {
168
-
169
- // Get all blog ids
170
- $blog_ids = self::get_blog_ids();
171
-
172
- foreach ( $blog_ids as $blog_id ) {
173
-
174
- switch_to_blog( $blog_id );
175
- self::single_deactivate();
176
-
177
- }
178
-
179
- restore_current_blog();
180
-
181
- } else {
182
- self::single_deactivate();
183
- }
184
-
185
- } else {
186
- self::single_deactivate();
187
- }
188
-
189
- }
190
-
191
- /**
192
- * Fired when a new site is activated with a WPMU environment.
193
- *
194
- * @since 1.1.0
195
- *
196
- * @param int $blog_id ID of the new blog.
197
- */
198
- public function activate_new_site( $blog_id ) {
199
-
200
- if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
201
- return;
202
- }
203
-
204
- switch_to_blog( $blog_id );
205
- self::single_activate();
206
- restore_current_blog();
207
-
208
- }
209
-
210
- /**
211
- * Get all blog ids of blogs in the current network that are:
212
- * - not archived
213
- * - not spam
214
- * - not deleted
215
- *
216
- * @since 1.1.0
217
- *
218
- * @return array|false The blog ids, false if no matches.
219
- */
220
- private static function get_blog_ids() {
221
-
222
- global $wpdb;
223
-
224
- // get an array of blog ids
225
- $sql = "SELECT blog_id FROM $wpdb->blogs
226
- WHERE archived = '0' AND spam = '0'
227
- AND deleted = '0'";
228
-
229
- return $wpdb->get_col( $sql );
230
-
231
- }
232
-
233
- /**
234
- * Fired for each blog when the plugin is activated.
235
- *
236
- * @since 1.1.0
237
- */
238
- private static function single_activate() {
239
- // @TODO: Define activation functionality here
240
- }
241
-
242
- /**
243
- * Fired for each blog when the plugin is deactivated.
244
- *
245
- * @since 1.1.0
246
- */
247
- private static function single_deactivate() {
248
- // @TODO: Define deactivation functionality here
249
- }
250
-
251
- /**
252
- * Load the plugin text domain for translation.
253
- *
254
- * @since 1.1.0
255
- */
256
- public function load_plugin_textdomain() {
257
-
258
- $domain = $this->plugin_slug;
259
- $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
260
-
261
- load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
262
- load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
263
-
264
- }
265
-
266
- /**
267
- * Register and enqueue public-facing style sheet.
268
- *
269
- * @since 1.1.0
270
- */
271
- public function enqueue_styles() {
272
- wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
273
- }
274
-
275
- /**
276
- * Register and enqueues public-facing JavaScript files.
277
- *
278
- * @since 1.1.0
279
- */
280
- public function enqueue_scripts() {
281
- wp_enqueue_script( $this->plugin_slug . '-plugin-script', plugins_url( 'assets/js/public.js', __FILE__ ), array( 'jquery' ), self::VERSION );
282
- }
283
-
284
- /**
285
- * NOTE: Actions are points in the execution of a page or process
286
- * lifecycle that WordPress fires.
287
- *
288
- * Actions: http://codex.wordpress.org/Plugin_API#Actions
289
- * Reference: http://codex.wordpress.org/Plugin_API/Action_Reference
290
- *
291
- * @since 1.1.0
292
- */
293
- public function action_method_name() {
294
- // @TODO: Define your action hook callback here
295
- }
296
-
297
- /**
298
- * NOTE: Filters are points of execution in which WordPress modifies data
299
- * before saving it or sending it to the browser.
300
- *
301
- * Filters: http://codex.wordpress.org/Plugin_API#Filters
302
- * Reference: http://codex.wordpress.org/Plugin_API/Filter_Reference
303
- *
304
- * @since 1.1.0
305
- */
306
- public function filter_method_name() {
307
- // @TODO: Define your filter hook callback here
308
- }
309
-
310
- public function efb_likebox_shortcode($atts, $content=""){
311
- return $this->render_fb_box($atts);
312
- }
313
-
314
- /**
315
- * This fucntion will render the facebook like box
316
- * before saving it or sending it to the browser.
317
- *
318
- * Filters: http://codex.wordpress.org/Plugin_API#Filters
319
- * Reference: http://codex.wordpress.org/Plugin_API/Filter_Reference
320
- *
321
- * @since 1.1.0
322
- */
323
- public function render_fb_box($options) {
324
-
325
- extract($options, EXTR_SKIP);
326
-
327
- if( empty( $fb_appid ) ){
328
- $fb_appid = '395202813876688';
329
- }
330
-
331
- if( empty( $locale ) ){
332
- $locale = 'en_US';
333
- }
334
-
335
- if( !empty( $locale_other ) ){
336
- $locale = $locale_other;
337
- }
338
-
339
- $pieces = explode('/', $fanpage_url); // divides the string in pieces where '/' is found
340
- $page_name_id = end($pieces); //takes the last piece
341
-
342
- $show_stream = ( $show_stream == 1 ) ? 'data-stream=true' : 'data-stream=false';
343
- $show_faces = ( $show_faces == 1 ) ? 'data-show-faces=true' : 'data-show-faces=false';
344
- $show_border = ( $show_border == 1 ) ? 'data-show-border=true' : 'data-show-border=false' ;
345
- $show_header = ( $show_header == 1 ) ? 'data-header=true' : 'data-header=false';
346
- $responsive = ( $responsive == 1 ) ? 'responsive' : '';
347
-
348
- $returner = '<div id="fb-root"></div>
349
- <script>(function(d, s, id) {
350
- var js, fjs = d.getElementsByTagName(s)[0];
351
- if (d.getElementById(id)) return;
352
- js = d.createElement(s); js.id = id;
353
- js.src = "//connect.facebook.net/'.$locale.'/all.js#xfbml=1&appId='.$fb_appid.'";
354
- fjs.parentNode.insertBefore(js, fjs);
355
- }(document, \'script\', \'facebook-jssdk\'));</script>';
356
-
357
- $returner .= '<div class="fb-like-box '.$responsive.' " data-href="https://www.facebook.com/'.$page_name_id.'" data-colorscheme="'.$colorscheme.'" data-width="'.$box_width.'" data-height="'.$box_height.'" '.$show_faces.' '.$show_header.' '.$show_stream.' '.$show_border.'></div>';
358
-
359
- /* echo '<pre>';
360
- echo htmlspecialchars($returner);
361
- echo '</pre>';*/
362
-
363
- return $returner;
364
-
365
- }
366
-
367
-
368
-
369
- }
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name.
4
+ *
5
+ * @package Plugin_Name
6
+ * @author Your Name <email@example.com>
7
+ * @license GPL-2.0+
8
+ * @link http://example.com
9
+ * @copyright 2014 Your Name or Company Name
10
+ */
11
+
12
+ /**
13
+ * Plugin class. This class should ideally be used to work with the
14
+ * public-facing side of the WordPress site.
15
+ *
16
+ * If you're interested in introducing administrative or dashboard
17
+ * functionality, then refer to `class-plugin-name-admin.php`
18
+ *
19
+ * @TODO: Rename this class to a proper name for your plugin.
20
+ *
21
+ * @package Plugin_Name
22
+ * @author Your Name <email@example.com>
23
+ */
24
+ class Easy_Facebook_Likebox {
25
+
26
+ /**
27
+ * Plugin version, used for cache-busting of style and script file references.
28
+ *
29
+ * @since 1.1.0
30
+ *
31
+ * @var string
32
+ */
33
+ const VERSION = '2.1.0';
34
+
35
+ /**
36
+ * @TODO - Rename "plugin-name" to the name your your plugin
37
+ *
38
+ * Unique identifier for your plugin.
39
+ *
40
+ *
41
+ * The variable name is used as the text domain when internationalizing strings
42
+ * of text. Its value should match the Text Domain file header in the main
43
+ * plugin file.
44
+ *
45
+ * @since 1.1.0
46
+ *
47
+ * @var string
48
+ */
49
+ protected $plugin_slug = 'easy-facebook-likebox';
50
+
51
+ /**
52
+ * Instance of this class.
53
+ *
54
+ * @since 1.1.0
55
+ *
56
+ * @var object
57
+ */
58
+ protected static $instance = null;
59
+
60
+ /**
61
+ * Initialize the plugin by setting localization and loading public scripts
62
+ * and styles.
63
+ *
64
+ * @since 1.1.0
65
+ */
66
+ private function __construct() {
67
+
68
+ // Load plugin text domain
69
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
70
+
71
+ // Load plugin text domain
72
+ add_action( 'wp_footer', array( $this, 'efbl_display_popup' ), 50 );
73
+
74
+ // Activate plugin when new blog is added
75
+ add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
76
+
77
+ // Load public-facing style sheet and JavaScript.
78
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
79
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
80
+
81
+ add_shortcode( 'efb_likebox', array( $this, 'efb_likebox_shortcode' ) );
82
+
83
+ /* Define custom functionality.
84
+ * Refer To http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
85
+ */
86
+ //add_action( '@TODO', array( $this, 'action_method_name' ) );
87
+ //add_filter( '@TODO', array( $this, 'filter_method_name' ) );
88
+
89
+ }
90
+
91
+ /**
92
+ * Return the plugin slug.
93
+ *
94
+ * @since 1.1.0
95
+ *
96
+ * @return Plugin slug variable.
97
+ */
98
+ public function get_plugin_slug() {
99
+ return $this->plugin_slug;
100
+ }
101
+
102
+ /**
103
+ * Return an instance of this class.
104
+ *
105
+ * @since 1.1.0
106
+ *
107
+ * @return object A single instance of this class.
108
+ */
109
+ public static function get_instance() {
110
+
111
+ // If the single instance hasn't been set, set it now.
112
+ if ( null == self::$instance ) {
113
+ self::$instance = new self;
114
+ }
115
+
116
+ return self::$instance;
117
+ }
118
+
119
+ /**
120
+ * Fired when the plugin is activated.
121
+ *
122
+ * @since 1.1.0
123
+ *
124
+ * @param boolean $network_wide True if WPMU superadmin uses
125
+ * "Network Activate" action, false if
126
+ * WPMU is disabled or plugin is
127
+ * activated on an individual blog.
128
+ */
129
+ public static function activate( $network_wide ) {
130
+
131
+ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
132
+
133
+ if ( $network_wide ) {
134
+
135
+ // Get all blog ids
136
+ $blog_ids = self::get_blog_ids();
137
+
138
+ foreach ( $blog_ids as $blog_id ) {
139
+
140
+ switch_to_blog( $blog_id );
141
+ self::single_activate();
142
+ }
143
+
144
+ restore_current_blog();
145
+
146
+ } else {
147
+ self::single_activate();
148
+ }
149
+
150
+ } else {
151
+ self::single_activate();
152
+ }
153
+
154
+ }
155
+
156
+ /**
157
+ * Fired when the plugin is deactivated.
158
+ *
159
+ * @since 1.1.0
160
+ *
161
+ * @param boolean $network_wide True if WPMU superadmin uses
162
+ * "Network Deactivate" action, false if
163
+ * WPMU is disabled or plugin is
164
+ * deactivated on an individual blog.
165
+ */
166
+ public static function deactivate( $network_wide ) {
167
+
168
+ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
169
+
170
+ if ( $network_wide ) {
171
+
172
+ // Get all blog ids
173
+ $blog_ids = self::get_blog_ids();
174
+
175
+ foreach ( $blog_ids as $blog_id ) {
176
+
177
+ switch_to_blog( $blog_id );
178
+ self::single_deactivate();
179
+
180
+ }
181
+
182
+ restore_current_blog();
183
+
184
+ } else {
185
+ self::single_deactivate();
186
+ }
187
+
188
+ } else {
189
+ self::single_deactivate();
190
+ }
191
+
192
+ }
193
+
194
+ /**
195
+ * Fired when a new site is activated with a WPMU environment.
196
+ *
197
+ * @since 1.1.0
198
+ *
199
+ * @param int $blog_id ID of the new blog.
200
+ */
201
+ public function activate_new_site( $blog_id ) {
202
+
203
+ if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
204
+ return;
205
+ }
206
+
207
+ switch_to_blog( $blog_id );
208
+ self::single_activate();
209
+ restore_current_blog();
210
+
211
+ }
212
+
213
+ /**
214
+ * Get all blog ids of blogs in the current network that are:
215
+ * - not archived
216
+ * - not spam
217
+ * - not deleted
218
+ *
219
+ * @since 1.1.0
220
+ *
221
+ * @return array|false The blog ids, false if no matches.
222
+ */
223
+ private static function get_blog_ids() {
224
+
225
+ global $wpdb;
226
+
227
+ // get an array of blog ids
228
+ $sql = "SELECT blog_id FROM $wpdb->blogs
229
+ WHERE archived = '0' AND spam = '0'
230
+ AND deleted = '0'";
231
+
232
+ return $wpdb->get_col( $sql );
233
+
234
+ }
235
+
236
+ /**
237
+ * Fired for each blog when the plugin is activated.
238
+ *
239
+ * @since 1.1.0
240
+ */
241
+ private static function single_activate() {
242
+ // @TODO: Define activation functionality here
243
+ }
244
+
245
+ /**
246
+ * Fired for each blog when the plugin is deactivated.
247
+ *
248
+ * @since 1.1.0
249
+ */
250
+ private static function single_deactivate() {
251
+ // @TODO: Define deactivation functionality here
252
+ }
253
+
254
+ /**
255
+ * Load the plugin text domain for translation.
256
+ *
257
+ * @since 1.1.0
258
+ */
259
+ public function load_plugin_textdomain() {
260
+
261
+ $domain = $this->plugin_slug;
262
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
263
+
264
+ load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
265
+ load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
266
+
267
+ }
268
+
269
+ /**
270
+ * Register and enqueue public-facing style sheet.
271
+ *
272
+ * @since 1.1.0
273
+ */
274
+ public function enqueue_styles() {
275
+ wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
276
+
277
+ wp_enqueue_style( $this->plugin_slug . '-popup-styles', plugins_url( 'assets/popup/magnific-popup.css', __FILE__ ), array(), self::VERSION );
278
+ }
279
+
280
+ /**
281
+ * Register and enqueues public-facing JavaScript files.
282
+ *
283
+ * @since 1.1.0
284
+ */
285
+ public function enqueue_scripts() {
286
+ wp_enqueue_script( $this->plugin_slug . '-popup-script', plugins_url( 'assets/popup/jquery.magnific-popup.min.js', __FILE__ ), array( 'jquery' ), self::VERSION );
287
+ wp_enqueue_script( $this->plugin_slug . '-plugin-script', plugins_url( 'assets/js/public.js', __FILE__ ), array( 'jquery', $this->plugin_slug . '-popup-script' ), self::VERSION );
288
+ }
289
+
290
+ /**
291
+ * NOTE: Actions are points in the execution of a page or process
292
+ * lifecycle that WordPress fires.
293
+ *
294
+ * Actions: http://codex.wordpress.org/Plugin_API#Actions
295
+ * Reference: http://codex.wordpress.org/Plugin_API/Action_Reference
296
+ *
297
+ * @since 1.1.0
298
+ */
299
+ public function action_method_name() {
300
+ // @TODO: Define your action hook callback here
301
+ }
302
+
303
+ /**
304
+ * NOTE: Filters are points of execution in which WordPress modifies data
305
+ * before saving it or sending it to the browser.
306
+ *
307
+ * Filters: http://codex.wordpress.org/Plugin_API#Filters
308
+ * Reference: http://codex.wordpress.org/Plugin_API/Filter_Reference
309
+ *
310
+ * @since 1.1.0
311
+ */
312
+ public function filter_method_name() {
313
+ // @TODO: Define your filter hook callback here
314
+ }
315
+
316
+ public function efb_likebox_shortcode($atts, $content=""){
317
+ return $this->render_fb_box($atts);
318
+ }
319
+
320
+ /**
321
+ * This fucntion will render the facebook like box
322
+ * before saving it or sending it to the browser.
323
+ *
324
+ * Filters: http://codex.wordpress.org/Plugin_API#Filters
325
+ * Reference: http://codex.wordpress.org/Plugin_API/Filter_Reference
326
+ *
327
+ * @since 1.1.0
328
+ */
329
+ public function render_fb_box($options) {
330
+
331
+ extract($options, EXTR_SKIP);
332
+
333
+ if( empty( $fb_appid ) ){
334
+ $fb_appid = '395202813876688';
335
+ }
336
+
337
+ if( empty( $locale ) ){
338
+ $locale = 'en_US';
339
+ }
340
+
341
+ if( !empty( $locale_other ) ){
342
+ $locale = $locale_other;
343
+ }
344
+
345
+ $pieces = explode('/', $fanpage_url); // divides the string in pieces where '/' is found
346
+ $page_name_id = end($pieces); //takes the last piece
347
+
348
+ $show_stream = ( $show_stream == 1 ) ? 'data-stream=true' : 'data-stream=false';
349
+ $show_faces = ( $show_faces == 1 ) ? 'data-show-faces=true' : 'data-show-faces=false';
350
+ $show_border = ( $show_border == 1 ) ? 'data-show-border=true' : 'data-show-border=false' ;
351
+ $show_header = ( $show_header == 1 ) ? 'data-header=true' : 'data-header=false';
352
+ $responsive = ( $responsive == 1 ) ? 'responsive' : '';
353
+
354
+ $returner = '<div id="fb-root"></div>
355
+ <script>(function(d, s, id) {
356
+ var js, fjs = d.getElementsByTagName(s)[0];
357
+ if (d.getElementById(id)) return;
358
+ js = d.createElement(s); js.id = id;
359
+ js.src = "//connect.facebook.net/'.$locale.'/all.js#xfbml=1&appId='.$fb_appid.'";
360
+ fjs.parentNode.insertBefore(js, fjs);
361
+ }(document, \'script\', \'facebook-jssdk\'));</script>';
362
+
363
+ $returner .= '<div class="fb-like-box '.$responsive.' " data-href="https://www.facebook.com/'.$page_name_id.'" data-colorscheme="'.$colorscheme.'" data-width="'.$box_width.'" data-height="'.$box_height.'" '.$show_faces.' '.$show_header.' '.$show_stream.' '.$show_border.'></div>';
364
+
365
+ /* echo '<pre>';
366
+ echo htmlspecialchars($returner);
367
+ echo '</pre>';*/
368
+
369
+ return $returner;
370
+
371
+ }
372
+
373
+ function efbl_display_popup(){
374
+ include('views/public.php');
375
+ }
376
+
377
+
378
+
379
+ }
public/views/public.php CHANGED
@@ -11,6 +11,68 @@
11
  * @link http://example.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
- ?>
 
 
 
 
 
 
 
 
 
 
15
 
 
 
 
 
16
  <!-- This file is used to markup the public facing aspect of the plugin. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  * @link http://example.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
+
15
+ $options = get_option( 'efbl_settings_display_options' );
16
+ /*echo "<pre>";
17
+ print_r($options);
18
+ exit;*/
19
+ $delay = ($options['efbl_popup_interval']) ? $options['efbl_popup_interval'] : 1000;
20
+ $width = ($options['efbl_popup_width']) ? $options['efbl_popup_width'] : 400;
21
+ $height = ($options['efbl_popup_height']) ? $options['efbl_popup_height'] : 300;
22
+ $shortcode = $options['efbl_popup_shortcode'];
23
+
24
+ if($options['efbl_enable_popup']){
25
 
26
+ ?>
27
+ <div style="display:none">
28
+ <a class="popup-with-form efbl_popup_trigger" href="#efbl_popup" >Inline</a>
29
+ </div>
30
  <!-- This file is used to markup the public facing aspect of the plugin. -->
31
+
32
+ <div style="width:400px;display: none;">
33
+ <div id="efbl_popup" class="white-popup" style="width:<?php echo $width?>px; height:<?php echo $height?>px">
34
+ <?php
35
+ if(empty($shortcode)){
36
+ echo __('Please enter easy facebook like box shortcode from settings > Easy Fcebook Likebox', 'easy-facebook-likebox');
37
+ }else{
38
+ if( preg_match('/efb_likebox/i', $shortcode ) ){
39
+ echo do_shortcode($shortcode);
40
+ }else{
41
+ echo __('Please enter easy facebook like box shortcode from settings > Easy Fcebook Likebox', 'easy-facebook-likebox');
42
+ }
43
+ }
44
+ ?>
45
+ </div>
46
+ </div>
47
+
48
+ <script type="text/javascript">
49
+ jQuery(document).ready(function($) {
50
+
51
+ $('.popup-with-form').magnificPopup({
52
+ type: 'inline',
53
+ preloader: false,
54
+ });
55
+
56
+ /*$(".efbl").fancybox({
57
+ maxWidth : 800,
58
+ maxHeight : 600,
59
+ fitToView : true,
60
+ 'scrolling' : 'no',
61
+ width : '<?php echo $width?>px',
62
+ height : '<?php echo $height?>px',
63
+ autoSize : false,
64
+ closeClick : false,
65
+ openEffect : 'none',
66
+ closeEffect : 'none',
67
+ padding : 0,
68
+ });*/
69
+
70
+ openFancybox(<?php echo $delay?>);
71
+
72
+ });
73
+
74
+ function openFancybox(interval) {
75
+ setTimeout( function() {jQuery('.efbl_popup_trigger').trigger('click'); },interval);
76
+ }
77
+ </script>
78
+ <?php }?>