Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Milan
diaspora
Commits
ba984009
Commit
ba984009
authored
Jul 01, 2010
by
maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added chrome frame
parent
ce60d6a9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
8 deletions
+67
-8
app/views/layouts/application.html.haml
app/views/layouts/application.html.haml
+1
-2
config.ru
config.ru
+2
-0
lib/chrome_frame.rb
lib/chrome_frame.rb
+63
-0
public/javascripts/google.js
public/javascripts/google.js
+1
-6
No files found.
app/views/layouts/application.html.haml
View file @
ba984009
...
...
@@ -5,12 +5,11 @@
=
"diaspora "
=
"-
#{
User
.
first
.
real_name
}
"
if
User
.
first
%meta
{
"http-equiv"
=>
"Content-Type"
,
:content
=>
"text/html; charset=utf-8"
}
/
%meta
{
"http-equiv"
=>
"X-UA-Compatible"
,
:content
=>
"chrome=1"
}
=
stylesheet_link_tag
"blueprint/screen"
,
:media
=>
'screen'
=
stylesheet_link_tag
"application"
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
=
javascript_include_tag
'jquery142'
,
'rails'
,
'view'
,
'publisher'
,
'
http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js'
,
'
google_a'
=
javascript_include_tag
'jquery142'
,
'rails'
,
'view'
,
'publisher'
,
'google_a'
=
javascript_include_tag
'tiny_mce/tiny_mce'
,
'jquery.infieldlabel'
=
render
'js/websocket_js'
...
...
config.ru
View file @
ba984009
...
...
@@ -2,4 +2,6 @@
require
::
File
.
expand_path
(
'../config/environment'
,
__FILE__
)
#use Rack::FiberPool
require
'lib/chrome_frame'
use
Rack
::
ChromeFrame
run
Diaspora
::
Application
lib/chrome_frame.rb
0 → 100644
View file @
ba984009
module
Rack
class
ChromeFrame
def
initialize
(
app
,
options
=
{})
@app
=
app
@options
=
options
end
def
call
(
env
)
if
env
[
'HTTP_USER_AGENT'
]
=~
/MSIE/
if
env
[
'HTTP_USER_AGENT'
]
=~
/chromeframe/
status
,
headers
,
response
=
@app
.
call
(
env
)
new_body
=
insert_tag
(
build_response_body
(
response
))
new_headers
=
recalculate_body_length
(
headers
,
new_body
)
return
[
status
,
new_headers
,
new_body
]
elsif
@options
[
:minimum
].
nil?
or
ie_version
(
env
[
'HTTP_USER_AGENT'
])
<
@options
[
:minimum
]
html
=
<<-
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>You need to use a real browser in order to use Diaspora!</title>
</head>
<body>
<div id="cf-placeholder"></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<script>CFInstall.check({ node: "cf-placxeholder"
#{
', destination: "'
+
@options
[
:destination
]
+
'" '
if
@options
[
:destination
]
}
});</script>
</body>
</html>
HTML
return
[
200
,
{
'Content-Type'
=>
'text/html'
,
'Content-Length'
=>
html
.
size
.
to_s
},
Rack
::
Response
.
new
([
html
])]
end
end
@app
.
call
(
env
)
end
def
build_response_body
(
response
)
response_body
=
""
response
.
each
{
|
part
|
response_body
+=
part
}
response_body
end
def
recalculate_body_length
(
headers
,
body
)
new_headers
=
headers
new_headers
[
"Content-Length"
]
=
body
.
length
.
to_s
new_headers
end
def
insert_tag
(
body
)
head
=
<<-
HEAD
<meta http-equiv="X-UA-Compatible" content="chrome=1">
HEAD
body
.
gsub!
(
'<head>'
,
"<head>
\n
"
+
head
)
body
end
def
ie_version
(
ua_string
)
ua_string
.
match
(
/MSIE (\S+)/
)[
1
].
to_f
end
end
end
\ No newline at end of file
public/javascripts/google.js
View file @
ba984009
...
...
@@ -7,9 +7,4 @@ _gaq.push(['_trackPageview']);
var
ga
=
document
.
createElement
(
'
script
'
);
ga
.
type
=
'
text/javascript
'
;
ga
.
async
=
true
;
ga
.
src
=
(
'
https:
'
==
document
.
location
.
protocol
?
'
https://ssl
'
:
'
http://www
'
)
+
'
.google-analytics.com/ga.js
'
;
var
s
=
document
.
getElementsByTagName
(
'
script
'
)[
0
];
s
.
parentNode
.
insertBefore
(
ga
,
s
);
})();
CFInstall
.
check
({
mode
:
"
overlay
"
,
destination
:
"
http://www.waikiki.com
"
});
\ No newline at end of file
})();
\ No newline at end of file
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