grim/port-authority
Clone
Summary
Browse
Changes
Graph
add hljs for debugging and cleaned up some other stuff
feature/semantic-ui
2015-03-12, Gary Kramlich
370ec34df3a6
add hljs for debugging and cleaned up some other stuff
/*! angular-highlightjs
version: 0.4.1
build date: 2015-02-03
author: Chih-Hsuan Fan
https://github.com/pc035860/angular-highlightjs.git */
"undefined"
!=
typeof
module
&&
"undefined"
!=
typeof
exports
&&
module
.
exports
===
exports
&&
(
module
.
exports
=
"hljs"
),
function
(
a
,
b
){
function
c
(
a
){
var
c
=!
0
;
return
b
.
forEach
([
"source"
,
"include"
],
function
(
b
){
a
[
b
]
&&
(
c
=!
1
)}),
c
}
var
d
=
b
.
module
(
"hljs"
,[]);
d
.
provider
(
"hljsService"
,
function
(){
var
a
=
{};
return
{
setOptions
:
function
(
c
){
b
.
extend
(
a
,
c
)},
getOptions
:
function
(){
return
b
.
copy
(
a
)},
$get
:
[
"$window"
,
function
(
c
){
return
(
c
.
hljs
.
configure
||
b
.
noop
)(
a
),
c
.
hljs
}]}}),
d
.
factory
(
"hljsCache"
,[
"$cacheFactory"
,
function
(
a
){
return
a
(
"hljsCache"
)}]),
d
.
controller
(
"HljsCtrl"
,[
"hljsCache"
,
"hljsService"
,
function
(
a
,
c
){
var
d
=
this
,
e
=
null
,
f
=
null
,
g
=
null
,
h
=
null
;
d
.
init
=
function
(
a
){
e
=
a
},
d
.
setLanguage
=
function
(
a
){
f
=
a
,
g
&&
d
.
highlight
(
g
)},
d
.
highlightCallback
=
function
(
a
){
h
=
a
},
d
.
highlight
=
function
(
i
){
if
(
e
){
var
j
,
k
;
g
=
i
,
f
?
(
k
=
d
.
_cacheKey
(
f
,
g
),
j
=
a
.
get
(
k
),
j
||
(
j
=
c
.
highlight
(
f
,
c
.
fixMarkup
(
g
),
!
0
),
a
.
put
(
k
,
j
)))
:
(
k
=
d
.
_cacheKey
(
g
),
j
=
a
.
get
(
k
),
j
||
(
j
=
c
.
highlightAuto
(
c
.
fixMarkup
(
g
)),
a
.
put
(
k
,
j
))),
e
.
html
(
j
.
value
),
e
.
addClass
(
j
.
language
),
null
!==
h
&&
b
.
isFunction
(
h
)
&&
h
()}},
d
.
clear
=
function
(){
e
&&
(
g
=
null
,
e
.
text
(
""
))},
d
.
release
=
function
(){
e
=
null
},
d
.
_cacheKey
=
function
(){
var
a
=
Array
.
prototype
.
slice
.
call
(
arguments
),
b
=
"!angular-highlightjs!"
;
return
a
.
join
(
b
)}}]);
var
e
,
f
,
g
,
h
;
e
=
[
"$compile"
,
"$parse"
,
function
(
a
,
d
){
return
{
restrict
:
"EA"
,
controller
:
"HljsCtrl"
,
compile
:
function
(
e
){
var
f
=
e
[
0
].
innerHTML
.
replace
(
/^(\r\n|\r|\n)/m
,
""
),
g
=
e
[
0
].
textContent
.
replace
(
/^(\r\n|\r|\n)/m
,
""
);
return
e
.
html
(
'<pre><code class="hljs"></code></pre>'
),
function
(
e
,
h
,
i
,
j
){
var
k
,
l
;
if
(
b
.
isDefined
(
i
.
compile
)
&&
(
k
=
d
(
i
.
compile
)),
b
.
isDefined
(
i
.
escape
)
?
l
=
d
(
i
.
escape
)
:
b
.
isDefined
(
i
.
noEscape
)
&&
(
l
=
d
(
"false"
)),
j
.
init
(
h
.
find
(
"code"
)),
i
.
onhighlight
&&
j
.
highlightCallback
(
function
(){
e
.
$eval
(
i
.
onhighlight
)}),(
f
||
g
)
&&
c
(
i
)){
var
m
;
m
=
l
&&!
l
(
e
)
?
g
:
f
,
j
.
highlight
(
m
),
k
&&
k
(
e
)
&&
a
(
h
.
find
(
"code"
).
contents
())(
e
)}
e
.
$on
(
"$destroy"
,
function
(){
j
.
release
()})}}}}],
f
=
function
(
a
){
return
[
function
(){
return
{
require
:
"?hljs"
,
restrict
:
"A"
,
link
:
function
(
c
,
d
,
e
,
f
){
f
&&
e
.
$observe
(
a
,
function
(
a
){
b
.
isDefined
(
a
)
&&
f
.
setLanguage
(
a
)})}}}]},
g
=
function
(
a
){
return
[
"$compile"
,
"$parse"
,
function
(
c
,
d
){
return
{
require
:
"?hljs"
,
restrict
:
"A"
,
link
:
function
(
e
,
f
,
g
,
h
){
var
i
;
h
&&
(
b
.
isDefined
(
g
.
compile
)
&&
(
i
=
d
(
g
.
compile
)),
e
.
$watch
(
g
[
a
],
function
(
a
){
a
?
(
h
.
highlight
(
a
),
i
&&
i
(
e
)
&&
c
(
f
.
find
(
"code"
).
contents
())(
e
))
:
h
.
clear
()}))}}}]},
h
=
function
(
a
){
return
[
"$http"
,
"$templateCache"
,
"$q"
,
"$compile"
,
"$parse"
,
function
(
c
,
d
,
e
,
f
,
g
){
return
{
require
:
"?hljs"
,
restrict
:
"A"
,
compile
:
function
(
h
,
i
){
var
j
=
i
[
a
];
return
function
(
a
,
h
,
i
,
k
){
var
l
,
m
=
0
;
k
&&
(
b
.
isDefined
(
i
.
compile
)
&&
(
l
=
g
(
i
.
compile
)),
a
.
$watch
(
j
,
function
(
g
){
var
i
=++
m
;
if
(
g
&&
b
.
isString
(
g
)){
var
j
,
n
;
j
=
d
.
get
(
g
),
j
||
(
n
=
e
.
defer
(),
c
.
get
(
g
,{
cache
:
d
,
transformResponse
:
function
(
a
){
return
a
}}).
success
(
function
(
a
){
i
===
m
&&
n
.
resolve
(
a
)}).
error
(
function
(){
i
===
m
&&
k
.
clear
(),
n
.
resolve
()}),
j
=
n
.
promise
),
e
.
when
(
j
).
then
(
function
(
c
){
c
&&
(
b
.
isArray
(
c
)
?
c
=
c
[
1
]
:
b
.
isObject
(
c
)
&&
(
c
=
c
.
data
),
c
=
c
.
replace
(
/^(\r\n|\r|\n)/m
,
""
),
k
.
highlight
(
c
),
l
&&
l
(
a
)
&&
f
(
h
.
find
(
"code"
).
contents
())(
a
))})}
else
k
.
clear
()}))}}}}]},
d
.
directive
(
"hljs"
,
e
).
directive
(
"language"
,
f
(
"language"
)).
directive
(
"source"
,
g
(
"source"
)).
directive
(
"include"
,
h
(
"include"
))}(
window
,
window
.
angular
);