Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">
<head>
  <script src="https://code.jquery.com/jquery-1.12.4.min.js"
          integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
          crossorigin="anonymous"></script>
  <meta charset="UTF-8">
  <title>Generator</title>
  <style type="text/css">
    .g-wrap__form {
      width: 100%;
    }

    .g-wrap__form .g-wrap__form-wrap {
      max-width: 250px;
    }

    .g-wrap__form .g-wrap__form-wrap .form-group {
      margin-bottom: 15px;
    }

    .g-wrap__form .g-wrap__form-wrap .form-control {
      width: 100%;
      height: 44px;
      padding: 12px 15px 13px;
      font-size: 16px;
      line-height: 1.3;
      letter-spacing: normal;
      color: #28392a;
      border: 0 none;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 8px;
      outline: 0 none;
      -webkit-appearance: none;
      -webkit-transition: background 0.2s ease-in-out;
      transition: background 0.2s ease-in-out;
    }

    .g-wrap__form .g-wrap__form-wrap .form-control-bordered {
      border-style: solid;
      border-color: #e3e3e3;
      background: #fff;
      -webkit-transition: box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
      transition: box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
    }

    .g-wrap__form .g-wrap__form-wrap .form-control-bordered {
      padding: 19px 25px;
      border-radius: 12px;
      border-width: 2px;
    }

    .g-wrap__form .g-wrap__form-wrap .form-control-bordered_md {
      padding: 7px 10px;
      height: 28px;
    }

    .g-wrap__form .g-wrap__form-wrap .btn, code #cp_btn, code #cp_btnr {
      display: -webkit-inline-box;
      display: inline-flex;
      vertical-align: middle;
      -webkit-box-pack: center;
      justify-content: center;
      -webkit-box-align: center;
      align-items: center;
      border: 0 none;
      line-height: 1.2;
      letter-spacing: -0.5pt;
      font-weight: 300;
      text-align: center;
      cursor: pointer;
      -webkit-user-select: none;
      -ms-user-select: none;
      user-select: none;
      -webkit-transition: background 0.15s ease-in-out, color 0.15s ease-in-out;
      transition: background 0.15s ease-in-out, color 0.15s ease-in-out;
    }

    .g-wrap__form .g-wrap__form-wrap .btn-green {
      color: #fff;
      background: #09941f;
    }

    .g-wrap__form .g-wrap__form-wrap .btn-md {
      padding: 20px 40px;
    }

    .g-wrap__form .g-wrap__form-wrap .g-wrap__form-footer {
      text-align: center;
    }

    .g-wrap__form .g-wrap__form-wrap .btn {
      padding: 12px 40px;
      font-size: 18px;
      outline: none;
      border-radius: 12px;
    }

    .g-wrap__form .g-wrap__form-wrap .btn.disabled {
      cursor: not-allowed;
      pointer-events: none;
      opacity: 0.3;
      -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
      filter: alpha(opacity=30);
    }

    .g-wrap__form .g-wrap__form-wrap input:focus::placeholder {
      color: transparent;
      transition: color 0.5s ease-out;
    }

    .g-wrap__form .g-wrap__form-wrap .btn-green:hover {
      background: #1ec637;
      outline: none;
    }

    .g-wrap__form .g-wrap__form-wrap [type="radio"]:checked,
    .g-wrap__form .g-wrap__form-wrap [type="radio"]:not(:checked) {
      position: absolute;
      left: -9999px;
    }

    .g-wrap__form .g-wrap__form-wrap [type="radio"]:checked + label,
    .g-wrap__form .g-wrap__form-wrap [type="radio"]:not(:checked) + label {
      position: relative;
      padding-left: 28px;
      cursor: pointer;
      line-height: 20px;
      display: inline-block;
      color: #666;
    }

    .g-wrap__form .g-wrap__form-wrap [type="radio"]:checked + label:before,
    .g-wrap__form .g-wrap__form-wrap [type="radio"]:not(:checked) + label:before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      width: 18px;
      height: 18px;
      border: 1px solid #ddd;
      border-radius: 100%;
      background: #fff;
    }

    .g-wrap__form .g-wrap__form-wrap [type="radio"]:checked + label:after,
    .g-wrap__form .g-wrap__form-wrap [type="radio"]:not(:checked) + label:after {
      content: '';
      width: 12px;
      height: 12px;
      background: #1ec637;
      position: absolute;
      top: 4px;
      left: 4px;
      border-radius: 100%;
      -webkit-transition: all 0.2s ease;
      transition: all 0.2s ease;
    }

    [type="radio"]:not(:checked) + label:after {
      opacity: 0;
      -webkit-transform: scale(0);
      transform: scale(0);
    }

    [type="radio"]:checked + label:after {
      opacity: 1;
      -webkit-transform: scale(1);
      transform: scale(1);
    }

    #redirect, #onpage {
      display: none;
      transition: all 0.5s ease-in-out;
      margin-top: 40px;
      position: relative;
      font-size: 10px;
      line-height: 16px;
    }

    code #cp_btn, code #cp_btnr {
      position: absolute;
      bottom: -30px;
      left: 0;
      color: #fff;
      background: #09941f;
      padding: 5px 10px;
      border-radius: 5px;
    }

    #redirect pre, #onpage pre {
      border-radius: 5px;
      max-width: 1000px;
      max-height: 400px;
    }

    .g-wrap__form .g-wrap__form-wrap .form-control.error {
      border-color: #f44336;
    }

    .g-wrap__form .g-wrap__form-wrap .btn:active, code #cp_btn:active, code #cp_btnr:active {
      transform: matrix(0.95, 0, 0, 0.95, 0, 0);
      background: #1ec637;
    }
  </style>
  <script>
    jQuery(document).ready(function() {
      window.correrct_redirect = jQuery('#redirect').html()
      window.correrct_onpage = jQuery('#onpage').html()
      jQuery('#cp_btnr, #cp_btn').click(function(event) {
        event.preventDefault()
        copyToClp(event)
      })

      function copyToClp (event) {
        event.preventDefault()
        var form_type = jQuery('input[name=generate-type]:checked', '#tilda').val()
        var copyTextarea = jQuery('#' + form_type + ' pre')
        var temp = jQuery('<textarea>')
        jQuery('body').append(temp)
        temp.val(jQuery(copyTextarea).text()).select()
        document.execCommand('copy')
        temp.remove()
      }

      function validateForm (event) {
        event.preventDefault()
        jQuery('#onpage pre').css('display', 'none')
        jQuery('#redirect pre').css('display', 'none')
        var mid = jQuery('#mid')
        var currency = jQuery('#currency')
        if (isNaN(mid.val()) || mid.val().toString().length < 5) {
          mid.addClass('error')
          return false
        } else {
          mid.removeClass('error')
        }
        if (!currency.val() || currency.val().length !== 3) {
          currency.addClass('error')
          return false
        } else {
          currency.removeClass('error')
        }
        var form_type = jQuery('input[name=generate-type]:checked', '#tilda').val()
        var current_code = null
        if (form_type === 'redirect') {
          current_code = window.correrct_redirect
        } else {
          current_code = window.correrct_onpage
        }
        var replaced = current_code.replace('{mid}', mid.val())
        replaced = replaced.replace('{curr}', currency.val().toUpperCase())
        jQuery('#' + form_type).html(replaced)
        jQuery('#' + form_type).css('display', 'block')
        jQuery('#cp_btnr, #cp_btn').click(function(event) {
          event.preventDefault()
          copyToClp(event)
        })
      }

      jQuery('#submit_generator').click(function(event) {
        event.preventDefault()
        validateForm(event)
      })
    })
  </script>
</head>
<body>
<form class="g-wrap__form" id="tilda" onsubmit="return validateForm(event)">
  <div class="g-wrap__form-wrap">
    <div class="form-group">
      <input class="form-control form-control-bordered form-control-bordered_md" type="text" id="mid"
             value=""
             placeholder="Merchant ID">
    </div>
    <div class="form-group">
      <input class="form-control form-control-bordered form-control-bordered_md" type="text" id="currency"
             value=""
             placeholder="Currency">
    </div>
    <div class="form-group">
      <input type="radio" id="onpager" value="onpage" name="generate-type">
      <label for="onpager">На странице</label>
    </div>
    <div class="form-group">
      <input checked type="radio" id="redirectr" value="redirect" name="generate-type">
      <label for="redirectr">С перенаправлением</label>
    </div>
    <div class="g-wrap__form-footer">
      <button id="submit_generator" class="g-wrap__form-button btn btn-green btn-md">Поехали!</button>
    </div>
  </div>
</form>
<code id="redirect">
    <pre class="hljs"
         style="display: block; overflow-x: auto; padding: 0.5em; background: rgb(240, 240, 240); color: rgb(68, 68, 68);"><span
      class="xml"><span class="hljs-tag">&lt;<span class="hljs-name" style="font-weight: 700;">script</span> <span
      class="hljs-attr">src</span>=<span class="hljs-string" style="color: rgb(136, 0, 0);">"https://api.fondy.eu/static_common/v1/checkout/ipsp.js"</span>&gt;</span><span
      class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-name"
                                                                 style="font-weight: 700;">script</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name" style="font-weight: 700;">script</span>&gt;</span><span
        class="javascript">
    $(<span class="hljs-built_in" style="color: rgb(57, 115, 0);">document</span>).ready(<span
        class="hljs-function"><span class="hljs-keyword" style="font-weight: 700;">function</span>(<span
        class="hljs-params"></span>)</span>{
        <span class="hljs-built_in" style="color: rgb(57, 115, 0);">window</span>.fondySuccessFunction = <span
        class="hljs-function"><span class="hljs-keyword" style="font-weight: 700;">function</span>(<span
        class="hljs-params">$form</span>)</span>{
            <span class="hljs-keyword" style="font-weight: 700;">var</span> f_curency = <span class="hljs-string"
                                                                                              style="color: rgb(136, 0, 0);">'{curr}'</span>;
            <span class="hljs-keyword" style="font-weight: 700;">if</span> ($(<span class="hljs-string"
                                                                                    style="color: rgb(136, 0, 0);">"div"</span>).find(<span
        class="hljs-string" style="color: rgb(136, 0, 0);">'[data-project-currency-code]'</span>).data(<span
        class="hljs-string" style="color: rgb(136, 0, 0);">'project-currency-code'</span>)){
                f_curency = $(<span class="hljs-string" style="color: rgb(136, 0, 0);">"div"</span>).find(<span
        class="hljs-string" style="color: rgb(136, 0, 0);">'[data-project-currency-code]'</span>).data(<span
        class="hljs-string" style="color: rgb(136, 0, 0);">'project-currency-code'</span>);
            }
            <span class="hljs-keyword" style="font-weight: 700;">var</span> oDesc = <span class="hljs-string"
                                                                                          style="color: rgb(136, 0, 0);">''</span>
            <span class="hljs-keyword" style="font-weight: 700;">for</span> (index = <span class="hljs-number"
                                                                                           style="color: rgb(136, 0, 0);">0</span>; index &lt; tcart.products.length; ++index) {
                oDesc += tcart.products[index].name + <span class="hljs-string"
                                                            style="color: rgb(136, 0, 0);">' '</span>
            }
            <span class="hljs-keyword" style="font-weight: 700;">var</span> button = $ipsp.get(<span class="hljs-string"
                                                                                                     style="color: rgb(136, 0, 0);">"button"</span>);
            button.setMerchantId({mid});
            button.setAmount(<span class="hljs-built_in" style="color: rgb(57, 115, 0);">window</span>.tcart.amount, f_curency, <span
        class="hljs-literal" style="color: rgb(120, 169, 96);">true</span>);
            button.setHost(<span class="hljs-string" style="color: rgb(136, 0, 0);">'api.fondy.eu'</span>);
            button.addField({ label: <span class="hljs-string" style="color: rgb(136, 0, 0);">'Описание покупки'</span>, name: <span
        class="hljs-string" style="color: rgb(136, 0, 0);">'order_desc'</span>, value: oDesc, readonly: <span
        class="hljs-literal" style="color: rgb(120, 169, 96);">true</span> });
            <span class="hljs-keyword" style="font-weight: 700;">var</span> fform = $form.serializeArray();
            <span class="hljs-keyword" style="font-weight: 700;">for</span> (index = <span class="hljs-number"
                                                                                           style="color: rgb(136, 0, 0);">0</span>; index &lt; fform.length; ++index) {
                <span class="hljs-keyword" style="font-weight: 700;">if</span>(fform[index].name === <span
        class="hljs-string" style="color: rgb(136, 0, 0);">"Name"</span> || fform[index].name === <span
        class="hljs-string" style="color: rgb(136, 0, 0);">"Phone"</span> || fform[index].name === <span
        class="hljs-string" style="color: rgb(136, 0, 0);">"Email"</span>){
                    button.addField({ label: fform[index].name, name: fform[index].name, value: fform[index].value });
                }
            }
            <span class="hljs-built_in" style="color: rgb(57, 115, 0);">window</span>.location.href = button.getUrl();
        }
        $(<span class="hljs-string" style="color: rgb(136, 0, 0);">'.t706__orderform form'</span>).each(<span
        class="hljs-function"><span class="hljs-keyword" style="font-weight: 700;">function</span>(<span
        class="hljs-params"></span>)</span>{
            $(<span class="hljs-keyword" style="font-weight: 700;">this</span>).data(<span class="hljs-string"
                                                                                           style="color: rgb(136, 0, 0);">'success-callback'</span>, <span
        class="hljs-string" style="color: rgb(136, 0, 0);">'window.fondySuccessFunction'</span>);
        });
    });
</span><span class="hljs-tag">&lt;/<span class="hljs-name"
                                         style="font-weight: 700;">script</span>&gt;</span></span></pre>
  <button id="cp_btnr" class="g-wrap__form-button btn btn-green btn-md">Скопировать!</button>
</code>
<code id="onpage">
<pre class="hljs"
     style="display: block; overflow-x: auto; padding: 0.5em; background: rgb(240, 240, 240); color: rgb(68, 68, 68);"><span
  class="xml"><span class="hljs-tag">&lt;<span class="hljs-name" style="font-weight: 700;">script</span> <span
  class="hljs-attr">src</span>=<span class="hljs-string" style="color: rgb(136, 0, 0);">"https://pay.fondy.eu/latest/checkout-vue/checkout.js"</span>&gt;</span><span
  class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-name" style="font-weight: 700;">script</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name" style="font-weight: 700;">link</span> <span
  class="hljs-attr">type</span>=<span class="hljs-string" style="color: rgb(136, 0, 0);">"text/css"</span> <span
  class="hljs-attr">rel</span>=<span class="hljs-string" style="color: rgb(136, 0, 0);">"stylesheet"</span> <span
  class="hljs-attr">href</span>=<span class="hljs-string" style="color: rgb(136, 0, 0);">"https://pay.fondy.eu/latest/checkout-vue/checkout.css"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name" style="font-weight: 700;">script</span>&gt;</span><span
    class="javascript">
    $(<span class="hljs-built_in" style="color: rgb(57, 115, 0);">document</span>).ready(<span
    class="hljs-function"><span class="hljs-keyword" style="font-weight: 700;">function</span> (<span
    class="hljs-params"></span>) </span>{
        <span class="hljs-built_in" style="color: rgb(57, 115, 0);">window</span>.fondySuccessFunction = <span
    class="hljs-function"><span class="hljs-keyword" style="font-weight: 700;">function</span>(<span
    class="hljs-params">$form</span>)</span>{
            $(<span class="hljs-string" style="color: rgb(136, 0, 0);">".t706__orderform"</span>).remove(<span
    class="hljs-string" style="color: rgb(136, 0, 0);">"#checkout-container"</span>);
            <span class="hljs-keyword" style="font-weight: 700;">var</span> f_curency = <span class="hljs-string"
                                                                                              style="color: rgb(136, 0, 0);">'{curr}'</span>;
            <span class="hljs-keyword" style="font-weight: 700;">if</span> ($(<span class="hljs-string"
                                                                                    style="color: rgb(136, 0, 0);">"div"</span>).find(<span
    class="hljs-string" style="color: rgb(136, 0, 0);">'[data-project-currency-code]'</span>).data(<span
    class="hljs-string" style="color: rgb(136, 0, 0);">'project-currency-code'</span>)){
                f_curency = $(<span class="hljs-string" style="color: rgb(136, 0, 0);">"div"</span>).find(<span
    class="hljs-string" style="color: rgb(136, 0, 0);">'[data-project-currency-code]'</span>).data(<span
    class="hljs-string" style="color: rgb(136, 0, 0);">'project-currency-code'</span>);
            }
            <span class="hljs-keyword" style="font-weight: 700;">var</span> oDesc = <span class="hljs-string"
                                                                                          style="color: rgb(136, 0, 0);">''</span>;
            <span class="hljs-keyword" style="font-weight: 700;">for</span> (index = <span class="hljs-number"
                                                                                           style="color: rgb(136, 0, 0);">0</span>; index &lt; tcart.products.length; ++index) {
                oDesc += tcart.products[index].name + <span class="hljs-string"
                                                            style="color: rgb(136, 0, 0);">' '</span>
            }
            <span class="hljs-keyword" style="font-weight: 700;">var</span> Options = {
                options: {
                    fullScreen: <span class="hljs-literal" style="color: rgb(120, 169, 96);">false</span>,
                    fee: <span class="hljs-literal" style="color: rgb(120, 169, 96);">true</span>,
                    locales: [<span class="hljs-string" style="color: rgb(136, 0, 0);">'ru'</span>]
                },
                params: {
                    merchant_id: {mid},
                    currency: f_curency,
                    order_id: <span class="hljs-keyword" style="font-weight: 700;">new</span> <span
    class="hljs-built_in" style="color: rgb(57, 115, 0);">Date</span>().getTime(),
                    amount: <span class="hljs-built_in"
                                  style="color: rgb(57, 115, 0);">window</span>.tcart.amount * <span class="hljs-number"
                                                                                                     style="color: rgb(136, 0, 0);">100</span>,
                    order_desc: oDesc,
                }
            };
            <span class="hljs-keyword" style="font-weight: 700;">var</span> fform = $form.serializeArray();

            <span class="hljs-keyword" style="font-weight: 700;">for</span> (index = <span class="hljs-number"
                                                                                           style="color: rgb(136, 0, 0);">0</span>; index &lt; fform.length; ++index) {
                <span class="hljs-keyword" style="font-weight: 700;">if</span>(fform[index].name === <span
    class="hljs-string" style="color: rgb(136, 0, 0);">"Email"</span>){
                    Options.params[<span class="hljs-string" style="color: rgb(136, 0, 0);">'sender_email'</span>] = fform[index].value
                }
                <span class="hljs-keyword" style="font-weight: 700;">if</span>(fform[index].name === <span
    class="hljs-string" style="color: rgb(136, 0, 0);">"Phone"</span>){
                    Options.params[<span class="hljs-string" style="color: rgb(136, 0, 0);">'sender_phone'</span>] = fform[index].value
                }
            }
            Options.params[<span class="hljs-string" style="color: rgb(136, 0, 0);">'product_id'</span>] = <span
    class="hljs-built_in" style="color: rgb(57, 115, 0);">JSON</span>.stringify(fform);
            $(<span class="hljs-string" style="color: rgb(136, 0, 0);">".t706__orderform"</span>).append(<span
    class="hljs-string" style="color: rgb(136, 0, 0);">"&lt;div id='checkout-container'&gt;&lt;/div&gt;"</span>);
            fondy(<span class="hljs-string" style="color: rgb(136, 0, 0);">'#checkout-container'</span>, Options)
        };
        $(<span class="hljs-string" style="color: rgb(136, 0, 0);">'.t706__orderform form'</span>).each(<span
    class="hljs-function"><span class="hljs-keyword" style="font-weight: 700;">function</span>(<span
    class="hljs-params"></span>)</span>{
            $(<span class="hljs-keyword" style="font-weight: 700;">this</span>).data(<span class="hljs-string"
                                                                                           style="color: rgb(136, 0, 0);">'success-callback'</span>, <span
    class="hljs-string" style="color: rgb(136, 0, 0);">'window.fondySuccessFunction'</span>);
        });
    });
</span><span class="hljs-tag">&lt;/<span class="hljs-name" style="font-weight: 700;">script</span>&gt;</span>
</span></pre>
  <button id="cp_btn" class="g-wrap__form-button btn btn-green btn-md">Скопировать!</button>
</code>
</body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console