Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F823546
fckplugin.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Mar 9, 9:41 PM
Size
1 KB
Mime Type
text/plain
Expires
Tue, Mar 11, 9:41 PM (1 d, 7 h)
Engine
blob
Format
Raw Data
Handle
585736
Attached To
rINP In-Portal
fckplugin.js
View Options
var
MyPreviewCommand
=
function
()
{
this
.
Name
=
'MyPreview'
;
}
MyPreviewCommand
.
prototype
.
Execute
=
function
()
{
initXmlHTTP
();
xmlHTTP
.
onreadystatechange
=
OnGetAnswerPost
;
// the path is NOT /admin, otherwise content will be stored in admin session !
xmlHTTP
.
open
(
'POST'
,
FCKConfig
.
ProjectPath
+
'index.php?t=dummy&events[c]=OnUpdatePreviewBlock&ajax=yes'
,
true
);
xmlHTTP
.
setRequestHeader
(
'Content-Type'
,
'application/x-www-form-urlencoded'
);
xmlHTTP
.
send
(
'&preview_content='
+
encodeURIComponent
(
FCK
.
GetXHTML
()));
}
MyPreviewCommand
.
prototype
.
GetState
=
function
()
{
return
FCK_TRISTATE_OFF
;
}
function
initXmlHTTP
(){
//if (xmlHTTP) return;
try
{
xmlHTTP
=
new
ActiveXObject
(
"Msxml2.XMLHTTP"
);
}
catch
(
e
)
{
try
{
xmlHTTP
=
new
ActiveXObject
(
"Microsoft.XMLHTTP"
);
}
catch
(
E
)
{
xmlHTTP
=
false
;
}
}
if
(
!
xmlHTTP
&&
typeof
XMLHttpRequest
!=
'undefined'
)
{
xmlHTTP
=
new
XMLHttpRequest
();
}
}
function
OnGetAnswerPost
()
{
var
ret
=
''
;
if
(
xmlHTTP
.
readyState
==
4
)
{
if
(
xmlHTTP
.
status
==
200
)
{
ret
=
xmlHTTP
.
responseText
;
var
iWidth
=
FCKConfig
.
ScreenWidth
*
0.8
;
var
iHeight
=
FCKConfig
.
ScreenHeight
*
0.7
;
var
iLeft
=
(
FCKConfig
.
ScreenWidth
-
iWidth
)
/
2
;
var
sOpenUrl
=
FCKConfig
.
PreviewUrl
+
'&_editor_preview_=1'
;
var
oWindow
=
window
.
open
(
sOpenUrl
,
null
,
'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='
+
iWidth
+
',height='
+
iHeight
+
',left='
+
iLeft
)
;
}
}
}
FCKCommands
.
RegisterCommand
(
'MyPreview'
,
new
MyPreviewCommand
());
FCKToolbarItems
.
RegisterItem
(
'MyPreview'
,
new
FCKToolbarButton
(
'MyPreview'
,
FCKLang
.
PreviewLbl
,
FCKLang
.
Preview
,
null
,
false
,
true
,
5
)
)
;
Event Timeline
Log In to Comment