Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
preetwinder
jio
Commits
c1a8aff1
Commit
c1a8aff1
authored
Dec 05, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
html5.js not used by Firefox and Chrome anymore
parent
f544ed16
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
228 additions
and
223 deletions
+228
-223
test/html5.js
test/html5.js
+228
-223
No files found.
test/html5.js
View file @
c1a8aff1
/*jslint indent: 2, nomen: true, sloppy: true */
/*global setTimeout */
/*global setTimeout
, window, navigator
*/
////////////////////////////////////////////////////////////
// https://github.com/TristanCavelier/notesntools/blob/\
// master/javascript/stringToUtf8Bytes.js
/**
(
function
()
{
////////////////////////////////////////////////////////////
// https://github.com/TristanCavelier/notesntools/blob/\
// master/javascript/stringToUtf8Bytes.js
/**
* Converts a string into a Utf8 raw string (0 <= char <= 255)
*
* @param {String} input String to convert
* @return {String} Utf8 byte string
*/
function
stringToUtf8ByteString
(
input
)
{
function
stringToUtf8ByteString
(
input
)
{
/*jslint bitwise: true */
var
output
=
""
,
i
,
x
,
y
,
l
=
input
.
length
;
...
...
@@ -47,15 +48,15 @@ function stringToUtf8ByteString(input) {
}
}
return
output
;
}
}
/**
/**
* Converts a Utf8 raw string (0 <= char <= 255) into a real string
*
* @param {String} input Utf8 encoded Bytes to convert
* @return {String} Real string
*/
function
utf8ByteStringToString
(
input
)
{
function
utf8ByteStringToString
(
input
)
{
/*jslint bitwise: true */
var
output
=
""
,
i
,
x
,
l
=
input
.
length
;
...
...
@@ -101,15 +102,11 @@ function utf8ByteStringToString(input) {
}
}
return
output
;
}
////////////////////////////////////////////////////////////
}
function
ord
(
chr
)
{
return
chr
.
charCodeAt
(
0
);
}
////////////////////////////////////////////////////////////
function
Blob
(
parts
,
properties
)
{
function
Blob
(
parts
,
properties
)
{
var
i
,
part
,
raw
=
''
,
type
;
type
=
(
properties
&&
properties
.
type
&&
properties
.
type
.
toString
())
||
""
;
if
(
!
Array
.
isArray
(
parts
))
{
...
...
@@ -148,10 +145,10 @@ function Blob(parts, properties) {
"
writable
"
:
false
,
"
value
"
:
type
});
}
Blob
.
prototype
.
type
=
""
;
Blob
.
prototype
.
size
=
0
;
Blob
.
prototype
.
slice
=
function
(
start
,
end
,
contentType
)
{
}
Blob
.
prototype
.
type
=
""
;
Blob
.
prototype
.
size
=
0
;
Blob
.
prototype
.
slice
=
function
(
start
,
end
,
contentType
)
{
var
data
,
blob
,
i
,
fake_data
=
''
;
data
=
this
.
_data
.
slice
(
start
,
end
);
for
(
i
=
0
;
i
<
data
.
length
;
i
+=
1
)
{
...
...
@@ -160,16 +157,16 @@ Blob.prototype.slice = function (start, end, contentType) {
blob
=
new
Blob
([
fake_data
],
{
"
type
"
:
contentType
});
blob
.
_data
=
data
;
return
blob
;
};
};
////////////////////////////////////////////////////////////
// https://github.com/TristanCavelier/notesntools/blob/\
// master/javascript/emitter.js
function
FileReader
()
{
////////////////////////////////////////////////////////////
// https://github.com/TristanCavelier/notesntools/blob/\
// master/javascript/emitter.js
function
FileReader
()
{
return
;
}
}
FileReader
.
prototype
.
addEventListener
=
function
(
eventName
,
callback
)
{
FileReader
.
prototype
.
addEventListener
=
function
(
eventName
,
callback
)
{
// Check parameters
if
(
typeof
callback
!==
"
function
"
)
{
return
;
...
...
@@ -179,9 +176,9 @@ FileReader.prototype.addEventListener = function (eventName, callback) {
this
.
_events
=
this
.
_events
||
{};
this
.
_events
[
eventName
]
=
this
.
_events
[
eventName
]
||
[];
this
.
_events
[
eventName
].
push
(
callback
);
};
};
function
dispatchEvent
(
fr
,
eventName
)
{
function
dispatchEvent
(
fr
,
eventName
)
{
var
args
,
i
,
funs
=
fr
.
_events
&&
fr
.
_events
[
eventName
]
&&
fr
.
_events
[
eventName
].
slice
();
...
...
@@ -206,9 +203,9 @@ function dispatchEvent(fr, eventName) {
funs
[
i
].
apply
(
fr
,
args
);
}
}
}
}
FileReader
.
prototype
.
removeEventListener
=
function
(
eventName
,
callback
)
{
FileReader
.
prototype
.
removeEventListener
=
function
(
eventName
,
callback
)
{
var
i
,
funs
=
this
.
_events
&&
this
.
_events
[
eventName
];
if
(
funs
)
{
...
...
@@ -219,14 +216,14 @@ FileReader.prototype.removeEventListener = function (eventName, callback) {
}
}
}
};
};
FileReader
.
prototype
.
abort
=
function
()
{
FileReader
.
prototype
.
abort
=
function
()
{
this
.
dispatchEvent
(
"
abort
"
,
{
"
target
"
:
this
});
delete
this
.
_events
;
};
};
FileReader
.
prototype
.
readAsBinaryString
=
function
(
blob
)
{
FileReader
.
prototype
.
readAsBinaryString
=
function
(
blob
)
{
var
that
=
this
;
setTimeout
(
function
()
{
dispatchEvent
(
that
,
"
progress
"
,
{
...
...
@@ -241,9 +238,9 @@ FileReader.prototype.readAsBinaryString = function (blob) {
"
target
"
:
that
});
});
};
};
FileReader
.
prototype
.
readAsText
=
function
(
blob
)
{
FileReader
.
prototype
.
readAsText
=
function
(
blob
)
{
var
that
=
this
;
setTimeout
(
function
()
{
dispatchEvent
(
that
,
"
progress
"
,
{
...
...
@@ -258,6 +255,14 @@ FileReader.prototype.readAsText = function (blob) {
"
target
"
:
that
});
});
};
};
////////////////////////////////////////////////////////////
if
(
typeof
Blob
!==
'
function
'
||
typeof
FileReader
!==
'
function
'
||
(
/
\b
PhantomJS
\b
/i
).
test
(
navigator
.
userAgent
))
{
window
.
Blob
=
Blob
;
window
.
FileReader
=
FileReader
;
}
////////////////////////////////////////////////////////////
}());
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment