code_manager.js
4 years ago
code_manager_dashboard.js
4 years ago
code_manager_listmode.js
4 years ago
code_manager_message.js
4 years ago
code_manager_tabmode.js
4 years ago
notify.min.js
4 years ago
code_manager_message.js
68 lines
| 1 | function cm_warning() { |
| 2 | const cm_home = window.location.href.split('&')[0]; |
| 3 | |
| 4 | warningHtml = ` |
| 5 | <p> |
| 6 | Adding custom code may introduce incompatibilities that break your site. Here are some guidelines to keep in mind when writing custom code: |
| 7 | </p> |
| 8 | <ul> |
| 9 | <li>Do NOT copy code into the Code Manager you don’t understand</li> |
| 10 | <li>Do NOT copy code from the internet into the Code Manager if you’re not sure what the code does</li> |
| 11 | <li>Know what you do, do what you know</li> |
| 12 | </ul> |
| 13 | <p> |
| 14 | Bookmark these links in case your code results in failures: |
| 15 | </p> |
| 16 | <ul> |
| 17 | <li> |
| 18 | <a href="${cm_home}"> |
| 19 | Your Code Manager admin page |
| 20 | </a> |
| 21 | </li> |
| 22 | <li> |
| 23 | <a href="https://code-manager.com/blog/docs/index/getting-started/read-this-first/" target="_blank"> |
| 24 | Four alternatives to disable faulty code |
| 25 | </a> |
| 26 | </li> |
| 27 | </ul> |
| 28 | <div> |
| 29 | <label> |
| 30 | <input type="checkbox" id="code_manager_message_off" /> Don't show this message again |
| 31 | </label> |
| 32 | </div> |
| 33 | `; |
| 34 | |
| 35 | var dialog = jQuery("<div/>").html(warningHtml).dialog({ |
| 36 | title: "Heads up!", |
| 37 | width: "max-content", |
| 38 | dialogClass: "code-manager-dialog", |
| 39 | modal: true, |
| 40 | autoOpen: true, |
| 41 | closeOnEscape: false, |
| 42 | draggable:false, |
| 43 | resizable: false, |
| 44 | buttons: { |
| 45 | "Go back": function() { |
| 46 | cm_message_off(); |
| 47 | window.location.href = cm_home; |
| 48 | }, |
| 49 | "I understand": function() { |
| 50 | cm_message_off(); |
| 51 | dialog.dialog("destroy"); |
| 52 | } |
| 53 | } |
| 54 | }); |
| 55 | } |
| 56 | |
| 57 | function cm_message_off() { |
| 58 | if (jQuery("#code_manager_message_off").is(":checked")) { |
| 59 | // turn off alert |
| 60 | jQuery.ajax({ |
| 61 | type: 'POST', |
| 62 | url: pathname + '?action=code_manager_alert_off', |
| 63 | data: { |
| 64 | wpnonce: wpnonce |
| 65 | } |
| 66 | }); |
| 67 | } |
| 68 | } |