List of usage examples for com.google.gwt.dom.client VideoElement getPoster
public final native String getPoster() ;
From source file:com.dom_distiller.client.ContentExtractor.java
License:Open Source License
private static void makeAllLinksAbsolute(Node rootNode) { Element root = Element.as(rootNode); // AnchorElement.getHref() and ImageElement.getSrc() both return the // absolute URI, so simply set them as the respective attributes. NodeList<Element> allLinks = root.getElementsByTagName("A"); for (int i = 0; i < allLinks.getLength(); i++) { AnchorElement link = AnchorElement.as(allLinks.getItem(i)); if (!link.getHref().isEmpty()) { link.setHref(link.getHref()); }/*from www . j a v a2 s .c o m*/ } NodeList<Element> videoTags = root.getElementsByTagName("VIDEO"); for (int i = 0; i < videoTags.getLength(); i++) { VideoElement video = (VideoElement) videoTags.getItem(i); if (!video.getPoster().isEmpty()) { video.setPoster(video.getPoster()); } } makeAllSrcAttributesAbsolute(root); }
From source file:org.chromium.distiller.DomUtil.java
License:Open Source License
/** * Makes all anchors and video posters absolute. This calls "makeAllSrcAttributesAbsolute". * @param rootNode The root Node to look through. *///from w w w. ja v a2 s . c o m public static void makeAllLinksAbsolute(Node rootNode) { Element root = Element.as(rootNode); // AnchorElement.getHref() and ImageElement.getSrc() both return the // absolute URI, so simply set them as the respective attributes. if ("A".equals(root.getTagName())) { AnchorElement link = AnchorElement.as(root); if (!link.getHref().isEmpty()) { link.setHref(link.getHref()); } } NodeList<Element> allLinks = root.getElementsByTagName("A"); for (int i = 0; i < allLinks.getLength(); i++) { AnchorElement link = AnchorElement.as(allLinks.getItem(i)); if (!link.getHref().isEmpty()) { link.setHref(link.getHref()); } } if (root.getTagName().equals("VIDEO")) { VideoElement video = (VideoElement) root; if (!video.getPoster().isEmpty()) { video.setPoster(video.getPoster()); } } NodeList<Element> videoTags = root.getElementsByTagName("VIDEO"); for (int i = 0; i < videoTags.getLength(); i++) { VideoElement video = (VideoElement) videoTags.getItem(i); if (!video.getPoster().isEmpty()) { video.setPoster(video.getPoster()); } } makeAllSrcAttributesAbsolute(root); makeSrcSetAbsolute(root); }
From source file:org.chromium.distiller.webdocument.WebVideo.java
License:Open Source License
@Override public String generateOutput(boolean textOnly) { if (textOnly) return ""; Element container = Document.get().createDivElement(); VideoElement ve = (VideoElement) videoElement.cloneNode(false); for (int i = 0; i < videoElement.getChildCount(); i++) { Node curNode = videoElement.getChild(i); if (curNode.getNodeType() != Node.ELEMENT_NODE) continue; Element el = Element.as(curNode); // Only take "source" and "track" children. if ("SOURCE".equals(el.getTagName()) || "TRACK".equals(el.getTagName())) { ve.appendChild(el.cloneNode(false)); }//from w w w . j ava2 s . co m } if (!ve.getPoster().isEmpty()) { ve.setPoster(ve.getPoster()); } DomUtil.makeAllSrcAttributesAbsolute(ve); DomUtil.stripIds(ve); container.appendChild(ve); return container.getInnerHTML(); }