/dev/adei-asec

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/adei-asec

« back to all changes in this revision

Viewing changes to includes/cropper/cropper.js

  • Committer: Suren A. Chilingaryan
  • Date: 2011-03-15 02:47:05 UTC
  • mfrom: (210.1.3 adei)
  • Revision ID: csa@dside.dyndns.org-20110315024705-qljn30gwin8yrkne
Integration of work of students with fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
374
374
                        }, 
375
375
                        options || {}
376
376
                );
 
377
 
 
378
                this.initialized = false;
377
379
                /**
378
380
                 * @var obj
379
381
                 * The img node to attach to
455
457
                
456
458
                // quit if the image element doesn't exist
457
459
                if( typeof this.img == 'undefined' ) return;
458
 
                                
459
 
                // include the stylesheet               
 
460
/*                              
 
461
                var script_found = false;
460
462
                $A( document.getElementsByTagName( 'script' ) ).each( 
461
463
                        function(s) {
462
464
                                if( s.src.match( /cropper\.js/ ) ) {
 
465
                                        script_found = true;
463
466
                                        var path        = s.src.replace( /cropper\.js(.*)?/, '' );
464
467
                                        // '<link rel="stylesheet" type="text/css" href="' + path + 'cropper.css" media="screen" />';
 
468
//                                      var path        = "includes/cropper/"
 
469
                                        var path = "/zweb/includes/cropper/";
 
470
*/                                      
 
471
                                        var path = "includes/cropper/";
 
472
//                                      alert(path);
465
473
                                        var style               = document.createElement( 'link' );
466
474
                                        style.rel               = 'stylesheet';
467
475
                                        style.type              = 'text/css';
468
476
                                        style.href              = path + 'cropper.css';
469
477
                                        style.media     = 'screen';
470
478
                                        document.getElementsByTagName( 'head' )[0].appendChild( style );
471
 
                                }
472
 
                }
473
 
            );   
 
479
/*                              }
 
480
                        }
 
481
                );   
 
482
                
 
483
                if (!script_found) return;
 
484
*/
474
485
        
475
486
                // calculate the ratio when neccessary
476
487
                if( this.options.ratioDim.x > 0 && this.options.ratioDim.y > 0 ) {
510
521
                        }
511
522
                    }
512
523
                }
 
524
                
 
525
                this.initialized = true;
513
526
        },
514
527
        
515
528
        /**
739
752
                Event.observe( this.dragArea, 'mousedown', this.startDragBind );
740
753
                
741
754
                this.onDragBind         = this.onDrag.bindAsEventListener( this );
 
755
                //Event.observe( this.dragArea, 'mousemove', this.onDragBind );
742
756
                Event.observe( document, 'mousemove', this.onDragBind );
743
757
 
744
758
                if (this.options.onMouseMove) {
748
762
                    Event.observe( document, 'mouseout', this.onMouseOutBind );
749
763
                }
750
764
 
 
765
 
751
766
    if(this.options.onTouchStart){
752
767
      this.onTouchStartBind = this.onTouchStart.bindAsEventListener(this);
753
768
      Event.observe(this.dragArea,'touchstart',this.onTouchStartBind);
955
970
                            Event.stopObserving( document, 'mouseout', this.onMouseOutBind );           
956
971
                        }
957
972
 
 
973
 
958
974
            if(this.options.onTouchStart){
959
975
                Event.stopObserving(this.dragArea,'touchstart',this.onTouchStartBind);
960
976
            }
977
993
            if(this.options.onOrientationChange){
978
994
              Event.stopObserving(this.dragArea,'orientationchange', this.onOrientationChange);
979
995
            }
 
996
 
980
997
 
981
998
                        Event.stopObserving( document, 'mouseup', this.endCropBind );
982
999
//                      Event.stopObserving( this.imgWrap, 'mouseup', this.endCropBind );
1435
1452
                var areaWidth     = this.calcW();
1436
1453
                var areaHeight    = this.calcH();
1437
1454
                
 
1455
        
1438
1456
                /*
1439
1457
                 * Calculate all the style strings before we use them, allows reuse & produces quicker
1440
1458
                 * rendering (especially noticable in Mac based browsers)