Best JavaScript code snippet using storybook-root
ta-admin-functions.js
Source:ta-admin-functions.js
1/*******************************************************************************************************/2/*3/* ããã¯ã¨ã¤ãã®æé·ããèªä½ãã¼ã ãã¼ã¸WordPressãã¼ãã TAãã¼ã001 (ta-theme001) ã4/*5/* ta-admin-functions.js: ( Latest Version 2.03 2017.03.01 )6/*7/* ãã®ããã°ã©ã ã®èä½æ¨©ã使ç¨æ¨©ããã®ä»å
¨ã¦ã®æ¨©å©ã¯deéã¾ãæ ªå¼ä¼ç¤¾ã«å±ãã¾ãã8/* The copyright, royalty and all the other rights of this program belong to deatsumare Corporation.9/*10/* File Version å±¥æ´11/* File Version 2.00 2016.02.17: first edition by Kotaro Kashiwamura.12/* File Version 2.01 2016.05.05: ta_built_in追å by Kotaro Kashiwamura.13/* File Version 2.02 2016.09.17: SEOè¨å®ã®éä¸ç®¡çç»é¢è¿½å by Kotaro Kashiwamura.14/* File Version 2.03 2017.03.01: ta_cal_1, ta_cal_1p2, ta_cal_1p2p3追å 15/* ã¢ã³ã¼ãã£ãªã³(.nocookie-class-big-title)追å by Kotaro Kashiwamura.16/*17/*******************************************************************************************************/18jQuery(window).load( function() { //å
¨ã¦ã®ã³ã³ãã³ãã®ãã¼ããçµäºãããå®è¡19 jQuery('.big-title').each(function(){20 var refid = jQuery(this).attr('id');21 var currenthis = ( jQuery.cookie( 'ta_theme_setting_history' ) ) ? jQuery.cookie( 'ta_theme_setting_history' ): '';22 if ( -1 == currenthis.indexOf( refid ) ) {23 jQuery('#' + refid.replace('_title', '_disp')).hide();24 } else {25 jQuery('#' + refid.replace('_title', '_disp')).show();26 }27 jQuery('#' + refid).on( 'click', function() {28 currenthis = ( jQuery.cookie( 'ta_theme_setting_history' ) ) ? jQuery.cookie( 'ta_theme_setting_history' ): '';29 if ( 'none' == jQuery('#' + refid.replace('_title', '_disp')).css('display') ) {30 if ( -1 == currenthis.indexOf( refid ) ) {31 var arr = currenthis.split(',');32 if ( arr.length > 50 ) {33 currenthis = currenthis.replace( arr[0] + ',', '' );34 }35 currenthis = currenthis + refid + ',';36 jQuery.cookie( 'ta_theme_setting_history', currenthis );37 }38 } else {39 if ( -1 != currenthis.indexOf( refid ) ) {40 currenthis = currenthis.replace( refid + ',', '' );41 jQuery.cookie( 'ta_theme_setting_history', currenthis );42 }43 }44 jQuery('#' + refid.replace('_title', '_disp')).slideToggle();45 } );46 });47 jQuery('.pro-title').each(function(){48 var refid = jQuery(this).attr('id');49 var currenthis = ( jQuery.cookie( 'ta_theme_setting_history' ) ) ? jQuery.cookie( 'ta_theme_setting_history' ): '';50 if ( -1 == currenthis.indexOf( refid ) ) {51 jQuery('#' + refid.replace('_title', '_disp')).hide();52 } else {53 jQuery('#' + refid.replace('_title', '_disp')).show();54 }55 jQuery('#' + refid).on( 'click', function() {56 currenthis = ( jQuery.cookie( 'ta_theme_setting_history' ) ) ? jQuery.cookie( 'ta_theme_setting_history' ): '';57 if ( 'none' == jQuery('#' + refid.replace('_title', '_disp')).css('display') ) {58 if ( -1 == currenthis.indexOf( refid ) ) {59 var arr = currenthis.split(',');60 if ( arr.length > 50 ) {61 currenthis = currenthis.replace( arr[0] + ',', '' );62 }63 currenthis = currenthis + refid + ',';64 jQuery.cookie( 'ta_theme_setting_history', currenthis );65 }66 } else {67 if ( -1 != currenthis.indexOf( refid ) ) {68 currenthis = currenthis.replace( refid + ',', '' );69 jQuery.cookie( 'ta_theme_setting_history', currenthis );70 }71 }72 jQuery('#' + refid.replace('_title', '_disp')).slideToggle();73 } );74 });75 76 jQuery('.group-title').each(function(){77 var refid = jQuery(this).attr('id');78 var currenthis = ( jQuery.cookie( 'ta_theme_setting_history' ) ) ? jQuery.cookie( 'ta_theme_setting_history' ): '';79 if ( -1 == currenthis.indexOf( refid ) ) {80 jQuery('#' + refid.replace('_title', '_disp')).hide();81 } else {82 jQuery('#' + refid.replace('_title', '_disp')).show();83 }84 jQuery('#' + refid).on( 'click', function() {85 currenthis = ( jQuery.cookie( 'ta_theme_setting_history' ) ) ? jQuery.cookie( 'ta_theme_setting_history' ): '';86 if ( 'none' == jQuery('#' + refid.replace('_title', '_disp')).css('display') ) {87 if ( -1 == currenthis.indexOf( refid ) ) {88 var arr = currenthis.split(',');89 if ( arr.length > 50 ) {90 currenthis = currenthis.replace( arr[0] + ',', '' );91 }92 currenthis = currenthis + refid + ',';93 jQuery.cookie( 'ta_theme_setting_history', currenthis );94 }95 } else {96 if ( -1 != currenthis.indexOf( refid ) ) {97 currenthis = currenthis.replace( refid + ',', '' );98 jQuery.cookie( 'ta_theme_setting_history', currenthis );99 }100 }101 jQuery('#' + refid.replace('_title', '_disp')).slideToggle();102 } );103 });104 105 jQuery('.nocookie-big-title').each(function(){106 var refid = jQuery(this).attr('id');107 jQuery('#' + refid.replace('_title', '_disp')).hide();108 jQuery('#' + refid).on( 'click', function() {109 jQuery('#' + refid.replace('_title', '_disp')).slideToggle();110 } );111 });112 113 jQuery('.class-big-title').each(function(){114 var refid = jQuery(this).attr('id');115 var currenthis = ( jQuery.cookie( 'ta_theme_setting_history' ) ) ? jQuery.cookie( 'ta_theme_setting_history' ): '';116 if ( -1 == currenthis.indexOf( refid ) ) {117 jQuery('.' + refid.replace('_title', '_disp')).hide();118 } else {119 jQuery('.' + refid.replace('_title', '_disp')).show();120 }121 jQuery('#' + refid).on( 'click', function() {122 currenthis = ( jQuery.cookie( 'ta_theme_setting_history' ) ) ? jQuery.cookie( 'ta_theme_setting_history' ): '';123 if ( 'none' == jQuery('.' + refid.replace('_title', '_disp')).css('display') ) {124 if ( -1 == currenthis.indexOf( refid ) ) {125 var arr = currenthis.split(',');126 if ( arr.length > 50 ) {127 currenthis = currenthis.replace( arr[0] + ',', '' );128 }129 currenthis = currenthis + refid + ',';130 jQuery.cookie( 'ta_theme_setting_history', currenthis );131 }132 } else {133 if ( -1 != currenthis.indexOf( refid ) ) {134 currenthis = currenthis.replace( refid + ',', '' );135 jQuery.cookie( 'ta_theme_setting_history', currenthis );136 }137 }138 jQuery('.' + refid.replace('_title', '_disp')).slideToggle();139 } );140 });141 142 jQuery('.nocookie-class-big-title').each(function(){143 var refid = jQuery(this).attr('id');144 jQuery('.' + refid.replace('_picker_title', '_picker_disp')).hide();145 jQuery('#' + refid).on( 'click', function() {146 jQuery('.' + refid.replace('_picker_title', '_picker_disp')).slideToggle();147 } );148 });149 150 jQuery('.grad-pup').each(function(){151 var refId = jQuery(this).attr('id');152 var refIdwH = '#' + refId;153 var tgtId = refId.replace('_title', '_disp');154 var tgtIdwH = '#' + tgtId;155 jQuery(refIdwH).on( 'click', function() {156 jQuery(tgtIdwH).css( 'width', '100%' );157 jQuery(tgtIdwH).fadeToggle(500);158 } );159 jQuery(tgtIdwH + ' .grad-close').on( 'click', function() {160 jQuery(tgtIdwH).fadeOut(500);161 } );162 } );163 164 jQuery('.grd_onoff_cover input').on( 'click', function() {165 var refid = jQuery(this).attr('id');166 var checkValue = (jQuery(this).prop('checked')) ? 'valid' : 'invalid';167 if ('valid' == checkValue) {168 var grdDirect = jQuery("input[name=" + refid.replace('_grad_onoff', '_grd_direct') + "]:checked").val();169 var midOnoff = ( jQuery("input[name=" + refid.replace('_grad_onoff', '_grd_mid_color_onoff') + "]").prop("checked")) ? 'valid' : 'invalid';170 var midPos = jQuery("input[name=" + refid.replace('_grad_onoff', '_grd_mid_color_pos') + "]").val();171 var startColor = rgbToHex(jQuery('#' + refid.replace('_grad_onoff', '_grd_start_color_cover') + ' .color-picker-current-color-frame').css('background-color'));172 var midColor = rgbToHex(jQuery('#' + refid.replace('_grad_onoff', '_grd_mid_color_cover') + ' .color-picker-current-color-frame').css('background-color'));173 var stopColor = rgbToHex(jQuery('#' + refid.replace('_grad_onoff', '_grd_stop_color_cover') + ' .color-picker-current-color-frame').css('background-color'));174 if ( 'valid' == midOnoff ) { var midInfo = midColor + " " + midPos + "%, "; } else { var midInfo = ""; }175 switch ( grdDirect ) {176 case 'bottom':177 var newDirect = 'top';178 var directNum = 0;179 var newStart = startColor;180 var newStop = stopColor;181 break;182 case 'top':183 var newDirect = 'bottom';184 var directNum = 0;185 var newStart = stopColor;186 var newStop = startColor;187 break;188 case 'right':189 var newDirect = 'left';190 var directNum = 1;191 var newStart = startColor;192 var newStop = stopColor;193 break;194 case 'left':195 var newDirect = 'right';196 var directNum = 1;197 var newStart = stopColor;198 var newStop = startColor;199 break;200 default:201 var newDirect = 'top';202 var directNum = 0;203 var newStart = startColor;204 var newStop = stopColor;205 }206 var gradCss = {207 filter:"progid:DXImageTransform.Microsoft.Gradient(GradientType=" + directNum + ", StartColorStr=" + newStart + ", EndColorStr=" + newStop + ")",208 background:"-ms-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",209 background:"-o-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",210 background:"-moz-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",211 background:"-webkit-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",212 background:"linear-gradient(to " + grdDirect +"," + startColor + " 0%," + midInfo + stopColor + " 100%)"213 }214 jQuery('#' + refid.replace('_grad_onoff', '_cover') + ' #' + refid.replace('_grad_onoff', '-colorinfo-container') + ' .color-picker-current-color-frame').css(gradCss);215 var imgPath = images_url.url;216 var gradWord = '<span class="grad-disp-img"><img src="' + imgPath + 'grad_disp.png"/></span>';217 jQuery('#' + refid.replace('_grad_onoff', '_cover') + ' #' + refid.replace('_grad_onoff', '-colorinfo-container') + ' .colorcode-disp').html( gradWord );218 } else {219 var inputId = refid.replace('_grad_onoff', '_cover');220 var inputName = refid.replace('_grad_onoff', '_select');221 var radioValue = jQuery( 'input[name=' + inputName + ']:checked' ).attr( 'class' );222 switch ( radioValue ) {223 case 'c-s-bg-input':224 var selected_color = rgbToHex(jQuery( '#' + inputId + ' .c-s-bg-color' ).css( 'background-color' ));225 break;226 case 'c-s-hl-input':227 var selected_color = rgbToHex(jQuery( '#' + inputId + ' .c-s-hl-color' ).css( 'background-color' ));228 break;229 case 'c-s-tonbg-input':230 var selected_color = rgbToHex(jQuery( '#' + inputId + ' .c-s-tonbg-color' ).css( 'background-color' ));231 break;232 case 'c-s-tonhl-input':233 var selected_color = rgbToHex(jQuery( '#' + inputId + ' .c-s-tonhl-color' ).css( 'background-color' ));234 break;235 case 'c-f-a-input':236 var selected_color = rgbToHex(jQuery( '#' + inputId + ' .c-f-a-color' ).css( 'background-color' ));237 break;238 case 'c-f-ahover-input':239 var selected_color = rgbToHex(jQuery( '#' + inputId + ' .c-f-ahover-color' ).css( 'background-color' ));240 break;241 case 'selectable-input':242 var key_name = refid.replace('_grad_onoff', '');243 var selected_color = jQuery( '#' + inputId + ' input[name=' + key_name + ']' ).val();244 break;245 default:246 var selected_color = 'invalid';247 break;248 }249 if ( 'invalid' != selected_color ) {250 var targetBox = refid.replace('_grad_onoff', '-colorinfo-container');251 jQuery('#' + targetBox + ' .color-picker-current-color-frame').css( 'background', 'none' );252 jQuery('#' + targetBox + ' .color-picker-current-color-frame').css( 'background-color', selected_color );253 if ( 'transparent' == selected_color ) {254 var selected_color_disp = 'éæ';255 } else if ( '' == selected_color ) {256 var selected_color_disp = 'æªå®';257 } else {258 var selected_color_disp = selected_color;259 }260 jQuery('#' + targetBox + ' .colorcode-disp').html( selected_color_disp );261 }262 }263 });264 265 jQuery('.grd_mid_color_onoff_cover input').on( 'click', function() {266 var refid = jQuery(this).attr('id');267 var checkValue = (jQuery(this).prop('checked')) ? 'valid' : 'invalid';268 if ('valid' == checkValue) {269 jQuery('.' + refid.replace('_grd_mid_color_onoff', '_mid_cover') + ' .color-picker-exp').css( 'height', 'auto' );270 jQuery('.' + refid.replace('_grd_mid_color_onoff', '_mid_cover')).css( 'visibility', 'visible' );271 } else {272 jQuery('.' + refid.replace('_grd_mid_color_onoff', '_mid_cover') + ' .color-picker-exp').css( 'height', '0' );273 jQuery('.' + refid.replace('_grd_mid_color_onoff', '_mid_cover')).css( 'visibility', 'hidden' );274 }275 });276 277 jQuery('.gradient-color-setting-container').each(function(){278 var refId = jQuery(this).attr('id');279 //Direction280 jQuery('#' + refId + ' .grd-direct-trigger').on( 'click', function() {281 gradRewrite('#' + refId + ' .grd-direct-trigger', '-grd-direct-cover');282 });283 //Mid onoff284 jQuery('#' + refId + ' .grd_mid_color_onoff_cover input').on( 'click', function() {285 gradRewrite('#' + refId + ' .grd_mid_color_onoff_cover input', '_grd_mid_color_onoff');286 });287 //Mid position288 jQuery('#' + refId + ' .grd_mid_color_pos_cover input').keyup(function() {289 gradRewrite('#' + refId + ' .grd_mid_color_pos_cover input', '_grd_mid_color_pos');290 });291 //Start292 jQuery('#' + refId + ' .inner-grad-setting-start .c-s-bg-input').on( 'click', function() {293 gradRewrite('#' + refId + ' .inner-grad-setting-start .c-s-bg-input', '_grd_start_color-c-s-bg-input');294 });295 jQuery('#' + refId + ' .inner-grad-setting-start .c-s-hl-input').on( 'click', function() {296 gradRewrite('#' + refId + ' .inner-grad-setting-start .c-s-hl-input', '_grd_start_color-c-s-hl-input');297 });298 jQuery('#' + refId + ' .inner-grad-setting-start .c-s-tonbg-input').on( 'click', function() {299 gradRewrite('#' + refId + ' .inner-grad-setting-start .c-s-tonbg-input', '_grd_start_color-c-s-tonbg-input');300 });301 jQuery('#' + refId + ' .inner-grad-setting-start .c-s-tonhl-input').on( 'click', function() {302 gradRewrite('#' + refId + ' .inner-grad-setting-start .c-s-tonhl-input', '_grd_start_color-c-s-tonhl-input');303 });304 jQuery('#' + refId + ' .inner-grad-setting-start .c-f-a-input').on( 'click', function() {305 gradRewrite('#' + refId + ' .inner-grad-setting-start .c-f-a-input', '_grd_start_color-c-f-a-input');306 });307 jQuery('#' + refId + ' .inner-grad-setting-start .c-f-ahover-input').on( 'click', function() {308 gradRewrite('#' + refId + ' .inner-grad-setting-start .c-f-ahover-input', '_grd_start_color-c-f-ahover-input');309 });310 jQuery('#' + refId + ' .inner-grad-setting-start .selectable-input').on( 'click', function() {311 gradRewrite('#' + refId + ' .inner-grad-setting-start .selectable-input', '_grd_start_color-selectable-input');312 });313 //Mid314 jQuery('#' + refId + ' .inner-grad-setting-mid .c-s-bg-input').on( 'click', function() {315 gradRewrite('#' + refId + ' .inner-grad-setting-mid .c-s-bg-input', '_grd_mid_color-c-s-bg-input');316 });317 jQuery('#' + refId + ' .inner-grad-setting-mid .c-s-hl-input').on( 'click', function() {318 gradRewrite('#' + refId + ' .inner-grad-setting-mid .c-s-hl-input', '_grd_mid_color-c-s-hl-input');319 });320 jQuery('#' + refId + ' .inner-grad-setting-mid .c-s-tonbg-input').on( 'click', function() {321 gradRewrite('#' + refId + ' .inner-grad-setting-mid .c-s-tonbg-input', '_grd_mid_color-c-s-tonbg-input');322 });323 jQuery('#' + refId + ' .inner-grad-setting-mid .c-s-tonhl-input').on( 'click', function() {324 gradRewrite('#' + refId + ' .inner-grad-setting-mid .c-s-tonhl-input', '_grd_mid_color-c-s-tonhl-input');325 });326 jQuery('#' + refId + ' .inner-grad-setting-mid .c-f-a-input').on( 'click', function() {327 gradRewrite('#' + refId + ' .inner-grad-setting-mid .c-f-a-input', '_grd_mid_color-c-f-a-input');328 });329 jQuery('#' + refId + ' .inner-grad-setting-mid .c-f-ahover-input').on( 'click', function() {330 gradRewrite('#' + refId + ' .inner-grad-setting-mid .c-f-ahover-input', '_grd_mid_color-c-f-ahover-input');331 });332 jQuery('#' + refId + ' .inner-grad-setting-mid .selectable-input').on( 'click', function() {333 gradRewrite('#' + refId + ' .inner-grad-setting-mid .selectable-input', '_grd_mid_color-selectable-input');334 });335 //Stop336 jQuery('#' + refId + ' .inner-grad-setting-stop .c-s-bg-input').on( 'click', function() {337 gradRewrite('#' + refId + ' .inner-grad-setting-stop .c-s-bg-input', '_grd_stop_color-c-s-bg-input');338 });339 jQuery('#' + refId + ' .inner-grad-setting-stop .c-s-hl-input').on( 'click', function() {340 gradRewrite('#' + refId + ' .inner-grad-setting-stop .c-s-hl-input', '_grd_stop_color-c-s-hl-input');341 });342 jQuery('#' + refId + ' .inner-grad-setting-stop .c-s-tonbg-input').on( 'click', function() {343 gradRewrite('#' + refId + ' .inner-grad-setting-stop .c-s-tonbg-input', '_grd_stop_color-c-s-tonbg-input');344 });345 jQuery('#' + refId + ' .inner-grad-setting-stop .c-s-tonhl-input').on( 'click', function() {346 gradRewrite('#' + refId + ' .inner-grad-setting-stop .c-s-tonhl-input', '_grd_stop_color-c-s-tonhl-input');347 });348 jQuery('#' + refId + ' .inner-grad-setting-stop .c-f-a-input').on( 'click', function() {349 gradRewrite('#' + refId + ' .inner-grad-setting-stop .c-f-a-input', '_grd_stop_color-c-f-a-input');350 });351 jQuery('#' + refId + ' .inner-grad-setting-stop .c-f-ahover-input').on( 'click', function() {352 gradRewrite('#' + refId + ' .inner-grad-setting-stop .c-f-ahover-input', '_grd_stop_color-c-f-ahover-input');353 });354 jQuery('#' + refId + ' .inner-grad-setting-stop .selectable-input').on( 'click', function() {355 gradRewrite('#' + refId + ' .inner-grad-setting-stop .selectable-input', '_grd_stop_color-selectable-input');356 });357 });358 359 jQuery('.digest_steady_onoff_cover input').on( 'click', function() {360 var refid = jQuery(this).attr('id');361 var checkValue = (jQuery(this).prop('checked')) ? 'valid' : 'invalid';362 if ('invalid' == checkValue) {363 jQuery('#' + refid.replace('_onoff', '_shortcode')).fadeIn();364 jQuery('#' + refid.replace('_onoff', '_usable_cover')).fadeIn();365 jQuery('#' + refid.replace('_onoff', '_steady_cat_cover')).fadeOut();366 } else {367 jQuery('#' + refid.replace('_onoff', '_shortcode')).fadeOut();368 jQuery('#' + refid.replace('_onoff', '_usable_cover')).fadeOut();369 jQuery('#' + refid.replace('_onoff', '_steady_cat_cover')).fadeIn();370 }371 });372 373 jQuery('.headline_type_sel_cover input').on( 'click', function() {374 var refclass = jQuery(this).attr('class');375 var checkValue = jQuery(this).val();376 if ('simple' != checkValue && 'left' != checkValue) {377 jQuery('#' + refclass.replace('_type', '_box_color_container')).fadeIn();378 } else {379 jQuery('#' + refclass.replace('_type', '_box_color_container')).fadeOut();380 }381 if ('left' == checkValue) {382 jQuery('#' + refclass.replace('_type', '_left_color_container')).fadeIn();383 jQuery('#' + refclass.replace('_type', '_over_color_grad_container')).fadeOut();384 jQuery('#' + refclass.replace('_type', '_over_color_grad_container_off_disp')).fadeIn();385 jQuery('#' + refclass.replace('_type', '-left-grad-limit')).fadeIn();386 } else {387 jQuery('#' + refclass.replace('_type', '_left_color_container')).fadeOut();388 jQuery('#' + refclass.replace('_type', '_over_color_grad_container')).fadeIn();389 jQuery('#' + refclass.replace('_type', '_over_color_grad_container_off_disp')).fadeOut();390 jQuery('#' + refclass.replace('_type', '-left-grad-limit')).fadeOut();391 }392 if ( 'simple' == checkValue || 'left' == checkValue || "box" == checkValue ) {393 jQuery('#' + refclass.replace('_type', '_overunderline_container')).fadeIn();394 } else {395 jQuery('#' + refclass.replace('_type', '_overunderline_container')).fadeOut();396 }397 if ( 'simple' != checkValue && 'left' != checkValue ) {398 jQuery('#' + refclass.replace('_type', '_box_round_container')).fadeIn();399 } else {400 jQuery('#' + refclass.replace('_type', '_box_round_container')).fadeOut();401 }402 if ( 'balloon1' == checkValue ) {403 jQuery('#' + refclass.replace('_type', '_balloon1_container')).fadeIn();404 } else {405 jQuery('#' + refclass.replace('_type', '_balloon1_container')).fadeOut();406 }407 if ( 'balloon2' == checkValue ) {408 jQuery('#' + refclass.replace('_type', '_balloon2_container')).fadeIn();409 } else {410 jQuery('#' + refclass.replace('_type', '_balloon2_container')).fadeOut();411 }412 });413 414 jQuery('.headline_font_style_onoff_cover input').on( 'click', function() {415 var refid = jQuery(this).attr('id');416 var checkValue = (jQuery(this).prop('checked')) ? 'valid' : 'invalid';417 if ('valid' == checkValue) {418 jQuery('.' + refid.replace('_font_style_onoff', '_common_font_valid')).css( 'color', '#bbbbbb' );419 } else {420 jQuery('.' + refid.replace('_font_style_onoff', '_common_font_valid')).css( 'color', '#777777' );421 }422 });423 424 if (!jQuery('#ta-menu-group').length){425 jQuery('<div id="ta-menu-group"></div>').prependTo('#ta-setting-form');426 }427 if (!jQuery('#ta-menu-group #ta-menu-title').length){428 jQuery('#ta-menu-title').prependTo('#ta-menu-group');429 }430 if (!jQuery('#ta-menu-talink').length){431 jQuery('<div id="ta-menu-talink"></div>').appendTo('#ta-menu-group');432 }433 if (!jQuery('#ta-menu-talink-anc').length){434 jQuery('#ta-menu-talink').wrap('<a id="ta-menu-talink-anc" href="http://tec-aid.com/ta_theme001_add_info/" target="_blank"></a>')435 }436});437function ta_no_img(idNum) {438 if ( 'no_image' != jQuery(idNum).val() ) {439 var imgPath = images_url.url;440 var imgUrl = imgPath + "ta_no_img.png";441 jQuery(idNum).val('no_image');442 jQuery(idNum + '_info').html('<span style="font-weight:bold;color:#ff0000;" class="before-done">æ´æ°ããã¨ç»é²ããã¦ããç»åURLæ
å ±ã¯æ¶å»ããã¾ãã</span>');443 jQuery( idNum + '_disp' ).show();444 jQuery( idNum + '_disp' ).attr( 'src', imgUrl );445 }446}447function tomei(idNum) {448 jQuery(idNum).val('transparent');449 jQuery(idNum + '_cp_cover a.wp-color-result').css('background-color', 'transparent');450 if ( "selectable" == jQuery("input[name=" + idNum.replace('#', '') + "_select]:checked").val() ) {451 if ( -1 != idNum.indexOf('_grd_start_color') || -1 != idNum.indexOf('_grd_mid_color') || -1 != idNum.indexOf('_grd_stop_color') ) { //ã°ã©ãã¼ã·ã§ã³è¨å®å
452 //ã°ã©ãã¼ã·ã§ã³è¨å®å
ã®è¡¨ç¤º453 jQuery(idNum + '-colorinfo-container .color-picker-current-color-frame').css('background', 'none');454 jQuery(idNum + '-colorinfo-container .color-picker-current-color-frame').css('background-color', 'transparent');455 jQuery(idNum + '-colorinfo-container .colorcode-disp').html('éæ');456 //ã°ã©ãã¼ã·ã§ã³è¡¨è¨ã®å ´åã®è¦ªè²è¡¨ç¤ºIDã®åå¾457 if ( -1 != idNum.indexOf('_grd_start_color') ) {458 var parentId = idNum.replace( /_grd_start_color/g, '' );459 } else if ( -1 != idNum.indexOf('_grd_mid_color') ) {460 var parentId = idNum.replace( /_grd_mid_color/g, '' );461 } else if ( -1 != idNum.indexOf('_grd_stop_color') ) {462 var parentId = idNum.replace( /_grd_stop_color/g, '' );463 } else {464 var parentId = '';465 }466 //親è¨å®å
表示467 var gradOnoff = ( jQuery(parentId + '_cover .grd_onoff_cover input').prop('checked') ) ? 'valid' : 'invalid';468 var keyId = parentId.replace('#', '');469 onoff_gradRewrite(gradOnoff, keyId);470 } else { //é常åè²è¨å®471 if ( ! jQuery(idNum + '_cover .grd_onoff_cover input').prop('checked') ) { //ã°ã©ãã¼ã·ã§ã³Off472 jQuery(idNum + '-colorinfo-container .color-picker-current-color-frame').css('background', 'none');473 jQuery(idNum + '-colorinfo-container .color-picker-current-color-frame').css('background-color', 'transparent');474 jQuery(idNum + '-colorinfo-container .colorcode-disp').html('éæ');475 }476 }477 }478}479function ta_no_link(idNum) {480 if ( 'no_link' != jQuery(idNum).val() ) {481 jQuery(idNum).val('no_link');482 jQuery(idNum + '_info').html('<span style="font-weight:bold;color:#ff0000;" class="before-done">æ´æ°ããã¨ç»é²ããã¦ãããªã³ã¯æ
å ±ã¯æ¶å¤±ãã¾ãã</span>');483 }484}485function ta_no_disp(idNum) {486 jQuery(idNum).val('no_disp');487}488function ta_built_in(idNum) {489 if ( 'built_in' != jQuery(idNum).val() ) {490 jQuery(idNum).val('built_in');491 var imgPath = images_url.url;492 switch ( idNum ) {493 case '#ta_common_top_outframe_pic':494 var imgUrl = imgPath + "ta-bg-images/bodyhome_bg.png";495 break;496 case '#ta_common_outframe_pic':497 var imgUrl = imgPath + "ta-bg-images/body_bg.png";498 break;499 case '#ta_top_topcatch_pic1':500 var imgUrl = imgPath + "ta-top-catch/valentine-candy.jpg";501 break;502 case '#ta_top_topcatch_pic2':503 var imgUrl = imgPath + "ta-top-catch/jelly-babies.jpg";504 break;505 case '#ta_top_topcatch_pic3':506 var imgUrl = imgPath + "ta-top-catch/bananas.jpg";507 break;508 case '#ta_header_logo_pic':509 var imgUrl = imgPath + "ta-header-images/logo.png";510 break;511 case '#ta_footer_frame_pic':512 var imgUrl = imgPath + "ta-bg-images/footer_bg.png";513 break;514 case '#ta_responsible_footer_frame_pic':515 var imgUrl = imgPath + "ta-res-bg-images/res_footer_bg.png";516 break;517 case '#ta_common_back2top_img':518 var imgUrl = imgPath + "ta-back2top-images/ta-back2top.png";519 break;520 case '#ta_common_favicon_img':521 var imgUrl = imgPath + "ta-favicon-images/favicon.ico";522 break;523 case '#ta_common_appletouch_img':524 var imgUrl = imgPath + "ta-favicon-images/apple-touch-icon.png";525 break;526 default:527 var imgUrl = "";528 }529 jQuery( idNum + '_info').html('<span style="font-weight:bold;color:#ff7f00;" class="before-done">æ´æ°ããã¨ä¸ã®å
èµç»åURLæ
å ±ãç»é²ããã¾ãã</span>');530 jQuery( idNum + '_disp' ).show();531 jQuery( idNum + '_disp' ).attr( 'src', imgUrl );532 }533}534function ta_cal_1(idNum) {535 var cal_height1 = jQuery('#bg-bar-cal-height1').text();536 jQuery(idNum).val(parseInt(cal_height1));537}538function ta_cal_1p2(idNum) {539 var cal_height1 = jQuery('#bg-bar-cal-height1').text();540 var cal_height2 = jQuery('#bg-bar-cal-height2').text();541 var total = parseInt(cal_height1) + parseInt(cal_height2);542 jQuery(idNum).val(total);543}544function ta_cal_1p2p3(idNum) {545 var cal_height1 = jQuery('#bg-bar-cal-height1').text();546 var cal_height2 = jQuery('#bg-bar-cal-height2').text();547 var cal_height3 = jQuery('#bg-bar-cal-height3').text();548 var total = parseInt(cal_height1) + parseInt(cal_height2) + parseInt(cal_height3);549 jQuery(idNum).val(total);550}551function rgbToHex(rgb) {552 if ( 'transparent' == rgb ) {553 hexCode = 'transparent';554 } else {555 hexCode = "#" + rgb.match(/\d+/g).map(function(a){return ("0" + parseInt(a).toString(16)).slice(-2)}).join("");556 if ( '#00000000' == hexCode ) { hexCode = 'transparent'; }557 }558 return hexCode;559}560function gradRewrite(thisClass, thisId) {561 var refid = jQuery(thisClass).attr('id');562 var grdDirect = jQuery("input[name=" + refid.replace(thisId, '_grd_direct') + "]:checked").val();563 var midOnoff = ( jQuery("input[name=" + refid.replace(thisId, '_grd_mid_color_onoff') + "]").prop("checked")) ? 'valid' : 'invalid';564 var midPos = jQuery("input[name=" + refid.replace(thisId, '_grd_mid_color_pos') + "]").val();565 var startColor = rgbToHex(jQuery('#' + refid.replace(thisId, '_grd_start_color_cover') + ' .color-picker-current-color-frame').css('background-color'));566 var midColor = rgbToHex(jQuery('#' + refid.replace(thisId, '_grd_mid_color_cover') + ' .color-picker-current-color-frame').css('background-color'));567 var stopColor = rgbToHex(jQuery('#' + refid.replace(thisId, '_grd_stop_color_cover') + ' .color-picker-current-color-frame').css('background-color'));568 if ( 'valid' == midOnoff ) { var midInfo = midColor + " " + midPos + "%, "; } else { var midInfo = ""; }569 switch ( grdDirect ) {570 case 'bottom':571 var newDirect = 'top';572 var directNum = 0;573 var newStart = startColor;574 var newStop = stopColor;575 break;576 case 'top':577 var newDirect = 'bottom';578 var directNum = 0;579 var newStart = stopColor;580 var newStop = startColor;581 break;582 case 'right':583 var newDirect = 'left';584 var directNum = 1;585 var newStart = startColor;586 var newStop = stopColor;587 break;588 case 'left':589 var newDirect = 'right';590 var directNum = 1;591 var newStart = stopColor;592 var newStop = startColor;593 break;594 default:595 var newDirect = 'top';596 var directNum = 0;597 var newStart = startColor;598 var newStop = stopColor;599 }600 var gradCss = {601 filter:"progid:DXImageTransform.Microsoft.Gradient(GradientType=" + directNum + ", StartColorStr=" + newStart + ", EndColorStr=" + newStop + ")",602 background:"-ms-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",603 background:"-o-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",604 background:"-moz-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",605 background:"-webkit-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",606 background:"linear-gradient(to " + grdDirect +"," + startColor + " 0%," + midInfo + stopColor + " 100%)"607 }608 jQuery('#' + refid.replace(thisId, '-grd-seting-cover') + ' .color-picker-gradient-current-color-frame').css(gradCss);609 //ã°ã©ãã¼ã·ã§ã³è¡¨è¨ã®è¦ªè²è¡¨ç¤ºIDã®åå¾610 parentId = refid.replace( thisId, '_cover' );611 if ( jQuery('#' + parentId + ' .grd_onoff_cover input').prop('checked') ) { //ã°ã©ãã¼ã·ã§ã³On612 jQuery('#' + refid.replace(thisId, '_cover') + ' #' + refid.replace(thisId, '-colorinfo-container') + ' .color-picker-current-color-frame').css(gradCss);613 }614}615function onoff_gradRewrite(graOnoff, thisId) {616 var grdDirect = jQuery("input[name=" + thisId + "_grd_direct]:checked").val();617 var midOnoff = ( jQuery("input[name=" + thisId + "_grd_mid_color_onoff]").prop("checked")) ? 'valid' : 'invalid';618 var midPos = jQuery("input[name=" + thisId + "_grd_mid_color_pos]").val();619 var startColor = cp_rgbToHex(jQuery('#' + thisId + '_grd_start_color_cover .color-picker-current-color-frame').css('background-color'));620 var midColor = cp_rgbToHex(jQuery('#' + thisId + '_grd_mid_color_cover .color-picker-current-color-frame').css('background-color'));621 var stopColor = cp_rgbToHex(jQuery('#' + thisId + '_grd_stop_color_cover .color-picker-current-color-frame').css('background-color'));622 if ( 'valid' == midOnoff ) { var midInfo = midColor + " " + midPos + "%, "; } else { var midInfo = ""; }623 switch ( grdDirect ) {624 case 'bottom':625 var newDirect = 'top';626 var directNum = 0;627 var newStart = startColor;628 var newStop = stopColor;629 break;630 case 'top':631 var newDirect = 'bottom';632 var directNum = 0;633 var newStart = stopColor;634 var newStop = startColor;635 break;636 case 'right':637 var newDirect = 'left';638 var directNum = 1;639 var newStart = startColor;640 var newStop = stopColor;641 break;642 case 'left':643 var newDirect = 'right';644 var directNum = 1;645 var newStart = stopColor;646 var newStop = startColor;647 break;648 default:649 var newDirect = 'top';650 var directNum = 0;651 var newStart = startColor;652 var newStop = stopColor;653 }654 var gradCss = {655 filter:"progid:DXImageTransform.Microsoft.Gradient(GradientType=" + directNum + ", StartColorStr=" + newStart + ", EndColorStr=" + newStop + ")",656 background:"-ms-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",657 background:"-o-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",658 background:"-moz-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",659 background:"-webkit-linear-gradient(" + newDirect + "," + startColor + " 0%," + midInfo + stopColor + " 100%)",660 background:"linear-gradient(to " + grdDirect +"," + startColor + " 0%," + midInfo + stopColor + " 100%)"661 }662 jQuery('#' + thisId + '-grd-seting-cover .color-picker-gradient-current-color-frame').css(gradCss);663 if ( 'valid' == graOnoff ) { jQuery('#' + thisId + '_cover #' + thisId + '-colorinfo-container .color-picker-current-color-frame').css(gradCss); }...
editforms.js
Source:editforms.js
1function populate_user_fields(){2var F_NAME = document.getElementById('F_NAME').value;3var M_NAME = document.getElementById('M_NAME').value;4var L_NAME = document.getElementById('L_NAME').value;5var STREET = document.getElementById('STREET').value;6var CITY = document.getElementById('CITY').value;7var STATE = document.getElementById('STATE').value;8var ZIPCODE = document.getElementById('ZIPCODE').value;9var SURNAME = document.getElementById('SURNAME').value;10document.getElementById('F_NAME_IN').setAttribute("value", F_NAME);11document.getElementById('M_NAME_IN').setAttribute("value", M_NAME);12document.getElementById('L_NAME_IN').setAttribute("value", L_NAME);13document.getElementById('SURNAME_IN').setAttribute("value", SURNAME);14document.getElementById('USER_STREET_ADDRESS_IN').setAttribute("value", STREET);15document.getElementById('USER_CITY_IN').setAttribute("value", CITY);16document.getElementById('USER_STATE_IN').setAttribute("value", STATE);17document.getElementById('USER_ZIPCODE_IN').setAttribute("value", ZIPCODE);18}19function populate_ref_Fields(){20var refID = escape(document.getElementById('REFERENCE_ID_IN' ).value);21var F_NAME = escape(document.getElementById('F_NAME_' + refID).value);22var L_NAME = escape(document.getElementById('L_NAME_' + refID).value);23var TITLE = escape(document.getElementById('TITLE_' + refID).value);24var COMPANY = escape(document.getElementById('COMPANY_' + refID).value);25var ADDRESS = escape(document.getElementById('ADDRESS_' + refID).value);26var EMAIL = escape(document.getElementById('EMAIL_' + refID).value);27var PHONE_NUMBER = escape(document.getElementById('PHONE_NUMBER_' + refID).value);28var DISPLAY_RANK_ID = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);29document.getElementById('F_NAME_IN').setAttribute("value", unescape(F_NAME));30document.getElementById('L_NAME_IN').setAttribute("value", unescape(L_NAME));31document.getElementById('PHONE_NUMBER_IN').setAttribute("value", unescape(PHONE_NUMBER));32document.getElementById('ADDRESS_IN').setAttribute("value", unescape(ADDRESS));33document.getElementById('EMAIL_IN').setAttribute("value", unescape(EMAIL));34document.getElementById('COMPANY_IN').setAttribute("value", unescape(COMPANY));35document.getElementById('TITLE_IN').setAttribute("value", unescape(TITLE));36document.getElementById('REF_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK_ID));37}38function populate_ex_curr_Fields () {39var refID = escape(document.getElementById('EX_CURR_ID_IN' ).value);40var ORGANIZATION = escape(document.getElementById('ORGANIZATION_' + refID).value);41var TITLE = escape(document.getElementById('TITLE_' + refID).value);42var YEAR = escape(document.getElementById('YEAR_' + refID).value);43var DISPLAY_RANK_ID = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);44var SEMESTER_IN = escape(document.getElementById('SEMESTER_' + refID).value);45document.getElementById('TITLE_IN').setAttribute("value", unescape(TITLE));46document.getElementById('SEMESTER_IN').setAttribute("value", unescape(SEMESTER_IN));47document.getElementById('YEAR_IN').setAttribute("value", unescape(YEAR));48document.getElementById('EX_CUR_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK_ID));49document.getElementById('ORGANIZATION_IN').setAttribute("value", unescape( ORGANIZATION));50}51function populate_academic_fields(){52var refID = escape(document.getElementById('COURSE_ID_IN' ).value);53var COURSE_TITLE = escape(document.getElementById('COURSE_TITLE_' + refID).value);54var COURSE_NUMBER = escape(document.getElementById('COURSE_NUMBER_' + refID).value);55var COURSE_DESCRIPTION = escape(document.getElementById('COURSE_DESCRIPTION_' + refID).value);56var DISPLAY_RANK_ID = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);57unescape(document.getElementById('COURSE_TITLE_IN').setAttribute("value", COURSE_TITLE));58unescape(document.getElementById('COURSE_NUMBER_IN').setAttribute("value", COURSE_NUMBER));59unescape(document.getElementById('COURSE_DESCRIPTION_IN').setAttribute("value", COURSE_DESCRIPTION));60unescape(document.getElementById('ACADEMIC_DISPLAY_RANK_IN').setAttribute("value", DISPLAY_RANK_ID));61}62function populate_certification_fields(){63var refID = escape(document.getElementById('CERT_ID_IN' ).value);64var CERTIFICATION_TITLE = escape(document.getElementById('CERTIFICATION_TITLE_' + refID).value);65var CERTIFICATION_DATE = escape(document.getElementById('CERTIFICATION_DATE_' + refID).value);66var DISPLAY_RANK_ID = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);67document.getElementById('CERTIFICATION_TITLE_IN').setAttribute("value", unescape(CERTIFICATION_TITLE));68document.getElementById('DATE_RECORDED_IN').setAttribute("value", unescape(CERTIFICATION_DATE));69document.getElementById('CERT_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK_ID));70}71function populate_award_fields() {72var refID = escape(document.getElementById('HONOR_ID_IN' ).value);73var AWARD_NAME = escape(document.getElementById('AWARD_NAME_' + refID).value);74var SEMESTER = escape(document.getElementById('SEMESTER_' + refID).value);75var YEAR = escape(document.getElementById('YEAR_' + refID).value);76var DISPLAY_RANK_ID = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);77document.getElementById('AWARD_NAME_IN').setAttribute("value", unescape(AWARD_NAME));78document.getElementById('YEAR_RECEIVED_IN').setAttribute("value", unescape(YEAR));79document.getElementById('SEMESTER_RECEIVED_IN').setAttribute("value", unescape(SEMESTER));80document.getElementById('AWARD_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK_ID));81}82function populate_education_fields() {83var refID = escape(document.getElementById('EDUCATION_ID_IN' ).value);84var SCHOOL_ID = escape(document.getElementById('SCHOOL_ID_' + refID).value);85var DEGREE = escape(document.getElementById('DEGREE_' + refID).value);86var MAJOR = escape(document.getElementById('MAJOR_' + refID).value);87var GRAD_DATE = escape(document.getElementById('GRAD_DATE_' + refID).value);88var GPA = escape(document.getElementById('GPA_' + refID).value);89var MINOR = escape(document.getElementById('MINOR_' + refID).value);90var CERTIFICATIONS = escape(document.getElementById('CERTIFICATIONS_' + refID).value);91var DISPLAY_RANK_ID = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);92document.getElementById('DEGREE_NAME_IN').setAttribute("value", unescape(DEGREE));93document.getElementById('DEGREE_MAJOR_IN').setAttribute("value", unescape(MAJOR));94document.getElementById('DEGREE_MINOR_IN').setAttribute("value", unescape(MINOR));95document.getElementById('CERTIFICATION_IN').setAttribute("value", unescape(CERTIFICATIONS));96document.getElementById('GRADE_POINTS_IN').setAttribute("value", unescape(GPA));97document.getElementById('GRADUATION_DATE_IN').setAttribute("value", unescape(GRAD_DATE));98document.getElementById('EDU_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK_ID));99}100function populate_publication_fields() {101var refID = escape(document.getElementById('RESEARCH_PUB_ID_IN' ).value);102var TITLE = escape(document.getElementById('TITLE_' + refID).value);103var TYPE = escape(document.getElementById('TYPE_' + refID).value);104var LOCATION = escape(document.getElementById('LOCATION_' + refID).value);105var DATE_PRESENTED = escape(document.getElementById('DATE_PRESENTED_' + refID).value);106var DISPLAY_RANK = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);107document.getElementById('RESEARCH_TITLE_IN').setAttribute("value", unescape(TITLE));108document.getElementById('RESEARCH_TYPE_IN').setAttribute("value", unescape(TYPE));109document.getElementById('RESEARCH_LOCATION_IN').setAttribute("value", unescape(LOCATION));110document.getElementById('RESEARCH_DATE_PRESENTED_IN').setAttribute("value", unescape(DATE_PRESENTED));111document.getElementById('PUB_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK));112}113function populate_projects_fields(){114var refID = escape(document.getElementById('PROJECT_ID_IN' ).value);115var PROJECT_NAME = escape(document.getElementById('NAME_' + refID).value);116var DESCRIPTION = escape(document.getElementById('DESCRIPTION_' + refID).value);117var DISPLAY_RANK = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);118document.getElementById('PROJECT_NAME_IN').setAttribute("value", unescape(PROJECT_NAME));119document.getElementById('PROJECT_DESCRIPTION_IN').setAttribute("value", unescape(DESCRIPTION));120document.getElementById('PROJ_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK));121}122function populate_standard_skill_fields(){123var refID = escape(document.getElementById('STANDARD_SKILL_ID_IN' ).value);124var SKILL_NAME = escape(document.getElementById('STANDARD_SKILL_NAME_' + refID).value);125var DISPLAY_RANK = escape(document.getElementById('STANDARD_DISPLAY_RANK_ID_' + refID).value);126var SKILL_TYPE = escape(document.getElementById('STANDARD_SKILL_TYPE_' + refID).value);127document.getElementById('STANDARD_SKILL_TYPE_IN').setAttribute("value", unescape(SKILL_TYPE));128document.getElementById('STANDARD_SKILL_NAME_IN').setAttribute("value", unescape(SKILL_NAME));129document.getElementById('STANDARD_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK));130}131function populate_technical_skill_fields(){132var refID = escape(document.getElementById('TECHNICAL_SKILL_ID_IN' ).value);133var SKILL_NAME = escape(document.getElementById('TECHNICAL_SKILL_NAME_' + refID).value);134var DISPLAY_RANK = escape(document.getElementById('TECHNICAL_DISPLAY_RANK_ID_' + refID).value);135var SKILL_TYPE = escape(document.getElementById('TECHNICAL_SKILL_TYPE_' + refID).value);136document.getElementById('TECHNICAL_SKILL_TYPE_IN').setAttribute("value", unescape(SKILL_TYPE));137document.getElementById('TECHNICAL_SKILL_NAME_IN').setAttribute("value", unescape(SKILL_NAME));138document.getElementById('TECHNICAL_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK));139}140function populate_design_skill_fields(){141var refID = escape(document.getElementById('DESIGN_SKILL_ID_IN' ).value);142var SKILL_NAME = escape(document.getElementById('DESIGN_SKILL_NAME_' + refID).value);143var DISPLAY_RANK = escape(document.getElementById('DESIGN_DISPLAY_RANK_ID_' + refID).value);144var SKILL_TYPE = escape(document.getElementById('DESIGN_SKILL_TYPE_' + refID).value);145document.getElementById('DESIGN_SKILL_TYPE_IN').setAttribute("value", unescape(SKILL_TYPE));146document.getElementById('DESIGN_SKILL_NAME_IN').setAttribute("value", unescape(SKILL_NAME));147document.getElementById('DESIGN_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK));148}149function populate_work_history_fields(){150var refID = escape(document.getElementById('WORK_ID_IN' ).value);151var POSITION_TITLE = escape(document.getElementById('POSITION_TITLE_' + refID).value);152var START_DATE = escape(document.getElementById('START_DATE_' + refID).value);153var END_DATE = escape(document.getElementById('END_DATE_' + refID).value);154var EMPLOYER = escape(document.getElementById('EMPLOYER_' + refID).value);155var CITY = escape(document.getElementById('CITY_' + refID).value);156var STATE = escape(document.getElementById('STATE_' + refID).value);157var DISPLAY_RANK_ID = escape(document.getElementById('DISPLAY_RANK_ID_' + refID).value);158var DESCRIPTION = escape(document.getElementById('DESCRIPTION_1_' + refID).value);159document.getElementById('WORK_POSITION_IN').setAttribute("value", unescape(POSITION_TITLE));160document.getElementById('WORK_START_DATE_IN').setAttribute("value", unescape(START_DATE));161document.getElementById('WORK_END_DATE_IN').setAttribute("value", unescape(END_DATE));162document.getElementById('WORK_EMPLOYER_IN').setAttribute("value", unescape(EMPLOYER));163document.getElementById('WORK_CITY_IN').setAttribute("value", unescape(CITY));164document.getElementById('WORK_STATE_IN').setAttribute("value", unescape(STATE));165document.getElementById('WORK_DESCRIPTION_IN').setAttribute("value", unescape(DESCRIPTION));166document.getElementById('WORK_DISPLAY_RANK_IN').setAttribute("value", unescape(DISPLAY_RANK_ID));...
index.js
Source:index.js
1import Vue from 'vue'2import Sidebar from './Sidebar'3let _sidebars = {}4class VonicSidebar {5 fromTemplateUrl(url, options) {6 return new Promise((resolve, reject) => {7 axios.get(url)8 .then((response) => {9 return response.data10 })11 .then((template) => {12 resolve(this.fromTemplate(template, options))13 })14 })15 }16 fromTemplate(template, options) {17 return this._init(template, options)18 }19 _init(template, options) {20 let refId = (options && options.refId) ? options.refId : Math.random().toString(36).substr(3, 6)21 let position = (options && options.position) ? options.position : 'left'22 let wrapper = document.createElement('div')23 wrapper.setAttribute('von-sidebar-container', '')24 wrapper.setAttribute('von-sidebar-container-' + refId, '')25 document.querySelector('[von-app]').appendChild(wrapper)26 wrapper.innerHTML = `<sidebar position='${position}' ref='${refId}'>${template}</sidebar>`27 let vm = new Vue({28 components: {29 Sidebar30 },31 el: `[von-sidebar-container-${refId}]`32 })33 _sidebars[refId] = vm.$refs[refId]34 vm.$refs[refId].setWrapperSelector(`[von-sidebar-container-${refId}]`)35 return vm.$refs[refId]36 }37 delegate(refId) {38 return _sidebars[refId]39 }40 destroy() {41 for (let refId in _sidebars) {42 if (_sidebars[refId]) {43 _sidebars[refId].$destroy()44 _sidebars[refId] = undefined45 }46 let wrapper = document.querySelector(`[von-sidebar-container-${refId}]`)47 wrapper.innerHTML = ''48 document.querySelector('[von-app]').removeChild(wrapper)49 }50 _sidebars = {}51 }52}...
Using AI Code Generation
1import { refId } from "storybook-root";2import { refId } from "storybook-root";3import { refId } from "storybook-root";4import { refId } from "storybook-root";5import { refId } from "storybook-root";6import { refId } from "storybook-root";7import { refId } from "storybook-root";8import { refId } from "storybook-root";9import { refId } from "storybook-root";10import { refId } from "storybook-root";11import { refId } from "storybook-root";12import { refId } from "storybook-root";13import { refId } from "storybook-root";14import { refId } from "storybook-root";15import { refId } from "storybook-root";16import { refId } from "storybook-root";17import { refId } from "storybook-root";18import { refId } from "storybook-root";19import { refId } from "storybook-root";20import { refId } from "storybook-root";
Using AI Code Generation
1import {refId} from 'storybook-root-provider';2import {refId} from 'storybook-root-provider/lib/refId';3import {refId} from 'storybook-root-provider/lib/refId.js';4import {refId} from 'storybook-root-provider/lib/refId.ts';5import {refId} from 'storybook-root-provider/lib/refId';6import {refId} from 'storybook-root-provider/lib/refId.js';7import {refId} from 'storybook-root-provider/lib/refId.ts';8import {refId} from 'storybook-root-provider/lib/refId.js';9import {refId} from 'storybook-root-provider/lib/refId.ts';10import {refId} from 'storybook-root-provider/lib/refId.ts';11- [refId](#refid)12 - [Parameters](#parameters)13 - [Examples](#examples)14import {refId} from 'storybook-root-provider';15import {refId} from 'storybook-root-provider/lib/refId';16import {refId} from 'storybook-root-provider/lib/refId.js';17import {refId} from 'storybook-root-provider/lib/refId.ts';18const currentRefId = refId(this.props.storyStore);
Using AI Code Generation
1import React from 'react';2import { refId } from 'storybook-root-provider';3const Test = () => {4 const id = refId('test');5 return <div ref={id}>test</div>;6};7export default Test;8import React from 'react';9import Test from './test';10import { storiesOf } from '@storybook/react';11storiesOf('Test', module).add('default', () => <Test />);
Using AI Code Generation
1import { refId } from 'storybook-root';2import { storiesOf } from '@storybook/react';3storiesOf('refId', module).add('refId', () => {4 return <div>{refId()}</div>;5});6import { configure } from '@storybook/react';7import 'storybook-root/register';8configure(9 require.context('../src', true, /\.stories\.js$/),10 require.context('../test', true, /\.stories\.js$/),11);12import { storiesOf } from '@storybook/react';13import { refId } from 'storybook-root';14storiesOf('refId', module).add('refId', () => {15 return <div>{refId()}</div>;16});17MIT © [Dustin Specker](
Using AI Code Generation
1import { refId } from 'storybook-root-decorator';2const story = () => {3 return <div ref={refId('myRefId')} />4}5story.story = {6 parameters: {7 rootDecorator: {8 },9 },10};11export default story;12import { render } from '@testing-library/react';13import story from './test.js';14describe('test', () => {15 it('should work', () => {16 const { container } = render(story());17 expect(container.querySelector('[ref="myRefId"]')).not.toBeNull();18 });19});
Using AI Code Generation
1import { refId } from 'storybook-root';2const button = refId('button');3button.click();4import { refId } from 'storybook-root';5const button = refId('button');6button.click();7import { refId } from 'storybook-root';8const button = refId('button');9button.click();10import { refId } from 'storybook-root';11const button = refId('button');12button.click();13import { refId } from 'storybook-root';14const button = refId('button');15button.click();16import { refId } from 'storybook-root';17const button = refId('button');18button.click();19import { refId } from 'storybook-root';20const button = refId('button');21button.click();22import { refId } from 'storybook-root';23const button = refId('button');24button.click();25import { refId } from 'storybook-root';26const button = refId('button');27button.click();28import { refId } from 'storybook-root';29const button = refId('button');30button.click();31import { refId } from 'storybook-root';32const button = refId('button');33button.click();34import { refId } from 'storybook-root';35const button = refId('button');36button.click();37import { refId } from 'storybook-root';38const button = refId('button');39button.click();40import { refId } from 'storybook-root';41const button = refId('button');
Using AI Code Generation
1import { refId } from './refId';2const id = refId('my-id');3export default id;4import { refId } from 'storybook-root';5const id = refId('my-id');6import { refId } from 'storybook-root';7import { getByTestId } from '@testing-library/dom';8const id = refId('my-id');9const element = getByTestId(id);10import { refId } from 'storybook-root';11const id = refId('my-id');12const element = document.getElementById(id);13import { refId } from 'storybook-root';14const id = refId('my-id');15const element = cy.get(`#${id}`);16import { refId } from 'storybook-root';17const id = refId('my-id');18const element = driver.findElement(By.id(id));19import { refId } from 'storybook-root';20const id = refId('my-id');21const element = element(by.id(id));22import { refId } from 'storybook-root';23const id = refId('my-id');24const element = browser.element(`#${id}`);25import { refId } from 'storybook-root';26const id = refId('my-id');27const element = await page.$(`#${id}`);28import
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!