How to use fcp method in wpt

Best JavaScript code snippet using wpt

fitnesscalculators.js

Source:fitnesscalculators.js Github

copy

Full Screen

1<?php 2/*3 * create shortcode with class 4*/5class FcpShortCodes {6 function __construct() {7 8 }9 public static function fcp_water_intake_calculator( $atts, $content = "" ) {10 $fcw_title = __( 'no title', 'fitness-calculators' );11 if(trim(get_option('fcw_heading'))!=false)12 {13 $fcw_title = get_option('fcw_heading'); 14 }15 $fcw_calculator_type = '';16 $placeHolderHeight = '';17 $placeHolderWeight = '';18 if(trim(get_option('fcw_calculator_type'))!=false)19 {20 $fcw_calculator_type = get_option('fcw_calculator_type'); 21 }22 $fcw_theme_color = '#004d99';23 if(trim(get_option('fcw_theme_color'))!=false)24 {25 $fcw_theme_color = get_option('fcw_theme_color'); 26 }27 28 $html = '<style>#fcp-water-intake-form {29 margin: 0px;30 padding: 0px;31 border: solid 2px '.$fcw_theme_color.';32 width: 100%;33 float: left;34 }';35 if($fcw_calculator_type == 'metric') { 36 $html .= '#fcp-water-intake-form .fcp-radio-btn {37 width: 100%;38 }';39 $placeHolderWeight = 'Kilogram'; 40 $placeHolderHeight = 'Centimeter'; 41 }42 43 if($fcw_calculator_type == 'standard') { 44 $html .= '#fcp-water-intake-form .fcp-radio-btn {45 width: 100%;46 }';47 $placeHolderWeight = 'Pound'; 48 $placeHolderHeight = 'Feet'; 49 }50 51 $html .= '#fcp-water-intake-form h3 {52 text-transform: uppercase;53 background-color: '.$fcw_theme_color.';54 padding: 2%;55 color: #fff;56 font-weight: bolder;57 text-align: center;58 margin: 0px;59 }60 #fcp-water-intake-form .fcp-result-string {61 background-color: '.$fcw_theme_color.';62 padding: 1%;63 color: #fff;64 font-size: 20px;65 text-align: center;66 margin: 0px;67 }68 #fcp-water-intake-form .fcp-btn {69 background-color: '.$fcw_theme_color.';70 color: #fff;71 text-transform: uppercase;72 border-radius: 4px;73 border: solid 2px '.$fcw_theme_color.';74 }75 </style><div id="fcp-water-intake-form" class="container">76 <h3><span id="daily_Water_intake_calculator">'.$fcw_title.'</span></h3> 77 <div class="fcp-row">';78 if( $fcw_calculator_type == 'metric' || $fcw_calculator_type == 'both') { 79 $html .= '<div class="fcp-radio-btn fcp-radio-btn-metric">80 <label for="fcp-water-intake-radio-metric">'. __( 'Metric', 'fitness-calculators' ).'</label>81 <input type="radio" id="fcp-water-intake-radio-metric" 82 class="form-control fcp-water-radio" name="fcp-water-intake-radio" 83 checked84 value="metric">85 <span class="fcp-error">require</span>86 </div>';87 }88 if( $fcw_calculator_type == 'standard' || $fcw_calculator_type == 'both') { 89 $html .= '<div class="fcp-radio-btn fcp-radio-btn-standard">90 <label for="fcp-water-intake-radio-imperial">'. __( 'Standard', 'fitness-calculators' ).'</label>91 <input type="radio" id="fcp-water-intake-radio-imperial" 92 class="form-control fcp-water-radio" name="fcp-water-intake-radio" 93 checked94 value="imperial" >95 <span class="fcp-error">require</span>96 </div>';97 } 98 $html .= '<table class="fcp-table">99 <tbody><tr>100 <td>101 <label for="fcp-water-intake-age">'. __( 'Age', 'fitness-calculators' ).'</label>102 <select id="fcp-water-intake-age" class="left form-control" name="fcp-water-intake-age">103 <option value="14-18">14-18</option>104 <option value="19-30">19-30</option>105 <option value="31-50">31-50</option>106 <option value="50+">50+</option>107 </select>108 </td>109 <td>110 <label for="fcp-water-intake-sex">'. __( 'Sex', 'fitness-calculators' ).'</label>111 <select id="fcp-water-intake-sex" class="left form-control" name="fcp-water-intake-sex">112 <option value="male">'. __( 'Male', 'fitness-calculators' ).'</option>113 <option value="female">'. __( 'Female', 'fitness-calculators' ).'</option>114 </select>115 </td>116 </tr>117 <tr>118 <td>119 <label for="fcp-water-intake-height">'. __( 'Height', 'fitness-calculators' ) .'</label>120 <input id="fcp-water-intake-height" pattern="[0-9]" type="text" class="left form-control" 121 name="fcp-water-intake-height" placeholder="'.$placeHolderHeight.'">122 <span id="fcp-water-intake-height-error" class="fcp-error">require</span>123 </td>124 <td>125 <label for="fcp-water-intake-weight">'. __( 'Weight', 'fitness-calculators' ) .'</label>126 <input id="fcp-water-intake-weight" pattern="[0-9]" type="text" class="left form-control" 127 name="fcp-water-intake-weight" placeholder="'. $placeHolderWeight .'">128 <span id="fcp-water-intake-weight-error" class="fcp-error">require</span>129 </td>130 </tr>131 <tr>132 <td>133 <label for="fcp-water-intake-season">'. __( 'Season', 'fitness-calculators' ) .'</label>134 <select id="fcp-water-intake-season" class="left form-control" name="fcp-water-intake-season">135 <option value="winter">'. __( 'Winter', 'fitness-calculators' ).'</option>136 <option value="normal">'. __( 'Normal', 'fitness-calculators' ).'</option>137 <option value="summer">'. __( 'Summer', 'fitness-calculators' ).'</option>138 </select>139 </td>140 <td>141 <label for="fcp-water-intake-activity-level">'. __( 'Activity level', 'fitness-calculators' ) .'</label>142 <select id="fcp-water-intake-activity-level" class="left form-control" name="fcp-water-intake-activity-level">143 <option value="lightly-active">'. __( 'Lightly active', 'fitness-calculators' ).'</option>144 <option value="moderately-active">'. __( 'Moderately active', 'fitness-calculators' ).'</option>145 <option value="very-active">'. __( 'Very Active', 'fitness-calculators' ).'</option>146 </select>147 </td>148 </tr>149 <tr style="text-align: center;"><td colspan="2"><button onclick="fcpCalculateWaterIntake()" class="btn btn-default fcp-btn">'. __( 'Calculate', 'fitness-calculators' ) .'</button></td></tr>150 </tbody></table>151 <p class="fcp-result-string">'. __( 'you should drink ', 'fitness-calculators' ) .'<span class="fcp-calculated-result">......</span> '. __( ' of water per day', 'fitness-calculators' ) .' </p>152 </div>153 </div>';154 return $html;155 }156 public static function fcp_protein_intake_calculator( $atts, $content = "" ) { 157 $fcp_title = __( 'No title', 'fitness-calculators' );158 if(trim(get_option('fcp_heading'))!=false)159 {160 $fcp_title = get_option('fcp_heading'); 161 }162 $fcp_metric_only = '';163 if(trim(get_option('fcp_metric_only'))!=false)164 {165 $fcp_metric_only = get_option('fcp_metric_only'); 166 }167 $fcp_theme_color = '#004d99';168 if(trim(get_option('fcp_theme_color'))!=false)169 {170 $fcp_theme_color = get_option('fcp_theme_color'); 171 }172 $html = '';173 $html .= '<style>174 #fcp-protein-intake-form {175 margin: 0px;176 padding: 0px;177 border: solid 2px '.$fcp_theme_color.';178 width: 100%;179 float: left;180 }';181 if($fcp_metric_only == 'yes') { 182 $html .= '#fcp-protein-intake-form .fcp-radio-btn {183 width: 100%;184 }';185 } 186 $html .= '#fcp-protein-intake-form h3 {187 text-transform: uppercase;188 background-color: '.$fcp_theme_color.';189 padding: 2%;190 color: #fff;191 font-weight: bolder;192 text-align: center;193 margin: 0px;194 }195 196 #fcp-protein-intake-form .fcp-result-string {197 background-color: '.$fcp_theme_color.';198 padding: 1%;199 color: #fff;200 font-size: 20px;201 text-align: center;202 margin: 0px;203 }204 #fcp-protein-intake-form .fcp-btn {205 background-color: '.$fcp_theme_color.';206 color: #fff;207 text-transform: uppercase;208 border-radius: 4px;209 border: solid 2px '.$fcp_theme_color.';210 }211 </style><div id="fcp-protein-intake-form" class="container">212 <h3>'.$fcp_title.'</h3> 213 <div class="fcp-row">214 <div class="fcp-radio-btn fcp-radio-btn-protein-metric">215 <label for="fcp-protein-intake-radio-metric">'. __( 'Metric', 'fitness-calculators' ) .'</label>216 <input type="radio" id="fcp-protein-intake-radio-metric" class="form-control fcp-protein-radio" name="fcp-protein-intake-radio" value="metric">217 <span class="fcp-error">require</span>218 </div>';219 if($fcp_metric_only == 'no') { 220 $html .= '<div class="fcp-radio-btn fcp-radio-btn-protein-standard">221 <label for="fcp-protein-intake-radio-imperial">'. __( 'Standard', 'fitness-calculators' ) .'</label>222 <input type="radio" id="fcp-protein-intake-radio-imperial" class="form-control fcp-protein-radio" name="fcp-protein-intake-radio" value="imperial">223 <span class="fcp-error">require</span>224 </div>';225 }226 227 $html .= '<table class="fcp-table">228 <tr>229 <td>230 <label for="fcp-protein-intake-age">'. __( 'Age', 'fitness-calculators' ) .'</label>231 <input type="text" id="fcp-protein-intake-age" class="left form-control" name="fcp-protein-intake-age" />232 <span id="fcp-protein-intake-age-error" class="fcp-error">'. __( 'age should be in 14 to 80 range', 'fitness-calculators' ) .'</span>233 </td>234 <td>235 <label for="fcp-protein-intake-sex">'. __( 'Sex', 'fitness-calculators' ) .'</label>236 <select id="fcp-protein-intake-sex" class="left form-control" name="fcp-protein-intake-sex">237 <option value="male">'. __( 'Male', 'fitness-calculators' ).'</option>238 <option value="female">'. __( 'Female', 'fitness-calculators' ).'</option>239 </select>240 </td>241 </tr>242 <tr>243 <td>244 <label for="fcp-protein-intake-height">'. __( 'Height', 'fitness-calculators' ) .'</label>245 <input id="fcp-protein-intake-height" pattern="[0-9]" type="text" class="left form-control" id="fcp-protein-intake-height" name="fcp-protein-intake-height" placeholder="Centimeter/Feet" />246 <span id="fcp-protein-intake-height-error" class="fcp-error">require</span>247 </td>248 <td>249 <label for="fcp-protein-intake-weight">'. __( 'Weight', 'fitness-calculators' ) .'</label>250 <input id="fcp-protein-intake-weight" pattern="[0-9]" type="text" class="left form-control" id="fcp-protein-intake-weight" name="fcp-protein-intake-weight" placeholder="Kilogram/Pound" />251 <span id="fcp-protein-intake-weight-error" class="fcp-error">require</span>252 </td>253 </tr>254 <tr>255 <td>256 <label for="fcp-protein-intake-goal">'. __( 'Goal', 'fitness-calculators' ) .'</label>257 <select id="fcp-protein-intake-goal" class="left form-control" name="fcp-protein-intake-goal">258 <option value="fat-loss">'. __( 'Fat loss', 'fitness-calculators' ).'</option>259 <option value="maintenance">'. __( 'Maintenance', 'fitness-calculators' ).'</option>260 <option value="muscle-gain">'. __( 'Muscle gain', 'fitness-calculators' ).'</option>261 </select>262 </td>263 <td>264 <label for="fcp-protein-intake-activity-level">'. __( 'Activity level', 'fitness-calculators' ) .'</label>265 <select id="fcp-protein-intake-activity-level" class="left form-control" name="fcp-protein-intake-activity-level">266 <option value="sedentary">'. __( 'Sedentary', 'fitness-calculators' ).'</option>267 <option value="lightly-active">'. __( 'Lightly Active', 'fitness-calculators' ).'</option>268 <option value="moderately-active">'. __( 'Moderately Active', 'fitness-calculators' ).'</option>269 <option value="very-active">'. __( 'Very Active', 'fitness-calculators' ).'</option>270 </select>271 </td>272 </tr>273 <tr style="text-align: center;"><td colspan="2"><button onclick="fcpCalculateproteinIntake()" class="btn btn-default fcp-btn">'. __( 'Calculate', 'fitness-calculators' ) .'</button></td></tr>274 </table>275 <p class="fcp-result-string">'. __( 'You should take', 'fitness-calculators' ) .' <span class=fcp-protein-calculated-result>......</span> '. __( 'of protein per day', 'fitness-calculators' ) .'</p>276 </div>277 </div>';278 return $html;279 }280 // for BMI calculator281 public static function fcp_bmi_calculator( $atts, $content = "" ) { 282 $fcbmi_title = __( 'no title', 'fitness-calculators' );283 if(trim(get_option('fcbmi_heading'))!=false)284 {285 $fcbmi_title = get_option('fcbmi_heading'); 286 }287 $fcbmi_metric_only = '';288 if(trim(get_option('fcbmi_metric_only'))!=false)289 {290 $fcbmi_metric_only = get_option('fcbmi_metric_only'); 291 }292 $fcbmi_theme_color = '#004d99';293 if(trim(get_option('fcbmi_theme_color'))!=false)294 {295 $fcbmi_theme_color = get_option('fcbmi_theme_color'); 296 }297 $html = '';298 $html .= '<style>299 #fcp-bmi-intake-form {300 margin: 0px;301 padding: 0px;302 border: solid 2px '.$fcbmi_theme_color.';303 width: 100%;304 float: left;305 }';306 307 if($fcbmi_metric_only == 'yes') { 308 $html .= '#fcp-bmi-intake-form .fcp-radio-btn {309 width: 100%;310 }';311 } 312 $html .= '#fcp-bmi-intake-form h3 {313 text-transform: uppercase;314 background-color: '.$fcbmi_theme_color.';315 padding: 2%;316 color: #fff;317 font-weight: bolder;318 text-align: center;319 margin: 0px;320 }321 322 #fcp-bmi-intake-form .fcp-result-string {323 background-color: '.$fcbmi_theme_color.';324 padding: 1%;325 color: #fff;326 font-size: 20px;327 text-align: center;328 margin: 0px;329 }330 #fcp-bmi-intake-form .fcp-btn {331 background-color: '.$fcbmi_theme_color.';332 color: #fff;333 text-transform: uppercase;334 border-radius: 4px;335 border: solid 2px '.$fcbmi_theme_color.';336 }337 </style><div id="fcp-bmi-intake-form" class="container">338 <h3>'.$fcbmi_title.'</h3> 339 <div class="fcp-row">340 <div class="fcp-radio-btn fcp-radio-btn-bmi-metric">341 <label for="fcp-bmi-intake-radio-metric">'. __( 'Metric', 'fitness-calculators' ) .'</label>342 <input type="radio" id="fcp-bmi-intake-radio-metric" class="form-control fcp-protein-radio" name="fcp-bmi-intake-radio" value="metric" checked="checked">343 <span class="fcp-error">require</span>344 </div>';345 if($fcbmi_metric_only == 'no') {346 $html .= '<div class="fcp-radio-btn fcp-radio-btn-bmi-standard">347 <label for="fcp-bmi-intake-radio-imperial">'. __( 'Standard', 'fitness-calculators' ) .'</label>348 <input type="radio" id="fcp-bmi-intake-radio-imperial" class="form-control fcp-protein-radio" name="fcp-bmi-intake-radio" value="imperial">349 <span class="fcp-error">require</span>350 </div>';351 } 352 $html .= '<table class="fcp-table">353 <tr>354 <td>355 <label class="fcp-bmi-intake-height" for="fcp-bmi-intake-height">'. __( 'Height', 'fitness-calculators' ) .'</label>356 <input id="fcp-bmi-intake-height" pattern="[0-9]" type="text" class="left form-control" id="fcp-bmi-intake-height" name="fcp-bmi-intake-height" />357 <span id="fcp-bmi-intake-height-error" class="fcp-error">require</span>358 </td>359 <td>360 <label for="fcp-bmi-intake-weight">'. __( 'Weight', 'fitness-calculators' ) .'</label>361 <input id="fcp-bmi-intake-weight" pattern="[0-9]" type="text" class="left form-control" id="fcp-bmi-intake-weight" name="fcp-bmi-intake-weight" />362 <span id="fcp-bmi-intake-weight-error" class="fcp-error">require</span>363 </td>364 </tr>365 <tr style="text-align: center;"><td colspan="2"><button onclick="fcpCalculatebmiIntake()" class="btn btn-default fcp-btn">'. __( 'Calculate', 'fitness-calculators' ) .'</button></td></tr>366 </table>367 <p class="fcp-result-string"> '. __( 'Your BMI is', 'fitness-calculators' ) .'<span class=fcp-bmi-calculated-result>......</span></p>368 <div id="bmiClassList"> 369 <table id="bmiResultTable" class="hide_result">370 <tbody><tr>371 <th>'. __( 'BMI', 'fitness-calculators' ) .'</th><th>'. __( 'Classification', 'fitness-calculators' ) .'</th>372 </tr>373 <tr class="">374 <td>less than 18.5:</td><td>'. __( 'Underweight', 'fitness-calculators' ).'</td>375 </tr><tr>376 </tr><tr class="bmiGreen">377 <td>18.5 - 24.9:</td><td>'. __( 'Normal weight', 'fitness-calculators' ).'</td>378 </tr>379 <tr class="">380 <td>25 - 29.9:</td><td>'. __( 'Overweight', 'fitness-calculators' ).'</td>381 </tr><tr>382 </tr><tr class="">383 <td>30 upwards:</td><td>'. __( 'Obese', 'fitness-calculators' ).'</td>384 </tr> 385 </tbody></table> 386 </div>387 </div>388 </div>';389 return $html;390 }391 // for Body Fat calculator392 public static function fcp_bfc_calculator( $atts, $content = "" ) { 393 $fcbfc_title = __( 'No title', 'fitness-calculators' );394 if(trim(get_option('fcbfc_heading'))!=false)395 {396 $fcbfc_title = get_option('fcbfc_heading'); 397 }398 $fcbfc_metric_only = '';399 if(trim(get_option('fcbfc_metric_only'))!=false)400 {401 $fcbfc_metric_only = get_option('fcbfc_metric_only'); 402 }403 $fcbfc_theme_color = '#004d99';404 if(trim(get_option('fcbfc_theme_color'))!=false)405 {406 $fcbfc_theme_color = get_option('fcbfc_theme_color'); 407 }408 $html = '';409 $html .= '<style>410 #fcp-bfc-intake-form {411 margin: 0px;412 padding: 0px;413 border: solid 2px '.$fcbfc_theme_color.';414 width: 100%;415 float: left;416 }';417 418 if($fcbfc_metric_only == 'yes') { 419 $html .= '#fcp-bfc-intake-form .fcp-radio-btn {420 width: 100%;421 }';422 } 423 $html .= '#fcp-bfc-intake-form h3 {424 text-transform: uppercase;425 background-color: '.$fcbfc_theme_color.';426 padding: 2%;427 color: #fff;428 font-weight: bolder;429 text-align: center;430 margin: 0px;431 }432 433 #fcp-bfc-intake-form .fcp-result-string {434 background-color: '.$fcbfc_theme_color.';435 padding: 1%;436 color: #fff;437 font-size: 20px;438 text-align: center;439 margin: 0px;440 }441 #fcp-bfc-intake-form .fcp-btn {442 background-color: '.$fcbfc_theme_color.';443 color: #fff;444 text-transform: uppercase;445 border-radius: 4px;446 border: solid 2px '.$fcbfc_theme_color.';447 }448 </style><div id="fcp-bfc-intake-form" class="container">449 <h3>'.$fcbfc_title.'</h3> 450 <div class="fcp-row">451 <div class="fcp-radio-btn fcp-radio-btn-bfc-metric">452 <label for="fcp-bfc-intake-radio-metric">'. __( 'Metric', 'fitness-calculators' ) .'</label>453 <input type="radio" id="fcp-bfc-intake-radio-metric" class="fcp-protein-radio-metric form-control fcp-protein-radio" name="fcp-bfc-intake-radio" checked="checked" value="metric">454 <span class="fcp-error">require</span>455 </div>';456 if($fcbfc_metric_only == 'no') {457 $html .= '<div class="fcp-radio-btn fcp-radio-btn-bfc-standard">458 <label for="fcp-bfc-intake-radio-imperial">'. __( 'Standard', 'fitness-calculators' ) .'</label>459 <input type="radio" id="fcp-bfc-intake-radio-imperial" class="fcp-protein-radio-standard form-control fcp-protein-radio" name="fcp-bfc-intake-radio" value="imperial">460 <span class="fcp-error">require</span>461 </div>';462 }463 464 $html .= '<table class="fcp-table">465 <tr>466 <td>467 <label for="fcp-bfc-male"> 468 '. __( 'Male', 'fitness-calculators' ) .'469 <input value="male" id="fcp-bfc-male" type="radio" class="left form-control" id="fcp-bfc-male" name="fcp-bfc-gender" />470 <span id="fcp-bfc-male-error" class="fcp-error-gender">require</span>471 </label>472 </td>473 <td>474 <label for="fcp-bfc-female">475 '. __( 'Female', 'fitness-calculators' ) .'476 <input value="female" id="fcp-bfc-female" type="radio" class="left form-control" id="fcp-bfc-female" name="fcp-bfc-gender" />477 <span id="fcp-bfc-female-error" class="fcp-error-gender">require</span>478 </label>479 </td>480 </tr>481 <tr>482 <td>483 <label class="fcp-bmi-intake-height" for="fcp-bfc-intake-height">'. __( 'Height', 'fitness-calculators' ) .'</label>484 <input id="fcp-bfc-intake-height" 485 pattern="[0-9]" 486 type="text" 487 class="left form-control" 488 name="fcp-bmi-intake-height"489 placeholder="Centimeter/Feet" />490 <span id="fcp-bfc-intake-height-error" class="fcp-error-height">require</span>491 </td>492 <td>493 <label for="fcp-bmi-intake-weight">'. __( 'Weight', 'fitness-calculators' ) .'</label>494 <input id="fcp-bfc-intake-weight" pattern="[0-9]" type="text" class="left form-control" name="fcp-bfc-intake-weight" placeholder="'. __( 'Kilogram/Pound', 'fitness-calculators' ).'" />495 <span id="fcp-bfc-intake-weight-error" class="fcp-error-height">require</span>496 </td>497 </tr>498 <tr>499 <td>500 <label class="fcp-bfc-age" for="fcp-bfc-age">'. __( 'Age', 'fitness-calculators' ) .'</label>501 <input id="fcp-bfc-age" type="text" class="left form-control" name="fcp-bfc-age" />502 <span id="fcp-bfc-age-error" class="fcp-error-age">require</span>503 </td>504 <td>505 &nbsp;506 </td>507 </tr>508 <tr style="text-align: center;"><td colspan="2"><button onclick="fcpCalculatebfcIntake()" class="btn btn-default fcp-btn">'. __( 'Calculate', 'fitness-calculators' ) .'</button></td></tr>509 </table>510 <p class="fcp-result-string">'. __( 'Your body fat is ', 'fitness-calculators' ) .' <span class=fcp-bfc-calculated-result>......</span></p>511 <div id="bmiClassList"> 512 <table id="bfcResultTable" class="hide_result">513 <tbody><tr>514 <th>'. __( 'Description', 'fitness-calculators' ) .'</th><th>'. __( 'Women', 'fitness-calculators' ) .'</th><th>'. __( 'Men', 'fitness-calculators' ) .'</th>515 </tr>516 <tr class="">517 <td>'. __( 'Recommended amount', 'fitness-calculators' ) .':</td><td>20-25%</td><td>8-14%</td>518 </tr><tr>519 </tr><tr class="bmiGreen">520 <td>'. __( 'Adults in United States, average', 'fitness-calculators' ) .' :</td><td>22-25%</td><td>15-19%</td>521 </tr>522 <tr class="">523 <td>'. __( 'Obese', 'fitness-calculators' ) .' :</td><td>30+%</td><td>25+%</td>524 </tr> 525 </tbody></table> 526 </div>527 </div>528 </div>';529 return $html;530 }531 public static function fcp_cc_calculator( $atts, $content = "" ) { 532 $fccc_title = __( 'No title', 'fitness-calculators' );533 if(trim(get_option('fccc_heading'))!=false)534 {535 $fccc_title = get_option('fccc_heading'); 536 }537 $fccc_metric_only = '';538 if(trim(get_option('fccc_metric_only'))!=false)539 {540 $fccc_metric_only = get_option('fccc_metric_only'); 541 }542 $fccc_theme_color = '#004d99';543 if(trim(get_option('fccc_theme_color'))!=false)544 {545 $fccc_theme_color = get_option('fccc_theme_color'); 546 }547 $html = '';548 $html .= '<style>549 #fcp-bfc-intake-form {550 margin: 0px;551 padding: 0px;552 border: solid 2px '.$fccc_theme_color.';553 width: 100%;554 float: left;555 }';556 557 if($fccc_metric_only == 'yes') { 558 $html .= '#fcp-bfc-intake-form .fcp-radio-btn {559 width: 100%;560 }';561 } 562 $html .= '#fcp-bfc-intake-form h3 {563 text-transform: uppercase;564 background-color: '.$fccc_theme_color.';565 padding: 2%;566 color: #fff;567 font-weight: bolder;568 text-align: center;569 margin: 0px;570 }571 572 #fcp-bfc-intake-form .fcp-result-string {573 background-color: '.$fccc_theme_color.';574 padding: 1%;575 color: #fff;576 font-size: 20px;577 text-align: center;578 margin: 0px;579 }580 #fcp-bfc-intake-form .fcp-btn {581 background-color: '.$fccc_theme_color.';582 color: #fff;583 text-transform: uppercase;584 border-radius: 4px;585 border: solid 2px '.$fccc_theme_color.';586 }587 </style><div id="fcp-bfc-intake-form" class="container">588 <h3>'.$fccc_title.'</h3> 589 <div class="fcp-row">590 <div class="fcp-radio-btn fcp-radio-btn-cc-metric">591 <label for="fcp-cc-radio-metric">'. __( 'Metric', 'fitness-calculators' ) .'</label>592 <input type="radio" id="fcp-cc-radio-metric" class="fcp-cc-radio-metric form-control fcp-cc-radio" name="fcp-cc-radio" checked="checked" value="metric">593 <span class="fcp-error">require</span>594 </div>';595 if($fccc_metric_only == 'no') {596 $html .= '<div class="fcp-radio-btn fcp-radio-btn-cc-standard">597 <label for="fcp-cc-radio-imperial">'. __( 'Standard', 'fitness-calculators' ) .'</label>598 <input type="radio" id="fcp-cc-radio-imperial" class="fcp-cc-radio-standard form-control fcp-cc-radio" name="fcp-cc-radio" value="imperial">599 <span class="fcp-error">require</span>600 </div>';601 }602 603 $html .= '<table class="fcp-table">604 <tr>605 <td>606 <label for="fcp-cc-male"> 607 '. __( 'Male', 'fitness-calculators' ) .'608 <input value="male" id="fcp-cc-male" type="radio" class="left form-control" id="fcp-cc-male" name="fcp-cc-gender" />609 <span id="fcp-cc-male-error" class="fcp-error-gender">require</span>610 </label>611 </td>612 <td>613 <label for="fcp-cc-female">614 '. __( 'Female', 'fitness-calculators' ) .'615 <input value="female" id="fcp-cc-female" type="radio" class="left form-control" id="fcp-cc-female" name="fcp-cc-gender" />616 <span id="fcp-cc-female-error" class="fcp-error-gender">require</span>617 </label>618 </td>619 </tr>620 <tr>621 <td>622 <label class="fcp-cc-height" for="fcp-cc-height">'. __( 'Height', 'fitness-calculators' ) .'</label>623 <input id="fcp-cc-height" 624 pattern="[0-9]" 625 type="text" 626 class="left form-control" 627 name="fcp-cc-height"628 placeholder="Centimeter/Feet" />629 <span id="fcp-cc-height-error" class="fcp-error-height">require</span>630 </td>631 <td>632 <label for="fcp-cc-weight">'. __( 'Weight', 'fitness-calculators' ) .'</label>633 <input id="fcp-cc-weight" pattern="[0-9]" type="text" class="left form-control" name="fcp-cc-weight" placeholder="'. __( 'Kilogram/Pound', 'fitness-calculators' ).'" />634 <span id="fcp-cc-weight-error" class="fcp-error-height">require</span>635 </td>636 </tr>637 <tr>638 <td>639 <label class="fcp-cc-age" for="fcp-cc-age">'. __( 'Age', 'fitness-calculators' ) .'</label>640 <input id="fcp-cc-age" type="text" class="left form-control" name="fcp-cc-age" />641 <span id="fcp-cc-age-error" class="fcp-error-age">require</span>642 </td>643 <td>644 <label for="fcp-cc-activity-level">'. __( 'Activity level', 'fitness-calculators' ) .'</label>645 <select id="fcp-cc-activity-level" class="left form-control" name="fcp-cc-activity-level">646 <option value="sedentary">'. __( 'Sedentary', 'fitness-calculators' ).'</option>647 <option value="lightly-active">'. __( 'Lightly active', 'fitness-calculators' ).'</option>648 <option value="moderately-active">'. __( 'Moderately active', 'fitness-calculators' ).'</option>649 <option value="very-active">'. __( 'Very Active', 'fitness-calculators' ).'</option>650 <option value="extra-active">'. __( 'Extra active', 'fitness-calculators' ).'</option>651 </select>652 </td>653 </tr>654 <tr style="text-align: center;"><td colspan="2"><button onclick="fcpCalculateccIntake()" class="btn btn-default fcp-btn">'. __( 'Calculate', 'fitness-calculators' ) .'</button></td></tr>655 </table>656 <p class="fcp-result-string">'. __( 'Your body Carb requirment ', 'fitness-calculators' ) .' <span class=fcp-cc-calculated-result>......</span></p>657 <div id="ccClassList"> 658 <table id="ccResultTable" class="hide_result" cellspacing="20">659 <tbody>660 <tr>661 <td style="padding:5%;">662 <p> '. __( 'The calorie count is then adjusted based on your goal:', 'fitness-calculators' ) . ' </p>663 <ul> 664 <li>'. __( 'Weight loss: Reduce by 10-20%', 'fitness-calculators' ) . ' </li>665 <li>'. __( 'Weight gain: Add 500 calories', 'fitness-calculators' ) . ' </li>666 <li>'. __( 'Weight maintenance: Unchanged', 'fitness-calculators' ) . ' </li>667 668 <p>'. __( 'This calorie count is split into macronutrient percentages in the following ratios, based on splits commonly recommended by our nutrition experts for muscle gain, weight loss, and weight maintenance. (Yes, weight gain and maintenance are the same ratio, but the calories and macros are different.) ', 'fitness-calculators' ) . ' </p>669 <ul>670 <li>'. __( 'Weight loss: 40/40/20 (carbohydrates/protein/fats)', 'fitness-calculators' ) . ' </li>671 <li>'. __( 'Weight gain: 40/30/30', 'fitness-calculators' ) . ' </li>672 <li>'. __( 'Weight maintenance: 40/30/30', 'fitness-calculators' ) . ' </li>673 </ol>674 675 <p>'. __( 'Finally, your carbohydrate intake comes from applying those percentages to your daily calorie number. Each gram of carbohydrates is "worth" 4 calories.', 'fitness-calculators' ) . ' </p>676 </td>677 </tr> 678 </tbody></table> 679 </div>680 </div>681 </div>';682 return $html;683 }684 }685 // shortcode for water intake calculator686 add_shortcode( 'fcp-water-intake-calculator', array( 'FcpShortCodes', 'fcp_water_intake_calculator' ) );687 // shortcode for protein intake calculator688 add_shortcode( 'fcp-protein-intake-calculator', array( 'FcpShortCodes', 'fcp_protein_intake_calculator' ) );689 // shortcode for bmi calculator690 add_shortcode( 'fcp-bmi-calculator', array( 'FcpShortCodes', 'fcp_bmi_calculator' ) );691 // shortcode for Body Fat692 add_shortcode( 'fcp-bfc-calculator', array( 'FcpShortCodes', 'fcp_bfc_calculator' ) );693 add_shortcode( 'fcp-cc-calculator', array( 'FcpShortCodes', 'fcp_cc_calculator' ) );694 ...

Full Screen

Full Screen

script_select_unselect_price.js

Source:script_select_unselect_price.js Github

copy

Full Screen

1//variáveis com tamanho dos açaís CREMOSO2var _300ml = document.getElementById('300ml');3var _500ml = document.getElementById('500ml');4var _700ml = document.getElementById('700ml');5var _1L = document.getElementById('1L');6var _barca = document.getElementById('barca');7//variáveis com acréscimos 8var _nutela = document.getElementById('nutela')9var _doce_de_leite = document.getElementById('doce-de-leite')10var _tortuguita = document.getElementById('tortuguita')11var _pacoca = document.getElementById('pacoca')12//variáveis com os preços 13var _R$8 = document.getElementById('preco300mlCremoso')14var _R$10 = document.getElementById('preco500mlCremoso')15var _R$14 = document.getElementById('preco700mlCremoso')16var _R$20 = document.getElementById('preco1LCremoso')17var _R$25 = document.getElementById('preco_barca')18//preços acréscimos19var _R$3 = document.getElementById('precoAcrescimoCremoso')20var _R$3_ = document.getElementById('precoAcrescimoCremoso_doce')21var _R$2 = document.getElementById('precoAcrescimoCremoso_tortuguita')22var _R$1 = document.getElementById('precoAcrescimoCremoso_pacoca')23//evento de click24_300ml.addEventListener('click',selecionarPreco)25_500ml.addEventListener('click',selecionarPreco1)26_700ml.addEventListener('click',selecionarPreco2)27_1L.addEventListener('click',selecionarPreco3)28_barca.addEventListener('click',selecionarPrecoBarca)29_nutela.addEventListener('click',selecionarPrecoNutela)30_doce_de_leite.addEventListener('click',selecionarPrecoDoce)31_tortuguita.addEventListener('click',selecionarPrecoTortuguita)32_pacoca.addEventListener('click',selecionarPrecoPacoca)33//funções que seleciona os preços cremoso34function selecionarPreco(){35 if(_300ml.value='300ml' || _500ml.checked || _700ml.checked || _1L.checked || _barca.checked){36 37 _R$8.classList.remove('fcp_unselected')38 _R$8.classList.add('fcp')39 _R$10.classList.add('fcp_unselected')40 _R$10.classList.remove('fcp')41 _R$14.classList.add('fcp_unselected')42 _R$14.classList.remove('fcp')43 _R$20.classList.add('fcp_unselected')44 _R$20.classList.remove('fcp')45 _R$25.classList.add('fcp_unselected')46 _R$25.classList.remove('fcp')47 48 49 }50}51function selecionarPreco1(){52 if(_500ml.value='500ml' || _300ml.checked || _700ml.checked || _1L.checked|| _barca.checked){53 54 _R$8.classList.add('fcp_unselected')55 _R$8.classList.remove('fcp')56 _R$10.classList.remove('fcp_unselected')57 _R$10.classList.add('fcp')58 _R$14.classList.add('fcp_unselected')59 _R$14.classList.remove('fcp')60 _R$20.classList.add('fcp_unselected')61 _R$20.classList.remove('fcp')62 _R$25.classList.add('fcp_unselected')63 _R$25.classList.remove('fcp')64 65 66 }67}68function selecionarPreco2(){69 if(_700ml.value='700ml' || _300ml.checked || _500ml.checked || _1L.checked||_barca.checked){70 71 _R$8.classList.add('fcp_unselected')72 _R$8.classList.remove('fcp')73 _R$10.classList.add('fcp_unselected')74 _R$10.classList.remove('fcp')75 _R$14.classList.remove('fcp_unselected')76 _R$14.classList.add('fcp')77 _R$20.classList.add('fcp_unselected')78 _R$20.classList.remove('fcp')79 _R$25.classList.add('fcp_unselected')80 _R$25.classList.remove('fcp')81 82 83 }84}85function selecionarPreco3(){86 if( _1L.value='1L' || _300ml.checked || _500ml.checked || _700ml.checked ||_barca.checked){87 88 _R$8.classList.add('fcp_unselected')89 _R$8.classList.remove('fcp')90 _R$10.classList.add('fcp_unselected')91 _R$10.classList.remove('fcp')92 _R$14.classList.add('fcp_unselected')93 _R$14.classList.remove('fcp')94 _R$20.classList.remove('fcp_unselected')95 _R$20.classList.add('fcp')96 _R$25.classList.add('fcp_unselected')97 _R$25.classList.remove('fcp')98 99 100 }101}102function selecionarPrecoBarca(){103 if( _barca.value='Barca' || _300ml.checked || _500ml.checked || _700ml.checked ||_1L.checked){104 105 _R$8.classList.add('fcp_unselected')106 _R$8.classList.remove('fcp')107 _R$10.classList.add('fcp_unselected')108 _R$10.classList.remove('fcp')109 _R$14.classList.add('fcp_unselected')110 _R$14.classList.remove('fcp')111 _R$20.classList.add('fcp_unselected')112 _R$20.classList.remove('fcp')113 _R$25.classList.remove('fcp_unselected')114 _R$25.classList.add('fcp')115 116 117 }118}119function selecionarPrecoNutela(){120 if(_nutela.checked == true){121 122 _R$3.classList.add('fcp')123 _R$3.classList.remove('fcp_unselected')124 125 126 }else{127 _R$3.classList.remove('fcp')128 _R$3.classList.add('fcp_unselected')129 130 }131}132function selecionarPrecoDoce(){133 if(_doce_de_leite.checked == true){134 135 _R$3_.classList.add('fcp')136 _R$3_.classList.remove('fcp_unselected')137 138 139 }else{140 _R$3_.classList.remove('fcp')141 _R$3_.classList.add('fcp_unselected')142 143 }144}145function selecionarPrecoTortuguita(){146 if(_tortuguita.checked == true){147 148 _R$2.classList.add('fcp')149 _R$2.classList.remove('fcp_unselected')150 151 152 }else{153 _R$2.classList.remove('fcp')154 _R$2.classList.add('fcp_unselected')155 156 }157}158function selecionarPrecoPacoca(){159 if(_pacoca.checked == true){160 161 _R$1.classList.add('fcp')162 _R$1.classList.remove('fcp_unselected')163 164 165 }else{166 _R$1.classList.remove('fcp')167 _R$1.classList.add('fcp_unselected')168 169 }170}171//---------------------------------------------------------172//variáveis com tamanho dos açaís TRADICIONAL173var _300ml_trad = document.getElementById('300ml_trad');174var _500ml_trad = document.getElementById('500ml_trad');175var _700ml_trad = document.getElementById('700ml_trad');176var _1L_trad = document.getElementById('1L_trad');177var _barca_trad = document.getElementById('barca_trad');178//acréscimos tradicionais179var _nutela_trad = document.getElementById('nutela_trad')180var _doce_de_leite_trad = document.getElementById('doce-de-leite_trad')181var _tortuguita_trad = document.getElementById('tortuguita_trad')182var _pacoca_trad = document.getElementById('pacoca_trad')183//variáveis com os preços tradicional184var _R$8_trad = document.getElementById('preco300ml_trad')185var _R$10_trad = document.getElementById('preco500ml_trad')186var _R$14_trad = document.getElementById('preco700ml_trad')187var _R$20_trad = document.getElementById('preco1L_trad')188var _R$25_trad = document.getElementById('preco_barca_trad')189//preços com acréscimos tradicionais 190var _R$3_trad = document.getElementById('precoAcrescimo_trad')191var _R$3__trad = document.getElementById('precoAcrescimo_trad_Doce')192var _R$2_trad = document.getElementById('precoAcrescimo_trad_tortuguita')193var _R$1_trad = document.getElementById('precoAcrescimo_trad_pacoca')194//evento de click195_300ml_trad.addEventListener('click',selecionarPreco5)196_500ml_trad.addEventListener('click',selecionarPreco6)197_700ml_trad.addEventListener('click',selecionarPreco7)198_1L_trad.addEventListener('click',selecionarPreco8)199_barca_trad.addEventListener('click',selecionarPrecoBarcaTrad)200_nutela_trad.addEventListener('click',selecionarPreco9)201_doce_de_leite_trad.addEventListener('click',selecionarPrecoDoceTrad)202_tortuguita_trad.addEventListener('click',selecionarPrecoTortuguitaTrad)203_pacoca_trad.addEventListener('click',selecionarPrecoPacocaTrad)204//funções que seleciona os preços TRADICIONAL205function selecionarPreco5(){206 if(_300ml_trad.value='300ml' || _500ml_trad.checked || _700ml_trad.checked || _1L_trad.checked||_barca_trad.checked){207 208 _R$8_trad.classList.remove('fcp_unselected')209 _R$8_trad.classList.add('fcp')210 _R$10_trad.classList.add('fcp_unselected')211 _R$10_trad.classList.remove('fcp')212 _R$14_trad.classList.add('fcp_unselected')213 _R$14_trad.classList.remove('fcp')214 _R$20_trad.classList.add('fcp_unselected')215 _R$20_trad.classList.remove('fcp')216 _R$25_trad.classList.add('fcp_unselected')217 _R$25_trad.classList.remove('fcp')218 219 220 }221}222function selecionarPreco6(){223 if(_500ml_trad.value='500ml' || _300ml_trad.checked || _700ml_trad.checked || _1L_trad.checked||_barca_trad.checked){224 225 _R$8_trad.classList.add('fcp_unselected')226 _R$8_trad.classList.remove('fcp')227 _R$10_trad.classList.remove('fcp_unselected')228 _R$10_trad.classList.add('fcp')229 _R$14_trad.classList.add('fcp_unselected')230 _R$14_trad.classList.remove('fcp')231 _R$20_trad.classList.add('fcp_unselected')232 _R$20_trad.classList.remove('fcp')233 _R$25_trad.classList.add('fcp_unselected')234 _R$25_trad.classList.remove('fcp')235 236 237 }238}239function selecionarPreco7(){240 if(_700ml_trad.value='700ml' || _300ml_trad.checked || _500ml_trad.checked || _1L_trad.checked||_barca_trad.checked){241 242 _R$8_trad.classList.add('fcp_unselected')243 _R$8_trad.classList.remove('fcp')244 _R$10_trad.classList.add('fcp_unselected')245 _R$10_trad.classList.remove('fcp')246 _R$14_trad.classList.remove('fcp_unselected')247 _R$14_trad.classList.add('fcp')248 _R$20_trad.classList.add('fcp_unselected')249 _R$20_trad.classList.remove('fcp')250 _R$25_trad.classList.add('fcp_unselected')251 _R$25_trad.classList.remove('fcp')252 253 254 }255}256function selecionarPreco8(){257 if( _1L_trad.value='1L' || _300ml_trad.checked || _500ml_trad.checked || _700ml_trad.checked||_barca_trad.checked){258 259 _R$8_trad.classList.add('fcp_unselected')260 _R$8_trad.classList.remove('fcp')261 _R$10_trad.classList.add('fcp_unselected')262 _R$10_trad.classList.remove('fcp')263 _R$14_trad.classList.add('fcp_unselected')264 _R$14_trad.classList.remove('fcp')265 _R$20_trad.classList.remove('fcp_unselected')266 _R$20_trad.classList.add('fcp')267 _R$25_trad.classList.add('fcp_unselected')268 _R$25_trad.classList.remove('fcp')269 270 271 }272}273function selecionarPrecoBarcaTrad(){274 if( _barca_trad.value='Barca' || _300ml_trad.checked || _500ml_trad.checked || _700ml_trad.checked||_barca_trad.checked){275 276 _R$8_trad.classList.add('fcp_unselected')277 _R$8_trad.classList.remove('fcp')278 _R$10_trad.classList.add('fcp_unselected')279 _R$10_trad.classList.remove('fcp')280 _R$14_trad.classList.add('fcp_unselected')281 _R$14_trad.classList.remove('fcp')282 _R$20_trad.classList.add('fcp_unselected')283 _R$20_trad.classList.remove('fcp')284 _R$25_trad.classList.remove('fcp_unselected')285 _R$25_trad.classList.add('fcp')286 287 288 }289}290function selecionarPreco9(){291 if(_nutela_trad.checked == true){292 293 _R$3_trad.classList.add('fcp')294 _R$3_trad.classList.remove('fcp_unselected')295 296 }else{297 _R$3_trad.classList.remove('fcp')298 _R$3_trad.classList.add('fcp_unselected')299 300 }301}302function selecionarPrecoDoceTrad(){303 if(_doce_de_leite_trad.checked == true){304 305 _R$3__trad.classList.add('fcp')306 _R$3__trad.classList.remove('fcp_unselected')307 308 }else{309 _R$3__trad.classList.remove('fcp')310 _R$3__trad.classList.add('fcp_unselected')311 312 }313}314function selecionarPrecoTortuguitaTrad(){315 if(_tortuguita_trad.checked == true){316 317 _R$2_trad.classList.add('fcp')318 _R$2_trad.classList.remove('fcp_unselected')319 320 }else{321 _R$2_trad.classList.remove('fcp')322 _R$2_trad.classList.add('fcp_unselected')323 324 }325}326function selecionarPrecoPacocaTrad(){327 if(_pacoca_trad.checked == true){328 329 _R$1_trad.classList.add('fcp')330 _R$1_trad.classList.remove('fcp_unselected')331 332 }else{333 _R$1_trad.classList.remove('fcp')334 _R$1_trad.classList.add('fcp_unselected')335 336 }337}338//--------------------------------------------------------339//variáveis com tamanho hot dog340//hot dog tradicional341var hdt = document.getElementById('hdt')342//hot dog gourmet clabresa343var hdgc = document.getElementById('hdgc')344//hot dog moda da casa345var hdmoda = document.getElementById('hdmoda')346//Hambuerguer347var hambuerguer = document.getElementById('hamburguer')348//misto quente349var mistoquente=document.getElementById('mistoquente')350//Xbacon351var xbacon=document.getElementById('xbacon')352//Xeggbacon353var xeggbacon=document.getElementById('xeggbacon')354//Xtudo355var xtudo=document.getElementById('xtudo')356//Xtudoduplo357var xtudoduplo=document.getElementById('xtudoduplo')358//Xmodacasa359var Xmodacasa=document.getElementById('Xmodacasa')360//variáveis com os preços hotdog361var R$_hdt = document.getElementById('hdtp')362var R$_hdgc = document.getElementById('hdgcp')363var R$_hdmoda = document.getElementById('hdmodap')364var R$_hamburguer = document.getElementById('hamburguerPreco')365var R$_mistoquente = document.getElementById('mistoquentePreco')366var R$_xbacon = document.getElementById('xbaconPreco')367var R$_xeggbacon = document.getElementById('xeggbaconPreco')368var R$_xtudo = document.getElementById('xtudoPreco')369var R$_xtudoduplo = document.getElementById('xtudoduploPreco')370var R$_Xmodacasa = document.getElementById('xmodacasaPreco')371//variáveis com as descrições hotdog372var hd01_desc = document.getElementById('hd01_desc')373var hd02_desc = document.getElementById('hd02_desc')374var hdmoda_desc = document.getElementById('hdmoda_desc')375var hamburguer_desc = document.getElementById('hamburguer_desc')376var mistoquente_desc = document.getElementById('mistoquente_desc')377var xbacon_desc = document.getElementById('xbacon_desc')378var xeggbacon_desc = document.getElementById('xeggbacon_desc')379var xtudo_desc = document.getElementById('xtudo_desc')380var xtudoduplo_desc = document.getElementById('xtudoduplo_desc')381var xmodacasa_desc = document.getElementById('xmodacasa_desc')382//funções que seleciona os preços tradicional383function selecionarPrecoHotDogTradicional(){384 if(hdt.checked==true){385 386 387 R$_hdt.classList.add('fcp_color')388 389 hd01_desc.classList.add('fcp_color')390 hd01_desc.classList.remove('p_ingredientes_hot_dog_unselected')391 392 393 394 }else{395 R$_hdt.classList.remove('fcp_color')396 hd01_desc.classList.remove('fcp_color')397 hd01_desc.classList.add('p_ingredientes_hot_dog_unselected')398 }399}400//funções que seleciona os preços Gourmet401function selecionarPrecoHotDogGourmet(){402 if(hdgc.checked==true){403 404 405 R$_hdgc.classList.add('fcp_color')406 407 hd02_desc.classList.add('fcp_color')408 hd02_desc.classList.remove('p_ingredientes_hot_dog_unselected')409 410 411 412 }else{413 R$_hdgc.classList.remove('fcp_color')414 hd02_desc.classList.remove('fcp_color')415 hd02_desc.classList.add('p_ingredientes_hot_dog_unselected')416 }417}418//funções que seleciona os preços moda da casa 419function selecionarPrecoHotDogModa(){420 if(hdmoda.checked==true){421 422 423 R$_hdmoda.classList.add('fcp_color')424 425 hdmoda_desc.classList.add('fcp_color')426 hdmoda_desc.classList.remove('p_ingredientes_hot_dog_unselected')427 428 429 430 }else{431 R$_hdmoda.classList.remove('fcp_color')432 hdmoda_desc.classList.remove('fcp_color')433 hdmoda_desc.classList.add('p_ingredientes_hot_dog_unselected')434 }435}436function selecionarPrecoHamburguer(){437 if(hambuerguer.checked==true){438 439 440 R$_hamburguer.classList.add('fcp_color')441 442 hamburguer_desc.classList.add('fcp_color')443 hamburguer_desc.classList.remove('p_ingredientes_hot_dog_unselected')444 445 446 447 }else{448 R$_hamburguer.classList.remove('fcp_color')449 hamburguer_desc.classList.remove('fcp_color')450 hamburguer_desc.classList.add('p_ingredientes_hot_dog_unselected')451 }452}453function selecionarPrecoMistoQuente(){454 if(mistoquente.checked==true){455 456 457 R$_mistoquente.classList.add('fcp_color')458 459 mistoquente_desc.classList.add('fcp_color')460 mistoquente_desc.classList.remove('p_ingredientes_hot_dog_unselected')461 462 463 464 }else{465 R$_mistoquente.classList.remove('fcp_color')466 mistoquente_desc.classList.remove('fcp_color')467 mistoquente_desc.classList.add('p_ingredientes_hot_dog_unselected')468 }469}470function selecionarPrecoXeggbacon(){471 if(xeggbacon.checked==true){472 473 474 R$_xeggbacon.classList.add('fcp_color')475 476 xeggbacon_desc.classList.add('fcp_color')477 xeggbacon_desc.classList.remove('p_ingredientes_hot_dog_unselected')478 479 480 481 }else{482 R$_xeggbacon.classList.remove('fcp_color')483 xeggbacon_desc.classList.remove('fcp_color')484 xeggbacon_desc.classList.add('p_ingredientes_hot_dog_unselected')485 }486}487function selecionarPrecoXbacon(){488 if(xbacon.checked==true){489 490 491 R$_xbacon.classList.add('fcp_color')492 493 xbacon_desc.classList.add('fcp_color')494 xbacon_desc.classList.remove('p_ingredientes_hot_dog_unselected')495 496 497 498 }else{499 R$_xbacon.classList.remove('fcp_color')500 xbacon_desc.classList.remove('fcp_color')501 xbacon_desc.classList.add('p_ingredientes_hot_dog_unselected')502 }503}504function selecionarPrecoXtudoduplo(){505 if(xtudoduplo.checked==true){506 507 508 R$_xtudoduplo.classList.add('fcp_color')509 510 xtudoduplo_desc.classList.add('fcp_color')511 xtudoduplo_desc.classList.remove('p_ingredientes_hot_dog_unselected')512 513 514 515 }else{516 R$_xtudoduplo.classList.remove('fcp_color')517 xtudoduplo_desc.classList.remove('fcp_color')518 xtudoduplo_desc.classList.add('p_ingredientes_hot_dog_unselected')519 }520}521function selecionarPrecoXtudo(){522 if(xtudo.checked==true){523 524 525 R$_xtudo.classList.add('fcp_color')526 527 xtudo_desc.classList.add('fcp_color')528 xtudo_desc.classList.remove('p_ingredientes_hot_dog_unselected')529 530 531 532 }else{533 R$_xtudo.classList.remove('fcp_color')534 xtudo_desc.classList.remove('fcp_color')535 xtudo_desc.classList.add('p_ingredientes_hot_dog_unselected')536 }537}538function selecionarPrecoXmodadacasa(){539 if(Xmodacasa.checked==true){540 541 542 R$_Xmodacasa.classList.add('fcp_color')543 544 xmodacasa_desc.classList.add('fcp_color')545 xmodacasa_desc.classList.remove('p_ingredientes_hot_dog_unselected')546 547 548 549 }else{550 R$_Xmodacasa.classList.remove('fcp_color')551 xmodacasa_desc.classList.remove('fcp_color')552 xmodacasa_desc.classList.add('p_ingredientes_hot_dog_unselected')553 }554}555//evento de click556hdt.addEventListener('click',selecionarPrecoHotDogTradicional)557hdgc.addEventListener('click',selecionarPrecoHotDogGourmet)558hdmoda.addEventListener('click',selecionarPrecoHotDogModa)559hambuerguer.addEventListener('click',selecionarPrecoHamburguer)560mistoquente.addEventListener('click',selecionarPrecoMistoQuente)561xbacon.addEventListener('click',selecionarPrecoXbacon)562xeggbacon.addEventListener('click',selecionarPrecoXeggbacon)563xtudo.addEventListener('click',selecionarPrecoXtudo)564xtudoduplo.addEventListener('click',selecionarPrecoXtudoduplo)565Xmodacasa.addEventListener('click',selecionarPrecoXmodadacasa)566//--------------------------------------------------------567//SALGAOS568var salgado01 = document.getElementById('efr')569var salgado02 = document.getElementById('eqp')570var salgado03 = document.getElementById('bauru')571//variáveis com preços sagados572var salg_preco01 = document.getElementById('salg_preco01')573var salg_preco02 = document.getElementById('salg_preco02')574var salg_preco03 = document.getElementById('salg_preco03')575//evento click576salgado01.addEventListener('click',selecionarPrecoSalgado01)577salgado02.addEventListener('click',selecionarPrecoSalgado02)578salgado03.addEventListener('click',selecionarPrecoSalgado03)579// funções580function selecionarPrecoSalgado01(){581 if(salgado01.checked==true){582 583 584 salg_preco01.classList.add('fcp_color')585 586 587 }else{588 salg_preco01.classList.remove('fcp_color')589 }590}591function selecionarPrecoSalgado02(){592 if(salgado02.checked==true){593 594 595 salg_preco02.classList.add('fcp_color')596 597 598 }else{599 salg_preco02.classList.remove('fcp_color')600 }601}602function selecionarPrecoSalgado03(){603 if(salgado03.checked==true){604 605 606 salg_preco03.classList.add('fcp_color')607 608 609 }else{610 salg_preco03.classList.remove('fcp_color')611 }612}613//--------------------------------------------------------------614//Bebidas615var Bebida01 = document.getElementById('bd01')616var Bebida02 = document.getElementById('bd02')617var Bebida03 = document.getElementById('bd03')618var Bebida04 = document.getElementById('bd04')619var Bebida05 = document.getElementById('bd05')620var Bebida06 = document.getElementById('bd06')621var Bebida07 = document.getElementById('bd07')622var Bebida08 = document.getElementById('bd08')623var Bebida09 = document.getElementById('bd09')624var Bebida10 = document.getElementById('bd10')625var Bebida11 = document.getElementById('bd11')626var Bebida12 = document.getElementById('bd12')627var Bebida13 = document.getElementById('bd13')628var Bebida14 = document.getElementById('bd14')629var Bebida15 = document.getElementById('bd15')630var Bebida16 = document.getElementById('bd16')631//variáveis com preços bebidas632var Bebida01_preco = document.getElementById('bdp01')633var Bebida02_preco = document.getElementById('bdp02')634var Bebida03_preco = document.getElementById('bdp03')635var Bebida04_preco = document.getElementById('bdp04')636var Bebida05_preco = document.getElementById('bdp05')637var Bebida06_preco = document.getElementById('bdp06')638var Bebida07_preco = document.getElementById('bdp07')639var Bebida08_preco = document.getElementById('bdp08')640var Bebida09_preco = document.getElementById('bdp09')641var Bebida10_preco = document.getElementById('bdp10')642var Bebida11_preco = document.getElementById('bdp11')643var Bebida12_preco = document.getElementById('bdp12')644var Bebida13_preco = document.getElementById('bdp13')645var Bebida14_preco = document.getElementById('bdp14')646var Bebida15_preco = document.getElementById('bdp15')647var Bebida16_preco = document.getElementById('bdp16')648//eventos click649Bebida01.addEventListener('click',selecionarPrecoBebida01)650Bebida02.addEventListener('click',selecionarPrecoBebida02)651Bebida03.addEventListener('click',selecionarPrecoBebida03)652Bebida04.addEventListener('click',selecionarPrecoBebida04)653Bebida05.addEventListener('click',selecionarPrecoBebida05)654Bebida06.addEventListener('click',selecionarPrecoBebida06)655Bebida07.addEventListener('click',selecionarPrecoBebida07)656Bebida08.addEventListener('click',selecionarPrecoBebida08)657Bebida09.addEventListener('click',selecionarPrecoBebida09)658Bebida10.addEventListener('click',selecionarPrecoBebida10)659Bebida11.addEventListener('click',selecionarPrecoBebida11)660Bebida12.addEventListener('click',selecionarPrecoBebida12)661Bebida13.addEventListener('click',selecionarPrecoBebida13)662Bebida14.addEventListener('click',selecionarPrecoBebida14)663Bebida15.addEventListener('click',selecionarPrecoBebida15)664Bebida16.addEventListener('click',selecionarPrecoBebida16)665//funções para selecionar preços Bebidas666function selecionarPrecoBebida01(){667 if(Bebida01.checked==true){668 669 670 Bebida01_preco.classList.add('fcp_color')671 672 673 }else{674 Bebida01_preco.classList.remove('fcp_color')675 }676}677function selecionarPrecoBebida02(){678 if(Bebida02.checked==true){679 680 681 Bebida02_preco.classList.add('fcp_color')682 683 684 }else{685 Bebida02_preco.classList.remove('fcp_color')686 }687}688function selecionarPrecoBebida03(){689 if(Bebida03.checked==true){690 691 692 Bebida03_preco.classList.add('fcp_color')693 694 695 }else{696 Bebida03_preco.classList.remove('fcp_color')697 }698}699function selecionarPrecoBebida04(){700 if(Bebida04.checked==true){701 702 703 Bebida04_preco.classList.add('fcp_color')704 705 706 }else{707 Bebida04_preco.classList.remove('fcp_color')708 }709}710function selecionarPrecoBebida05(){711 if(Bebida05.checked==true){712 713 714 Bebida05_preco.classList.add('fcp_color')715 716 717 }else{718 Bebida05_preco.classList.remove('fcp_color')719 }720}721function selecionarPrecoBebida06(){722 if(Bebida06.checked==true){723 724 725 Bebida06_preco.classList.add('fcp_color')726 727 728 }else{729 Bebida06_preco.classList.remove('fcp_color')730 }731}732function selecionarPrecoBebida07(){733 if(Bebida07.checked==true){734 735 736 Bebida07_preco.classList.add('fcp_color')737 738 739 }else{740 Bebida07_preco.classList.remove('fcp_color')741 }742}743function selecionarPrecoBebida08(){744 if(Bebida08.checked==true){745 746 747 Bebida08_preco.classList.add('fcp_color')748 749 750 }else{751 Bebida08_preco.classList.remove('fcp_color')752 }753}754function selecionarPrecoBebida09(){755 if(Bebida09.checked==true){756 757 758 Bebida09_preco.classList.add('fcp_color')759 760 761 }else{762 Bebida09_preco.classList.remove('fcp_color')763 }764}765function selecionarPrecoBebida10(){766 if(Bebida10.checked==true){767 768 769 Bebida10_preco.classList.add('fcp_color')770 771 772 }else{773 Bebida10_preco.classList.remove('fcp_color')774 }775}776function selecionarPrecoBebida11(){777 if(Bebida11.checked==true){778 779 780 Bebida11_preco.classList.add('fcp_color')781 782 783 }else{784 Bebida11_preco.classList.remove('fcp_color')785 }786}787function selecionarPrecoBebida12(){788 if(Bebida12.checked==true){789 790 791 Bebida12_preco.classList.add('fcp_color')792 793 794 }else{795 Bebida12_preco.classList.remove('fcp_color')796 }797}798function selecionarPrecoBebida13(){799 if(Bebida13.checked==true){800 801 802 Bebida13_preco.classList.add('fcp_color')803 804 805 }else{806 Bebida13_preco.classList.remove('fcp_color')807 }808}809function selecionarPrecoBebida14(){810 if(Bebida14.checked==true){811 812 813 Bebida14_preco.classList.add('fcp_color')814 815 816 }else{817 Bebida14_preco.classList.remove('fcp_color')818 }819}820function selecionarPrecoBebida15(){821 if(Bebida15.checked==true){822 823 824 Bebida15_preco.classList.add('fcp_color')825 826 827 }else{828 Bebida15_preco.classList.remove('fcp_color')829 }830}831function selecionarPrecoBebida16(){832 if(Bebida16.checked==true){833 834 835 Bebida16_preco.classList.add('fcp_color')836 837 838 }else{839 Bebida16_preco.classList.remove('fcp_color')840 }841}842//----------------------------------------843//--------------------------------------844//POlpa fe frutas845var polpa01 = document.getElementById('polpa01')846var polpa02 = document.getElementById('polpa02')847//preços848var polpa01P = document.getElementById('polpa01P')849var polpa02P = document.getElementById('polpa02P')850//eventos click851polpa01.addEventListener('click',selecionarPrecoPolpa01)852polpa02.addEventListener('click',selecionarPrecoPolpa02)853//funções selecionar preços854function selecionarPrecoPolpa01(){855 if(polpa01.checked==true){856 857 858 polpa01P.classList.add('fcp_color')859 860 861 }else{862 polpa01P.classList.remove('fcp_color')863 }864}865function selecionarPrecoPolpa02(){866 if(polpa02.checked==true){867 868 869 polpa02P.classList.add('fcp_color')870 871 872 }else{873 polpa02P.classList.remove('fcp_color')874 }875}876//função para cancelar todos os itens açaí tradicional877function unselected(){878 879 let mySound = new Audio('sounds/cancel_item.mp3')880 mySound.play()881 let radioButtonArray = document.getElementsByName('tamanho2');882 let radioButtonArray2 = document.getElementsByName('frutas2');883 let radioButtonArray3 = document.getElementsByName('complementos2');884 let radioButtonArray4 = document.getElementsByName('coberturas2');885 let radioButtonArray5 = document.getElementsByName('acrescimo');886 887 for (var i=0; i<radioButtonArray.length; i++)888 {889 var radioButton = radioButtonArray[i];890 radioButton.checked = false;891 }892 for (var i=0; i<radioButtonArray2.length; i++)893 {894 var radioButton = radioButtonArray2[i];895 radioButton.checked = false;896 }897 for (var i=0; i<radioButtonArray3.length; i++)898 {899 var radioButton = radioButtonArray3[i];900 radioButton.checked = false;901 }902 for (var i=0; i<radioButtonArray4.length; i++)903 {904 var radioButton = radioButtonArray4[i];905 radioButton.checked = false;906 }907 for (var i=0; i<radioButtonArray5.length; i++)908 {909 var radioButton = radioButtonArray5[i];910 radioButton.checked = false;911 }912 913 914 915 }916function unselected2(){917 918 var radioButtonArray = document.getElementsByName('tamanho');919 var radioButtonArray2 = document.getElementsByName('frutas');920 var radioButtonArray3 = document.getElementsByName('complementos');921 var radioButtonArray4 = document.getElementsByName('coberturas');922 var radioButtonArray5 = document.getElementsByName('acrescimo_trad');923 924 for (var i=0; i<radioButtonArray.length; i++)925 {926 var radioButton = radioButtonArray[i];927 radioButton.checked = false;928 }929 for (var i=0; i<radioButtonArray2.length; i++)930 {931 var radioButton = radioButtonArray2[i];932 radioButton.checked = false;933 }934 for (var i=0; i<radioButtonArray3.length; i++)935 {936 var radioButton = radioButtonArray3[i];937 radioButton.checked = false;938 }939 for (var i=0; i<radioButtonArray4.length; i++)940 {941 var radioButton = radioButtonArray4[i];942 radioButton.checked = false;943 }944 for (var i=0; i<radioButtonArray5.length; i++)945 {946 var radioButton = radioButtonArray5[i];947 radioButton.checked = false;948 }949 950 951 }952 ...

Full Screen

Full Screen

Copyright.js

Source:Copyright.js Github

copy

Full Screen

1import React, { useState, useEffect } from 'react';2import Typography from '@material-ui/core/Typography';3import MuiLink from '@material-ui/core/Link';4import Metric from './Metric';5let fcpEvent = null;6export const dispatchFcpEvent = (fcp) => {7 fcpEvent = new CustomEvent('fcpTime', { detail: fcp.value });8 window.dispatchEvent(fcpEvent);9}10const Copyright = () => {11 const [fcpTime, setFcpTime] = useState();12 if (typeof window !== "undefined") {13 const onFcpTimeUpdate = (e) => {14 setFcpTime(e.detail);15 window.removeEventListener('fcpTime', onFcpTimeUpdate, false);16 };17 useEffect(() => {18 window.addEventListener('fcpTime', onFcpTimeUpdate);19 }, []);20 }21 return (22 <Typography variant="body2" color="textSecondary" align="center">23 {'Copyright © '}24 <MuiLink color="inherit" href="https://elviswong.space/">25 Elvis Wong26 </MuiLink>{' '}27 {new Date().getFullYear()}28 {'.'}29 {30 fcpTime && <Metric time={fcpTime} />31 }32 </Typography>33 );34}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webpagetest = require('webpagetest');2var wpt = new webpagetest('www.webpagetest.org');3var location = 'Dulles:Chrome';4wpt.runTest(url, {5}, function(err, data) {6 if (err) {7 console.log('Error: ' + err.message);8 } else {9 console.log('Test Finished. Results: ' + data.data.summary);10 }11});12var webpagetest = require('webpagetest');13var wpt = new webpagetest('www.webpagetest.org');14var location = 'Dulles:Chrome';15wpt.runTest(url, {16}, function(err, data) {17 if (err) {18 console.log('Error: ' + err.message);19 } else {20 console.log('Test Finished. Results: ' + data.data.summary);21 }22});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var fs = require('fs');3var test = wpt('www.webpagetest.org');4var location = 'Dulles:Chrome';5var options = {6};7test.runTest(url, options, function (err, data) {8 if (err) return console.error(err);9 console.log(data);10 test.getTestResults(data.data.testId, function (err, data) {11 if (err) return console.error(err);12 console.log(data);13 fs.writeFile('testresults.json', JSON.stringify(data), function (err) {14 if (err) return console.error(err);15 console.log('testresults.json written successfully.');16 });17 });18});19{ statusCode: 400,20 { statusCode: 400,21 message: 'Invalid test options' } }22var options = {23};

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var api = new wpt('www.webpagetest.org', 'A.4d9a4e4a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4A4B4C4D4E4F4G4H4I4J4K4L4M4N4O4P4Q4R4S4T4U4V4W4X4Y4Z4');3api.runTest('www.google.com', {fcp: 1}, function(err, data) {4 console.log(data);5});6var wpt = require('webpagetest');7var api = new wpt('www.webpagetest.org', 'A.4d9a4e4a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4A4B4C4D4E4F4G4H4I4J4K4L4M4N4O4P4Q4R4S4T4U4V4W4X4Y4Z4');8api.runTest('www.google.com', {location: 'Dulles:Chrome'}, function(err, data) {9 console.log(data);10});11var wpt = require('webpagetest');12var api = new wpt('www.webpagetest.org', 'A.4d9a4e4a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4A4B4C4D4E4F4G4H4I4J4K4L4M4N4O4P4Q4R4S4T4U4V4W4X4Y4

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('webpagetest');2const wptObject = new wpt('API_KEY');3async function getFCP(url) {4 let promise = new Promise((resolve, reject) => {5 wptObject.runTest(url).then(data => {6 let fcp = Number(data.data.median.firstView.firstContentfulPaint);7 resolve(fcp);8 });9 });10 return promise;11}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org', 'A.2c1a9c9e1d8e3d3b3e3f3d3a3b3e3a3');3 if (err) {4 console.log('Error: ' + err);5 } else {6 console.log('Test submitted: ' + data);7 }8});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful