Commit 32a70212 authored by Dele Olajide's avatar Dele Olajide Committed by dele

Jitsi Videobridge plugin - Added support for sharing PDF Presentations

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13927 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1651273a
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
Jitsi Video Bridge Plugin Changelog Jitsi Video Bridge Plugin Changelog
</h1> </h1>
<p><b>1.1.1</b> -- Feb 9th, 2014</p>
<ul>
<li>Added support for PDF Presentations</li>
</ul>
<p><b>1.1</b> -- Jan 27th, 2014</p> <p><b>1.1</b> -- Jan 27th, 2014</p>
<ul> <ul>
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<author>jitsi.org and igniterealtime.org</author> <author>jitsi.org and igniterealtime.org</author>
<class>org.jitsi.videobridge.openfire.PluginImpl</class> <class>org.jitsi.videobridge.openfire.PluginImpl</class>
<description>Integrates Jitsi Video Bridge into Openfire.</description> <description>Integrates Jitsi Video Bridge into Openfire.</description>
<licenseType>other</licenseType> <licenseType>LGPL</licenseType>
<minServerVersion>3.9.0</minServerVersion> <minServerVersion>3.9.0</minServerVersion>
<name>Jitsi Video Bridge</name> <name>Jitsi Video Bridge</name>
<version>1.1</version> <version>1.1.1</version>
<adminconsole> <adminconsole>
<tab id="tab-server"> <tab id="tab-server">
......
...@@ -69,16 +69,20 @@ It includes the OfMeet video conference application using WebRTC as well as a si ...@@ -69,16 +69,20 @@ It includes the OfMeet video conference application using WebRTC as well as a si
<h2>Installation</h2> <h2>Installation</h2>
<p>Copy jitsivideobridge.jar into the plugins directory of your Openfire server. The <ol>
plugin will then be automatically deployed. To upgrade to a new version, copy the new <li>Copy the jitsivideobridge.jar file to the OPENFIRE_HOME/plugins directory.</li>
jitsiVideobridge.jar file over the existing file.</p> <li>Restart Openfire.</li>
<li>Configure the admin properties page.</li>
</ol>
<h2>Configuration</h2> <h2>Configuration</h2>
Under Server settings -> Jitsi Videobridge tab you can configure it. Under Server settings -> Jitsi Videobridge tab you can configure the range of UDP ports to be used by the videobridge.
<h2>How to use</h2> <h2>How to use</h2>
Make sure you are using Google Chrome as your web browser and you have a webcam installed and ready for use.
</p>
To run the demo video conference application, point your browser at https://your_server:7443/ofmeet To run the demo video conference application, point your browser at https://your_server:7443/ofmeet
<p/> <p/>
To download the Spark plugin, point your browser at https://your_server:7443/ofmeet/jitsivideobridge-plugin.jar To download the Spark plugin, point your browser at https://your_server:7443/ofmeet/jitsivideobridge-plugin.jar
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app> <web-app>
<servlet>
<servlet-name>proxy</servlet-name>
<servlet-class>org.jitsi.videobridge.openfire.HttpProxy</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>proxy</servlet-name>
<url-pattern>/proxy</url-pattern>
</servlet-mapping>
</web-app> </web-app>
\ No newline at end of file
...@@ -27,11 +27,19 @@ html, body{ ...@@ -27,11 +27,19 @@ html, body{
z-index: 0; z-index: 0;
} }
#pdfViewer {
display:block;
position:relative;
width:auto;
height:auto;
}
#remoteVideos { #remoteVideos {
display:block; display:block;
position:relative; position:relative;
text-align:center; text-align:center;
height:196px; height:170px;
width:auto; width:auto;
overflow: hidden; overflow: hidden;
border:1px solid transparent; border:1px solid transparent;
...@@ -46,6 +54,9 @@ html, body{ ...@@ -46,6 +54,9 @@ html, body{
width:auto; width:auto;
z-index:0; z-index:0;
border:1px solid #FFFFFF; border:1px solid #FFFFFF;
background-repeat:no-repeat;
background-image:url(../images/avatar1.png);
background-size: contain;
} }
#remoteVideos video:hover { #remoteVideos video:hover {
......
...@@ -37,17 +37,22 @@ ...@@ -37,17 +37,22 @@
<a class="button" onclick="openLinkDialog();"><i title="Invite others" class="fa fa-link fa-lg"></i></a> <a class="button" onclick="openLinkDialog();"><i title="Invite others" class="fa fa-link fa-lg"></i></a>
<div class="header_button_separator"></div> <div class="header_button_separator"></div>
<a class="button" onclick='openChat();'><i id="chat" title="Open chat" class="fa fa-comments fa-lg"></i></a> <a class="button" onclick='openChat();'><i id="chat" title="Open chat" class="fa fa-comments fa-lg"></i></a>
<div class="header_button_separator"></div>
<a class="button" onclick='openPDFDialog();'><i id="pdf" title="Share PDF" class="fa fa-file fa-lg"></i></a>
<div class="header_button_separator"></div>
<a class="button" onclick='goFullScreen();'><i id="pdf" title="Full Screen" class="fa fa-arrows-alt fa-lg"></i></a>
</div> </div>
</div> </div>
<div id="videospace"> <div id="videospace">
<div class="fade_line"></div> <div class="fade_line"></div>
<video id="largeVideo" onDblClick="toggleFullScreen();" autoplay oncontextmenu="return false;"></video> <video id="largeVideo" onDblClick="goFullScreen();" autoplay oncontextmenu="return false;"></video>
<iframe id="pdfViewer" style="display:none"></iframe>
<div class="fade_line"></div> <div class="fade_line"></div>
<div id="remoteVideos"> <div id="remoteVideos">
<video id="localVideo" autoplay oncontextmenu="return false;" muted/> <video id="localVideo" autoplay oncontextmenu="return false;" muted/>
<audio id="localAudio" autoplay oncontextmenu="return false;" muted/>
</div> </div>
<video id="screenVideo" autoplay oncontextmenu="return false;" muted style="display:block"/>
</div> </div>
<div id="chatspace"> <div id="chatspace">
<div id="nickname"> <div id="nickname">
......
/*
* Jitsi Videobridge, OpenSource video conferencing.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jitsi.videobridge.openfire;
import org.jivesoftware.util.*;
import org.slf4j.*;
import org.slf4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletOutputStream;
import java.io.*;
import java.net.*;
import java.util.*;
import java.text.*;
public class HttpProxy extends HttpServlet
{
private static final Logger Log = LoggerFactory.getLogger(HttpProxy.class);
public static final long serialVersionUID = 24362462L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
Log.info("HttpProxy - doGet start");
String url = request.getParameter("url");
if (url != null) {
writeHeader(response);
writeGet(url, response.getOutputStream());
}
}
catch(Exception e) {
Log.info("HttpProxy doGet Error: " + e.toString());
}
}
private void writeHeader(HttpServletResponse response)
{
try {
response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");
response.setHeader("Content-Type", "application/pdf");
response.setHeader("Connection", "close");
}
catch(Exception e)
{
Log.info("HttpProxy writeHeader Error: " + e.toString());
}
}
private void writeGet(String urlString, ServletOutputStream out)
{
byte[] buffer = new byte[4096];
try{
URL url = new URL(urlString);
URLConnection urlConn = url.openConnection();
InputStream inStream = urlConn.getInputStream();
int n = -1;
while ( (n = inStream.read(buffer)) != -1)
{
out.write(buffer, 0, n);
}
out.close();
} catch(MalformedURLException e){
Log.info("HttpProxy writeGet MalformedURLException", e);
} catch(IOException e1){
Log.info("HttpProxy writeGet IOException", e1);
} catch (Exception e2) {
Log.info("HttpProxy - writeGet Exception", e2);
}
}
}
...@@ -6,7 +6,7 @@ var config = { ...@@ -6,7 +6,7 @@ var config = {
}, },
useIPv6: false, // ipv6 support. use at your own risk useIPv6: false, // ipv6 support. use at your own risk
useNicks: false, useNicks: false,
useWebsockets: true, useWebsockets: false,
resolution: "360", resolution: "360",
bosh: window.location.protocol + "//" + window.location.host + '/http-bind/' // FIXME: use xep-0156 for that bosh: window.location.protocol + "//" + window.location.host + '/http-bind/' // FIXME: use xep-0156 for that
}; };
...@@ -4,6 +4,9 @@ var nickname = null; ...@@ -4,6 +4,9 @@ var nickname = null;
var roomUrl = null; var roomUrl = null;
var sharedKey = ''; var sharedKey = '';
var screenShare = false; var screenShare = false;
var pdfShare = null;
var pdfFrame = null;
var pdfPage = "1";
$(document).ready(function () $(document).ready(function ()
{ {
...@@ -89,7 +92,8 @@ $(document).ready(function () ...@@ -89,7 +92,8 @@ $(document).ready(function ()
getConstraints(['audio', 'video'], config.resolution); getConstraints(['audio', 'video'], config.resolution);
$("#screen").removeClass("fa-border"); $("#screen").removeClass("fa-border");
} }
showToolbar();
updateRoomUrl(window.location.href);
getUserMedia(); getUserMedia();
} else { } else {
...@@ -100,23 +104,75 @@ $(document).ready(function () ...@@ -100,23 +104,75 @@ $(document).ready(function ()
$(window).bind('beforeunload', function () $(window).bind('beforeunload', function ()
{ {
console.log("beforeunload");
if (pdfShare != null)
{
connection.emuc.pdfShare("destroy", pdfShare);
}
if (connection && connection.connected) { if (connection && connection.connected) {
unregisterRayoEvents(); unregisterRayoEvents();
connection.disconnect(); }
if (window.RTC.rayo.localStream)
{
window.RTC.rayo.localStream.stop();
window.RTC.rayo.localStream = null;
}
if (window.RTC.rayo.pc)
{
var pcs = Object.getOwnPropertyNames(window.RTC.rayo.pc)
for (var i=0; i< pcs.length; i++)
{
console.log("closing peer connection", pcs[i]);
var pc = window.RTC.rayo.pc[pcs[i]];
if (pc)
{
pc.close();
pc = null;
}
}
} }
connection.disconnect();
});
$(window).bind('entered.muc', function (event, from, member)
{
console.log('entered.muc', from, member);
if (pdfShare)
{
connection.emuc.pdfShare("create", pdfShare + "&control=false#" + pdfPage);
}
});
$(window).bind('left.muc', function (event, from)
{
console.log('left.muc', from);
}); });
$(document).bind('mediaready.rayo', function(event, stream) $(document).bind('mediaready.rayo', function(event, stream)
{ {
window.RTC.rayo.localStream = stream; window.RTC.rayo.localStream = stream;
window.RTC.attachMediaStream($('#localVideo'), stream); if (stream.getVideoTracks().length > 0)
document.getElementById('localVideo').muted = true; {
document.getElementById('localVideo').autoplay = true; window.RTC.attachMediaStream($('#localVideo'), stream);
document.getElementById('localVideo').volume = 0; document.getElementById('localVideo').muted = true;
document.getElementById('localVideo').autoplay = true;
document.getElementById('localVideo').volume = 0;
document.getElementById('largeVideo').volume = 0; document.getElementById('largeVideo').volume = 0;
document.getElementById('largeVideo').src = document.getElementById('localVideo').src; document.getElementById('largeVideo').src = document.getElementById('localVideo').src;
} else {
window.RTC.attachMediaStream($('#localAudio'), stream);
}
console.log("mediaready.rayo"); console.log("mediaready.rayo");
...@@ -177,6 +233,7 @@ $(document).bind('remotestreamadded.rayo', function(event, data, sid) ...@@ -177,6 +233,7 @@ $(document).bind('remotestreamadded.rayo', function(event, data, sid)
console.log('hover in', $(this).attr('src')); console.log('hover in', $(this).attr('src'));
$("#largeVideo").css("visibility", "visible"); $("#largeVideo").css("visibility", "visible");
var newSrc = $(this).attr('src'); var newSrc = $(this).attr('src');
if ($('#largeVideo').attr('src') != newSrc) { if ($('#largeVideo').attr('src') != newSrc) {
document.getElementById('largeVideo').volume = 1; document.getElementById('largeVideo').volume = 1;
$('#largeVideo').fadeOut(300, function(){ $('#largeVideo').fadeOut(300, function(){
...@@ -184,6 +241,11 @@ $(document).bind('remotestreamadded.rayo', function(event, data, sid) ...@@ -184,6 +241,11 @@ $(document).bind('remotestreamadded.rayo', function(event, data, sid)
$(this).fadeIn(300); $(this).fadeIn(300);
}); });
} }
if (pdfFrame != null)
{
$("#largeVideo").css("display", "none");
}
} }
); );
}); });
...@@ -694,9 +756,6 @@ function handleOffer (from, offer) ...@@ -694,9 +756,6 @@ function handleOffer (from, offer)
window.RTC.rayo.pc[videobridge].addStream(window.RTC.rayo.localStream); window.RTC.rayo.pc[videobridge].addStream(window.RTC.rayo.localStream);
window.RTC.rayo.pc[videobridge].setRemoteDescription(new RTCSessionDescription({type: "offer", sdp : bridgeSDP.raw})); window.RTC.rayo.pc[videobridge].setRemoteDescription(new RTCSessionDescription({type: "offer", sdp : bridgeSDP.raw}));
showToolbar();
updateRoomUrl(window.location.href);
}; };
...@@ -957,6 +1016,130 @@ function lockRoom(lock) { ...@@ -957,6 +1016,130 @@ function lockRoom(lock) {
buttonClick("#lockIcon", "fa fa-unlock fa-lg fa fa-lock fa-lg"); buttonClick("#lockIcon", "fa fa-unlock fa-lg fa fa-lock fa-lg");
} }
function openPDFDialog()
{
if (pdfShare)
{
$.prompt("Are you sure you would like to remove your Presentation?",
{
title: "Remove PDF Presentation",
buttons: { "Remove": true, "Cancel": false},
defaultButton: 1,
submit: function(e,v,m,f)
{
if(v)
{
connection.emuc.pdfShare("destroy", pdfShare);
pdfStop(pdfShare);
pdfShare = null;
$("#pdf").removeClass("fa-spin fa-border");
}
}
});
}
else if (pdfFrame != null) {
$.prompt("Another participant is already sharing a Presentation. This conference allows only one Presentation at a time.",
{
title: "Share a PDF Prsentation",
buttons: { "Ok": true},
defaultButton: 0,
submit: function(e,v,m,f)
{
$.prompt.close();
}
});
}
else {
$.prompt('<h2>Share a Presentation</h2><input id="pdfiUrl" type="text" placeholder="e.g. http://www.ge.com/battery/resources/pdf/CraigIrwin.pdf" autofocus >',
{
title: "Share a PDF Prsentation",
persistent: false,
buttons: { "Share": true , "Cancel": false},
defaultButton: 1,
loaded: function(event) {
document.getElementById('pdfiUrl').select();
},
submit: function(e,v,m,f)
{
if(v)
{
pdfShare = document.getElementById('pdfiUrl').value;
if (pdfShare)
{
pdfStart(pdfShare + "&control=true");
connection.emuc.pdfShare("create", pdfShare + "&control=false");
}
}
}
});
}
}
function pfdReady()
{
if (pdfFrame != null)
{
console.log("pdfReady");
$("#pdfViewer").css("display", "block");
$('#pdfViewer').height($('#largeVideo').height());
$('#pdfViewer').width($('#largeVideo').width());
$("#largeVideo").css("display", "none");
$("#pdf").removeClass("fa-spin");
if (pdfShare) $("#pdf").addClass("fa-border");
}
}
function pdfStart(url)
{
console.log("pdfStart", url);
pdfFrame = document.getElementById("pdfViewer");
pdfFrame.contentWindow.location.href = "/ofmeet/pdf/index.html?pdf=" + url;
$("#pdf").addClass("fa-spin");
}
function pdfStop(url)
{
console.log("pdfStop", url);
$("#pdf").removeClass("fa-border fa-spin");
$("#largeVideo").css("display", "block");
$("#pdfViewer").css("display", "none");
pdfFrame = null;
}
function pfdGoto(page)
{
console.log("pfdGoto", page);
pdfPage = page;
if (pdfShare != null)
{
connection.emuc.pdfShare("goto", pdfShare + "#" + page);
}
}
function handlePdfShare(action, url)
{
console.log("handlePdfShare", url, action);
if (pdfShare == null)
{
if (pdfFrame == null)
{
if (action == "create") pdfStart(url);
} else {
if (action == "destroy") pdfStop(url);
if (action == "goto") pdfFrame.contentWindow.location.href = "/ofmeet/pdf/index.html?pdf=" + url;
}
}
}
function openChat() { function openChat() {
var chatspace = $('#chatspace'); var chatspace = $('#chatspace');
var videospace = $('#videospace'); var videospace = $('#videospace');
...@@ -988,9 +1171,13 @@ function updateRoomUrl(newRoomUrl) { ...@@ -988,9 +1171,13 @@ function updateRoomUrl(newRoomUrl) {
roomUrl = newRoomUrl; roomUrl = newRoomUrl;
} }
function toggleFullScreen() function goFullScreen()
{ {
var videoElement = document.getElementById("largeVideo"); var tag = "largeVideo";
if (pdfFrame != null) tag = "pdfViewer";
var videoElement = document.getElementById(tag);
if (!document.mozFullScreen && !document.webkitFullScreen) if (!document.mozFullScreen && !document.webkitFullScreen)
{ {
......
...@@ -20,7 +20,7 @@ Strophe.addConnectionPlugin('emuc', { ...@@ -20,7 +20,7 @@ Strophe.addConnectionPlugin('emuc', {
this.connection.addHandler(this.onPresence.bind(this), null, 'presence', null, null, this.roomjid, {matchBare: true}); this.connection.addHandler(this.onPresence.bind(this), null, 'presence', null, null, this.roomjid, {matchBare: true});
this.connection.addHandler(this.onPresenceUnavailable.bind(this), null, 'presence', 'unavailable', null, this.roomjid, {matchBare: true}); this.connection.addHandler(this.onPresenceUnavailable.bind(this), null, 'presence', 'unavailable', null, this.roomjid, {matchBare: true});
this.connection.addHandler(this.onPresenceError.bind(this), null, 'presence', 'error', null, this.roomjid, {matchBare: true}); this.connection.addHandler(this.onPresenceError.bind(this), null, 'presence', 'error', null, this.roomjid, {matchBare: true});
this.connection.addHandler(this.onMessage.bind(this), null, 'message', null, null, this.roomjid, {matchBare: true}); this.connection.addHandler(this.onMessage.bind(this), null, 'message');
} }
var join = $pres({to: this.myroomjid }).c('x', {xmlns: 'http://jabber.org/protocol/muc'}); var join = $pres({to: this.myroomjid }).c('x', {xmlns: 'http://jabber.org/protocol/muc'});
...@@ -35,6 +35,7 @@ Strophe.addConnectionPlugin('emuc', { ...@@ -35,6 +35,7 @@ Strophe.addConnectionPlugin('emuc', {
this.connection.send(presence); this.connection.send(presence);
}, },
onPresence: function (pres) { onPresence: function (pres) {
console.log('onPresence', $(pres))
var from = pres.getAttribute('from'); var from = pres.getAttribute('from');
var type = pres.getAttribute('type'); var type = pres.getAttribute('type');
if (type != null) { if (type != null) {
...@@ -71,6 +72,7 @@ Strophe.addConnectionPlugin('emuc', { ...@@ -71,6 +72,7 @@ Strophe.addConnectionPlugin('emuc', {
return true; return true;
}, },
onPresenceUnavailable: function (pres) { onPresenceUnavailable: function (pres) {
console.log('onPresenceUnavailable', $(pres))
var from = pres.getAttribute('from'); var from = pres.getAttribute('from');
delete this.members[from]; delete this.members[from];
$(document).trigger('left.muc', [from]); $(document).trigger('left.muc', [from]);
...@@ -105,15 +107,34 @@ Strophe.addConnectionPlugin('emuc', { ...@@ -105,15 +107,34 @@ Strophe.addConnectionPlugin('emuc', {
this.connection.send(msg); this.connection.send(msg);
}, },
onMessage: function (msg) { onMessage: function (msg) {
console.log('onMessage', $(msg))
var txt = $(msg).find('>body').text(); var txt = $(msg).find('>body').text();
// TODO: <subject/> // TODO: <subject/>
// FIXME: this is a hack. but jingle on muc makes nickchanges hard // FIXME: this is a hack. but jingle on muc makes nickchanges hard
var nick = $(msg).find('>nick[xmlns="http://jabber.org/protocol/nick"]').text() || Strophe.getResourceFromJid(msg.getAttribute('from')); var nick = $(msg).find('>nick[xmlns="http://jabber.org/protocol/nick"]').text() || Strophe.getResourceFromJid(msg.getAttribute('from'));
if (txt) { if (txt) {
updateChatConversation(nick, txt); updateChatConversation(nick, txt);
return true;
} }
$(msg).find('pdfshare').each(function()
{
var action = $(this).attr('action');
var url = $(this).attr('url');
handlePdfShare(action, url);
});
return true; return true;
}, },
pdfShare: function(action, url) {
console.log("emuc.pdfShare", url, action)
var msg = $msg({to: this.roomjid, type: 'groupchat'});
msg.c('pdfshare', {xmlns: 'http://igniterealtime.org/protocol/pdfshare', action: action, url: url}).up();
this.connection.send(msg);
},
lockRoom: function (key) { lockRoom: function (key) {
//http://xmpp.org/extensions/xep-0045.html#roomconfig //http://xmpp.org/extensions/xep-0045.html#roomconfig
var ob = this; var ob = this;
......
/* jshint node:true */
/* globals cp, ls, test */
'use strict';
require('../shelljs/make');
var fs = require('fs'),
path = require('path'),
vm = require('vm');
/**
* A simple preprocessor that is based on the firefox preprocessor
* see (https://developer.mozilla.org/en/Build/Text_Preprocessor). The main
* difference is that this supports a subset of the commands and it supports
* preproccesor commands in html style comments.
* Currently Supported commands:
* - if
* - else
* - endif
* - include
* - expand
*/
function preprocess(inFilename, outFilename, defines) {
// TODO make this really read line by line.
var lines = fs.readFileSync(inFilename).toString().split('\n');
var totalLines = lines.length;
var out = '';
var i = 0;
function readLine() {
if (i < totalLines) {
return lines[i++];
}
return null;
}
var writeLine = typeof outFilename === 'function' ? outFilename :
function(line) {
out += line + '\n';
};
function include(file) {
var realPath = fs.realpathSync(inFilename);
var dir = path.dirname(realPath);
preprocess(path.join(dir, file), writeLine, defines);
}
function expand(line) {
line = line.replace(/__[\w]+__/g, function(variable) {
variable = variable.substring(2, variable.length - 2);
if (variable in defines) {
return defines[variable];
}
return '';
});
writeLine(line);
}
var s, state = 0, stack = [];
var control =
/^(?:\/\/|<!--)\s*#(if|else|endif|expand|include)(?:\s+(.*?)(?:-->)?$)?/;
var lineNumber = 0;
while ((s = readLine()) !== null) {
++lineNumber;
var m = control.exec(s);
if (m) {
switch (m[1]) {
case 'if':
stack.push(state);
try {
state = vm.runInNewContext(m[2], defines) ? 3 : 1;
} catch (e) {
console.error('Could not evalute line \'' + m[2] + '\' at ' +
fs.realpathSync(inFilename) + ':' + lineNumber);
throw e;
}
break;
case 'else':
state = state === 1 ? 3 : 2;
break;
case 'endif':
state = stack.pop();
break;
case 'expand':
if (state === 0 || state === 3)
expand(m[2]);
break;
case 'include':
if (state === 0 || state === 3)
include(m[2]);
break;
}
} else {
if (state === 0) {
writeLine(s);
} else if (state === 3) {
writeLine(s.replace(/^\/\/|^<!--|-->/g, ' '));
}
}
}
if (state !== 0 || stack.length !== 0)
throw new Error('Missing endif in preprocessor.');
if (typeof outFilename !== 'function')
fs.writeFileSync(outFilename, out);
}
exports.preprocess = preprocess;
function preprocessCSS(mode, source, destination) {
function hasPrefixed(line) {
return (/(^|\W)-(ms|o|webkit)-\w/.test(line));
}
function removePrefixed(content) {
var lines = content.split(/\r?\n/g);
var i = 0;
while (i < lines.length) {
var line = lines[i];
if (!hasPrefixed(line)) {
i++;
continue;
}
if (/\{\s*$/.test(line)) {
var bracketLevel = 1;
var j = i + 1;
while (j < lines.length && bracketLevel > 0) {
var checkBracket = /([{}])\s*$/.exec(lines[j]);
if (checkBracket) {
if (checkBracket[1] === '{') {
bracketLevel++;
} else if (lines[j].indexOf('{') < 0) {
bracketLevel--;
}
}
j++;
}
lines.splice(i, j - i);
} else if (/[};]\s*$/.test(line)) {
lines.splice(i, 1);
} else {
// multiline? skipping until next directive or bracket
do {
lines.splice(i, 1);
} while (i < lines.length &&
!/\}\s*$/.test(lines[i]) &&
lines[i].indexOf(':') < 0);
if (i < lines.length && /\S\s*}\s*$/.test(lines[i])) {
lines[i] = lines[i].substr(lines[i].indexOf('}'));
}
}
// collapse whitespaces
while (lines[i] === '' && lines[i - 1] === '') {
lines.splice(i, 1);
}
}
return lines.join('\n');
}
if (mode !== 'firefox') {
throw new Error('Invalid CSS preprocessor mode');
}
var content = fs.readFileSync(source, 'utf8');
var out = removePrefixed(content);
fs.writeFileSync(destination, out);
}
exports.preprocessCSS = preprocessCSS;
/**
* Simplifies common build steps.
* @param {object} setup
* .defines defines for preprocessors
* .copy array of arrays of source and destination pairs of files to copy
* .preprocess array of arrays of source and destination pairs of files
* run through preprocessor.
*/
function build(setup) {
var defines = setup.defines;
setup.copy.forEach(function(option) {
var source = option[0];
var destination = option[1];
cp('-R', source, destination);
});
setup.preprocess.forEach(function(option) {
var sources = option[0];
var destination = option[1];
sources = ls('-R', sources);
sources.forEach(function(source) {
// ??? Warn if the source is wildcard and dest is file?
var destWithFolder = destination;
if (test('-d', destination))
destWithFolder += '/' + path.basename(source);
preprocess(source, destWithFolder, defines);
});
});
(setup.preprocessCSS || []).forEach(function(option) {
var mode = option[0];
var source = option[1];
var destination = option[2];
preprocessCSS(mode, source, destination);
});
}
exports.build = build;
/**
* Merge two defines arrays. Values in the second param will override values in
* the first.
*/
function merge(defaults, defines) {
var ret = {};
for (var key in defaults)
ret[key] = defaults[key];
for (key in defines)
ret[key] = defines[key];
return ret;
}
exports.merge = merge;
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* jshint node:true */
/* globals cat, echo, exit, ls */
'use strict';
function checkIfCrlfIsPresent(files) {
var failed = [];
(ls(files)).forEach(function checkCrlf(file) {
if ((cat(file)).match(/.*\r.*/)) {
failed.push(file);
}
});
if (failed.length) {
var errorMessage =
'Please remove carriage return\'s from\n' + failed.join('\n') + '\n' +
'Also check your setting for: git config core.autocrlf.';
echo();
echo(errorMessage);
exit(1);
}
}
exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent;
Copyright (c) 2008-2011 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
#HTMLReporter a { text-decoration: none; }
#HTMLReporter a:hover { text-decoration: underline; }
#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
#HTMLReporter #jasmine_content { position: fixed; right: 100%; }
#HTMLReporter .version { color: #aaaaaa; }
#HTMLReporter .banner { margin-top: 14px; }
#HTMLReporter .duration { color: #aaaaaa; float: right; }
#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
#HTMLReporter .symbolSummary li.passed { font-size: 14px; }
#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
#HTMLReporter .symbolSummary li.failed { line-height: 9px; }
#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
#HTMLReporter .symbolSummary li.pending { line-height: 11px; }
#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
#HTMLReporter .runningAlert { background-color: #666666; }
#HTMLReporter .skippedAlert { background-color: #aaaaaa; }
#HTMLReporter .skippedAlert:first-child { background-color: #333333; }
#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
#HTMLReporter .passingAlert { background-color: #a6b779; }
#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
#HTMLReporter .failingAlert { background-color: #cf867e; }
#HTMLReporter .failingAlert:first-child { background-color: #b03911; }
#HTMLReporter .results { margin-top: 14px; }
#HTMLReporter #details { display: none; }
#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter.showDetails .summary { display: none; }
#HTMLReporter.showDetails #details { display: block; }
#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter .summary { margin-top: 14px; }
#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
#HTMLReporter .summary .specSummary.failed a { color: #b03911; }
#HTMLReporter .description + .suite { margin-top: 0; }
#HTMLReporter .suite { margin-top: 14px; }
#HTMLReporter .suite a { color: #333333; }
#HTMLReporter #details .specDetail { margin-bottom: 28px; }
#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
#HTMLReporter .resultMessage span.result { display: block; }
#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
#TrivialReporter a:visited, #TrivialReporter a { color: #303; }
#TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
#TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
#TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
#TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
#TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
#TrivialReporter .runner.running { background-color: yellow; }
#TrivialReporter .options { text-align: right; font-size: .8em; }
#TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
#TrivialReporter .suite .suite { margin: 5px; }
#TrivialReporter .suite.passed { background-color: #dfd; }
#TrivialReporter .suite.failed { background-color: #fdd; }
#TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
#TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
#TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
#TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
#TrivialReporter .spec.skipped { background-color: #bbb; }
#TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
#TrivialReporter .passed { background-color: #cfc; display: none; }
#TrivialReporter .failed { background-color: #fbb; }
#TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
#TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
#TrivialReporter .resultMessage .mismatch { color: black; }
#TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
#TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
#TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
#TrivialReporter #jasmine_content { position: fixed; right: 100%; }
#TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }
Copyright (C) 2011 notmasteryet
Contributors: Yury Delendik <ydelendik@mozilla.com>
Brendan Dahl <bdahl@mozilla.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This diff is collapsed.
Copyright (c) 2012, Artur Adib <aadib@mozilla.com>
All rights reserved.
You may use this project under the terms of the New BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Artur Adib nor the
names of the contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var shell = require('./shell.js');
for (var cmd in shell)
global[cmd] = shell[cmd];
require('./global');
config.fatal = true;
global.target = {};
// This ensures we only execute the script targets after the entire script has
// been evaluated
var args = process.argv.slice(2);
setTimeout(function() {
var t;
if (args.length === 1 && args[0] === '--help') {
console.log('Available targets:');
for (t in target)
console.log(' ' + t);
return;
}
// Wrap targets to prevent duplicate execution
for (t in target) {
(function(t, oldTarget){
// Wrap it
target[t] = function(force) {
if (oldTarget.done && !force)
return;
oldTarget.done = true;
return oldTarget.apply(oldTarget, arguments);
};
})(t, target[t]);
}
// Execute desired targets
if (args.length > 0) {
args.forEach(function(arg) {
if (arg in target)
target[arg]();
else {
console.log('no such target: ' + arg);
exit(1);
}
});
} else if ('all' in target) {
target.all();
}
}, 0);
{
"name": "shelljs",
"version": "0.1.2",
"author": "Artur Adib <aadib@mozilla.com>",
"description": "Portable Unix shell commands for Node.js",
"keywords": [
"unix",
"shell",
"makefile",
"make",
"jake",
"synchronous"
],
"repository": {
"type": "git",
"url": "git://github.com/arturadib/shelljs.git"
},
"homepage": "http://github.com/arturadib/shelljs",
"main": "./shell.js",
"scripts": {
"test": "node scripts/run-tests"
},
"bin": {
"shjs": "./bin/shjs"
},
"dependencies": {},
"devDependencies": {},
"optionalDependencies": {},
"engines": {
"node": "*"
}
}
This diff is collapsed.
The source code for the library can be found at
https://github.com/fabi1cazenave/webL10n
This diff is collapsed.
<!doctype html>
<html>
<head>
<!-- In production, only one script (pdf.js) is necessary -->
<!-- In production, change the content of PDFJS.workerSrc below -->
<script type="text/javascript" src="pdf.js"></script>
</head>
<body onload="start()">
<canvas id="the-canvas" style="border:1px solid black;" onclick="nextPage()"/>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var ISOAdobeCharset = [
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright',
'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero',
'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight',
'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question',
'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore',
'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent',
'sterling', 'fraction', 'yen', 'florin', 'section', 'currency',
'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft',
'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl',
'periodcentered', 'paragraph', 'bullet', 'quotesinglbase',
'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis',
'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde',
'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla',
'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine',
'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash',
'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu',
'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter',
'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior',
'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright',
'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde',
'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute',
'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex',
'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex',
'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute',
'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla',
'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex',
'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis',
'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis',
'ugrave', 'yacute', 'ydieresis', 'zcaron'
];
var ExpertCharset = [
'.notdef', 'space', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle',
'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior',
'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma',
'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle',
'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle',
'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle',
'colon', 'semicolon', 'commasuperior', 'threequartersemdash',
'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior',
'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior',
'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior',
'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior',
'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall',
'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall',
'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall',
'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall',
'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary',
'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle',
'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall',
'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall',
'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall',
'Cedillasmall', 'onequarter', 'onehalf', 'threequarters',
'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths',
'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior',
'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior',
'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior',
'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior',
'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior',
'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior',
'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall',
'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall',
'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall',
'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall',
'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall',
'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall',
'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall',
'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall',
'Ydieresissmall'
];
var ExpertSubsetCharset = [
'.notdef', 'space', 'dollaroldstyle', 'dollarsuperior',
'parenleftsuperior', 'parenrightsuperior', 'twodotenleader',
'onedotenleader', 'comma', 'hyphen', 'period', 'fraction',
'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle',
'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle',
'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior',
'threequartersemdash', 'periodsuperior', 'asuperior', 'bsuperior',
'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior',
'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior',
'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior',
'parenrightinferior', 'hyphensuperior', 'colonmonetary', 'onefitted',
'rupiah', 'centoldstyle', 'figuredash', 'hypheninferior', 'onequarter',
'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths',
'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior',
'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior',
'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior',
'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior',
'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior',
'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior',
'periodinferior', 'commainferior'
];
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals Document, error, PDFJS */
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var Metadata = PDFJS.Metadata = (function MetadataClosure() {
function fixMetadata(meta) {
return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) {
var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g,
function(code, d1, d2, d3) {
return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
});
var chars = '';
for (var i = 0; i < bytes.length; i += 2) {
var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
chars += code >= 32 && code < 127 && code != 60 && code != 62 &&
code != 38 && false ? String.fromCharCode(code) :
'&#x' + (0x10000 + code).toString(16).substring(1) + ';';
}
return '>' + chars;
});
}
function Metadata(meta) {
if (typeof meta === 'string') {
// Ghostscript produces invalid metadata
meta = fixMetadata(meta);
var parser = new DOMParser();
meta = parser.parseFromString(meta, 'application/xml');
} else if (!(meta instanceof Document)) {
error('Metadata: Invalid metadata object');
}
this.metaDocument = meta;
this.metadata = {};
this.parse();
}
Metadata.prototype = {
parse: function Metadata_parse() {
var doc = this.metaDocument;
var rdf = doc.documentElement;
if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { // Wrapped in <xmpmeta>
rdf = rdf.firstChild;
while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf')
rdf = rdf.nextSibling;
}
var nodeName = (rdf) ? rdf.nodeName.toLowerCase() : null;
if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes())
return;
var children = rdf.childNodes, desc, entry, name, i, ii, length, iLength;
for (i = 0, length = children.length; i < length; i++) {
desc = children[i];
if (desc.nodeName.toLowerCase() !== 'rdf:description')
continue;
for (ii = 0, iLength = desc.childNodes.length; ii < iLength; ii++) {
if (desc.childNodes[ii].nodeName.toLowerCase() !== '#text') {
entry = desc.childNodes[ii];
name = entry.nodeName.toLowerCase();
this.metadata[name] = entry.textContent.trim();
}
}
}
},
get: function Metadata_get(name) {
return this.metadata[name] || null;
},
has: function Metadata_has(name) {
return typeof this.metadata[name] !== 'undefined';
}
};
return Metadata;
})();
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns="http://www.w3.org/2000/svg"
width="64"
height="64">
<path
d="M 4.8364028,0.4891005 32.096378,4.5726641 59.163597,0.4891005 54.680408,57.805097 32.096378,63.510899 8.3116209,57.805097 z"
style="fill:#e5e7e8;fill-opacity:1;fill-rule:nonzero;stroke:#cccccc" />
<path
d="M 32.096378,10.745857 53.925414,6.8301117 51.016574,53.81906 32.096378,58.517955 z"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<rect
width="34.027256"
height="19.136194"
x="3.7557135"
y="22.431904"
style="fill:#ff2600;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<rect
width="23.480518"
height="19.136194"
x="36.763767"
y="22.431904"
style="fill:#ff501a;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<g transform="matrix(0.42778543,0,0,0.42778543,58.617711,9.6737064)">
<path
d="m -120.53125,34.59375 0,35.1875 6.53125,0 0,-5.9375 0,-5.96875 8.875,0 4.15625,-3.71875 0,-7.71875 0,-7.71875 -4.21875,-4.125 -15.34375,0 z m 6.53125,6.8125 6.21875,0 0,10.21875 -6.21875,0 0,-10.21875 z"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m -98.125,34.59375 0,35.1875 16.125,0 3.75,-3.625 0,-27.96875 -3.96875,-3.59375 -15.90625,0 z m 6.8125,6.8125 6.8125,0 0,21.5625 -6.8125,0 0,-21.5625 z" id="path3056"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m -74.856072,34.602929 c 5.485697,0 10.971394,0 16.457091,0 0,2.269943 0,4.539887 0,6.80983 -3.404915,0 -6.809831,0 -10.214746,0 0,2.472069 0,4.944138 0,7.416206 2.93201,0.110496 5.864021,-0.110494 8.796031,0 l 0,3.366025 0,3.375914 c -2.93201,0.110495 -5.864021,-0.110495 -8.796031,0 l 0,7.146446 0,7.069702 c -2.080782,0 -4.161563,0 -6.242345,0 0,-11.728041 0,-23.456082 0,-35.184123 z"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m -42.8813,67.942723 -2.181762,-1.844329 c 0,-1.986871 0,-3.973742 0,-5.960613 2.175363,6.7e-4 4.350725,0.0013 6.526088,0.002 0,0.94581 0,1.891619 0,2.837429 1.891619,0 3.783239,0 5.674858,0 0,-9.458098 0,-18.916195 0,-28.374293 2.175363,-1.26e-4 4.350725,-2.52e-4 6.526088,-3.78e-4 0,10.498614 0,20.997229 0,31.495843 -1.454508,1.229554 -2.909019,2.459106 -4.363529,3.688658 -3.333325,0 -6.666651,0 -9.999976,0 -0.727237,-0.614768 -1.454563,-1.229595 -2.181767,-1.844308 z"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m -21.316836,67.942723 -2.109122,-1.844329 0,-5.978379 c 2.061011,0 4.392437,0.01978 6.453448,0.01978 0,0.94581 0,1.891619 0,2.837429 2.269943,0 4.539887,0 6.80983,0 0,-2.459105 0,-4.918211 0,-7.377316 -3.196954,0 -6.393909,0 -9.590863,0 l -3.745055,-3.688659 0,-6.80983 0,-6.80983 3.745055,-3.688658 c 3.863156,0 7.726313,0 11.5894692,0 l 4.2511106,3.688658 c -0.00204,1.797039 -0.00472,3.594077 -0.00737,5.391115 -2.0807816,0 -4.1615632,0 -6.2423448,0 0,-0.756648 0,-1.513295 0,-2.269943 -2.269943,0 -4.539887,0 -6.80983,0 0,2.459105 0,4.918211 0,7.377316 2.990126,0 5.980253,0 8.9703792,0 1.3605964,1.204585 4.0817956,3.613749 4.0817956,3.613749 0,4.555246 0,9.110492 0,13.665738 l -2.0892845,1.858745 -2.0892901,1.858745 -5.5180792,0 -5.51808,0 z"
style="fill:#ffffff;fill-opacity:1" />
</g>
</svg>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment