MoMA.master: Need to reference the DisqusProxy.asmx service, so the javascript proxy script is generated

IssueView.aspx, IssueView.aspx.cs: Use the DisqusControl control to manage comments.

DisqusControl.cs, disqus.js: A server control with a javascript client-side part to embed Disqus comments on a page.

DisqusProxy.asmx, DisqusProxy.cs: Proxy the disqus API to get around browser cross-domain restrictions

disqus.css:  Extracted from disqus's embed.js so we can reference it directly, to workaround IE not using the style sheet (I had IE working, then it broke and I can't figure out why.)

svn path=/trunk/moma-tool/; revision=127420
This commit is contained in:
Dick Porter 2009-02-19 16:33:50 +00:00
Родитель e30a0dc390
Коммит 68f2405d3b
8 изменённых файлов: 1290 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,236 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// A control to embed Disqus comments on a page, that copes with AJAX update panels
/// </summary>
namespace MoMATool
{
public class DisqusControl : WebControl, IScriptControl
{
private string _disqus_forum;
private bool _disqus_developer;
private string _disqus_container_id;
private string _disqus_url;
private string _disqus_title;
private string _disqus_message;
private string _disqus_identifier;
private string _width;
private ScriptManager sm;
public string DisqusForum
{
get
{
return _disqus_forum;
}
set
{
_disqus_forum = value;
}
}
public bool DisqusDeveloper
{
get
{
return _disqus_developer;
}
set
{
_disqus_developer = value;
}
}
public string DisqusContainerId
{
get
{
return _disqus_container_id;
}
set
{
_disqus_container_id = value;
}
}
public string DisqusURL
{
get
{
return _disqus_url;
}
set
{
_disqus_url = value;
}
}
public string DisqusTitle
{
get
{
return _disqus_title;
}
set
{
_disqus_title = value;
}
}
public string DisqusMessage
{
get
{
return _disqus_message;
}
set
{
_disqus_message = value;
}
}
public string DisqusIdentifier
{
get
{
return _disqus_identifier;
}
set
{
_disqus_identifier = value;
}
}
public string xWidth
{
get
{
return _width;
}
set
{
_width = value;
}
}
private string DivID
{
get
{
return "disqus-comment-div-" + this.ClientID;
}
}
private string IframeID
{
get
{
return "disqus-comment-iframe-" + this.ClientID;
}
}
private string Update
{
get
{
return this.IframeID;
}
set
{
}
}
public void DoUpdate()
{
this.Update = this.IframeID;
}
protected override void OnPreRender(EventArgs e)
{
if (!this.DesignMode)
{
sm = ScriptManager.GetCurrent(Page);
if (sm == null)
{
throw new HttpException("A ScriptManager control must exist on the current page");
}
sm.RegisterScriptControl(this);
}
base.OnPreRender(e);
}
protected override void Render(HtmlTextWriter writer)
{
if (!this.DesignMode)
{
sm.RegisterScriptDescriptors(this);
}
base.Render(writer);
}
protected override void RenderContents(HtmlTextWriter writer)
{
writer.AddAttribute("id", this.DivID);
writer.RenderBeginTag("div");
StringBuilder sb = new StringBuilder();
sb.Append("<iframe id='" + this.IframeID + "' name='" + this.IframeID + "' ");
sb.Append("width='" + this.Width.ToString() + "' height='0px' ");
sb.Append("style='border: none;' ");
sb.Append(">");
sb.Append("</iframe>");
writer.Write(sb.ToString());
writer.RenderEndTag();
base.RenderContents(writer);
}
protected virtual IEnumerable<ScriptReference> GetScriptReferences()
{
ScriptReference reference = new ScriptReference();
reference.Path = ResolveClientUrl("disqus.js");
return new ScriptReference[] { reference };
}
protected virtual IEnumerable<ScriptDescriptor> GetScriptDescriptors()
{
ScriptControlDescriptor descriptor = new ScriptControlDescriptor("MoMATool.DisqusControl", this.ClientID);
descriptor.AddProperty("disqusForum", this.DisqusForum);
descriptor.AddProperty("disqusDeveloper", this.DisqusDeveloper);
descriptor.AddProperty("disqusContainerId", this.DisqusContainerId);
descriptor.AddProperty("disqusURL", this.DisqusURL);
descriptor.AddProperty("disqusTitle", this.DisqusTitle);
descriptor.AddProperty("disqusMessage", this.DisqusMessage);
descriptor.AddProperty("disqusIdentifier", this.DisqusIdentifier);
descriptor.AddProperty("update", this.Update);
return new ScriptDescriptor[] { descriptor };
}
IEnumerable<ScriptReference> IScriptControl.GetScriptReferences()
{
return GetScriptReferences();
}
IEnumerable<ScriptDescriptor> IScriptControl.GetScriptDescriptors()
{
return GetScriptDescriptors();
}
}
}

Просмотреть файл

@ -0,0 +1,72 @@
using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Web.Script.Services;
using System.Net;
using System.IO;
using System.Text;
using System.Configuration;
/// <summary>
/// This service proxies calls from the client to the disqus service, to get around cross-domain
/// restrictions in the browser
/// </summary>
[WebService(Namespace = "http://mono-project.com/moma")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class DisqusProxy : System.Web.Services.WebService {
public DisqusProxy () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public bool EnsureThreadCreated(string title, string message, string thread_identifier) {
try
{
string forum_api_key = ConfigurationManager.ConnectionStrings["DisqusForumAPI"].ConnectionString;
string post_data = "forum_api_key=" + HttpUtility.UrlEncode(forum_api_key) +
"&title=" + HttpUtility.UrlEncode(title) +
"&identifier=" + HttpUtility.UrlEncode(thread_identifier);
UTF8Encoding enc = new UTF8Encoding();
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://disqus.com/api/thread_by_identifier/");
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = enc.GetByteCount(post_data);
using (Stream req_stream = req.GetRequestStream())
{
req_stream.Write(enc.GetBytes(post_data), 0, enc.GetByteCount(post_data));
}
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
string resp_str = "";
// We don't really care what the response is, apart from success/fail
// And no need to parse the JSON response, so long as it says '"succeeded": true' somewhere
using (Stream resp_stream = resp.GetResponseStream())
{
using (StreamReader reader = new StreamReader(resp_stream))
{
resp_str = reader.ReadToEnd();
}
}
return resp_str.Contains("\"succeeded\": true");
}
catch
{
return false;
}
}
}

Просмотреть файл

@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="~/App_Code/DisqusProxy.cs" Class="DisqusProxy" %>

Просмотреть файл

@ -1,6 +1,7 @@
<%@ Page Language="C#" MasterPageFile="~/MoMA.master" AutoEventWireup="true" CodeFile="IssueView.aspx.cs" Inherits="NamespaceView" Title="MoMA Studio - View Issue" EnableEventValidation="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Namespace="MoMATool" TagPrefix="disqus" %>
<%-- Have to disable event validation for this page, due to the dynamically populated cascading drop down lists --%>
<asp:Content ID="ContentHeaderContent" ContentPlaceHolderID="ContentHeaderPlaceholder" Runat="Server">
@ -245,6 +246,11 @@
</ContentTemplate>
</asp:UpdatePanel>
</LoggedInTemplate>
</asp:LoginView>
</asp:LoginView>
<asp:UpdatePanel ID="IssuesCommentsUpdatePanel" runat="server">
<ContentTemplate>
<disqus:DisqusControl ID="DisqusComments" Width="900px" DisqusForum="mono-momastudio-issues" DisqusDeveloper="true" runat="server"></disqus:DisqusControl>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

Просмотреть файл

@ -16,6 +16,8 @@ using Npgsql;
using System.Collections.Generic;
using System.Collections.Specialized;
using MoMATool;
public partial class NamespaceView : System.Web.UI.Page
{
int issue_id = 0;
@ -181,6 +183,8 @@ public partial class NamespaceView : System.Web.UI.Page
{
default_ns = (string)issue_data[0]["method_namespace"];
default_cls = (string)issue_data[0]["method_class"];
string method = (string)issue_data[0]["method_name"];
string iss_type = (string)issue_data[0]["lookup_name"];
IssueDetailsView.DataBind();
@ -196,6 +200,12 @@ public partial class NamespaceView : System.Web.UI.Page
FixedLabel.Visible = false;
}
DisqusComments.DisqusTitle = default_ns + "." + default_cls + "::" + method + " [" + iss_type + "]";
DisqusComments.DisqusMessage = "Mono Issue: " + DisqusComments.DisqusTitle;
DisqusComments.DisqusIdentifier = "issue-" + id.ToString();
DisqusComments.DisqusURL = Page.Request.Url.GetLeftPart(UriPartial.Path) + "?IssueID=" + id.ToString();
DisqusComments.DoUpdate();
if (Page.User.Identity.IsAuthenticated)
{
IssueReportsSqlDataSource.SelectParameters["id"].DefaultValue = id.ToString();

Просмотреть файл

@ -32,7 +32,11 @@
<div id="page">
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="True" EnableScriptLocalization="True" />
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="True" EnableScriptLocalization="True">
<Services>
<asp:ServiceReference Path="~/DisqusProxy.asmx" />
</Services>
</asp:ScriptManager>
<div id="header">
<h1>MoMA Studio</h1>
<asp:LoginView ID="LoginView1" runat="server">

780
web_service/disqus.css Normal file
Просмотреть файл

@ -0,0 +1,780 @@
/* This was pulled from embed.js, because IE doesn't pick up the styles inside the iframe otherwise */
#dsq-content #dsq-comments .dsq-comment {
list-style-type: none;
padding: 0;
margin: 0;
border: 0;
}
#dsq-content #dsq-comments .dsq-comment {
margin-bottom: 20px;
}
#dsq-content #dsq-comments .dsq-comment-rate {
float: left;
line-height: 1.22em;
*margin-top: 15px;
}
#dsq-content #dsq-comments .dsq-comment-rate a,
#dsq-content #dsq-comments .dsq-comment-rate img {
border: 0;
margin: 0;
padding: 0;
background-color: transparent;
}
#dsq-content #dsq-comments .dsq-arrows,
#dsq-content #dsq-comments .not-votable .dsq-arrows:hover {
opacity: .25;
filter: alpha(opacity=25);
_width: 16px;
_height: 14px;
}
#dsq-content #dsq-comments .dsq-arrows.voted {
opacity: .5;
filter: alpha(opacity=50);
}
#dsq-content #dsq-comments .dsq-arrows:hover {
opacity: 1;
filter: alpha(opacity=100);
}
#dsq-content #dsq-comments .dsq-arrows img {
_width: 16px;
_height: 14px;
}
#dsq-content #dsq-comments .dsq-comment-header {
margin-left: 20px;
background: url(\'http://media.disqus.com/images/embed/header-grey.png\') repeat-x;
height: 30px;
line-height: 30px;
height: 38px;
line-height: 38px;
}
#dsq-content #dsq-comments .dsq-comment.special .dsq-comment-header {
background: url(\'http://media.disqus.com/images/embed/header-blue.png\') repeat-x;
}
#dsq-content #dsq-comments .dsq-comment-header a {
text-decoration: none;
}
#dsq-content #dsq-comments .dsq-header-avatar {
position: relative;
float: left;
width: 32px;
height: 34px;
margin-top: -2px;
height: 43px;
width: 40px;
}
#dsq-content #dsq-comments .dsq-header-avatar.dsq-menu-on,
#dsq-content #dsq-comments .dsq-header-avatar:hover{
background: url(\'http://media.disqus.com/images/embed/avatar-frame-32.png\') no-repeat top left;
cursor: pointer;
z-index: 9999;
}
#dsq-content #dsq-comments .dsq-header-avatar img{
float: left;
margin: 4px;
width: 32px;
height: 32px;
}
#dsq-content #dsq-comments .dsq-header-avatar .dsq-menu img {
height: 8px;
width: 7px;
display: inline;
float: none;
margin-bottom: -1px;
}
#dsq-content #dsq-comments .dsq-comment-header cite {
float: left;
font-style: normal;
font-weight: bold;
margin: 0 3px;
line-height: inherit;
cursor: pointer;
}
#dsq-content #dsq-comments .dsq-comment-header cite a {
line-height: inherit;
}
#dsq-content #dsq-comments .dsq-comment-header .dsq-header-meta {
font-size: 90%;
line-height: inherit;
}
#dsq-content #dsq-comments a.dsq-header-time{
margin: 0 5px;
color: inherit;
line-height: inherit;
}
#dsq-content #dsq-comments span.dsq-header-points{
margin: 0 5px;
color: inherit;
line-height: inherit;
}
#dsq-content #dsq-comments .dsq-comment-body{
margin-left: 20px;
padding-top: 5px;
}
#dsq-content #dsq-comments .dsq-comment-footer {
font-size: 90%;
margin: 10px 0 0 20px;
}
#dsq-content #dsq-comments .dsq-footer-alert {
text-align: right;
}
#dsq-content #dsq-comments .dsq-header-avatar .dsq-menu {
display: none;
}
#dsq-content #dsq-comments .dsq-header-avatar .dsq-menu {
float: left;
left: 0px;
position: relative;
_position: absolute;
_top: 30px;
background: #f0f0f0;
z-index: 2;
border-left: 1px solid #888;
border-right: 1px solid #888;
border-bottom: 1px solid #888;
-moz-border-radius: 0px 0px 4px 4px;
-webkit-border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
display: inline;
padding: 5px 10px 5px 0;
}
#dsq-content #dsq-comments .dsq-menu li{
float: left;
clear: both;
line-height: 1.3em;
font-size: 12px;
margin-bottom: 2px;
margin-left: 4px;
white-space: nowrap;
}
#dsq-content #dsq-comments .dsq-menu li a.dsq-admin-toggle {
font-weight: bold;
}
#dsq-content #dsq-comments .dsq-menu li.dsq-admin-email,
#dsq-content #dsq-comments .dsq-menu li.dsq-admin-ip {
color: #555;
font-style: italic;
cursor: default;
}
#dsq-content #dsq-comments .dsq-menu li.dsq-admin-ip {
padding-bottom: 3px;
border-bottom: 1px dotted #aaa;
cursor: default;
}
#dsq-content #dsq-comments .dsq-menu li a{
text-decoration: none;
color: #333;
}
#dsq-content #dsq-comments .dsq-menu li a:hover {
color: #869AAD;
}
#dsq-content #dsq-comments .dsq-menu-clout{
margin: 6px 0;
width: 72px;
height: 32px;
background: url(\'http://media.disqus.com/images/embed/clout-background.png\') no-repeat top left;
}
#dsq-content #dsq-comments .dsq-menu-clout.unverified{
background: url(\'http://media.disqus.com/images/embed/unverified-background.png\') no-repeat top left;
}
#dsq-content #dsq-comments li.dsq-menu-clout a{
float: left;
width: 100%;
text-align: center;
color: #FFF;
font-size: 16px;
font-weight: bold;
margin-top: 5px;
}
#dsq-content #dsq-comments li.dsq-menu-clout.unverified a{
font-size: 10px;
font-weight: normal;
}
#dsq-content #dsq-comments li.dsq-menu-clout a:hover{
color: #FFF;
}
img.dsq-record-img {
border: 0;
padding: 0;
margin: 0;
float: none;
text-indent: 0;
background: none;
}
a.dsq-brlink {
font-size: 90%;
color: #666;
text-decoration: none;
font-family: Trebuchet MS, Trebuchet, Verdana, Arial, sans-serif;
}
span.disqus {
font-family: Trebuchet MS, Trebuchet, Verdana, Arial, sans-serif;
font-size: 90%;
text-transform: uppercase;
color: #64747d;
}
span.logo-disqus {
font-family: Trebuchet MS, Trebuchet, Verdana, Arial, sans-serif;
font-size: 95%;
text-transform: uppercase;
color: #64747d;
font-weight: bold;
}
span.logo-disq {
font-family: Trebuchet MS, Trebuchet, Verdana, Arial, sans-serif;
font-size: 95%;
text-transform: uppercase;
color: #64747d;
font-weight: bold;
}
span.logo-us {
font-family: Trebuchet MS, Trebuchet, Verdana, Arial, sans-serif;
font-size: 95%;
text-transform: uppercase;
color: #ff9300;
font-weight: bold;
}
#disqus_thread #dsq-content {
text-align: left;
font-family: inherit;
font-size: 13px;
}
#disqus_thread #dsq-content iframe {
overflow-y: auto;
overflow-x: hidden;
*overflow-x: visible;
width: 100%;
height: 340px;
background-color: transparent;
<!--[if IE 7]>
width: 0px;
<![endif]-->
}
#disqus_thread #dsq-content iframe.dsq-post-video {
height: 370px;
overflow: hidden;
}
#disqus_thread #dsq-content a.dsq-post-report {
/* color: #c03000;*/
/* background-color: #fff;*/
}
.clearfix:after {
content:".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
#dsq-content #dsq-comments img.icon-adjust {
margin-bottom: -3px;
}
#disqus_thread #dsq-content ul,
#disqus_thread #dsq-content li,
#disqus_thread #dsq-content ol,
#disqus_thread #dsq-content cite,
#disqus_thread #dsq-content img, /* dsq-content */
#dsq-content #dsq-comments ul,
#dsq-content #dsq-comments li,
#dsq-content #dsq-comments ol,
#dsq-content #dsq-comments div,
#dsq-content #dsq-comments p,
#dsq-content #dsq-comments a,
#dsq-content #dsq-comments cite,
#dsq-content #dsq-comments img {
border: 0;
padding: 0;
margin: 0;
float: none;
text-indent: 0;
background: none;
}
#disqus_thread #dsq-content cite,
#dsq-content #dsq-comments cite {
font-style: normal;
}
#dsq-content #dsq-comments img {
max-width: none;
}
#disqus_thread #dsq-content li,
#disqus_thread #dsq-content ul,
#disqus_thread #dsq-content ol,
#dsq-content #dsq-extra-links li,
#dsq-content #dsq-comments ul,
#dsq-content #dsq-comments li,
#dsq-content #dsq-comments ol {
list-style-type: none;
list-style-image: none;
background: none;
display: block;
}
#dsq-content #dsq-extra-links li:before,
#dsq-content #dsq-comments li:before {
content: "";
}
#dsq-content #dsq-content #dsq-post-add {
margin: 0 0 10px 0;
}
#dsq-content #dsq-comments {
width: 100%;
list-style-type: none;
padding: 0;
border: 0;
}
#dsq-content #dsq-comments .dsq-remove-message {
color: #555;
list-style-type: none;
margin: 10px 0;
padding: 5px;
border: 1px solid #c03000;
background-color: #FDDFD0;
}
#dsq-content #dsq-comments .dsq-comment-alert,
#dsq-content #dsq-alerts p {
font-weight: bold;
color: #555;
margin: 15px 0;
padding: 5px;
background-color: #fdf1d0;
border: 1px solid #fad163;
}
#dsq-content #dsq-comments .dsq-comment-header .dsq-hl-up {
background-color: #92C72A;
color: #fff;
margin:0pt 5px;
padding:0 2px;
}
#dsq-content #dsq-comments .dsq-comment-header .dsq-hl-down {
background-color: #c03000;
color: #fff;
margin:0pt 5px;
padding:0 2px;
}
#dsq-content #dsq-comments .dsq-hl-anchor {
background-color: #ffff99 !important;
color: #000 !important;
}
#dsq-content #dsq-comments .dsq-hl-anchor p {
color: #000 !important;
}
#dsq-content #dsq-comments .dsq-hl-anchor a {
color: #000 !important;
}
#dsq-content #dsq-friendfeed-comments {
border: solid 1px #437ec7;
}
#dsq-content #dsq-friendfeed-comments .dsq-frf-title {
padding-top: 10px;
margin-bottom: 10px;
font-size: 15px;
font-weight: bold;
}
#dsq-content #dsq-friendfeed-comments .dsq-frf-comments {
padding-left: 20px;
background-repeat: no-repeat;
background-position: 0px 3px;
}
#dsq-content #dsq-friendfeed-comments li {
margin-bottom: 5px;
}
#dsq-content #dsq-friendfeed-comments .dsq-frf-reply {
margin-top: 10px;
}
#dsq-content #dsq-friendfeed-comments .dsq-frf-reply iframe {
height: 50px;
}
/* ------ outside comment list ------ */
#dsq-content #dsq-auth .dsq-auth-header{
margin-bottom: 10px;
}
#dsq-content h3 { margin: 10px 0; }
#disqus_thread #dsq-content h3 {
font-weight: bold;
}
#dsq-content #dsq-auth .dsq-by {
float: right;
}
#dsq-content #dsq-auth img,
#dsq-content #dsq-options-toggle img {
border: 0;
margin: 0;
padding: 0;
max-width: none;
float: none;
}
#dsq-content #dsq-options {
margin-bottom: 20px;
}
#dsq-options .dsq-extra-meta {
background: transparent url(\'http://media.disqus.com/images/embed/transp-line-10.png\') repeat-x top center;
margin-top:10px;
padding-top:10px;
}
#dsq-extra-links {
margin-top: 15px;
font-size: 90%;
}
#dsq-extra-links img {
margin-bottom: -3px;
}
/* ------- pagination -------- */
#dsq-content #dsq-pagination {
margin-bottom: 20px;
}
#dsq-content #dsq-pagination a {
font-weight: bold;
}
/* ------- popup div -------- */
#dsq-popup-profile h4,
#dsq-popup-profile ul,
#dsq-popup-profile li,
#dsq-popup-profile ol,
#dsq-popup-profile div,
#dsq-popup-profile p,
#dsq-popup-profile a,
#dsq-popup-profile cite,
#dsq-popup-profile img {
border: 0;
padding: 0;
margin: 0;
float: none;
text-indent: 0;
background: none;
}
#dsq-popup-profile img {
max-width: none;
}
#dsq-popup-profile ul,
#dsq-popup-profile li,
#dsq-popup-profile ol {
list-style-type: none;
list-style-image: none;
background: none;
display: block;
}
#dsq-popup-profile li:before {
content: "";
}
#dsq-popup-profile {
padding: 0;
border: 0;
}
.dsq-popupdiv,
.dsq-reblogdiv {
color: #333;
display: none;
position: absolute;
z-index: 9999;
}
.dsq-popupdiv p {
color: #222;
line-height: 1.22em;
}
.dsq-popupdiv a {
color: #1C5392;
}
.dsq-popupdiv a:hover {
color: #869AAD;
}
#dsq-popup-profile {
text-align: left;
width: 520px;
_background: transparent url(http://media.disqus.com/images/embed/popup-body.png) repeat-y;
}
#dsq-popup-profile #dsq-popup-top {
position: relative;
text-align: right;
width: 520px;
height: 20px;
background: transparent url(http://media.disqus.com/images/embed/popup-top.png) no-repeat;
}
#dsq-popup-profile #dsq-popup-top img {
margin: 12px 13px 0 0;
*margin: 12px 13px 0 0;
}
#dsq-popup-profile #dsq-popup-bottom {
text-align: right;
width: 520px;
height: 20px;
background: transparent url(http://media.disqus.com/images/embed/popup-bottom.png) no-repeat;
}
#dsq-popup-profile #dsq-popup-body div.show-more{
padding-left: 10px;
font-size: 95%;
color:#7aa5d5;
}
#dsq-popup-profile #dsq-popup-body div.powered-by{
font-size: 90%;
text-align: right;
padding-right: 15px;
}
#dsq-popup-profile #dsq-popup-body div.powered-by a {
color: #888;
text-decoration:none;
}
#dsq-popup-profile #dsq-popup-body {
width: 520px;
background: transparent url(http://media.disqus.com/images/embed/popup-body.png) repeat-y;
}
#dsq-popup-profile #dsq-popup-body #dsq-popup-body-padding {
padding: 0 10px;
font-size: 13px;
}
#dsq-popup-profile #dsq-popup-body #dsq-popup-header {
background-color: #e5ebed;
padding: 0 10px;
position: relative;
padding-bottom: 10px;
border-bottom: 1px solid #445460;
}
#dsq-popup-profile #dsq-popup-body #dsq-popup-header a.dsq-close-link {
color:#7aa5d5;
position: absolute;
top:-10px;
right: 5px;
text-decoration:none;
}
#dsq-popup-profile #dsq-popup-body #dsq-popup-header img {
border: 1px solid #fff;
width: 32px;
height: 32px;
}
#dsq-popup-profile #dsq-popup-body #dsq-popup-body-padding cite {
margin-left: 5px;
top: 8px;
position: absolute;
font-style: normal;
}
.dsq-reblogdiv #dsq-popup-profile #dsq-popup-body #dsq-popup-body-padding cite {
position: static;
margin: 0;
}
#dsq-popup-profile #dsq-popup-body #dsq-popup-body-padding cite span {
font-weight: bold;
font-size: 150%;
font-style: normal;
margin-right: 10px;
}
#dsq-popup-profile #dsq-popup-body #dsq-popup-body-padding cite a{
/* pass */
}
#dsq-popup-profile #dsq-popup-body #dsq-popup-body-padding .dsq-popup-profilelink {
margin: 0 0 0 5px;
font-size: 90%;
}
#dsq-popup-profile .dsq-clout {
float: left;
width: 72px;
height: 32px;
line-height: 32px;
background: url(\'http://media.disqus.com/images/embed/clout-background.png\') no-repeat top left;
}
#dsq-popup-profile .dsq-clout.unverified {
background: url(\'http://media.disqus.com/images/embed/unverified-background.png\') no-repeat top left;
line-height: 24px;
}
#dsq-popup-profile .dsq-clout a{
float: left;
width: 100%;
text-align: center;
color: #FFF;
font-size: 16px;
font-weight: bold;
text-decoration: none;
}
#dsq-popup-profile .dsq-clout.unverified a{
font-size: 11px;
font-weight: normal;
}
#dsq-popup-profile .dsq-clout a:hover {
color: #fff;
}
#dsq-popup-profile #dsq-profile-services {
padding: 10px;
background-color: #f0f0f0;
border-bottom: 1px solid #aaa;
height: 1%;
overflow: hidden;
}
#dsq-popup-profile #dsq-profile-services a.dsq-profile-badge {
font-size: 95%;
color: #fff;
text-decoration: none;
font-weight: bold;
float: left;
display: block;
padding: 0 3px;
text-align: center;
background-color: #ffaf42;
border: 1px solid #dc7f00;
}
#dsq-popup-profile #dsq-profile-services a.dsq-profile-badge.anon {
border-color: #888;
background-color: #aaa;
color: #666;
}
#dsq-popup-profile #dsq-profile-services ul {
margin-left: 15px;
float: left;
}
#dsq-popup-profile #dsq-profile-services ul li{
display: inline;
margin-right: 15px;
}
#dsq-popup-profile #dsq-profile-services span.dsq-services-description {
font-size: 85%;
color: #555;
position: absolute;
top: 25px;
left: 5px;
display: none;
white-space: nowrap;
}
#dsq-popup-profile #dsq-clout-label {
margin-top: 5px;
font-size: 85%;
color: #555;
visibility: hidden;
clear: both;
padding-left: 10px;
}
#dsq-popup-profile #dsq-profile-services img {
border:2px solid #fff;
}
#dsq-popup-profile a#dsq-profile-follow {
color:#7aa5d5;
}
#dsq-popup-profile #dsq-profile-status,
#dsq-popup-profile #dsq-profile-recentcomments {
clear: both;
padding: 10px;
}
#dsq-popup-profile #dsq-profile-status h4,
#dsq-popup-profile #dsq-profile-recentcomments h4 {
font-size: 110%;
border-bottom: 2px solid #D7DBDD;
margin-bottom: 10px;
}
#dsq-popup-profile #dsq-profile-status h4 span,
#dsq-popup-profile #dsq-profile-recentcomments h4 span {
background-color: #D7DBDD;
padding: 2px 5px;
color: #555;
font-weight: bold;
}
#dsq-popup-profile p.dsq-profile-label {
font-family: Trebuchet MS, Trebuchet, Verdana, sans-serif;
font-size: 95%;
color: #aaa;
}
#dsq-popup-profile ul#dsq-profile-commentlist {
margin-top: 10px;
}
#dsq-popup-profile #dsq-profile-commentlist li{
padding: 5px 0;
border-bottom: 2px solid #e9ebed;
}
#dsq-popup-profile #dsq-profile-commentlist li img.avatar-small {
width: 24px;
height: 24px;
border: 1px solid #DDD;
float: left;
}
#dsq-popup-profile #dsq-profile-commentlist li .comment-message {
margin-left: 30px;
*float: left;
*margin-left: 5px;
}
#dsq-popup-profile #dsq-profile-commentlist li span.comment-meta {
clear: both;
margin-left: 30px;
display: block;
font-size: 90%;
}
#dsq-popup-profile #dsq-profile-commentlist span{
color: #666;
font-size: 95%;
}
/* Reblog */
.dsq-reblogdiv #dsq-popup-profile cite {
font-size:115%;
font-weight: bold;
color: #333;
}
.dsq-reblogdiv #dsq-popup-profile #dsq-reblog-form {
padding: 10px;
}
.dsq-reblogdiv #dsq-popup-profile #dsq-blogauth-form {
margin: 10px 0;
}
.dsq-reblogdiv #dsq-popup-profile #dsq-blogauth-form li {
margin-bottom: 5px;
}
.dsq-reblogdiv #dsq-popup-profile #dsq-blogauth-form li input {
width: 250px;
}
.dsq-reblogdiv #dsq-popup-profile #dsq-blogauth-form li label {
width: 100px;
display: block;
float: left;
}
.dsq-reblogdiv #dsq-popup-profile ul.dsq-reblog-input {
margin: 10px 0;
}
.dsq-reblogdiv #dsq-popup-profile ul.dsq-reblog-input li {
margin-bottom: 10px;
}
.dsq-reblogdiv #dsq-popup-profile ul.dsq-reblog-input li input {
width: 450px;
}
.dsq-reblogdiv #dsq-popup-profile ul.dsq-reblog-input li textarea {
width: 450px;
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
height: 175px;
}
.dsq-reblogdiv #dsq-popup-profile ul.dsq-reblog-input li label {
float: none;
display: block;
font-weight: bold;
}
.dsq-reblogdiv #dsq-popup-profile .dsq-blogauth-toggle {
font-weight: bold;
}
p.dsq-reblog-supported {
font-size: 90%;
color: #555;
}
/* Trackbacks and Pingbacks */
#disqus_thread #dsq-content ul#dsq-references li {
margin-bottom: 20px;
display: list-item;
list-style: disc;
margin-left: 15px;
}
#disqus_thread #dsq-content ul#dsq-references cite {
margin-bottom: 0px;
padding-bottom: 0px;
font-weight: bold;
}
#disqus_thread #dsq-content ul#dsq-references p.dsq-meta {
margin-top: 0px;
padding-top: 0px;
font-size: 95%;
}
#disqus_thread #dsq-content .dsq-reactions li {
background: url("http://media.disqus.com/images/reactions/closed.gif") no-repeat left 2px;
padding-left: 15px;
margin-bottom: 10px;
}
#disqus_thread #dsq-content .dsq-reactions li.dsq-opened {
background-image: url("http://media.disqus.com/images/reactions/opened.gif");
}
#disqus_thread #dsq-content .dsq-reactions li a.dsq-twittername {
font-weight: bold;
}
#disqus_thread #dsq-content .dsq-reactions p.dsq-meta {
font-style: italic;
}
#disqus_thread #dsq-content .dsq-reactions #dsq-showallreactions {
background: none;
}

179
web_service/disqus.js Normal file
Просмотреть файл

@ -0,0 +1,179 @@
Type.registerNamespace('MoMATool');
var disqus_developer = 0;
var disqus_url = '';
var disqus_title = '';
var disqus_message = '';
var disqus_container_id = "disqus_thread";
var disqus_identifier = '';
MoMATool.DisqusControl = function(element) {
MoMATool.DisqusControl.initializeBase(this, [element]);
this._disqusForum = null;
}
MoMATool.DisqusControl.prototype = {
initialize: function() {
MoMATool.DisqusControl.callBaseMethod(this, 'initialize');
$addHandlers(this.get_element(),
{},
this);
},
dispose: function() {
$clearHandlers(this.get_element());
MoMATool.DisqusControl.callBaseMethod(this, 'dispose');
},
get_disqusForum: function() {
return this._disqusForum;
},
set_disqusForum: function(value) {
if (this._disqusForum !== value) {
this._disqusForum = value;
this.raisePropertyChanged('disqusForum');
}
},
get_disqusDeveloper: function() {
return disqus_developer;
},
set_disqusDeveloper: function(value) {
if (disqus_developer !== value) {
disqus_developer = value;
this.raisePropertyChanged('disqusDeveloper');
}
},
get_disqusContainerId: function() {
return disqus_container_id;
},
set_disqusContainerId: function(value) {
if (value != null && disqus_container_id !== value) {
disqus_container_id = value;
this.raisePropertyChanged('disqusContainerId');
}
},
get_disqusURL: function() {
return disqus_url;
},
set_disqusURL: function(value) {
if (disqus_url !== value) {
disqus_url = value;
this.raisePropertyChanged('disqusURL');
}
},
get_disqusTitle: function() {
return disqus_title;
},
set_disqusTitle: function(value) {
if (disqus_title !== value) {
disqus_title = value;
this.raisePropertyChanged('disqusTitle');
}
},
get_disqusMessage: function() {
return disqus_message;
},
set_disqusMessage: function(value) {
if (disqus_message !== value) {
disqus_message = value;
this.raisePropertyChanged('disqusMessage');
}
},
get_disqusIdentifier: function() {
return disqus_identifier;
},
set_disqusIdentifier: function(value) {
if (disqus_identifier !== value) {
disqus_identifier = value;
this.raisePropertyChanged('disqusIdentifier');
}
},
get_update: function() {},
set_update: function(value) {
if (disqus_identifier !== null && disqus_message != null && disqus_title != null) {
// call the thread creation proxy service to make sure the correct disqus thread gets
// created on demand, and load the iframe when the proxy returns
DisqusProxy.EnsureThreadCreated(disqus_title, disqus_message, disqus_identifier, function(success) {
var disqus_control_iframe = document.getElementById(value);
var doc = disqus_control_iframe.contentDocument;
if (doc == undefined || doc == null) {
doc = disqus_control_iframe.contentWindow.document;
}
doc.open();
// The doctype is needed for IE to load the stylesheet contained inside embed.js. Except something
// seems to have broken it again. &#@%ing IE. Workaround by ripping the CSS out of embed.js and
// referencing it directly.
doc.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' +
'<html xmlns="http://www.w3.org/1999/xhtml">\n' +
'<head>\n' +
'<title>Disqus Comments</title>\n' +
'<link href="disqus.css" type="text/css" rel="stylesheet" media="screen"></link>\n' +
'</head><body>\n' +
'<' + 'script charset="utf-8" type="text/javascript">\n' +
'<!--//--><![CDATA[//><!--\n' +
'var disqus_developer = 1;\n' +
'var disqus_identifier = "' + disqus_identifier + '";\n' +
'//--><!]]>\n' +
'<' + '/script>\n' +
'<div id="disqus_thread"></div>\n' +
'<' + 'script type="text/javascript" src="http://disqus.com/forums/mono-momastudio-issues/embed.js"><' + '/script>\n' +
'<a href="http://disqus.com" class="dsq-brlink">Comments powered by <span class="logo-disqus">Disqus</span></a>\n' +
'</body></html>');
doc.close();
// Resize the iframe whenever Disqus loads its content. The fudge factor is needed to ensure
// scrollbars don't appear when the 'Options' button is toggled.
//
// This doesn't work on IE (surprise!) so I just set the height to 2000px there
if (doc.addEventListener) {
doc.addEventListener("DOMNodeInserted", function() {
disqus_control_iframe.height = disqus_control_iframe.contentDocument.body.offsetHeight + 150;
}, false);
doc.addEventListener("DOMNodeRemoved", function() {
disqus_control_iframe.height = disqus_control_iframe.contentDocument.body.offsetHeight + 150;
}, false);
// This one keeps Google Chrome happier (otherwise it doesn't resize properly on first load)
doc.addEventListener("DOMSubtreeModified", function() {
disqus_control_iframe.height = disqus_control_iframe.contentDocument.body.offsetHeight + 150;
}, false);
} else {
disqus_control_iframe.height = '2000px';
}
// I want to set display=none/display=block to hide and show the comments, but it breaks
// in *%$&ing IE. So I have to fart around setting the height to 0px to hide it
//disqus_control_iframe.style.display = 'block';
}, function() {
//alert("DisqusProxy fail");
});
} else {
//alert("Not updating");
}
}
}
MoMATool.DisqusControl.registerClass('MoMATool.DisqusControl', Sys.UI.Control);
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();