Example #1
0
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            var config = new Dictionary <string, object>
            {
                { "layout", "{0}{1}{2}".FormatSelf(this.Layout(), this.Counter() ? string.Empty : "-nocount", this.Color().IsEmpty() ? string.Empty : "-" + this.Color()) }
            };

            if (!this.Url().IsEmpty())
            {
                config["url"] = this.Url();
            }
            if (!this.Width().IsEmpty())
            {
                config["width"] = this.Width();
            }
            if (!this.Height().IsEmpty())
            {
                config["height"] = this.Height();
            }

            return(new TagBuilder("a")
                   .Attribute("target", "_blank")
                   .Attribute("href", "http://surfingbird.ru/share")
                   .Attribute("data-surf-config", config.Json())
                   .CssClass("surfinbird__like_button")
                   .InnerHtml(this.Label())
                   .ToString());
        }
Example #2
0
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            if (this.Domain().IsEmpty() || this.Width().IsEmpty() || this.Height().IsEmpty())
            {
                return(string.Empty);
            }

            var config = new Dictionary <string, object>
            {
                { "domain", this.Domain() },
                { "font", this.Font() },
                { "width", this.Width() },
                { "height", this.Height() }
            };

            if (!this.TitleText().IsEmpty())
            {
                config["title"] = this.TitleText();
            }
            if (!this.Title())
            {
                config["notitle"] = true;
            }
            if (!this.TitleColor().IsEmpty())
            {
                config["title-color"] = this.TitleColor();
            }
            if (!this.BackgroundColor().IsEmpty())
            {
                config["background"] = this.BackgroundColor();
            }
            if (!this.BorderColor().IsEmpty())
            {
                config["border"] = this.BorderColor();
            }
            if (!this.TextColor().IsEmpty())
            {
                config["color"] = this.TextColor();
            }
            if (!this.HyperlinkColor().IsEmpty())
            {
                config["link-color"] = this.HyperlinkColor();
            }

            return(new TagBuilder("a")
                   .Attribute("href", "http://connect.mail.ru/share_friends?{0}".FormatSelf(config.ToUrlQuery()))
                   .Attribute("rel", config.Json())
                   .CssClass("mrc__plugin_share_friends")
                   .InnerHtml("Друзья")
                   .ToString());
        }
Example #3
0
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            if (this.Account().IsEmpty() || this.Width().IsEmpty() || this.Height().IsEmpty())
            {
                return(string.Empty);
            }

            var config = new Dictionary <string, object>
            {
                { "group", this.Account() },
                { "max_sub", 50 },
                { "width", this.Width() },
                { "height", this.Height() }
            };

            if (this.Subscribers())
            {
                config["show_subscribers"] = true;
            }
            if (!this.BackgroundColor().IsEmpty())
            {
                config["background"] = this.BackgroundColor();
            }
            if (!this.TextColor().IsEmpty())
            {
                config["color"] = this.TextColor();
            }
            if (!this.ButtonColor().IsEmpty())
            {
                config["button_background"] = this.ButtonColor();
            }
            if (!this.Domain().IsEmpty())
            {
                config["domain"] = this.Domain();
            }

            return(new TagBuilder("a")
                   .Attribute("target", "_blank")
                   .Attribute("href", "http://connect.mail.ru/groups_widget?{0}".FormatSelf(config.ToUrlQuery()))
                   .Attribute("rel", config.Json())
                   .CssClass("mrc__plugin_groups_widget")
                   .InnerHtml("Группы")
                   .ToString());
        }
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            var config = new Dictionary <string, object>
            {
                { "sz", this.Size() },
                { "st", this.Layout() },
                { "tp", this.Type() }
            };

            if (!this.Counter())
            {
                config["nc"] = 1;
            }
            else if (this.CounterPosition() != null && string.Equals(this.CounterPosition(), MailRuLikeButtonCounterPosition.Upper.ToString(), StringComparison.InvariantCultureIgnoreCase))
            {
                config["vt"] = 1;
            }

            if (!this.Text())
            {
                config["nt"] = 1;
            }
            else
            {
                config["cm"] = this.TextType();
                config["ck"] = this.TextType();
            }

            return(new TagBuilder("a")
                   .Attribute("target", "_blank")
                   .Attribute("href", "http://connect.mail.ru/share")
                   .Attribute("data-mrc-config", config.Json())
                   .CssClass("mrc__plugin_uber_like_button")
                   .InnerHtml("Нравится")
                   .ToString());
        }
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            if (this.Account().IsEmpty())
            {
                return(string.Empty);
            }

            var config = new Dictionary <string, object>
            {
                { "mode", this.Layout() }
            };

            if (this.OnlyButton())
            {
                config["soft"] = 1;
            }

            var elementId = this.ElementId() ?? "vk_subscribe_{0}".FormatSelf(this.Account());

            return(new StringBuilder()
                   .Append(new TagBuilder("div").Attribute("id", elementId))
                   .Append(new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Subscribe(""{0}"", {1}, ""{2}"");".FormatSelf(elementId, config.Json(), this.Account())))
                   .ToString());
        }
Example #6
0
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            var config = new Dictionary <string, object>
            {
                { "limit", this.Limit() }
            };

            if (this.Attach().Any())
            {
                config["attach"] = this.Attach().Join(",");
            }
            else
            {
                config["attach"] = false;
            }
            if (!this.Width().IsEmpty())
            {
                config["width"] = this.Width();
            }
            if (this.AutoPublish() != null)
            {
                config["autoPublish"] = this.AutoPublish().Value ? 1 : 0;
            }
            if (this.AutoUpdate() != null)
            {
                config["norealtime"] = this.AutoUpdate().Value ? 0 : 1;
            }
            if (this.Mini() != null)
            {
                config["mini"] = this.Mini().Value ? 1 : 0;
            }

            var elementId = this.ElementId() ?? "vk_comments";

            return(new StringBuilder()
                   .Append(new TagBuilder("div").Attribute("id", elementId))
                   .Append(new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Comments(""{0}"", {1});".FormatSelf(elementId, config.Json())))
                   .ToString());
        }
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            if (this.Type() == VkontakteAuthButtonType.Dynamic && this.Callback().IsEmpty())
            {
                return(string.Empty);
            }

            if (this.Type() == VkontakteAuthButtonType.Standard && this.Url().IsEmpty())
            {
                return(string.Empty);
            }

            var elementId = this.ElementId() ?? "vk_auth";

            var config = new Dictionary <string, object>();

            if (!this.Callback().IsEmpty())
            {
                config["onAuth"] = this.Callback();
            }
            if (!this.Url().IsEmpty())
            {
                config["authUrl"] = this.Url();
            }
            if (!this.Width().IsEmpty())
            {
                config["width"] = this.Width();
            }

            return
                (new TagBuilder("div").Attribute("id", elementId).ToString() +
                 new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Auth(""{0}"", {1});".FormatSelf(elementId, config.Json())));
        }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Account().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>
      {
        { "mode", this.Layout() }
      };

      if (this.OnlyButton())
      {
        config["soft"] = 1;
      }

      var elementId = this.ElementId() ?? "vk_subscribe_{0}".FormatSelf(this.Account());

      return new StringBuilder()
        .Append(new TagBuilder("div").Attribute("id", elementId))
        .Append(new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Subscribe(""{0}"", {1}, ""{2}"");".FormatSelf(elementId, config.Json(), this.Account())))
        .ToString();
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      var config = new Dictionary<string, object>();
      
      if (!this.Layout().IsEmpty())
      {
        config["type"] = this.Layout();
      }
      if (!this.Width().IsEmpty())
      {
        config["width"] = this.Width();
      }
      if (!this.Title().IsEmpty())
      {
        config["pageTitle"] = this.Title();
      }
      if (!this.Description().IsEmpty())
      {
        config["pageDescription"] = this.Description();
      }
      if (!this.Url().IsEmpty())
      {
        config["pageUrl"] = this.Url();
      }
      if (!this.Image().IsEmpty())
      {
        config["pageImage"] = this.Image();
      }
      if (!this.Text().IsEmpty())
      {
        config["text"] = this.Text();
      }
      if (!this.Height().IsEmpty())
      {
        config["height"] = this.Height();
      }
      if (this.Verb() != null)
      {
        config["verb"] = this.Verb();
      }

      var elementId = this.ElementId() ?? "vk_like";

      return new StringBuilder()
        .Append(new TagBuilder("div").Attribute("id", elementId))
        .Append(new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Like(""{0}"", {1});".FormatSelf(elementId, config.Json())))
        .ToString();
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Domain().IsEmpty() || this.Width().IsEmpty() || this.Height().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>
      {
        { "domain", this.Domain() },
        { "font", this.Font() },
        { "width", this.Width() },
        { "height", this.Height() }
      };
      
      if (!this.TitleText().IsEmpty())
      {
        config["title"] = this.TitleText();
      }
      if (!this.Title())
      {
        config["notitle"] = true;
      }
      if (!this.TitleColor().IsEmpty())
      {
        config["title-color"] = this.TitleColor();
      }
      if (!this.BackgroundColor().IsEmpty())
      {
        config["background"] = this.BackgroundColor();
      }
      if (!this.BorderColor().IsEmpty())
      {
        config["border"] = this.BorderColor();
      }
      if (!this.TextColor().IsEmpty())
      {
        config["color"] = this.TextColor();
      }
      if (!this.HyperlinkColor().IsEmpty())
      {
        config["link-color"] = this.HyperlinkColor();
      }

      return new TagBuilder("a")
        .Attribute("href", "http://connect.mail.ru/share_friends?{0}".FormatSelf(config.ToUrlQuery()))
        .Attribute("rel", config.Json())
        .CssClass("mrc__plugin_share_friends")
        .InnerHtml("Друзья")
        .ToString();
    }
Example #11
0
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            if (this.Account().IsEmpty())
            {
                return(string.Empty);
            }

            var config = new Dictionary <string, object>
            {
                { "mode", this.Mode() }
            };

            if (this.Mode() == (byte)VkontakteCommunityMode.News)
            {
                config["wide"] = 1;
            }
            if (!this.Width().IsEmpty())
            {
                config["width"] = this.Width();
            }
            if (!this.Height().IsEmpty())
            {
                config["height"] = this.Height();
            }
            if (!this.BackgroundColor().IsEmpty())
            {
                config["color1"] = this.BackgroundColor();
            }
            if (!this.TextColor().IsEmpty())
            {
                config["color2"] = this.TextColor();
            }
            if (!this.ButtonColor().IsEmpty())
            {
                config["color3"] = this.ButtonColor();
            }

            var elementId = this.ElementId() ?? "vk_groups_{0}".FormatSelf(this.Account());

            return(new StringBuilder()
                   .Append(new TagBuilder("div").Attribute("id", elementId))
                   .Append(new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Group(""{0}"", {1}, ""{2}"");".FormatSelf(elementId, config.Json(), this.Account())))
                   .ToString());
        }
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            var config = new Dictionary <string, object>();

            if (!this.Layout().IsEmpty())
            {
                config["type"] = this.Layout();
            }
            if (!this.Width().IsEmpty())
            {
                config["width"] = this.Width();
            }
            if (!this.Title().IsEmpty())
            {
                config["pageTitle"] = this.Title();
            }
            if (!this.Description().IsEmpty())
            {
                config["pageDescription"] = this.Description();
            }
            if (!this.Url().IsEmpty())
            {
                config["pageUrl"] = this.Url();
            }
            if (!this.Image().IsEmpty())
            {
                config["pageImage"] = this.Image();
            }
            if (!this.Text().IsEmpty())
            {
                config["text"] = this.Text();
            }
            if (!this.Height().IsEmpty())
            {
                config["height"] = this.Height();
            }
            if (this.Verb() != null)
            {
                config["verb"] = this.Verb();
            }

            var elementId = this.ElementId() ?? "vk_like";

            return(new StringBuilder()
                   .Append(new TagBuilder("div").Attribute("id", elementId))
                   .Append(new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Like(""{0}"", {1});".FormatSelf(elementId, config.Json())))
                   .ToString());
        }
Example #13
0
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            var config = new Dictionary <string, object>();

            if (this.Limit() != null)
            {
                config["limit"] = this.Limit().Value;
            }
            if (this.Max() != null)
            {
                config["max"] = this.Max().Value;
            }
            if (this.Period() != null)
            {
                config["period"] = this.Period().Value.ToString().ToLowerInvariant();
            }
            if (this.Verb() != null)
            {
                config["verb"] = (byte)this.Verb().Value;
            }
            if (this.Sorting() != null)
            {
                switch (this.Sorting().Value)
                {
                case VkontakteRecommendationsSorting.FriendLikes:
                    config["sort"] = "friend_likes";
                    break;

                case VkontakteRecommendationsSorting.Likes:
                    config["sort"] = "likes";
                    break;
                }
            }
            if (this.Target() != null)
            {
                config["target"] = this.Target();
            }

            var elementId = this.ElementId() ?? "vk_recommendations";

            return
                (new TagBuilder("div").Attribute("id", elementId).ToString() +
                 new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Recommended(""{0}"", {1});".FormatSelf(elementId, config.Json())));
        }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Id().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>();
      if (!this.Url().IsEmpty())
      {
        config["pageUrl"] = this.Url();
      }
      if (!this.Width().IsEmpty())
      {
        config["width"] = this.Width();
      }

      var elementId = this.ElementId() ?? "vk_poll_{0}".FormatSelf(this.Id());
      
      return new TagBuilder("div").Attribute("id", elementId).ToString() + new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Poll(""{0}"", {1}, ""{2}"");".FormatSelf(elementId, config.Json(), this.Id()));
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Account().IsEmpty() || this.Width().IsEmpty() || this.Height().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>
      {
        { "group", this.Account() },
        { "max_sub", 50 },
        { "width", this.Width() },
        { "height", this.Height() }
      };

      if (this.Subscribers())
      {
        config["show_subscribers"] = true;
      }
      if (!this.BackgroundColor().IsEmpty())
      {
        config["background"] = this.BackgroundColor();
      }
      if (!this.TextColor().IsEmpty())
      {
        config["color"] = this.TextColor();
      }
      if (!this.ButtonColor().IsEmpty())
      {
        config["button_background"] = this.ButtonColor();
      }
      if (!this.Domain().IsEmpty())
      {
        config["domain"] = this.Domain();
      }

      return new TagBuilder("a")
        .Attribute("target", "_blank")
        .Attribute("href", "http://connect.mail.ru/groups_widget?{0}".FormatSelf(config.ToUrlQuery()))
        .Attribute("rel", config.Json())
        .CssClass("mrc__plugin_groups_widget")
        .InnerHtml("Группы")
        .ToString();
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      var config = new Dictionary<string, object>
      {
        { "layout", "{0}{1}{2}".FormatSelf(this.Layout(), this.Counter() ? string.Empty : "-nocount", this.Color().IsEmpty() ? string.Empty : "-" + this.Color()) }
      };

      if (!this.Url().IsEmpty())
      {
        config["url"] = this.Url();
      }
      if (!this.Width().IsEmpty())
      {
        config["width"] = this.Width();
      }
      if (!this.Height().IsEmpty())
      {
        config["height"] = this.Height();
      }

      return new TagBuilder("a")
        .Attribute("target", "_blank")
        .Attribute("href", "http://surfingbird.ru/share")
        .Attribute("data-surf-config", config.Json())
        .CssClass("surfinbird__like_button")
        .InnerHtml(this.Label())
        .ToString();
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Type() == VkontakteAuthButtonType.Dynamic && this.Callback().IsEmpty())
      {
        return string.Empty;
      }

      if (this.Type() == VkontakteAuthButtonType.Standard && this.Url().IsEmpty())
      {
        return string.Empty;
      }

      var elementId = this.ElementId() ?? "vk_auth";

      var config = new Dictionary<string, object>();
      if (!this.Callback().IsEmpty())
      {
        config["onAuth"] = this.Callback();
      }
      if (!this.Url().IsEmpty())
      {
        config["authUrl"] = this.Url();
      }
      if (!this.Width().IsEmpty())
      {
        config["width"] = this.Width();
      }

      return
        new TagBuilder("div").Attribute("id", elementId).ToString() +
        new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Auth(""{0}"", {1});".FormatSelf(elementId, config.Json()));
    }
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            if (this.Id().IsEmpty() || this.Owner().IsEmpty() || this.Hash().IsEmpty())
            {
                return(string.Empty);
            }

            var config = new Dictionary <string, object>();

            if (!this.Width().IsEmpty())
            {
                config["width"] = this.Width();
            }

            var elementId = this.ElementId() ?? "vk_post_{0}_{1}".FormatSelf(this.Owner(), this.Id());

            return
                (new TagBuilder("div").Attribute("id", elementId).ToString() +
                 new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"(function() {{ window.VK && VK.Widgets && VK.Widgets.Post && VK.Widgets.Post(""{0}"", {1}, {2}, ""{3}"", {4}) || setTimeout(arguments.callee, 50); }}());".FormatSelf(elementId, this.Owner(), this.Id(), this.Hash(), config.Json())));
        }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Id().IsEmpty() || this.Owner().IsEmpty() || this.Hash().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>();
      if (!this.Width().IsEmpty())
      {
        config["width"] = this.Width();
      }

      var elementId = this.ElementId() ?? "vk_post_{0}_{1}".FormatSelf(this.Owner(), this.Id());

      return
        new TagBuilder("div").Attribute("id", elementId).ToString() +
        new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"(function() {{ window.VK && VK.Widgets && VK.Widgets.Post && VK.Widgets.Post(""{0}"", {1}, {2}, ""{3}"", {4}) || setTimeout(arguments.callee, 50); }}());".FormatSelf(elementId, this.Owner(), this.Id(), this.Hash(), config.Json()));
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Account().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>
      {
        { "mode", this.Mode() }
      };
      
      if (this.Mode() == (byte)VkontakteCommunityMode.News)
      {
        config["wide"] = 1;
      }
      if (!this.Width().IsEmpty())
      {
        config["width"] = this.Width();
      }
      if (!this.Height().IsEmpty())
      {
        config["height"] = this.Height();
      }
      if (!this.BackgroundColor().IsEmpty())
      {
        config["color1"] = this.BackgroundColor();
      }
      if (!this.TextColor().IsEmpty())
      {
        config["color2"] = this.TextColor();
      }
      if (!this.ButtonColor().IsEmpty())
      {
        config["color3"] = this.ButtonColor();
      }

      var elementId = this.ElementId() ?? "vk_groups_{0}".FormatSelf(this.Account());

      return new StringBuilder()
        .Append(new TagBuilder("div").Attribute("id", elementId))
        .Append(new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Group(""{0}"", {1}, ""{2}"");".FormatSelf(elementId, config.Json(), this.Account())))
        .ToString();
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      var config = new Dictionary<string, object>
      {
        { "sz", this.Size() },
        { "st", this.Layout() },
        { "tp", this.Type() }
      };

      if (!this.Counter())
      {
        config["nc"] = 1;
      }
      else if (this.CounterPosition() != null && string.Equals(this.CounterPosition(), MailRuLikeButtonCounterPosition.Upper.ToString(), StringComparison.InvariantCultureIgnoreCase))
      {
        config["vt"] = 1;
      }

      if (!this.Text())
      {
        config["nt"] = 1;
      }
      else
      {
        config["cm"] = this.TextType();
        config["ck"] = this.TextType();
      }

      return new TagBuilder("a")
        .Attribute("target", "_blank")
        .Attribute("href", "http://connect.mail.ru/share")
        .Attribute("data-mrc-config", config.Json())
        .CssClass("mrc__plugin_uber_like_button")
        .InnerHtml("Нравится")
        .ToString();
    }
Example #22
0
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            if (this.Id().IsEmpty())
            {
                return(string.Empty);
            }

            var config = new Dictionary <string, object>();

            if (!this.Url().IsEmpty())
            {
                config["pageUrl"] = this.Url();
            }
            if (!this.Width().IsEmpty())
            {
                config["width"] = this.Width();
            }

            var elementId = this.ElementId() ?? "vk_poll_{0}".FormatSelf(this.Id());

            return(new TagBuilder("div").Attribute("id", elementId).ToString() + new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Poll(""{0}"", {1}, ""{2}"");".FormatSelf(elementId, config.Json(), this.Id())));
        }
        /// <summary>
        ///   <para>Returns HTML markup text of widget.</para>
        /// </summary>
        /// <returns>Widget's HTML markup.</returns>
        public override string ToHtmlString()
        {
            if (this.Account().IsEmpty())
            {
                return(string.Empty);
            }

            var config = new Dictionary <string, object>
            {
                { "id", this.Account() },
                { "webvisor", this.WebVisor() },
                { "clickmap", this.ClickMap() },
                { "trackLinks", this.TrackLinks() },
                { "accurateTrackBounce", this.Accurate() },
                { "trackHash", this.TrackHash() }
            };

            if (this.NoIndex())
            {
                config["ut"] = "noindex";
            }

            return(resources.yandex_analytics.FormatSelf(this.Account(), this.Language() ?? (HttpContext.Current != null ? HttpContext.Current.Request.Language() : Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName), config.Json()));
        }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Account().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>
      {
        { "id", this.Account() },
        { "webvisor", this.WebVisor() },
        { "clickmap", this.ClickMap() },
        { "trackLinks", this.TrackLinks() },
        { "accurateTrackBounce", this.Accurate() },
        { "trackHash", this.TrackHash() }
      };
      if (this.NoIndex())
      {
        config["ut"] = "noindex";
      }

      return resources.yandex_analytics.FormatSelf(this.Account(), this.Language() ?? (HttpContext.Current != null ? HttpContext.Current.Request.Language() : Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName), config.Json());
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      var config = new Dictionary<string, object>();
      if (this.Limit() != null)
      {
        config["limit"] = this.Limit().Value;
      }
      if (this.Max() != null)
      {
        config["max"] = this.Max().Value;
      }
      if (this.Period() != null)
      {
        config["period"] = this.Period().Value.ToString().ToLowerInvariant();
      }
      if (this.Verb() != null)
      {
        config["verb"] = (byte) this.Verb().Value;
      }
      if (this.Sorting() != null)
      {
        switch (this.Sorting().Value)
        {
          case VkontakteRecommendationsSorting.FriendLikes :
            config["sort"] = "friend_likes";
          break;

          case VkontakteRecommendationsSorting.Likes :
            config["sort"] = "likes";
          break;
        }
      }
      if (this.Target() != null)
      {
        config["target"] = this.Target();
      }

      var elementId = this.ElementId() ?? "vk_recommendations";

      return
        new TagBuilder("div").Attribute("id", elementId).ToString() +
        new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Recommended(""{0}"", {1});".FormatSelf(elementId, config.Json()));
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      var config = new Dictionary<string, object>
      {
        { "limit", this.Limit() }
      };
      
      if (this.Attach().Any())
      {
        config["attach"] = this.Attach().Join(",");
      }
      else
      {
        config["attach"] = false;
      }
      if (!this.Width().IsEmpty())
      {
        config["width"] = this.Width();
      }
      if (this.AutoPublish() != null)
      {
        config["autoPublish"] = this.AutoPublish().Value ? 1 : 0;
      }
      if (this.AutoUpdate() != null)
      {
        config["norealtime"] = this.AutoUpdate().Value ? 0 : 1;
      }
      if (this.Mini() != null)
      {
        config["mini"] = this.Mini().Value ? 1 : 0;
      }

      var elementId = this.ElementId() ?? "vk_comments";

      return new StringBuilder()
        .Append(new TagBuilder("div").Attribute("id", elementId))
        .Append(new TagBuilder("script").Attribute("type", "text/javascript").InnerHtml(@"VK.Widgets.Comments(""{0}"", {1});".FormatSelf(elementId, config.Json())))
        .ToString();
    }