ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10250


Ignore:
Timestamp:
Jan 20, 2009, 4:55:41 PM (14 years ago)
Author:
ShogoKawahara
Message:

changed parameter of make_modal_box() of the opJavascriptHelper

Location:
OpenPNE3/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/helper/opJavascriptHelper.php

    r10179 r10250  
    2424 * @param string $contents
    2525 */
    26 function make_modal_box($id, $contents, $width, $height)
     26function make_modal_box($id, $contents)
    2727{
     28  sfContext::getInstance()->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype');
    2829  sfContext::getInstance()->getResponse()->addJavascript('util');
    29   $div = '<div id="'.$id.'" class="modalWall" style="display:none" onclick="this.style.display=\'none\'; document.getElementById(\''.$id.'_contents\').style.display=\'none\'"></div>'
     30  $div = '<div id="'.$id.'" class="modalWall" style="display:none" onclick="this.style.display=\'none\'; $(\''.$id.'_contents\').style.display=\'none\'"></div>'
    3031       . '<div id="'.$id.'_contents" class="modalBox" style="display: none;">'
    3132       . $contents
    3233       . '</div>'
    3334       . '<script type="text/javascript">'
    34        . 'var _pos = getCenterMuchScreen('.$width.','.$height.');'
    35        . 'document.getElementById("'.$id.'_contents").style.left = _pos.left + "px";'
    36        . 'document.getElementById("'.$id.'_contents").style.top = _pos.top + "px";'
     35       . 'var contents = $("'.$id.'_contents");'
     36       . 'contents.setStyle(getCenterMuchScreen(contents))'
    3737       . '</script>';
    3838
     
    4040}
    4141
    42 function link_to_modal_box($text, $id, $contents, $width, $height)
     42function link_to_modal_box($text, $id, $contents)
    4343{
    4444  $link = link_to_function($text, visual_effect('appear', $id, array('to' => '0.7')).';'.visual_effect('appear', $id.'_contents'))
    45         . make_modal_box($id, $contents, $width, $height);
     45        . make_modal_box($id, $contents);
    4646
    4747  return $link;
     
    5151{
    5252  $iframe = '<iframe id="'.$id.'_iframe" src="'.$url_for.'" width="'.$width.'px" height="'.$height.'px"></iframe>';
    53   return link_to_modal_box($text, $id, $iframe, $width, $height);
     53  return link_to_modal_box($text, $id, $iframe);
    5454}
    5555
  • OpenPNE3/trunk/web/js/util.js

    r9582 r10250  
    1 function getCenterMuchScreen(width, height)
     1function getCenterMuchScreen(element)
    22{
    3   var screenWidth = document.body.clientWidth  || document.documentElement.clientWidth;
     3  var width  = $(element).getWidth();
     4  var height = $(element).getHeight();
     5  var screenWidth = document.viewport.getWidth();
    46  var screenHeight = document.documentElement.clientHeight;
    5   var screenTop = document.body.scrollTop || document.documentElement.scrollTop;
     7  var screenTop = document.viewport.getScrollOffsets().top;
    68
    79  var left = (screenWidth / 2) - (width / 2);
    810  var top = (screenHeight / 2 + screenTop) - (height / 2);
    911
    10   return {"left": left, "top" : top};
     12  if (top < 10)
     13  {
     14    top = 10;
     15  }
     16
     17  return {"left": left + "px", "top" : top + "px"};
    1118}
Note: See TracChangeset for help on using the changeset viewer.