当前位置: 首页>>代码示例>>Java>>正文


Java UserAgent.isSafari方法代码示例

本文整理汇总了Java中org.waveprotocol.wave.client.common.util.UserAgent.isSafari方法的典型用法代码示例。如果您正苦于以下问题:Java UserAgent.isSafari方法的具体用法?Java UserAgent.isSafari怎么用?Java UserAgent.isSafari使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.waveprotocol.wave.client.common.util.UserAgent的用法示例。


在下文中一共展示了UserAgent.isSafari方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleDOMMutation

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
/**
 * Handles DOM mutation events.
 * @param event
 * @param contentRange  last known selection
 */
public void handleDOMMutation(SignalEvent event, ContentRange contentRange) {
  // Early exit if non-safari or non-mac
  if (!(UserAgent.isSafari() && UserAgent.isMac())) {
    return;
  }

  // We don't care about DOMMutations that we generate while we are reverting.
  if (isReverting) {
    return;
  }

  previousContentRange = contentRange;

  Node n = event.getTarget();
  if (n.getNodeType() == Node.ELEMENT_NODE) {
    Element e = Element.as(event.getTarget());
    if (DOM_EVENTS_IGNORE.contains(event.getType())) {
      // ignore
    } else if (event.getType().equals(JsEvents.DOM_NODE_INSERTED) && handleDOMNodeInserted(e)) {
    } else if (event.getType().equals(JsEvents.DOM_NODE_REMOVED) && handleDOMNodeRemoved(e)) {
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:29,代码来源:DOMMutationExtractor.java

示例2: create

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
/**
 * Factory constructor, creates and attaches the buffer to the DOM.
 *
 * @return Browser specific implementation of a paste buffer.
 */
static PasteBufferImpl create() {
  PasteBufferImpl pasteBuffer;

  if (UserAgent.isSafari() || QuirksConstants.FIREFOX_GREATER_THAN_VER_15) {
    pasteBuffer = new PasteBufferImplSafariAndNewFirefox();
  } else if (UserAgent.isFirefox() && !QuirksConstants.SANITIZES_PASTED_CONTENT) {
    // Older versions of firefox doesn't sanitize pasted content and requires the
    // paste buffer to be an iframe to prevent XSS.
    pasteBuffer = new PasteBufferImplOldFirefox();
  } else {
    pasteBuffer = new PasteBufferImpl();
  }

  pasteBuffer.setupDom();
  return pasteBuffer;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:PasteBufferImpl.java

示例3: getMouseWheelVelocityYOnly

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
/**
 * In safari, there is X velocity and Y velocity.  GWT code return the combination of the 2.
 * This code only return the Y velocity.
 * @return The y velocity of the mouse event and only the y velocity.
 */
public static int getMouseWheelVelocityYOnly(Event event) {
  if (!UserAgent.isSafari()) {
    return event.getMouseWheelVelocityY();
  } else {
    return nativeGetMouseWheelVelocityYOnly(event);
  }
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:13,代码来源:EventWrapper.java

示例4: handleDOMMutation

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
/**
 * Handles DOM mutation events.
 * @param event
 * @param contentRange  last known selection
 */
public void handleDOMMutation(SignalEvent event, ContentRange contentRange) {
  // Early exit if non-safari or non-mac
  if (!(UserAgent.isSafari() && UserAgent.isMac())) {
    return;
  }

  // We don't care about DOMMutations that we generate while we are reverting.
  if (isReverting) {
    return;
  }

  previousContentRange = contentRange;

  Node n = event.getTarget();
  if (n.getNodeType() == Node.ELEMENT_NODE) {
    Element e = Element.as(event.getTarget());
    if (DOM_EVENTS_IGNORE.contains(event.getType())) {
      // ignore
      return;
    } else if (event.getType().equals("DOMNodeInserted") && handleDOMNodeInserted(e)) {
      return;
    } else if (event.getType().equals("DOMNodeRemoved") && handleDOMNodeRemoved(e)) {
      return;
    }
  }
  return;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:33,代码来源:DOMMutationExtractor.java

示例5: isWhiteListedCombo

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
/**
 * These key combos can be safely ignored. They don't directly modify the
 * editable region, but may perform something useful on the browser so we
 * don't want to cancel them. i.e. copy/cut/paste key events.
 *
 * Combos listed here should be accompanied with a comment stating the reason.
 *
 * Maintaining this whitelist is quite an effort, but at least we shouldn't
 * get the browser blowing up if the user entered some keycombo we don't know
 * about.
 *
 *
 * References:
 * http://support.mozilla.com/en-US/kb/Keyboard+shortcuts
 * http://docs.info.apple.com/article.html?artnum=42951
 * http://www.microsoft.com/windows/products/winfamily/ie/quickref.mspx
 *
 * @return true if it is safe to ignore, or false which will result in further
 *         handling.
 */
private boolean isWhiteListedCombo(SignalEvent signal) {
  KeyCombo keyCombo = EventWrapper.getKeyCombo(signal);
  switch (keyCombo) {
    // Edit actions:
    // Allow cut/copy/paste combos and handle the actual clipboard events
    // later.
    case ORDER_C: // copy
    case ORDER_X: // cut
    case ORDER_V: // paste
    case ORDER_A: // select all
    case ORDER_P: // print
    case ORDER_L: // navigate to url box

    // Page navigation
    // On safari, delete/backspace is normally used to go back as well, but
    // of course in the editor we won't allow that.
    case META_LEFT: // back
    case META_RIGHT: // forward
    case META_HOME: // home
    case ORDER_O: // open file
    case ORDER_R: // reload
    case ORDER_SHIFT_R: // reload (override cache)

    // Search
    case ORDER_F: // find
    case ORDER_G: // find again

    // tools
    case ORDER_D: // bookmark this page

   // Window and tabs
    case ORDER_N: // new window
    case ORDER_T: // new tab
    case ORDER_W: // close window
    case ORDER_Q: // quit
      return true;

    default:
  }

  if (QuirksConstants.HAS_OLD_SCHOOL_CLIPBOARD_SHORTCUTS) {
    if (isAlternateClipboardCombo(signal)) {
      return true;
    }
  }

  if (UserAgent.isSafari() && UserAgent.isMac()) {
    // Navigation events for Mac Safari only.
    switch (keyCombo) {
      case CTRL_A:
      case CTRL_B:
      case CTRL_E:
      case CTRL_F:
        return true;
      default:
    }
  }

  return false;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:81,代码来源:EditorEventHandler.java


注:本文中的org.waveprotocol.wave.client.common.util.UserAgent.isSafari方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。