|
| 1 | +<script type="text/javascript"> |
| 2 | + RED.nodes.registerType("puppeteer-rename", { |
| 3 | + category: "storage", |
| 4 | + color: "#deb887", |
| 5 | + defaults: { |
| 6 | + oldFilePath: { value: "", required: false }, |
| 7 | + oldFilePathtype: { value: "str" }, |
| 8 | + newFilePath: { value: "", required: false }, |
| 9 | + newFilePathtype: { value: "str" }, |
| 10 | + name: { value: "" }, |
| 11 | + }, |
| 12 | + inputs: 1, |
| 13 | + outputs: 1, |
| 14 | + icon: "rename.svg", |
| 15 | + label: function () { |
| 16 | + return name || "Rename"; |
| 17 | + }, |
| 18 | + paletteLabel: "Rename", |
| 19 | + oneditprepare: function () { |
| 20 | + $("#node-input-oldFilePath").typedInput({ |
| 21 | + type: "str", |
| 22 | + types: ["str", "msg", "flow", "global"], |
| 23 | + typeField: "#node-input-oldFilePathtype", |
| 24 | + }); |
| 25 | + $("#node-input-newFilePath").typedInput({ |
| 26 | + type: "str", |
| 27 | + types: ["str", "msg", "flow", "global"], |
| 28 | + typeField: "#node-input-newFilePathtype", |
| 29 | + }); |
| 30 | + }, |
| 31 | + }); |
| 32 | +</script> |
| 33 | + |
| 34 | +<script type="text/x-red" data-template-name="puppeteer-page-rename"> |
| 35 | + <div class="form-row"> |
| 36 | + <label for="node-input-oldFilePath"><i class="fa fa-file"></i> Old File Path</label> |
| 37 | + <input id="node-input-oldFilePath"></input> |
| 38 | + <input type="hidden" id="node-input-oldFilePathtype"></input> |
| 39 | + </div> |
| 40 | + <div class="form-row"> |
| 41 | + <label for="node-input-newFilePath"><i class="fa fa-file-o"></i> New File Path</label> |
| 42 | + <input id="node-input-newFilePath"></input> |
| 43 | + <input type="hidden" id="node-input-newFilePathtype"></input> |
| 44 | + </div> |
| 45 | + <div class="form-row"> |
| 46 | + <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> |
| 47 | + <input type="text" id="node-input-name" style="width:70%;" placeholder="Name" /> |
| 48 | + </div> |
| 49 | +</script> |
| 50 | + |
| 51 | +<script type="text/x-red" data-help-name="puppeteer-page-rename"> |
| 52 | + <p>Click on Chrome</p> |
| 53 | + <h3>Inputs</h3> |
| 54 | + <dl class="message-properties"> |
| 55 | + <dt>Selector<span class="property-type">string</span></dt> |
| 56 | + <dd>A <a href="#interface-selector" title="Selector">selector</a> to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.</dd> |
| 57 | + <dt>Button<span class="property-type">string</span></dt> |
| 58 | + <dd>Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.<"left"|"right"|"middle"> Defaults to <code>left</code>.</dd> |
| 59 | + <dt>Click Count<span class="property-type">number</span></dt> |
| 60 | + <dd>Whether to run browser in <a href="https://developers.google.com/web/updates/2017/04/headless-chrome" rel="nofollow">headless mode</a>. Defaults to <code>false</code>, it will show Chrome when <code>devtools</code> option is <code>true</code>.defaults to 1. See <a href="https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail" title="UIEvent.detail" rel="nofollow">UIEvent.detail</a>.</dd> |
| 61 | + <dt>Delay<span class="property-type">number</span></dt> |
| 62 | + <dd>Specify custom debugging port. Pass <code>0</code> to discover a random port. Defaults to <code>0</code>.Time to wait between <code>mousedown</code> and <code>mouseup</code> in milliseconds. Defaults to 0.</dd> |
| 63 | + <dt>Rename path<span class="property-type">string</span></dt> |
| 64 | + <dd>Specify custom rename path. Leave the field blank for default rename path. Defaults to user's default browser rename path.</dd> |
| 65 | + </dl> |
| 66 | + <h3>Details</h3> |
| 67 | + <p>This method fetches an element with <code>selector</code>, scrolls it into view if needed, and then uses <code>page.mouse</code> to click in the center of the element. |
| 68 | + If there's no element matching <code>selector</code>, the method throws an error.</p> |
| 69 | +</script> |
0 commit comments