{"id":1966,"date":"2020-10-08T13:22:03","date_gmt":"2020-10-08T11:22:03","guid":{"rendered":"https:\/\/cn.gshydro.com\/?page_id=1966"},"modified":"2020-10-08T14:04:24","modified_gmt":"2020-10-08T12:04:24","slug":"pipe-weight-calculator","status":"publish","type":"page","link":"https:\/\/cn.gshydro.com\/zh\/gs-resources\/pipe-weight-calculator\/","title":{"rendered":"\u7ba1\u9053\u91cd\u91cf\u8ba1\u7b97\u5668"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"1966\" class=\"elementor elementor-1966\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-37dfb88 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"37dfb88\" data-element_type=\"section\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[{&quot;jet_parallax_layout_image&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;,&quot;size&quot;:&quot;&quot;},&quot;_id&quot;:&quot;7cdbbae&quot;,&quot;jet_parallax_layout_image_tablet&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;,&quot;size&quot;:&quot;&quot;},&quot;jet_parallax_layout_image_mobile&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;,&quot;size&quot;:&quot;&quot;},&quot;jet_parallax_layout_speed&quot;:{&quot;unit&quot;:&quot;%&quot;,&quot;size&quot;:50,&quot;sizes&quot;:[]},&quot;jet_parallax_layout_type&quot;:&quot;scroll&quot;,&quot;jet_parallax_layout_direction&quot;:&quot;1&quot;,&quot;jet_parallax_layout_fx_direction&quot;:null,&quot;jet_parallax_layout_z_index&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_x&quot;:50,&quot;jet_parallax_layout_bg_x_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_x_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_y&quot;:50,&quot;jet_parallax_layout_bg_y_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_y_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_size&quot;:&quot;auto&quot;,&quot;jet_parallax_layout_bg_size_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_size_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_animation_prop&quot;:&quot;transform&quot;,&quot;jet_parallax_layout_on&quot;:[&quot;desktop&quot;,&quot;tablet&quot;]}]}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6175cc5\" data-id=\"6175cc5\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ee0f80f elementor-widget elementor-widget-heading\" data-id=\"ee0f80f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><b>\u7ba1\u9053\u91cd\u91cf<\/b> \u8ba1\u7b97\u5668<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5087029 elementor-widget elementor-widget-html\" data-id=\"5087029\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t <form id=\"weight-calc\" action=\"\">\r\n        <table width=\"600px\">\r\n          <tbody id=\"weight-table\">\r\n            <tr class=\"\" id=\"form-header\">\r\n              <td>\u6750\u6599<\/td>\r\n              <td>\u76f4\u5f84<\/td>\r\n              <td>\u5ba4\u58c1\u539a\u5ea6<\/td>\r\n              <td>\u957f\u5ea6<\/td>\r\n              <td>\u91cd\u91cf[\u516c\u65a4]<\/td>\r\n            <\/tr>\r\n            <tr class=\"form-row\" id=\"form-row-1\">\r\n              <td>\r\n                <select name=\"material-select\">\r\n                  <option name=\"material\" value=\"steel\">\u94a2<\/option>\r\n                  <option name=\"material\" value=\"stainless-steel\">\r\n                    \u4e0d\u9508\u94a2\r\n                  <\/option>\r\n                <\/select>\r\n              <\/td>\r\n              <td>\r\n                <input type=\"text\" class=\"weightCalc-input\" name=\"diameter\" \/>\r\n              <\/td>\r\n              <td>\r\n                <input type=\"text\" class=\"weightCalc-input\" name=\"thickness\" \/>\r\n              <\/td>\r\n              <td>\r\n                <input type=\"text\" class=\"weightCalc-input\" name=\"length\" \/>\r\n              <\/td>\r\n              <td>\r\n                <input\r\n                  type=\"text\"\r\n                  class=\"weightCalc-input input-weight\"\r\n                  name=\"weight\"\r\n                  readonly\r\n \/>\r\n              <\/td>\r\n            <\/tr>\r\n          <\/tbody>\r\n        <\/table>\r\n         <div id=\"weight-table-bottom-bar\">\r\n                  <div class=\"first-wrapper\">\r\n                    <button type=\"button\" id=\"add-row\">+<\/button>\r\n                    <button type=\"button\" id=\"calculate\">\u666e\u96f7\u6cfd\u5229\u5947<\/button>\r\n                  <\/div>\r\n                  <div class=\"second-wrapper\">\r\n                    <label for=\"summary\">\r\n                      \u6982\u62ec\r\n                      <input\r\n                        type=\"text\"\r\n                        name=\"weight-summary\"\r\n                        id=\"weight-summary\"\r\n                        readonly\r\n \/>\r\n                    <\/label>\r\n                  <\/div>\r\n                <\/div>\r\n      <input type=\"hidden\" name=\"trp-form-language\" value=\"zh\"\/><\/form>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-0363719 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"0363719\" data-element_type=\"section\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[{&quot;jet_parallax_layout_image&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;,&quot;size&quot;:&quot;&quot;},&quot;_id&quot;:&quot;c44185b&quot;,&quot;jet_parallax_layout_image_tablet&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;,&quot;size&quot;:&quot;&quot;},&quot;jet_parallax_layout_image_mobile&quot;:{&quot;url&quot;:&quot;&quot;,&quot;id&quot;:&quot;&quot;,&quot;size&quot;:&quot;&quot;},&quot;jet_parallax_layout_speed&quot;:{&quot;unit&quot;:&quot;%&quot;,&quot;size&quot;:50,&quot;sizes&quot;:[]},&quot;jet_parallax_layout_type&quot;:&quot;scroll&quot;,&quot;jet_parallax_layout_direction&quot;:&quot;1&quot;,&quot;jet_parallax_layout_fx_direction&quot;:null,&quot;jet_parallax_layout_z_index&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_x&quot;:50,&quot;jet_parallax_layout_bg_x_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_x_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_y&quot;:50,&quot;jet_parallax_layout_bg_y_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_y_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_size&quot;:&quot;auto&quot;,&quot;jet_parallax_layout_bg_size_tablet&quot;:&quot;&quot;,&quot;jet_parallax_layout_bg_size_mobile&quot;:&quot;&quot;,&quot;jet_parallax_layout_animation_prop&quot;:&quot;transform&quot;,&quot;jet_parallax_layout_on&quot;:[&quot;desktop&quot;,&quot;tablet&quot;]}]}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a54d86c\" data-id=\"a54d86c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-aacd299 elementor-widget elementor-widget-html\" data-id=\"aacd299\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<script>\n    let counter = 1,\n  addButton = document.getElementById(\"add-row\"),\n  calculateButton = document.getElementById(\"calculate\"),\n  weightForm = document.getElementById(\"weight-calc\"),\n  weightTable = document.getElementById(\"weight-table\"),\n  formRow = document.getElementById(`form-row-${counter}`),\n  weightSummary = document.getElementById(\"weight-summary\");\n\nfunction updateWeight() {\n  let row = document.querySelectorAll(\".form-row\");\n  let arr = [];\n  for (let u = 0; u < row.length; u++) {\n    let a = parseFloat(row[u].querySelector('input[name=\"diameter\"]').value);\n    let b = parseFloat(row[u].querySelector('input[name=\"thickness\"]').value);\n    let c = parseFloat(row[u].querySelector('input[name=\"length\"]').value);\n    let density = row[u].querySelector('select[name=\"material-select\"]').value;\n    let d = density === \"steel\" ? 7.85 : 7.86;\n    let singleWeight = row[u].querySelector(\".input-weight\");\n    let value = (\n      (Math.PI *\n        0.001 *\n        c *\n        d *\n        (Math.pow(a \/ 2, 2) - Math.pow((a - 2 * b) \/ 2, 2))) \/\n      1000\n    ).toFixed(2);\n    value < 0\n      ? (singleWeight.value = \"b\u0142\u0119dne dane\")\n      : (singleWeight.value = value);\n  }\n  let materialWeight = document.querySelectorAll(\".input-weight\");\n\n  for (let w of materialWeight) {\n    arr.push(w.value);\n  }\n  let summary = arr.reduce((a, b) => {\n    return +a + +b;\n  });\n  weightSummary.value =\n    isNaN(summary) === true ? \"b\u0142\u0119dne dane\" : parseFloat(summary).toFixed(2);\n}\ncalculateButton.addEventListener(\"click\", updateWeight);\n\n\/\/ add new form row button\naddButton.addEventListener(\"click\", (e) => {\n  e.preventDefault();\n  let formRow = document.querySelector(`#form-row-${counter}`).cloneNode(true);\n  counter += 1;\n  formRow.setAttribute(\"id\", `form-row-${counter}`);\n  formRow.querySelector('input[name=\"diameter\"]').value = 0;\n  formRow.querySelector('input[name=\"thickness\"]').value = 0;\n  formRow.querySelector('input[name=\"length\"]').value = 0;\n  formRow.querySelector(\".input-weight\").value = 0;\n  weightTable.appendChild(formRow);\n});\n\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>\u7ba1\u9053\u91cd\u91cf\u8ba1\u7b97\u5668 \u6750\u6599\u76f4\u5f84 \u58c1\u539a \u957f\u5ea6 \u91cd\u91cf [kg] \u94a2 \u4e0d\u9508\u94a2 + Przelicz \u6458\u8981<\/p>","protected":false},"author":3,"featured_media":0,"parent":1934,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"footnotes":""},"class_list":["post-1966","page","type-page","status-publish","hentry","entry","owp-thumbs-layout-horizontal","owp-btn-normal","owp-tabs-layout-horizontal","has-no-thumbnails","has-product-nav"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/cn.gshydro.com\/zh\/wp-json\/wp\/v2\/pages\/1966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.gshydro.com\/zh\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cn.gshydro.com\/zh\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cn.gshydro.com\/zh\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.gshydro.com\/zh\/wp-json\/wp\/v2\/comments?post=1966"}],"version-history":[{"count":0,"href":"https:\/\/cn.gshydro.com\/zh\/wp-json\/wp\/v2\/pages\/1966\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/cn.gshydro.com\/zh\/wp-json\/wp\/v2\/pages\/1934"}],"wp:attachment":[{"href":"https:\/\/cn.gshydro.com\/zh\/wp-json\/wp\/v2\/media?parent=1966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}