1// ver 0.0.1 2// IE9 later 3// tp_common_basic.js 4// tp_article_voice.js 5$(document).ready(function() { 6}); 7function f_tp_article_voice_button_addTopEle (l_in_av_id, event) { 8 try { 9 if ($.contains(event.target, $('#id_button_div')[0])) { 10 f_tp_article_voice_button_close(); 11 return; 12 } 13 } catch (ee1) { 14 } 15 // 16 var l_req = null; 17 if (window.ActiveXObject) { 18 try { 19 l_req = new ActiveXObject("Msxml2.XMLHTTP"); 20 } catch (e_xmlhttpobject) { 21 l_req = new ActiveXObject("Microsoft.XMLHTTP"); 22 } 23 } else if (window.XMLHttpRequest) { 24 l_req = new XMLHttpRequest(); 25 l_req.overrideMimeType('text/html'); 26 } else { 27 l_req = null; 28 } 29 if (f_tp_common_basic_isNull(l_req)) { return; } 30 l_req.open('POST', '/sr/button_voice.cgi?u=' + f_tp_common_basic_nowDate2yymmddhhmmss(), true); 31 l_req.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); 32 l_req.onreadystatechange = function() { 33 if (4 === l_req.readyState) { 34 var ll_stat = '0'; 35 var ll_res = ''; 36 if (200 === l_req.status) { 37 ll_res = l_req.responseText; 38 ll_stat = '1'; 39 } else if (1 === l_req.status) { 40 } else { 41 ll_stat = '-1'; 42 try { 43 l_req.abort(); 44 } catch (e1) { 45 } 46 try { 47 l_req = null; 48 } catch (e2) { 49 } 50 } 51 f_tp_article_voice_button_addTopEle_callback(ll_stat, ll_res, l_in_av_id, event); 52 } 53 }; 54 var l_sendData = 'avid=' + l_in_av_id; 55 l_req.send(l_sendData); 56} 57function f_tp_article_voice_button_addTopEle_callback(l_ret, l_res, l_in_av_id, event) { 58 if ('1' == l_ret) { 59 try { 60 var $lv_eventObj = $('#' + event.target.id); 61 $lv_eventObj.empty(); 62 63 var l_w = f_tp_common_basic_numPx2num($lv_eventObj.css('width')); 64 var l_h = f_tp_common_basic_numPx2num($lv_eventObj.css('height')); 65 var l_b_offsetX = -135 + Math.round(l_w * 0.5); // -135 260 / 2 <div name="n_button_div" id="id_button_div" 66 var $mainDiv_obj = $("<div></div>"); 67 $mainDiv_obj.attr("name", "n_button_div"); 68 $mainDiv_obj.attr("id", "id_button_div"); 69 $mainDiv_obj.css("left", l_b_offsetX + "px"); 70 $mainDiv_obj.css("top", l_h + "px"); 71 $mainDiv_obj.css("z-index", 100); 72// $mainDiv_obj.css("position", "absolute"); 73// $mainDiv_obj.css("float", "left"); 74 $mainDiv_obj.css("cursor", "auto"); 75 $mainDiv_obj.addClass("c_article_voice_button"); 76 $mainDiv_obj.click(f_tp_article_voice_button_onClickNoAction); 77 $mainDiv_obj.html(l_res); 78 $lv_eventObj.append($mainDiv_obj); 79 } catch (e0) { 80 } 81 } 82} 83/// 84function f_tp_article_voice_button_add (l_in_av_id, l_in_buttonNo) { 85// f_tp_article_voice_button_removeTopEle(null); 86 var l_req = null; 87 if (window.ActiveXObject) { 88 try { 89 l_req = new ActiveXObject("Msxml2.XMLHTTP"); 90 } catch (e_xmlhttpobject) { 91 l_req = new ActiveXObject("Microsoft.XMLHTTP"); 92 } 93 } else if (window.XMLHttpRequest) { 94 l_req = new XMLHttpRequest(); 95 l_req.overrideMimeType('text/html'); 96 } else { 97 l_req = null; 98 } 99 if (f_tp_common_basic_isNull(l_req)) { return; } 100 l_req.open('POST', '/sr/button_voice_add.cgi?u=' + f_tp_common_basic_nowDate2yymmddhhmmss(), true); 101 l_req.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); 102 l_req.onreadystatechange = function() { 103 if (4 === l_req.readyState) { 104 var ll_stat = '0'; 105 var ll_res = ''; 106 if (200 === l_req.status) { 107 ll_res = l_req.responseText; 108 ll_stat = '1'; 109 } else if (1 === l_req.status) { 110 } else { 111console.log("f_tp_article_voice_button_add err1"); 112 ll_stat = '-1'; 113 try { 114 l_req.abort(); 115 } catch (e1) { 116 } 117 try { 118 l_req = null; 119 } catch (e2) { 120 } 121 } 122 f_tp_article_voice_button_add_callback(ll_stat, ll_res, l_in_av_id); 123 } 124 }; 125 var l_sendData = 'avid=' + l_in_av_id; 126 l_sendData += '&bn=' + l_in_buttonNo; 127 l_req.send(l_sendData); 128} 129function f_tp_article_voice_button_add_callback(l_ret, l_res, l_in_av_id) { 130console.log("f_tp_article_voice_button_add_callback start " + l_ret + " " + l_in_av_id); 131 if ('1' == l_ret) { 132 try { 133 if ('' != l_res) { 134 var $mainDiv_obj = $('#id_button_div'); 135 $mainDiv_obj.html(l_res); 136 } 137 } catch (e0) { 138 } 139 140 try { 141 var ll = l_res.match(/<!-- +total ([0-9]+) +-->/); 142console.log("f_tp_article_voice_button_add_callback start l_res length " + ll.length); 143 if (2 == ll.length) { 144 $('#id_article_mid_div_1_div_mid_button3_span' + l_in_av_id).html(ll[1]); 145 } 146 } catch (e2) { 147 } 148// if (l_res.match(/^[0-9]+$/)) { 149// try { 150// $('#id_article_mid_div_1_div_mid_button3_span' + l_in_av_id).html(l_res); 151//// f_tp_article_voice_more_submit(g_aid, 'id_article_mid_osusume_voice_area_div', g_limit); 152// } catch (e1) { 153// } 154// } 155 } 156// f_tp_article_voice_button_removeTopEle(null); 157} 158///////////////////////// 159function f_tp_article_voice_button_removeTopEle (event) { 160 // ãã¬ã¼ã ãéãã 161 var $ol_obj = $("#id_tp_article_button_ol_div"); 162 if (f_tp_common_basic_isNull($ol_obj)) { return; } 163 try { 164 $ol_obj.remove(); 165 } catch (e0) { 166 } 167 var $main_obj = $("#id_button_div"); 168 try { 169 $main_obj.remove(); 170 } catch (e1) { 171 }
172 $(document.body).css("overflow", "auto"); 173} 174function f_tp_article_voice_button_close() { 175 try { 176 $('#id_button_div').remove(); 177 } catch (e0) { 178 } 179 try { 180 var l_ele = document.getElementsByName('n_button_div'); 181 if (l_ele.length) { 182 for (var i = (l_ele.length - 1); i >= 0; i = i - 1) { 183 try { 184 l_ele[i].parentNode.removeChild(l_ele[i]); 185 } catch (e1_0) { 186 } 187 } 188 } 189 } catch (e1) { 190 } 191} 192function f_tp_article_voice_button_onClickNoAction (event) { 193 // ãã¬ã¼ã å ãã¯ãªãã¯ãã¦ã親ã«ã¯ä¼æããªã 194 event.stopPropagation(); 195} 196// end of file
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.