Version Description
- Added Height & Width options.
Download this release
Release Info
Developer | danieliser |
Plugin | Easy Modal |
Version | 0.9.0.1 |
Comparing to | |
See all releases |
Version 0.9.0.1
- content/content.php +26 -0
- css/easy-modal.css +18 -0
- easy-modal.php +212 -0
- js/easy-modal.js +244 -0
- js/jquery.simplemodal.js +25 -0
- readme.txt +54 -0
content/content.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Easy Modal
|
4 |
+
* http://wizardinternetsolutions.com/project/easy-modal/
|
5 |
+
*
|
6 |
+
* Copyright (c) 2011 Wizard Internet Solutions
|
7 |
+
* http://wizardinternetsolutions.com
|
8 |
+
*
|
9 |
+
* Licensed under the MIT license:
|
10 |
+
* http://www.opensource.org/licenses/mit-license.php
|
11 |
+
*/
|
12 |
+
|
13 |
+
require( '../../../../wp-load.php' );
|
14 |
+
global $eM;
|
15 |
+
$options = $eM->getAdminOptions();
|
16 |
+
|
17 |
+
?>
|
18 |
+
<div>
|
19 |
+
<div class='eM-content'>
|
20 |
+
<h1 class='eM-title'><?php echo $options['title'] ?></h1>
|
21 |
+
|
22 |
+
<?php echo do_shortcode($options['content']) ?>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
<?php if(strstr($options['content'],'[contact-form')!= NULL){ ?>
|
26 |
+
<?php } ?>
|
css/easy-modal.css
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Easy Modal
|
3 |
+
* http://wizardinternetsolutions.com/project/easy-modal/
|
4 |
+
*
|
5 |
+
* Copyright (c) 2011 Wizard Internet Solutions
|
6 |
+
* http://wizardinternetsolutions.com
|
7 |
+
*
|
8 |
+
* Licensed under the MIT license:
|
9 |
+
* http://www.opensource.org/licenses/mit-license.php
|
10 |
+
*/
|
11 |
+
|
12 |
+
/* Overlay */
|
13 |
+
#eM-overlay {background-color:#000; cursor:wait;}
|
14 |
+
|
15 |
+
/* Container */
|
16 |
+
#eM-container {font: 16px/22px 'Trebuchet MS', Verdana, Arial; text-align:left; width:450px;}
|
17 |
+
.eM-content {background-color:#333; color:#ddd;}
|
18 |
+
.eM-title {color:#d76300; font-size:20px; line-height:20px; margin:0; padding:0 0 6px 12px; text-align:left;}
|
easy-modal.php
ADDED
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Easy Modal
|
4 |
+
Plugin URI: http://wizardinternetsolutions.com/plugins/easy-modal/
|
5 |
+
Description: Easy Modal allows you to easily add just about any shortcodes or other content into a modal window. This includes forms such as CF7.
|
6 |
+
Author: Wizard Internet Solutions
|
7 |
+
Version: 0.9.0.1
|
8 |
+
Author URI: http://wizardinternetsolutions.com
|
9 |
+
*/
|
10 |
+
|
11 |
+
add_action('wp_print_styles', 'easy_modal_styles');
|
12 |
+
|
13 |
+
function easy_modal_styles()
|
14 |
+
{
|
15 |
+
$em_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
|
16 |
+
|
17 |
+
if (!is_admin()) {
|
18 |
+
wp_enqueue_style('easy-modal-style', $em_plugin_url.'/css/easy-modal.css');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
add_action('wp_print_scripts', 'easy_modal_scripts');
|
22 |
+
|
23 |
+
function easy_modal_scripts()
|
24 |
+
{
|
25 |
+
global $eM;
|
26 |
+
$options = $eM->getAdminOptions();
|
27 |
+
$em_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
|
28 |
+
|
29 |
+
if (!is_admin()) {
|
30 |
+
wp_enqueue_script('jquery');
|
31 |
+
wp_enqueue_script('jquery-form', array('jquery'));
|
32 |
+
wp_enqueue_script('jquery-simplemodal', $em_plugin_url.'/js/jquery.simplemodal.js', array('jquery'));
|
33 |
+
wp_enqueue_script('easy-modal-script', $em_plugin_url.'/js/easy-modal.js', array('jquery','jquery-simplemodal'));
|
34 |
+
wp_localize_script( 'easy-modal-script', 'eMSettings', array(
|
35 |
+
'plugin_url' => $em_plugin_url,
|
36 |
+
|
37 |
+
'overlayId' => $options['overlayId'],
|
38 |
+
'overlayCss' => $options['overlayCss'],
|
39 |
+
'opacity' => $options['opacity'],
|
40 |
+
|
41 |
+
|
42 |
+
'containerId' => $options['containerId'],
|
43 |
+
'minHeight' => $options['minHeight'],
|
44 |
+
'maxHeight' => $options['maxHeight'],
|
45 |
+
'minWidth' => $options['minWidth'],
|
46 |
+
'maxWidth' => $options['maxWidth'],
|
47 |
+
|
48 |
+
'cf7form' => $options['cf7form'],
|
49 |
+
|
50 |
+
));
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/*
|
55 |
+
|
56 |
+
call variables in js
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
mode = WPWallSettings.mode;
|
61 |
+
*/
|
62 |
+
|
63 |
+
class easy_modal {
|
64 |
+
|
65 |
+
var $adminOptionsName = "easy_modalOptions";
|
66 |
+
|
67 |
+
function easy_modal() { //constructor
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
//Returns an array of admin options
|
72 |
+
function getAdminOptions() {
|
73 |
+
$easy_modalAdminOptions = array(
|
74 |
+
'title' => '',
|
75 |
+
'content' => '',
|
76 |
+
'opacity' => '50',
|
77 |
+
'overlayId' => 'eM-overlay',
|
78 |
+
'overlayCss' => '',
|
79 |
+
'containerId' => 'eM-container',
|
80 |
+
'minHeight' => '',
|
81 |
+
'maxHeight' => '',
|
82 |
+
'minWidth' => '',
|
83 |
+
'maxWidth' => '',
|
84 |
+
'cf7form' => false,
|
85 |
+
);
|
86 |
+
$eMOptions = get_option($this->adminOptionsName);
|
87 |
+
if (!empty($eMOptions)) {
|
88 |
+
foreach ($eMOptions as $key => $option)
|
89 |
+
$easy_modalAdminOptions[$key] = $option;
|
90 |
+
}
|
91 |
+
update_option($this->adminOptionsName, $easy_modalAdminOptions);
|
92 |
+
return $easy_modalAdminOptions;
|
93 |
+
}
|
94 |
+
|
95 |
+
// Plugin Initialization
|
96 |
+
function init() {
|
97 |
+
$this->getAdminOptions();
|
98 |
+
}
|
99 |
+
|
100 |
+
//Prints out the admin page
|
101 |
+
function printAdminPage() {
|
102 |
+
$eM_Options = $this->getAdminOptions();
|
103 |
+
if (isset($_POST['update_eM_settings'])) {
|
104 |
+
if (isset($_POST['eM_title'])) {
|
105 |
+
$eM_Options['title'] = apply_filters('content_save_pre', $_POST['eM_title']);
|
106 |
+
}
|
107 |
+
if (isset($_POST['eM_content'])) {
|
108 |
+
if(strstr($_POST['eM_content'],'[contact-form')!= NULL){ $eM_Options['cf7form'] = true; }
|
109 |
+
else { $eM_Options['cf7form'] = false; }
|
110 |
+
$eM_Options['content'] = $_POST['eM_content'];
|
111 |
+
}
|
112 |
+
if (isset($_POST['eM_overlayId'])) {
|
113 |
+
$eM_Options['overlayId'] = $_POST['eM_overlayId'];
|
114 |
+
}
|
115 |
+
if (isset($_POST['eM_opacity'])) {
|
116 |
+
if ($_POST['eM_opacity']>=0 && $_POST['eM_opacity']<=100){
|
117 |
+
$eM_Options['opacity'] = $_POST['eM_opacity'];
|
118 |
+
}
|
119 |
+
}
|
120 |
+
if (isset($_POST['eM_overlayCss'])) {
|
121 |
+
$eM_Options['overlayCss'] = $_POST['eM_overlayCss'];
|
122 |
+
}
|
123 |
+
|
124 |
+
if (isset($_POST['eM_containerId'])) {
|
125 |
+
$eM_Options['containerId'] = $_POST['eM_containerId'];
|
126 |
+
}
|
127 |
+
if (isset($_POST['eM_minHeight'])) {
|
128 |
+
$eM_Options['minHeight'] = $_POST['eM_minHeight'];
|
129 |
+
}
|
130 |
+
if (isset($_POST['eM_maxHeight'])) {
|
131 |
+
$eM_Options['maxHeight'] = $_POST['eM_maxHeight'];
|
132 |
+
}
|
133 |
+
if (isset($_POST['eM_minWidth'])) {
|
134 |
+
$eM_Options['minWidth'] = $_POST['eM_minWidth'];
|
135 |
+
}
|
136 |
+
if (isset($_POST['eM_maxWidth'])) {
|
137 |
+
$eM_Options['maxWidth'] = $_POST['eM_maxWidth'];
|
138 |
+
}
|
139 |
+
$eM_Options = stripslashes_deep($eM_Options);
|
140 |
+
update_option($this->adminOptionsName, $eM_Options);?>
|
141 |
+
<div class="updated"><p><strong><?php _e('Settings Updated','easy-modal')?>.</strong></p></div><?php
|
142 |
+
} ?>
|
143 |
+
<div id="poststuff" class="metabox-holder has-right-sidebar wrap" style="width:600px;">
|
144 |
+
<form method="post" action="<?php echo $_SERVER["REQUEST_URI"];?>">
|
145 |
+
<h2><?php _e('Easy Modal','easy-modal')?></h2>
|
146 |
+
<div class="postbox">
|
147 |
+
<h3><?php _e('Modal','easy-modal')?></h3>
|
148 |
+
<div class="inside">
|
149 |
+
<h4><?php _e('Title','easy-modal')?></h4>
|
150 |
+
<p><input type="text" name="eM_title" value="<?php echo $eM_Options['title'];?>" /></p>
|
151 |
+
<h4 style="display:inline-block;"><?php _e('Content','easy-modal');?></h4> - <h5 style="display:inline-block;"><?php _e('Can contain shortcodes','easy-modal')?></h5>
|
152 |
+
<p><textarea name="eM_content" style="width: 80%; height: 100px;"><?php echo $eM_Options['content']?></textarea></p>
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
<div class="postbox">
|
156 |
+
<h3><?php _e('Overlay Options','easy-modal')?></h3>
|
157 |
+
<div class="inside">
|
158 |
+
<h4><?php _e('CSS Id','easy-modal')?></h4>
|
159 |
+
<p><input type="text" name="eM_overlayId" value="<?php echo $eM_Options['overlayId']?>" /></p>
|
160 |
+
<h4><?php _e('CSS Styles', 'easy-modal');?></h4>
|
161 |
+
<p><input type="text" name="eM_overlayCss" value="<?php echo $eM_Options['overlayCss']?>" /></p>
|
162 |
+
<h4><?php _e('Opacity', 'easy-modal');?></h4>
|
163 |
+
<p><input type="text" name="eM_opacity" value="<?php echo $eM_Options['opacity']?>" /></p>
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
<div class="postbox">
|
167 |
+
<h3><?php _e('Container Options','easy-modal')?></h3>
|
168 |
+
<div class="inside">
|
169 |
+
<h4><?php _e('CSS Id','easy-modal')?></h4>
|
170 |
+
<p><input type="text" name="eM_containerId" value="<?php echo $eM_Options['containerId']?>" /></p>
|
171 |
+
<h4></h4>
|
172 |
+
<p></p>
|
173 |
+
<h4><?php _e('Height','easy-modal')?></h4>
|
174 |
+
<p><?php _e('Min','easy-modal')?>: <input type="text" name="eM_minHeight" value="<?php echo $eM_Options['minHeight']?>" /> <?php _e('Max','easy-modal')?>: <input type="text" name="eM_maxHeight" value="<?php echo $eM_Options['maxHeight']?>" /></p>
|
175 |
+
<h4><?php _e('Width','easy-modal')?></h4>
|
176 |
+
<p><?php _e('Min','easy-modal')?>: <input type="text" name="eM_minWidth" value="<?php echo $eM_Options['minWidth']?>" /> <?php _e('Max','easy-modal')?>: <input type="text" name="eM_maxWidth" value="<?php echo $eM_Options['maxWidth']?>" /></p>
|
177 |
+
</div>
|
178 |
+
</div>
|
179 |
+
<div class="submit">
|
180 |
+
<input type="submit" name="update_eM_settings" value="<?php _e('Update Settings','easy-modal')?>" />
|
181 |
+
</div>
|
182 |
+
</form>
|
183 |
+
</div><?php
|
184 |
+
}//End function printAdminPage()
|
185 |
+
|
186 |
+
}
|
187 |
+
$eM = new easy_modal;
|
188 |
+
register_activation_hook(__FILE__, array(&$eM, 'init'));
|
189 |
+
|
190 |
+
//Initialize the admin panel
|
191 |
+
if (!function_exists("easy_modal_ap")) {
|
192 |
+
function easy_modal_ap() {
|
193 |
+
global $eM;
|
194 |
+
if (!isset($eM)) {
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
if (function_exists('add_options_page')) {
|
198 |
+
add_options_page('Easy Modal', 'Easy Modal', 10, basename(__FILE__), array(&$eM, 'printAdminPage'));
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
add_action('admin_menu', 'easy_modal_ap');
|
203 |
+
|
204 |
+
|
205 |
+
// Initialize i18n Support
|
206 |
+
add_action( 'init', 'easy_modal_i18n' );
|
207 |
+
if(!function_exists(easy_modal_i18n)){
|
208 |
+
function easy_modal_i18n() {
|
209 |
+
load_plugin_textdomain( 'easy-modal', false, 'easy-modal/languages' );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
?>
|
js/easy-modal.js
ADDED
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Easy Modal
|
3 |
+
* http://wizardinternetsolutions.com/project/easy-modal/
|
4 |
+
*
|
5 |
+
* Copyright (c) 2011 Wizard Internet Solutions
|
6 |
+
* http://wizardinternetsolutions.com
|
7 |
+
*
|
8 |
+
* Licensed under the MIT license:
|
9 |
+
* http://www.opensource.org/licenses/mit-license.php
|
10 |
+
*/
|
11 |
+
eM_plugin_url = convertEntities(eMSettings.plugin_url);
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
eM_overlayId = convertEntities(eMSettings.overlayId);
|
16 |
+
eM_overlayCss = convertEntities(eMSettings.overlayCss);
|
17 |
+
eM_opacity = convertEntities(eMSettings.opacity);
|
18 |
+
|
19 |
+
eM_containerId = convertEntities(eMSettings.containerId);
|
20 |
+
eM_minHeight = convertEntities(eMSettings.minHeight);
|
21 |
+
eM_maxHeight = convertEntities(eMSettings.maxHeight);
|
22 |
+
eM_minWidth = convertEntities(eMSettings.minWidth);
|
23 |
+
eM_maxWidth = convertEntities(eMSettings.maxWidth);
|
24 |
+
|
25 |
+
|
26 |
+
eM_cf7form = convertEntities(eMSettings.cf7form);
|
27 |
+
|
28 |
+
|
29 |
+
jQuery(function ($) {
|
30 |
+
var contact = {
|
31 |
+
message: null,
|
32 |
+
init: function () {
|
33 |
+
$('.eModal').click(function (e) {
|
34 |
+
e.preventDefault();
|
35 |
+
// load the contact form using ajax
|
36 |
+
|
37 |
+
$.get("/wp-content/plugins/easy-modal/content/content.php?plugin_url=" + eM_plugin_url, function(data){
|
38 |
+
// create a modal dialog with the data
|
39 |
+
$(data).modal({
|
40 |
+
closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
|
41 |
+
position: ["15%",],
|
42 |
+
overlayId: eM_overlayId,
|
43 |
+
overlayCss: eM_overlayCss,
|
44 |
+
opacity : eM_opacity,
|
45 |
+
containerId: eM_containerId,
|
46 |
+
minHeight: eM_minHeight,
|
47 |
+
maxHeight: eM_maxHeight,
|
48 |
+
minWidth: eM_minWidth,
|
49 |
+
maxWidth: eM_maxWidth,
|
50 |
+
onOpen: contact.open,
|
51 |
+
onShow: contact.show,
|
52 |
+
onClose: contact.close
|
53 |
+
});
|
54 |
+
});
|
55 |
+
});
|
56 |
+
},
|
57 |
+
open: function (dialog) {
|
58 |
+
// add padding to the buttons in firefox/mozilla
|
59 |
+
if ($.browser.mozilla) {
|
60 |
+
$('#eM-container .contact-button').css({
|
61 |
+
'padding-bottom': '2px'
|
62 |
+
});
|
63 |
+
}
|
64 |
+
// input field font size
|
65 |
+
if ($.browser.safari) {
|
66 |
+
$('#eM-container .contact-input').css({
|
67 |
+
'font-size': '.9em'
|
68 |
+
});
|
69 |
+
}
|
70 |
+
|
71 |
+
// dynamically determine height
|
72 |
+
var h = 280;
|
73 |
+
if ($('#eM-subject').length) {
|
74 |
+
h += 26;
|
75 |
+
}
|
76 |
+
if ($('#eM-cc').length) {
|
77 |
+
h += 22;
|
78 |
+
}
|
79 |
+
|
80 |
+
var title = $('#eM-container .contact-title').html();
|
81 |
+
$('#eM-container .contact-title').html('Loading...');
|
82 |
+
dialog.overlay.fadeIn(200, function () {
|
83 |
+
dialog.container.fadeIn(200, function () {
|
84 |
+
dialog.data.fadeIn(200, function () {
|
85 |
+
$('#eM-container .contact-content').animate({
|
86 |
+
height: h
|
87 |
+
}, function () {
|
88 |
+
$('#eM-container .contact-title').html(title);
|
89 |
+
$('#eM-container form').fadeIn(200, function () {
|
90 |
+
$('#eM-container #eM-name').focus();
|
91 |
+
|
92 |
+
$('#eM-container .contact-cc').click(function () {
|
93 |
+
var cc = $('#eM-container #eM-cc');
|
94 |
+
cc.is(':checked') ? cc.attr('checked', '') : cc.attr('checked', 'checked');
|
95 |
+
});
|
96 |
+
|
97 |
+
// fix png's for IE 6
|
98 |
+
if ($.browser.msie && $.browser.version < 7) {
|
99 |
+
$('#eM-container .contact-button').each(function () {
|
100 |
+
if ($(this).css('backgroundImage').match(/^url[("']+(.*\.png)[)"']+$/i)) {
|
101 |
+
var src = RegExp.$1;
|
102 |
+
$(this).css({
|
103 |
+
backgroundImage: 'none',
|
104 |
+
filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '", sizingMethod="crop")'
|
105 |
+
});
|
106 |
+
}
|
107 |
+
});
|
108 |
+
}
|
109 |
+
});
|
110 |
+
});
|
111 |
+
});
|
112 |
+
});
|
113 |
+
});
|
114 |
+
},
|
115 |
+
show: function (dialog) {
|
116 |
+
if(eM_cf7form == true){
|
117 |
+
$('div.wpcf7 > form').ajaxForm({
|
118 |
+
|
119 |
+
beforeSubmit: function(formData, jqForm, options) {
|
120 |
+
|
121 |
+
jqForm.wpcf7ClearResponseOutput();
|
122 |
+
|
123 |
+
jqForm.find('img.ajax-loader').css({ visibility: 'visible' });
|
124 |
+
|
125 |
+
return true;
|
126 |
+
|
127 |
+
},
|
128 |
+
|
129 |
+
beforeSerialize: function(jqForm, options) {
|
130 |
+
|
131 |
+
jqForm.find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
|
132 |
+
|
133 |
+
$(n).val('');
|
134 |
+
|
135 |
+
});
|
136 |
+
|
137 |
+
return true;
|
138 |
+
|
139 |
+
},
|
140 |
+
|
141 |
+
data: { '_wpcf7_is_ajax_call': 1 },
|
142 |
+
|
143 |
+
dataType: 'json',
|
144 |
+
|
145 |
+
success: function(data) {
|
146 |
+
|
147 |
+
var ro = $(data.into).find('div.wpcf7-response-output');
|
148 |
+
|
149 |
+
$(data.into).wpcf7ClearResponseOutput();
|
150 |
+
|
151 |
+
|
152 |
+
|
153 |
+
if (data.invalids) {
|
154 |
+
|
155 |
+
$.each(data.invalids, function(i, n) {
|
156 |
+
|
157 |
+
$(data.into).find(n.into).wpcf7NotValidTip(n.message);
|
158 |
+
|
159 |
+
});
|
160 |
+
|
161 |
+
ro.addClass('wpcf7-validation-errors');
|
162 |
+
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
if (data.captcha)
|
168 |
+
|
169 |
+
$(data.into).wpcf7RefillCaptcha(data.captcha);
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
if (data.quiz)
|
174 |
+
|
175 |
+
$(data.into).wpcf7RefillQuiz(data.quiz);
|
176 |
+
|
177 |
+
|
178 |
+
|
179 |
+
if (1 == data.spam)
|
180 |
+
|
181 |
+
ro.addClass('wpcf7-spam-blocked');
|
182 |
+
|
183 |
+
|
184 |
+
|
185 |
+
if (1 == data.mailSent) {
|
186 |
+
|
187 |
+
$(data.into).find('form').resetForm().clearForm();
|
188 |
+
|
189 |
+
ro.addClass('wpcf7-mail-sent-ok');
|
190 |
+
|
191 |
+
|
192 |
+
|
193 |
+
if (data.onSentOk)
|
194 |
+
|
195 |
+
$.each(data.onSentOk, function(i, n) { eval(n) });
|
196 |
+
|
197 |
+
} else {
|
198 |
+
|
199 |
+
ro.addClass('wpcf7-mail-sent-ng');
|
200 |
+
|
201 |
+
}
|
202 |
+
|
203 |
+
|
204 |
+
|
205 |
+
if (data.onSubmit)
|
206 |
+
|
207 |
+
$.each(data.onSubmit, function(i, n) { eval(n) });
|
208 |
+
|
209 |
+
|
210 |
+
|
211 |
+
$(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
|
212 |
+
|
213 |
+
$(n).val($(n).attr('title'));
|
214 |
+
|
215 |
+
});
|
216 |
+
|
217 |
+
|
218 |
+
|
219 |
+
ro.append(data.message).slideDown('fast');
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
});
|
224 |
+
}
|
225 |
+
},
|
226 |
+
close: function (dialog) {
|
227 |
+
$('#eM-container').fadeOut();
|
228 |
+
$('#eM-container .eM-content').animate({
|
229 |
+
height: 40
|
230 |
+
}, function () {
|
231 |
+
dialog.data.fadeOut(200, function () {
|
232 |
+
dialog.container.fadeOut(200, function () {
|
233 |
+
dialog.overlay.fadeOut(200, function () {
|
234 |
+
$.modal.close();
|
235 |
+
});
|
236 |
+
});
|
237 |
+
});
|
238 |
+
});
|
239 |
+
},
|
240 |
+
};
|
241 |
+
|
242 |
+
contact.init();
|
243 |
+
|
244 |
+
});
|
js/jquery.simplemodal.js
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* SimpleModal 1.4.1 - jQuery Plugin
|
3 |
+
* http://www.ericmmartin.com/projects/simplemodal/
|
4 |
+
* Copyright (c) 2010 Eric Martin (http://twitter.com/ericmmartin)
|
5 |
+
* Dual licensed under the MIT and GPL licenses
|
6 |
+
* Revision: $Id: jquery.simplemodal.js 259 2010-11-05 05:53:13Z emartin24 $
|
7 |
+
*/
|
8 |
+
(function(d){var k=d.browser.msie&&parseInt(d.browser.version)===6&&typeof window.XMLHttpRequest!=="object",m=d.browser.msie&&parseInt(d.browser.version)===7,l=null,f=[];d.modal=function(a,b){return d.modal.impl.init(a,b)};d.modal.close=function(){d.modal.impl.close()};d.modal.focus=function(a){d.modal.impl.focus(a)};d.modal.setContainerDimensions=function(){d.modal.impl.setContainerDimensions()};d.modal.setPosition=function(){d.modal.impl.setPosition()};d.modal.update=function(a,b){d.modal.impl.update(a,
|
9 |
+
b)};d.fn.modal=function(a){return d.modal.impl.init(this,a)};d.modal.defaults={appendTo:"body",focus:true,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:false,autoPosition:true,zIndex:1E3,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",escClose:true,overlayClose:false,position:null,
|
10 |
+
persist:false,modal:true,onOpen:null,onShow:null,onClose:null};d.modal.impl={d:{},init:function(a,b){var c=this;if(c.d.data)return false;l=d.browser.msie&&!d.boxModel;c.o=d.extend({},d.modal.defaults,b);c.zIndex=c.o.zIndex;c.occb=false;if(typeof a==="object"){a=a instanceof jQuery?a:d(a);c.d.placeholder=false;if(a.parent().parent().size()>0){a.before(d("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"}));c.d.placeholder=true;c.display=a.css("display");if(!c.o.persist)c.d.orig=
|
11 |
+
a.clone(true)}}else if(typeof a==="string"||typeof a==="number")a=d("<div></div>").html(a);else{alert("SimpleModal Error: Unsupported data type: "+typeof a);return c}c.create(a);c.open();d.isFunction(c.o.onShow)&&c.o.onShow.apply(c,[c.d]);return c},create:function(a){var b=this;f=b.getDimensions();if(b.o.modal&&k)b.d.iframe=d('<iframe src="javascript:false;"></iframe>').css(d.extend(b.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:f[0],width:f[1],zIndex:b.o.zIndex,top:0,left:0})).appendTo(b.o.appendTo);
|
12 |
+
b.d.overlay=d("<div></div>").attr("id",b.o.overlayId).addClass("simplemodal-overlay").css(d.extend(b.o.overlayCss,{display:"none",opacity:b.o.opacity/100,height:b.o.modal?f[0]:0,width:b.o.modal?f[1]:0,position:"fixed",left:0,top:0,zIndex:b.o.zIndex+1})).appendTo(b.o.appendTo);b.d.container=d("<div></div>").attr("id",b.o.containerId).addClass("simplemodal-container").css(d.extend(b.o.containerCss,{display:"none",position:"fixed",zIndex:b.o.zIndex+2})).append(b.o.close&&b.o.closeHTML?d(b.o.closeHTML).addClass(b.o.closeClass):
|
13 |
+
"").appendTo(b.o.appendTo);b.d.wrap=d("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(b.d.container);b.d.data=a.attr("id",a.attr("id")||b.o.dataId).addClass("simplemodal-data").css(d.extend(b.o.dataCss,{display:"none"})).appendTo("body");b.setContainerDimensions();b.d.data.appendTo(b.d.wrap);if(k||l)b.fixIE()},bindEvents:function(){var a=this;d("."+a.o.closeClass).bind("click.simplemodal",function(b){b.preventDefault();a.close()});
|
14 |
+
a.o.modal&&a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(b){b.preventDefault();a.close()});d(document).bind("keydown.simplemodal",function(b){if(a.o.modal&&b.keyCode===9)a.watchTab(b);else if(a.o.close&&a.o.escClose&&b.keyCode===27){b.preventDefault();a.close()}});d(window).bind("resize.simplemodal",function(){f=a.getDimensions();a.o.autoResize?a.setContainerDimensions():a.o.autoPosition&&a.setPosition();if(k||l)a.fixIE();else if(a.o.modal){a.d.iframe&&a.d.iframe.css({height:f[0],
|
15 |
+
width:f[1]});a.d.overlay.css({height:f[0],width:f[1]})}})},unbindEvents:function(){d("."+this.o.closeClass).unbind("click.simplemodal");d(document).unbind("keydown.simplemodal");d(window).unbind("resize.simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this,b=a.o.position;d.each([a.d.iframe||null,!a.o.modal?null:a.d.overlay,a.d.container],function(c,h){if(h){var g=h[0].style;g.position="absolute";if(c<2){g.removeExpression("height");g.removeExpression("width");g.setExpression("height",
|
16 |
+
'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"');g.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"')}else{var e;if(b&&b.constructor===Array){c=b[0]?typeof b[0]==="number"?b[0].toString():b[0].replace(/px/,""):h.css("top").replace(/px/,"");c=c.indexOf("%")===-1?c+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"':
|
17 |
+
parseInt(c.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"';if(b[1]){e=typeof b[1]==="number"?b[1].toString():b[1].replace(/px/,"");e=e.indexOf("%")===-1?e+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':parseInt(e.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'}}else{c=
|
18 |
+
'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"';e='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'}g.removeExpression("top");g.removeExpression("left");g.setExpression("top",
|
19 |
+
c);g.setExpression("left",e)}}})},focus:function(a){var b=this;a=a&&d.inArray(a,["first","last"])!==-1?a:"first";var c=d(":input:enabled:visible:"+a,b.d.wrap);setTimeout(function(){c.length>0?c.focus():b.d.wrap.focus()},10)},getDimensions:function(){var a=d(window);return[d.browser.opera&&d.browser.version>"9.5"&&d.fn.jquery<"1.3"||d.browser.opera&&d.browser.version<"9.5"&&d.fn.jquery>"1.2.6"?a[0].innerHeight:a.height(),a.width()]},getVal:function(a,b){return a?typeof a==="number"?a:a==="auto"?0:
|
20 |
+
a.indexOf("%")>0?parseInt(a.replace(/%/,""))/100*(b==="h"?f[0]:f[1]):parseInt(a.replace(/px/,"")):null},update:function(a,b){var c=this;if(!c.d.data)return false;c.d.origHeight=c.getVal(a,"h");c.d.origWidth=c.getVal(b,"w");c.d.data.hide();a&&c.d.container.css("height",a);b&&c.d.container.css("width",b);c.setContainerDimensions();c.d.data.show();c.o.focus&&c.focus();c.unbindEvents();c.bindEvents()},setContainerDimensions:function(){var a=this,b=k||m,c=a.d.origHeight?a.d.origHeight:d.browser.opera?
|
21 |
+
a.d.container.height():a.getVal(b?a.d.container[0].currentStyle.height:a.d.container.css("height"),"h");b=a.d.origWidth?a.d.origWidth:d.browser.opera?a.d.container.width():a.getVal(b?a.d.container[0].currentStyle.width:a.d.container.css("width"),"w");var h=a.d.data.outerHeight(true),g=a.d.data.outerWidth(true);a.d.origHeight=a.d.origHeight||c;a.d.origWidth=a.d.origWidth||b;var e=a.o.maxHeight?a.getVal(a.o.maxHeight,"h"):null,i=a.o.maxWidth?a.getVal(a.o.maxWidth,"w"):null;e=e&&e<f[0]?e:f[0];i=i&&i<
|
22 |
+
f[1]?i:f[1];var j=a.o.minHeight?a.getVal(a.o.minHeight,"h"):"auto";c=c?a.o.autoResize&&c>e?e:c<j?j:c:h?h>e?e:a.o.minHeight&&j!=="auto"&&h<j?j:h:j;e=a.o.minWidth?a.getVal(a.o.minWidth,"w"):"auto";b=b?a.o.autoResize&&b>i?i:b<e?e:b:g?g>i?i:a.o.minWidth&&e!=="auto"&&g<e?e:g:e;a.d.container.css({height:c,width:b});a.d.wrap.css({overflow:h>c||g>b?"auto":"visible"});a.o.autoPosition&&a.setPosition()},setPosition:function(){var a=this,b,c;b=f[0]/2-a.d.container.outerHeight(true)/2;c=f[1]/2-a.d.container.outerWidth(true)/
|
23 |
+
2;if(a.o.position&&Object.prototype.toString.call(a.o.position)==="[object Array]"){b=a.o.position[0]||b;c=a.o.position[1]||c}else{b=b;c=c}a.d.container.css({left:c,top:b})},watchTab:function(a){var b=this;if(d(a.target).parents(".simplemodal-container").length>0){b.inputs=d(":input:enabled:visible:first, :input:enabled:visible:last",b.d.data[0]);if(!a.shiftKey&&a.target===b.inputs[b.inputs.length-1]||a.shiftKey&&a.target===b.inputs[0]||b.inputs.length===0){a.preventDefault();b.focus(a.shiftKey?"last":
|
24 |
+
"first")}}else{a.preventDefault();b.focus()}},open:function(){var a=this;a.d.iframe&&a.d.iframe.show();if(d.isFunction(a.o.onOpen))a.o.onOpen.apply(a,[a.d]);else{a.d.overlay.show();a.d.container.show();a.d.data.show()}a.o.focus&&a.focus();a.bindEvents()},close:function(){var a=this;if(!a.d.data)return false;a.unbindEvents();if(d.isFunction(a.o.onClose)&&!a.occb){a.occb=true;a.o.onClose.apply(a,[a.d])}else{if(a.d.placeholder){var b=d("#simplemodal-placeholder");if(a.o.persist)b.replaceWith(a.d.data.removeClass("simplemodal-data").css("display",
|
25 |
+
a.display));else{a.d.data.hide().remove();b.replaceWith(a.d.orig)}}else a.d.data.hide().remove();a.d.container.hide().remove();a.d.overlay.hide();a.d.iframe&&a.d.iframe.hide().remove();setTimeout(function(){a.d.overlay.remove();a.d={}},10)}}}})(jQuery);
|
readme.txt
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Easy Modal ===
|
2 |
+
Contributors: danieliser
|
3 |
+
Donate link: http://wizardinternetsolutions.com/
|
4 |
+
Tags: modal, contact form 7, ajax
|
5 |
+
Requires at least: 3.0.1
|
6 |
+
Tested up to: 3.1.3
|
7 |
+
Stable tag: 0.9.0.1
|
8 |
+
|
9 |
+
This plugin allows you to easily add a Modal window with just about any content. It accepts shortcodes and has been tested to work with Contact Form 7 custom forms using ajax submission.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This plugin allows you to easily add a Modal window with just about any content. It accepts shortcodes and has been tested to work with Contact Form 7 custom forms using ajax submission.
|
14 |
+
|
15 |
+
If you like the plugin please rate it.
|
16 |
+
|
17 |
+
|
18 |
+
[easyModal Page](http://wizardinternetsolutions.com/plugins/easy-modal/ "easyModal Page - Info, Demo and Discussion") - Info, Demo and Discussion
|
19 |
+
|
20 |
+
[Wizard Internet Solutions](http://wizardinternetsolutions.com/ "Website Design & Development") - Developers Site
|
21 |
+
|
22 |
+
== Installation ==
|
23 |
+
|
24 |
+
1. Upload `easy-Modal` folder to the `/wp-content/plugins/` directory
|
25 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
26 |
+
3. Add `eModal` class to the object you want to make activate the modal window. Will work on divs, links, list elements and just about anything else.
|
27 |
+
|
28 |
+
== Frequently Asked Questions ==
|
29 |
+
|
30 |
+
= Does this work with CF7 =
|
31 |
+
|
32 |
+
Yes, this will work with any custom form shortcode and uses ajax submit features.
|
33 |
+
|
34 |
+
= Is the form styled =
|
35 |
+
|
36 |
+
We have only included some basic styling for the modal at this point. We will be adding more features to customize the look and feel of the plugin and modal windows in upcoming versions. For now you can add styles to your themes styles.css or add them to the head via plugin.
|
37 |
+
|
38 |
+
== Screenshots ==
|
39 |
+
|
40 |
+
1. easy-Modal Example used on our site.
|
41 |
+
|
42 |
+
== Changelog ==
|
43 |
+
|
44 |
+
= 0.9.0.1 =
|
45 |
+
* Added Height & Width options.
|
46 |
+
|
47 |
+
= 0.9 =
|
48 |
+
* Initial Release
|
49 |
+
|
50 |
+
|
51 |
+
== Upgrade Notice ==
|
52 |
+
|
53 |
+
= 0.9 =
|
54 |
+
* Initial Release
|