PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/Ultimate_VC_Addons/admin/smooth-scroll-setting.php

https://gitlab.com/ezgonzalez/integral
PHP | 300 lines | 279 code | 13 blank | 8 comment | 14 complexity | a72f82f6bf56b58ac41d721696255f5e MD5 | raw file
  1. <?php
  2. if(isset($_GET['author']))
  3. $author = true;
  4. else
  5. $author = false;
  6. $author_extend = '';
  7. if($author)
  8. $author_extend = '&author';
  9. ?>
  10. <div class="wrap about-wrap bsf-page-wrapper ultimate-smooth-scroll bend">
  11. <div class="wrap-container">
  12. <div class="bend-heading-section ultimate-header">
  13. <h1><?php _e( "Ultimate Addons Settings", "ultimate_vc" ); ?></h1>
  14. <h3><?php _e( "The smooth scroll will change the built-in scroll effect of browsers. It is mostly used in combination with parallax effects.", "ultimate_vc" ); ?></h3>
  15. <div class="bend-head-logo">
  16. <div class="bend-product-ver">
  17. <?php _e( "Version", "ultimate_vc" ); echo ' '.ULTIMATE_VERSION; ?>
  18. </div>
  19. </div>
  20. </div><!-- bend-heading section -->
  21. <div id="msg"></div>
  22. <div id="bsf-message"></div>
  23. <div class="bend-content-wrap">
  24. <div class="smile-settings-wrapper">
  25. <h2 class="nav-tab-wrapper">
  26. <a href="<?php echo admin_url('admin.php?page=about-ultimate'.$author_extend); ?>" data-tab="about-ultimate" class="nav-tab"> <?php echo __('About','ultimate_vc'); ?> </a>
  27. <a href="<?php echo admin_url('admin.php?page=ultimate-dashboard'.$author_extend); ?>" data-tab="ultimate-modules" class="nav-tab"> <?php echo __('Modules','ultimate_vc'); ?> </a>
  28. <a href="<?php echo admin_url('admin.php?page=ultimate-smoothscroll'.$author_extend); ?>" data-tab="css-settings" class="nav-tab nav-tab-active"> <?php echo __('Smooth Scroll','ultimate_vc'); ?> </a>
  29. <a href="<?php echo admin_url('admin.php?page=ultimate-scripts-and-styles'.$author_extend); ?>" data-tab="css-settings" class="nav-tab"> <?php echo __('Scripts and Styles','ultimate_vc'); ?> </a>
  30. <?php if($author) : ?>
  31. <a href="<?php echo admin_url('admin.php?page=ultimate-debug-settings'); ?>" data-tab="ultimate-debug" class="nav-tab"> Debug </a>
  32. <?php endif; ?>
  33. </h2>
  34. </div><!-- smile-settings-wrapper -->
  35. </hr>
  36. <div class="container ultimate-content">
  37. <div class="col-md-12">
  38. <?php
  39. $ultimate_smooth_scroll = get_option('ultimate_smooth_scroll');
  40. $ultimate_smooth_scroll_options = get_option('ultimate_smooth_scroll_options');
  41. $checked = '';
  42. if($ultimate_smooth_scroll == "enable"){
  43. $ultimate_smooth_scroll_attr = 'checked="checked"';
  44. } else {
  45. $ultimate_smooth_scroll_attr = '';
  46. }
  47. ?>
  48. <div id="ultimate-settings" class="ult-tabs active-tab">
  49. <form method="post" id="ultimate_settings">
  50. <input type="hidden" name="action" value="update_ultimate_options" />
  51. <table class="form-table">
  52. <tbody>
  53. <tr valign="top">
  54. <th scope="row"><?php echo __("Smooth Scroll","ultimate_vc"); ?></th>
  55. <td>
  56. <div class="onoffswitch">
  57. <input type="checkbox" <?php echo $ultimate_smooth_scroll_attr; ?> id="ultimate_smooth_scroll" value="enable" class="onoffswitch-checkbox" name="ultimate_smooth_scroll" />
  58. <label class="onoffswitch-label" for="ultimate_smooth_scroll">
  59. <div class="onoffswitch-inner">
  60. <div class="onoffswitch-active">
  61. <div class="onoffswitch-switch"><?php echo __('ON','ultimate_vc'); ?></div>
  62. </div>
  63. <div class="onoffswitch-inactive">
  64. <div class="onoffswitch-switch"><?php echo __('OFF','ultimate_vc'); ?></div>
  65. </div>
  66. </div>
  67. </label>
  68. </div>
  69. </td>
  70. </tr>
  71. <tr class="ult-smooth-options" style="<?php echo ($ultimate_smooth_scroll !== 'enable') ? 'display:none' : '' ?>">
  72. <th><label>Step: </label></th>
  73. <td>
  74. <div id="ult-smooth-options" >
  75. <div>
  76. <input type="text" name="ultimate_smooth_scroll_options[step]" value="<?php echo (isset($ultimate_smooth_scroll_options['step'])) ? $ultimate_smooth_scroll_options['step'] : '' ?>" placeholder="80" />
  77. <span class="dashicons dashicons-editor-help bsf-has-tip" title="The speed of the scrolling effect with a mouse wheel." data-position="right"></span>
  78. </div>
  79. </div>
  80. </td>
  81. </tr>
  82. <tr class="ult-smooth-options" style="<?php echo ($ultimate_smooth_scroll !== 'enable') ? 'display:none' : '' ?>">
  83. <th><label>Scroll Speed: </label></th>
  84. <td>
  85. <div id="ult-smooth-options">
  86. <div>
  87. <input type="text" name="ultimate_smooth_scroll_options[speed]" value="<?php echo (isset($ultimate_smooth_scroll_options['speed'])) ? $ultimate_smooth_scroll_options['speed'] : '' ?>" placeholder="480" />
  88. <span class="dashicons dashicons-editor-help bsf-has-tip" title="The speed of the scrolling effect." data-position="right"></span>
  89. </div>
  90. </div>
  91. </td>
  92. </tr>
  93. </tbody>
  94. </table>
  95. </form>
  96. <p class="submit"><input type="submit" name="submit" id="submit-settings" class="button button-primary" value="<?php echo __("Save Changes","ultimate");?>"></p>
  97. </div>
  98. </div> <!--col-md-12 -->
  99. </div> <!-- ultimate-content -->
  100. </div> <!-- bend-content-wrap -->
  101. </div> <!-- .wrap-container -->
  102. </div> <!-- .bend -->
  103. <script type="text/javascript">
  104. var submit_btn = jQuery("#submit-settings");
  105. submit_btn.bind('click',function(e){
  106. e.preventDefault();
  107. var data = jQuery("#ultimate_settings").serialize();
  108. console.log(data);
  109. jQuery.ajax({
  110. url: ajaxurl,
  111. data: data,
  112. dataType: 'html',
  113. type: 'post',
  114. success: function(result){
  115. result = jQuery.trim(result);
  116. console.log(result);
  117. if(result == "success"){
  118. jQuery("#msg").html('<div class="updated"><p><?php echo __('Settings updated successfully!','ultimate_vc'); ?></p></div>');
  119. } else {
  120. jQuery("#msg").html('<div class="error"><p><?php echo __('No settings were updated.','ultimate_vc'); ?></p></div>');
  121. }
  122. }
  123. });
  124. });
  125. jQuery(document).ready(function(e) {
  126. jQuery('.onoffswitch').on('onUltimateSwitchClick',function(){
  127. setTimeout(function(){
  128. var is_smooth_scroll = (jQuery('#ultimate_smooth_scroll').is(':checked')) ? true : false;
  129. var is_smooth_scroll_compatible = (jQuery('#ultimate_smooth_scroll_compatible').is(':checked')) ? true : false;
  130. if(is_smooth_scroll) {
  131. if(!is_smooth_scroll_compatible) {
  132. jQuery('.ult-smooth-options').fadeIn(200);
  133. }
  134. else {
  135. jQuery('.ult-smooth-options').fadeOut(200);
  136. }
  137. }
  138. else {
  139. jQuery('.ult-smooth-options').fadeOut(200);
  140. }
  141. },300);
  142. });
  143. jQuery('.onoffswitch').click(function(){
  144. $switch = jQuery(this);
  145. setTimeout(function(){
  146. if($switch.find('.onoffswitch-checkbox').is(':checked'))
  147. $switch.find('.onoffswitch-checkbox').attr('checked',false);
  148. else
  149. $switch.find('.onoffswitch-checkbox').attr('checked',true);
  150. $switch.trigger('onUltimateSwitchClick');
  151. },300);
  152. });
  153. });
  154. </script>
  155. <style type="text/css">
  156. /*On Off Checkbox Switch*/
  157. .onoffswitch {
  158. position: relative;
  159. width: 95px;
  160. display: inline-block;
  161. float: left;
  162. margin-right: 15px;
  163. -webkit-user-select:none;
  164. -moz-user-select:none;
  165. -ms-user-select: none;
  166. }
  167. .onoffswitch-checkbox {
  168. display: none !important;
  169. }
  170. .onoffswitch-label {
  171. display: block;
  172. overflow: hidden;
  173. cursor: pointer;
  174. border: 0px solid #999999;
  175. border-radius: 0px;
  176. }
  177. .onoffswitch-inner {
  178. width: 200%;
  179. margin-left: -100%;
  180. -moz-transition: margin 0.3s ease-in 0s;
  181. -webkit-transition: margin 0.3s ease-in 0s;
  182. -o-transition: margin 0.3s ease-in 0s;
  183. transition: margin 0.3s ease-in 0s;
  184. }
  185. .rtl .onoffswitch-inner{
  186. margin: 0;
  187. }
  188. .rtl .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
  189. margin-right: -100%;
  190. margin-left:auto;
  191. }
  192. .onoffswitch-inner > div {
  193. float: left;
  194. position: relative;
  195. width: 50%;
  196. height: 24px;
  197. padding: 0;
  198. line-height: 24px;
  199. font-size: 12px;
  200. color: white;
  201. font-weight: bold;
  202. -moz-box-sizing: border-box;
  203. -webkit-box-sizing: border-box;
  204. box-sizing: border-box;
  205. }
  206. .onoffswitch-inner .onoffswitch-active {
  207. padding-left: 15px;
  208. background-color: #CCCCCC;
  209. color: #FFFFFF;
  210. }
  211. .onoffswitch-inner .onoffswitch-inactive {
  212. padding-right: 15px;
  213. background-color: #CCCCCC;
  214. color: #FFFFFF;
  215. text-align: right;
  216. }
  217. .onoffswitch-switch {
  218. /*width: 50px;*/
  219. width:35px;
  220. margin: 0px;
  221. text-align: center;
  222. border: 0px solid #999999;
  223. border-radius: 0px;
  224. position: absolute;
  225. top: 0;
  226. bottom: 0;
  227. }
  228. .onoffswitch-active .onoffswitch-switch {
  229. background: #3F9CC7;
  230. left: 0;
  231. }
  232. .onoffswitch-inactive .onoffswitch-switch {
  233. background: #7D7D7D;
  234. right: 0;
  235. }
  236. .onoffswitch-active .onoffswitch-switch:before {
  237. content: " ";
  238. position: absolute;
  239. top: 0;
  240. /*left: 50px;*/
  241. left:35px;
  242. border-style: solid;
  243. border-color: #3F9CC7 transparent transparent #3F9CC7;
  244. /*border-width: 12px 8px;*/
  245. border-width: 15px;
  246. }
  247. .onoffswitch-inactive .onoffswitch-switch:before {
  248. content: " ";
  249. position: absolute;
  250. top: 0;
  251. /*right: 50px;*/
  252. right:35px;
  253. border-style: solid;
  254. border-color: transparent #7D7D7D #7D7D7D transparent;
  255. /*border-width: 12px 8px;*/
  256. border-width: 50px;
  257. }
  258. .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
  259. margin-left: 0;
  260. }
  261. #ultimate-settings, #ultimate-modules, .ult-tabs{ display:none; }
  262. #ultimate-settings.active-tab, #ultimate-modules.active-tab, .ult-tabs.active-tab{ display:block; }
  263. .ult-badge {
  264. padding-bottom: 10px;
  265. height: 170px;
  266. width: 150px;
  267. position: absolute;
  268. border-radius: 3px;
  269. top: 0;
  270. right: 0;
  271. }
  272. div#msg > .updated, div#msg > .error { display:block !important;}
  273. div#msg {
  274. position: absolute;
  275. left: 20px;
  276. top: 140px;
  277. max-width: 30%;
  278. }
  279. .onoffswitch-inner:before,
  280. .onoffswitch-inner:after {
  281. display:none
  282. }
  283. .onoffswitch-switch {
  284. height: initial !important;
  285. color: white !important;
  286. }
  287. </style>