<?php
include_once(_DIR_TO_CLASS."/c_page.php");
class c_page_cab_demo_sign extends c_page
{
  public $h1='Магнит - Проверка плагинов экранной подписи' ;

  function second_menu_config()
  { $this->second_menu['/cab/demo_sign/']=array('title'=>'Плагин1') ;
    $this->second_menu['/cab/demo_sign/v2/']=array('title'=>'Плагин2') ;
    $this->second_menu['/cab/demo_sign/v3/']=array('title'=>'Плагин3') ;
    $this->second_menu['/cab/demo_sign/v4/']=array('title'=>'Плагин4') ;
  }


 function block_main()
 { $this->page_title() ;
  ?><script src="/<?echo _CLASS_LOCAL_?>/ext/demo_sign/Touch-enabled-Signature-Plugin-with-jQuery-Canvas/jq-signature.js"></script>

     <div class="js-signature"
          data-width="600"
          data-height="200"
          data-border="1px solid #1ABC9C"
          data-background="#16A085"
          data-line-color="#fff"
          data-auto-fit="true">
     </div>
     <button id="clearBtn" onclick="clearCanvas();">Clear Canvas</button>
     <button id="saveBtn" onclick="saveSignature();" disabled>Save Signature</button>
     <div id="signature"></div>

        <script type="text/javascript">

             $j(document).on('ready', function() {
               $j('.js-signature').jqSignature(
                   {

                   // The color of the signature
                   lineColor: '#222222',

                   // The width of the signature line
                   lineWidth: 1,

                   // The CSS for the border of the canvas.
                   border: '1px dashed #AAAAAA',

                   // The CSS for the background of the canvas.
                   background: '#FFFFFF',

                   // The width of the signature canvas (in pixels)
                   width: 300,

                   // The height of the signature canvas (in pixels).
                   height: 100,

                   // Make the canvas fill the width of its parent element.
                   autoFit: false

                   }



               );
             });

             function clearCanvas() {
               $j('#signature').html('<p><em>Your signature will appear here when you click "Save Signature"</em></p>');
               $j('.js-signature').jqSignature('clearCanvas');
               $j('#saveBtn').attr('disabled', true);
             }

             function saveSignature() {
               $j('#signature').empty();
               var dataUrl = $j('.js-signature').jqSignature('getDataURL');
               var img = $j('<img>').attr('src', dataUrl);
               $j('#signature').append($j('<p>').text("Here's your signature:"));
               $j('#signature').append(img);
             }

             $j('.js-signature').on('jq.signature.changed', function() {
               $j('#saveBtn').attr('disabled', false);
             });

       </script>
   <?

 }








}



?>
