コード例 #1
0
		protected AspNetFacesContext (FacesContext wrappedFacesContex, ExternalContext externalContext, HttpContext httpContext, FacesContext oldFacesContex) {
			_facesContex = wrappedFacesContex;
			_httpContext = httpContext;
			_oldFacesContex = oldFacesContex;
			_externalContext = externalContext;
			setCurrentInstance (this);
		}
コード例 #2
0
 protected AspNetFacesContext(FacesContext wrappedFacesContex, ExternalContext externalContext, HttpContext httpContext, FacesContext oldFacesContex)
 {
     _facesContex     = wrappedFacesContex;
     _httpContext     = httpContext;
     _oldFacesContex  = oldFacesContex;
     _externalContext = externalContext;
     setCurrentInstance(this);
 }
コード例 #3
0
 public SickRageSync(ISettingsService <SickRageSettings> s, ISickRageApi api, ILogger <SickRageSync> l, ExternalContext ctx)
 {
     _settings = s;
     _api      = api;
     _log      = l;
     _ctx      = ctx;
     _settings.ClearCache();
 }
コード例 #4
0
 public RadarrSync(ISettingsService <RadarrSettings> radarr, IRadarrApi radarrApi, ILogger <RadarrSync> log, ExternalContext ctx)
 {
     RadarrSettings = radarr;
     RadarrApi      = radarrApi;
     Logger         = log;
     _ctx           = ctx;
     RadarrSettings.ClearCache();
 }
コード例 #5
0
 public LidarrAlbumSync(ISettingsService <LidarrSettings> lidarr, ILidarrApi lidarrApi, ILogger <LidarrAlbumSync> log, ExternalContext ctx,
                        ILidarrAvailabilityChecker availability)
 {
     _lidarrSettings = lidarr;
     _lidarrApi      = lidarrApi;
     _logger         = log;
     _ctx            = ctx;
     _availability   = availability;
 }
コード例 #6
0
 public LidarrAlbumSync(ISettingsService <LidarrSettings> lidarr, ILidarrApi lidarrApi, ILogger <LidarrAlbumSync> log, ExternalContext ctx,
                        IHubContext <NotificationHub> notification)
 {
     _lidarrSettings = lidarr;
     _lidarrApi      = lidarrApi;
     _logger         = log;
     _ctx            = ctx;
     _notification   = notification;
 }
コード例 #7
0
ファイル: CouchPotatoSync.cs プロジェクト: xCeeTee/Ombi
 public CouchPotatoSync(ISettingsService <CouchPotatoSettings> cpSettings,
                        ICouchPotatoApi api, ILogger <CouchPotatoSync> log, ExternalContext ctx)
 {
     _settings = cpSettings;
     _api      = api;
     _log      = log;
     _ctx      = ctx;
     _settings.ClearCache();
 }
コード例 #8
0
 public LidarrArtistSync(ISettingsService <LidarrSettings> lidarr, ILidarrApi lidarrApi, ILogger <LidarrArtistSync> log, ExternalContext ctx,
                         ILidarrAlbumSync album)
 {
     _lidarrSettings = lidarr;
     _lidarrApi      = lidarrApi;
     _logger         = log;
     _ctx            = ctx;
     _albumSync      = album;
 }
コード例 #9
0
 public CouchPotatoSync(ISettingsService <CouchPotatoSettings> cpSettings,
                        ICouchPotatoApi api, ILogger <CouchPotatoSync> log, ExternalContext ctx, IHubContext <NotificationHub> hub)
 {
     _settings     = cpSettings;
     _api          = api;
     _log          = log;
     _ctx          = ctx;
     _notification = hub;
     _settings.ClearCache();
 }
コード例 #10
0
ファイル: SonarrSync.cs プロジェクト: anojht/Ombi
 public SonarrSync(ISettingsService <SonarrSettings> s, ISonarrApi api, ILogger <SonarrSync> l, ExternalContext ctx,
                   IMovieDbApi movieDbApi)
 {
     _settings   = s;
     _api        = api;
     _log        = l;
     _ctx        = ctx;
     _movieDbApi = movieDbApi;
     _settings.ClearCache();
 }
コード例 #11
0
        public static IStateMonad GetStateMonad(
            ITestLoggerFactory testLoggerFactory,
            IExternalProcessRunner externalProcessRunner,
            IConsole console)
        {
            var sclSettings = SettingsHelpers.CreateSCLSettings(
                new NuixSettings(
                    Constants.NuixConsoleExe,
                    new Version(8, 0),
                    true,
                    Constants.AllNuixFeatures
                    )
                );

            var sfs = StepFactoryStore.Create(
                sclSettings,
                Assembly.GetAssembly(typeof(IRubyScriptStep)) !
                );

            var fileSystem = new MockFileSystem(
                new Dictionary <string, MockFileData>()
            {
                { NuixConnectionHelper.NuixGeneralScriptName, "Ultimate Nuix Script" }
            },
                AppContext.BaseDirectory
                );

            var monad = new StateMonad(
                testLoggerFactory.CreateLogger("Test"),
                sclSettings,
                sfs,
                new ExternalContext(
                    externalProcessRunner,
                    console,
                    (ConnectorInjection.FileSystemKey, fileSystem)
                    ),
                new Dictionary <string, object>()
                );

            return(monad);
        }
コード例 #12
0
 public RadarrSync(ISettingsService <RadarrSettings> radarr, ISettingsService <Radarr4KSettings> radarr4k, IRadarrV3Api radarrApi, ILogger <RadarrSync> log, ExternalContext ctx,
                   IExternalRepository <RadarrCache> radarrRepo)
 {
     _radarrSettings   = radarr;
     _radarr4kSettings = radarr4k;
     _api        = radarrApi;
     _logger     = log;
     _ctx        = ctx;
     _radarrRepo = radarrRepo;
     _radarrSettings.ClearCache();
     _radarr4kSettings.ClearCache();
 }
コード例 #13
0
            public GearsContext(ExternalContext Context)
            {
                this.Context = Context;

                this.GoogleGears_Factory_getPermission =
                    Context.ToExternalConverter <string, string, string, string, bool>(
                        "_siteName", "_imageUrl", "extraMessage", "_i",
                        "return window[_i].getPermission(_siteName, _imageUrl, extraMessage);"
                        );


                this.GoogleGears_Factory_getBuildInfo =
                    Context.ToExternalConverter <string, string>("_i", "return window[_i].getBuildInfo();");

                this.GoogleGears_Factory_create =
                    Context.ToExternal <string, string, string, string>("_id", "_version", "_i", "_v", "window[_v] = window[_i].create(_id, _version);");



                this.GoogleGears_Database_execute =
                    Context.ToExternal <string, object[], string, string>("_cmd", "_args", "_i", "_v",
                                                                          "window[_v] = window[_i].execute(_cmd, _args);"
                                                                          );

                this.GoogleGears_ResultSet_isValidRow =
                    Context.ToExternalConverter <string, bool>("_i", "return window[_i].isValidRow();");



                this.GoogleGears_ResultSet_close =
                    Context.ToExternal <string>("_i", "window[_i].close(); delete window[_i];");

                this.GoogleGears_ResultSet_fieldCount =
                    Context.ToExternalConverter <string, int>("_i", "return window[_i].fieldCount();");

                this.GoogleGears_ResultSet_field =
                    Context.ToExternal <int, string, string>("_index", "_i", "_v",
                                                             "window[_v] = window[_i].field(_index);"
                                                             );

                this.GoogleGears_GetToken =
                    Context.ToExternalConverter <string, object>("_i",
                                                                 "return window[_i];"
                                                                 );
            }
コード例 #14
0
        public static void Factory(ExternalContext Context, Action <GearsFactory> Handler)
        {
            var f = new GearsFactory
            {
                Context = new GearsContext(Context)
            };

            Context.ToPlugin("GearsFactory", "Gears.Factory", "application/x-googlegears",
                             GoogleGears_Factory =>
            {
                if (GoogleGears_Factory == null)
                {
                    Handler(null);
                    return;
                }

                f.GetBuildInfo =
                    () => f.Context.GoogleGears_Factory_getBuildInfo(GoogleGears_Factory);

                f.GetPermission =
                    (siteName, imageUrl, extraMessage) =>
                    f.Context.GoogleGears_Factory_getPermission(siteName, imageUrl, extraMessage, GoogleGears_Factory);

                f.Create =
                    (id, version) =>
                {
                    // database will be saved here
                    var GoogleGears_Database = Context.CreateToken();

                    f.Context.GoogleGears_Factory_create(id, version, GoogleGears_Factory, GoogleGears_Database);

                    return(GoogleGears_Database);
                };

                Handler(f);
            }
                             );
        }
コード例 #15
0
ファイル: ExternalRepository.cs プロジェクト: xCeeTee/Ombi
 public ExternalRepository(ExternalContext ctx) : base(ctx)
 {
 }
コード例 #16
0
        /// <summary>
        /// This is to remove the Settings from the Ombi.db to the "new"
        /// OmbiSettings.db
        ///
        /// Ombi is hitting a limitation with SQLite where there is a lot of database activity
        /// and SQLite does not handle concurrency at all, causing db locks.
        ///
        /// Splitting it all out into it's own DB helps with this.
        /// </summary>
        private static void CheckAndMigrate()
        {
            var doneGlobal = false;
            var doneConfig = false;
            var ombi       = new OmbiContext();
            var settings   = new SettingsContext();

            try
            {
                if (ombi.Settings.Any() && !settings.Settings.Any())
                {
                    // OK migrate it!
                    var allSettings = ombi.Settings.ToList();
                    settings.Settings.AddRange(allSettings);
                    doneGlobal = true;
                }

                // Check for any application settings

                if (ombi.ApplicationConfigurations.Any() && !settings.ApplicationConfigurations.Any())
                {
                    // OK migrate it!
                    var allSettings = ombi.ApplicationConfigurations.ToList();
                    settings.ApplicationConfigurations.AddRange(allSettings);
                    doneConfig = true;
                }

                settings.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            // Now delete the old stuff
            if (doneGlobal)
            {
                ombi.Database.ExecuteSqlCommand("DELETE FROM GlobalSettings");
            }
            if (doneConfig)
            {
                ombi.Database.ExecuteSqlCommand("DELETE FROM ApplicationConfiguration");
            }

            // Now migrate all the external stuff
            var external = new ExternalContext();

            try
            {
                if (ombi.PlexEpisode.Any())
                {
                    external.PlexEpisode.AddRange(ombi.PlexEpisode.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM PlexEpisode");
                }

                if (ombi.PlexSeasonsContent.Any())
                {
                    external.PlexSeasonsContent.AddRange(ombi.PlexSeasonsContent.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM PlexSeasonsContent");
                }
                if (ombi.PlexServerContent.Any())
                {
                    external.PlexServerContent.AddRange(ombi.PlexServerContent.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM PlexServerContent");
                }
                if (ombi.EmbyEpisode.Any())
                {
                    external.EmbyEpisode.AddRange(ombi.EmbyEpisode.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM EmbyEpisode");
                }

                if (ombi.EmbyContent.Any())
                {
                    external.EmbyContent.AddRange(ombi.EmbyContent.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM EmbyContent");
                }
                if (ombi.RadarrCache.Any())
                {
                    external.RadarrCache.AddRange(ombi.RadarrCache.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM RadarrCache");
                }
                if (ombi.SonarrCache.Any())
                {
                    external.SonarrCache.AddRange(ombi.SonarrCache.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM SonarrCache");
                }
                if (ombi.LidarrAlbumCache.Any())
                {
                    external.LidarrAlbumCache.AddRange(ombi.LidarrAlbumCache.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM LidarrAlbumCache");
                }
                if (ombi.LidarrArtistCache.Any())
                {
                    external.LidarrArtistCache.AddRange(ombi.LidarrArtistCache.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM LidarrArtistCache");
                }
                if (ombi.SickRageEpisodeCache.Any())
                {
                    external.SickRageEpisodeCache.AddRange(ombi.SickRageEpisodeCache.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM SickRageEpisodeCache");
                }
                if (ombi.SickRageCache.Any())
                {
                    external.SickRageCache.AddRange(ombi.SickRageCache.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM SickRageCache");
                }
                if (ombi.CouchPotatoCache.Any())
                {
                    external.CouchPotatoCache.AddRange(ombi.CouchPotatoCache.ToList());
                    ombi.Database.ExecuteSqlCommand("DELETE FROM CouchPotatoCache");
                }

                external.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #17
0
ファイル: PlexContentRepository.cs プロジェクト: anojht/Ombi
 public PlexServerContentRepository(ExternalContext db) : base(db)
 {
     Db = db;
 }
コード例 #18
0
ファイル: ServletFacesContext.cs プロジェクト: nlhepler/mono
		protected ServletFacesContext (FacesContext wrappedFacesContext, ExternalContext externalContext, HttpContext httpContext, FacesContext oldFacesContext)
			: base (wrappedFacesContext, externalContext, httpContext, oldFacesContext) {
		}
コード例 #19
0
 public CustomerTbsController(ExternalContext context)
 {
     _context = context;
 }
コード例 #20
0
ファイル: ServletFacesContext.cs プロジェクト: nlhepler/mono
			public ServletExternalContext (ExternalContext externalContext, HttpContext httpContext, string executionFilePath)
				: base (httpContext, executionFilePath) {
				_externalContext = externalContext;
			}
コード例 #21
0
 protected ServletFacesContext(FacesContext wrappedFacesContext, ExternalContext externalContext, HttpContext httpContext, FacesContext oldFacesContext)
     : base(wrappedFacesContext, externalContext, httpContext, oldFacesContext)
 {
 }
コード例 #22
0
 public static IHTMLDiv AttachAsDiv(this string e, ExternalContext c)
 {
     return(new IHTMLDiv {
         innerHTML = e
     }.AttachTo(c));
 }
コード例 #23
0
 public JellyfinContentRepository(ExternalContext db) : base(db)
 {
     Db = db;
 }
コード例 #24
0
ファイル: SonarrCacheRule.cs プロジェクト: xCeeTee/Ombi
 public SonarrCacheRule(ExternalContext ctx)
 {
     _ctx = ctx;
 }
コード例 #25
0
 public ProductTbsController(ExternalContext context)
 {
     _context = context;
 }
コード例 #26
0
        // change: C:\util\xampplite\apache\conf\httpd.conf

        // http://localhost/jsc/FlashBrowserDocument/FlashBrowserDocument.htm

        /*
         * Alias /jsc/FlashBrowserDocument "C:\work\jsc.svn\examples\actionscript\FlashBrowserDocument\FlashBrowserDocument\bin\Release\web"
         * <Directory "C:\work\jsc.svn\examples\actionscript\FlashBrowserDocument\FlashBrowserDocument\bin\Release\web">
         *     Options Indexes FollowSymLinks ExecCGI
         *     AllowOverride All
         *     Order allow,deny
         *     Allow from all
         * </Directory>
         */

        /// <summary>
        /// Default constructor
        /// </summary>
        public FlashBrowserDocument()
        {
            ConsoleFormPackageExperience.Initialize();

            Console.WriteLine("ConsoleFormPackageExperience");

            var t = new TextField
            {
                defaultTextFormat = new TextFormat {
                    font = "Courier"
                },
                backgroundColor = 0x303030,
                textColor       = 0xffff00,
                text            = "powered by jsc",
                background      = true,
                x = 0,
                y = 0,
                alwaysShowSelection = true,
                width  = DefaultWidth,
                height = DefaultHeight
            }.AttachTo(this);

            // you should be running within the browser
            //SecurityError: Error #2060: Security sandbox violation: ExternalInterface caller file:///C:/work/jsc.svn/examples/actionscript/FlashBrowserDocument/FlashBrowserDocument/bin/Release/web/FlashBrowserDocument.swf cannot access file:///C:/work/jsc.svn/examples/actionscript/FlashBrowserDocument/FlashBrowserDocument/bin/Release/web/FlashBrowserDocument.htm.
            //    at flash.external::ExternalInterface$/_initJS()
            //    at flash.external::ExternalInterface$/addCallback()
            //    at Extensions::ExternalExtensions$/External_100668292()
            //    at DOM::ExternalContext()
            //    at DOM::ExternalContext$/ExternalAuthentication_100663321()
            //    at FlashBrowserDocument.ActionScript::FlashBrowserDocument()

            t.text = "before ExternalAuthentication";
            try
            {
                Console.WriteLine("before ExternalAuthentication");
                ExternalContext.ExternalAuthentication(
                    context =>
                {
                    Console.WriteLine("at ExternalAuthentication");
                    t.text = "after ExternalAuthentication";

                    context.Document.body.style.backgroundColor = "#afafff";
                    context.Document.body.style.color           = "#000080";

                    t.appendText("\nflash element was found within html document");

                    context.Document.title = "hello world";

                    #region hide/show flash element
                    var HideFlashButtonCounter = 0;
                    var HideFlashButton        = new IHTMLButton {
                        innerHTML = "hide flash element"
                    };

                    HideFlashButton.AttachTo(context);
                    HideFlashButton.onclick +=
                        delegate
                    {
                        if (HideFlashButtonCounter % 2 == 0)
                        {
                            t.appendText("\nflash element hidden");
                            context.Element.width     = 0;
                            context.Element.height    = 0;
                            HideFlashButton.innerHTML = "show flash element";
                        }
                        else
                        {
                            t.appendText("\nflash element shown");
                            context.Element.width     = DefaultWidth;
                            context.Element.height    = DefaultHeight;
                            HideFlashButton.innerHTML = "hide flash element";
                        }

                        HideFlashButtonCounter++;
                    };
                    #endregion

                    var Content = @"
					<hr />
					<blockqoute>
						<h1>This application was written in c# and was compiled to actionscript with <a href='http://jsc.sf.net'>jsc compiler</a>.</h1>
						<h2>Currently supported browsers:</h2>
						<ul>
							<li><img src='http://www.w3schools.com/images/compatible_firefox.gif' />Firefox</li>
							<li><img src='http://www.w3schools.com/images/compatible_chrome.gif' />Google Chrome</li>
							<li><img src='http://www.w3schools.com/images/compatible_safari.gif' />Safari</li>
							<li><img src='http://www.w3schools.com/images/compatible_opera.gif' />Opera</li>
						</ul>
					</blockqoute>
					"                    .AttachAsDiv(context);

                    var DynamicChild = new IHTMLSpan {
                        innerHTML = "hello world"
                    }.AttachTo(Content);

                    DynamicChild.style.color = "red";
                    DynamicChild.innerHTML   = "click on the image to remove it!";

                    var DynamicChildImage = new IHTMLImage
                    {
                        title = "jsc diagram",
                        src   = "http://jsc.sourceforge.net/jsc.png"
                    }.AttachTo(DynamicChild);

                    DynamicChildImage.style.backgroundColor = "white";

                    DynamicChildImage.onclick +=
                        delegate
                    {
                        Console.WriteLine("at DynamicChildImage onclick");

                        DynamicChild.removeChild(DynamicChildImage);
                        DynamicChild.innerHTML = "you have removed that image!";

                        var Undo = new IHTMLButton {
                            innerHTML = "undo"
                        }.AttachTo(DynamicChild);

                        Undo.onclick +=
                            delegate
                        {
                            DynamicChildImage.AttachTo(DynamicChild);
                            DynamicChild.removeChild(Undo);
                        };
                    };

                    DynamicChild.onclick +=
                        delegate
                    {
                        Console.WriteLine("at DynamicChild onclick");
                    };
                }
                    );
            }
            catch (Exception ex)
            {
                t.text = "error " + new { ex };
            }
        }
コード例 #27
0
 public static IHTMLSpan AttachAsSpan(this string e, ExternalContext c)
 {
     return(new IHTMLSpan {
         innerHTML = e
     }.AttachTo(c));
 }
コード例 #28
0
        // // change: C:\util\xampplite\apache\conf\httpd.conf

        // http://localhost/jsc/MovieAgentGadget/MovieAgentGadget.htm

        //Alias /jsc/MovieAgentGadget "C:\work\code.google\zmovies\MovieAgent\MovieAgentGadget\bin\Release\web"
        //<Directory "C:\work\code.google\zmovies\MovieAgent\MovieAgentGadget\bin\Release\web">
        //       Options Indexes FollowSymLinks ExecCGI
        //       AllowOverride All
        //       Order allow,deny
        //       Allow from all
        //</Directory>

        // http://curtismorley.com/2008/11/01/actionscript-security-error-2060-security-sandbox-violation/
        // http://mihai.bazon.net/blog/flash-s-externalinterface-and-ie
        // http://bugs.adobe.com/jira/browse/FP-692
        // http://team.mixmedia.com/index.php?title=ie_flash9_0_16_0_externalinterface_unkno&more=1&c=1&tb=1&pb=1



        /// <summary>
        /// Default constructor
        /// </summary>
        public MovieAgentGadget()
        {
            Security.allowDomain("*");

            ExternalContext.ExternalAuthentication(Initialize);
        }
コード例 #29
0
 public ServletExternalContext(ExternalContext externalContext, HttpContext httpContext, string executionFilePath)
     : base(httpContext, executionFilePath)
 {
     _externalContext = externalContext;
 }
コード例 #30
0
 public EmbyContentRepository(ExternalContext db) : base(db)
 {
 }
コード例 #31
0
 public static T AttachTo <T>(this T e, ExternalContext c)
     where T : INode
 {
     return(e.AttachTo(c.Document.body));
 }
コード例 #32
0
 public OrderTbsController(ExternalContext context)
 {
     _context = context;
 }
コード例 #33
0
        public void Initialize(ExternalContext Context)
        {
            KnownMoviesFilter = e => true;

            //Context.Document.title = "2 token: " + Context.PrivateKey;

            // wtf? we cannot modify body without resetting our flash
            // http://dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/firefox-reloads-flash-when-portion-page-refreshed-using-a
            //Context.Document.body.style.overflow = "hidden";
            //Context.Document.body.style.backgroundColor = "black";
            //Context.Document.body.style.color = "white";

            #region ContainerForPosters
            var ContainerForPosters = new IHTMLDiv().AttachTo(Context);

            ContainerForPosters.style.position = "absolute";
            ContainerForPosters.style.width    = "100%";
            ContainerForPosters.style.height   = "100%";
            //ContainerForPosters.style.background = "black url('http://www.stripegenerator.com/generators/generate_stripes.php?fore=000000&h=30&w=6&p=7&back1=333333&back2=ff0000&gt=0&d=0&shadow=0&')";
            ContainerForPosters.style.backgroundColor = "black";
            ContainerForPosters.style.color           = "white";
            ContainerForPosters.style.textAlign       = "center";
            ContainerForPosters.style.overflow        = "auto";
            #endregion

            var PostersGroup = new IHTMLDiv().AttachTo(ContainerForPosters);
            var FooterGroup  = new IHTMLDiv().AttachTo(ContainerForPosters);

            var ButtonsOnRightEdge = new IHTMLSpan().AttachTo(Context);

            ButtonsOnRightEdge.style.Apply(
                s =>
            {
                s.position   = "absolute";
                s.marginLeft = "-8em";
                s.marginTop  = "-2em";
                s.top        = "100%";
                s.left       = "100%";
            }
                );

            ButtonsOnRightEdge.innerHTML =
                Info.GoogleGadget.AddImage.ToImageMiddle().ToLink(Info.GoogleGadget.AddToYourWebPageLink) + "&nbsp;" +
                Info.RSSImage.ToImageMiddle().ToLink(Info.BuzzBlogPost);

            var Toolbar = new IHTMLDiv
            {
                innerHTML = ""
            }.AttachTo(Context);


            Toolbar.style.Apply(
                s =>
            {
                s.position  = "absolute";
                s.marginTop = "-2em";
                s.top       = "100%";
                s.left      = "1em";
            }
                );

            #region ToggleScrollbar
            var ToggleScrollbar = new IHTMLSpan {
                innerHTML = "&raquo; toggle scrollbar"
            }.AttachTo(Toolbar);

            ToggleScrollbar.style.Apply(
                s =>
            {
                s.border          = "1px dotted white";
                s.cursor          = "pointer";
                s.backgroundColor = "black";
                s.color           = "white";
                s.marginLeft      = "1em";
            }
                );

            var ToggleScrollbarCounter = 0;
            ToggleScrollbar.onclick +=
                delegate
            {
                ToggleScrollbarCounter++;

                if (ToggleScrollbarCounter % 2 == 0)
                {
                    ContainerForPosters.style.overflow = "auto";
                }
                else
                {
                    ContainerForPosters.style.overflow = "hidden";
                }
            };
            #endregion



            #region Shadow
            var Shadow = new IHTMLDiv().AttachTo(Context);

            Shadow.style.position = "absolute";
            Shadow.style.left     = "0px";
            Shadow.style.top      = "0px";
            Shadow.style.width    = "100%";
            Shadow.style.height   = "100%";



            // http://www.stripegenerator.com/generators/generate_stripes.php?fore=000000&h=30&w=1&p=18&back1=171313&back2=ff0000&gt=0&d=0&shadow=5&


            Shadow.style.overflow = "hidden";
            // chrome does not support opacity?
            #endregion

            Func <string, int, double, IHTMLDiv> AddContainerShadow =
                (color, margin, opacity) =>
            {
                var ContainerShadow = new IHTMLDiv().AttachTo(Shadow);

                ContainerShadow.style.position        = "absolute";
                ContainerShadow.style.left            = "50%";
                ContainerShadow.style.top             = "50%";
                ContainerShadow.style.marginLeft      = (-400 - margin) + "px";
                ContainerShadow.style.marginTop       = (-300 - margin) + "px";
                ContainerShadow.style.backgroundColor = color;
                ContainerShadow.style.width           = (800 + margin * 2) + "px";
                ContainerShadow.style.height          = (600 + margin * 2) + "px";

                Action <double> ContainerShadow_set_opacity =
                    value =>
                {
                    ContainerShadow.style.opacity = "" + value;
                    ContainerShadow.style.filter  = "Alpha(Opacity=" + Convert.ToInt32(value * 100) + ")";
                };

                if (opacity < 1.0)
                {
                    ContainerShadow_set_opacity(opacity);
                }

                return(ContainerShadow);
            };

            AddContainerShadow("#000000", 800, 0.5);
            for (int i = 0; i < 8; i++)
            {
                AddContainerShadow("#000000", i * 4, 0.4);
            }

            var SuggestionDialog = InitializeSuggestMovie(Context, KnownMovies, Toolbar, Shadow);

            #region ContainerForVideoPlayer
            var ContainerForVideoPlayer = new IHTMLDiv().AttachTo(Context);

            ContainerForVideoPlayer.style.position        = "absolute";
            ContainerForVideoPlayer.style.left            = "50%";
            ContainerForVideoPlayer.style.top             = "50%";
            ContainerForVideoPlayer.style.marginLeft      = "-400px";
            ContainerForVideoPlayer.style.marginTop       = "-300px";
            ContainerForVideoPlayer.style.backgroundColor = "black";
            ContainerForVideoPlayer.style.width           = "800px";
            ContainerForVideoPlayer.style.height          = "400px";
            #endregion

            #region ContainerForDetails
            var ContainerForDetails = new IHTMLDiv().AttachTo(Context);

            ContainerForDetails.style.position   = "absolute";
            ContainerForDetails.style.left       = "50%";
            ContainerForDetails.style.top        = "50%";
            ContainerForDetails.style.marginLeft = "-400px";
            ContainerForDetails.style.marginTop  = "120px";
            //ContainerForDetails.style.backgroundColor = "red";
            ContainerForDetails.style.width    = "800px";
            ContainerForDetails.style.height   = "180px";
            ContainerForDetails.style.overflow = "auto";
            ContainerForDetails.style.color    = "white";

            //            ContainerForDetails.innerHTML = @"
            //<a href='http://www.imdb.com/title/tt0421715/'  title='Movie: The Curious Case of Benjamin Button 2008'><img  src='http://tinyurl.com/dh5xay'  align='right'  /></a>
            //<h2><a href='http://piratebay.org/torrent/4710971/El.Curioso.Caso.De.Benjamin.Button.[2009].[Spanish].[DVD-Screene'>Movie: The Curious Case of Benjamin Button 2008</a></h2>
            //<div title='raiting'>8.2/10</div>
            //<div title='runtime'>166 min, 1.36 GiB</div>
            //<div title='tagline'>Life isn't measured in minutes, but in moments</div>
            //<div title='genres'>Drama, Fantasy, Mystery, Romance</div>
            //<div title='episode'></div>
            //<a href='http://tinyurl.com/cjhc2g'  title='Movie: The Curious Case of Benjamin Button 2008'><img  src='http://static.thepiratebay.org/img/dl.gif'    /> El.Curioso.Caso.De.Benjamin.Button.[2009].[Spanish].[DVD-Screene</a>
            //";
            #endregion


            YouTubePlayer.Create(ContainerForVideoPlayer, 0, 0,
                                 VideoPlayer =>
            {
                MovieItem CurrentVideo = null;

                #region ShowVideo
                Action <MovieItem> ShowVideo =
                    k =>
                {
                    if (k == null)
                    {
                        VideoPlayer.pauseVideo();

                        VideoPlayer.width  = 0;
                        VideoPlayer.height = 0;

                        ContainerForVideoPlayer.style.top = "-100%";
                        //ContainerForVideoPlayer.style.display = "none";
                        Shadow.style.display           = "none";
                        SuggestionDialog.style.display = "none";

                        ContainerForDetails.style.display = "none";
                        Context.Document.title            = "zmovies";
                        return;
                    }

                    //ContainerForVideoPlayer.style.display = "block";

                    ContainerForVideoPlayer.style.top = "50%";

                    VideoPlayer.width  = 800;
                    VideoPlayer.height = 400;

                    if (CurrentVideo == k)
                    {
                        VideoPlayer.playVideo();
                    }
                    else
                    {
                        CurrentVideo = k;
                        VideoPlayer.loadVideoById(k.YouTubeKey);
                    }

                    Context.Document.title = k.SmartTitle;

                    Shadow.style.display = "block";
                    ContainerForDetails.style.display = "block";

                    ContainerForDetails.innerHTML = k.ToDetails();
                };
                #endregion

                ShowVideo(null);


                Shadow.style.cursor = "pointer";
                Shadow.onclick     +=
                    delegate
                {
                    ShowVideo(null);
                };

                // document.getElementById('" + context.Element.id + "')['" + addfeeditem.Token + @"'](result.feed.entries[i].content);

                //{
                //      "title":"Movie: Yes Man 2008",
                //      "link":"http://feedproxy.google.com/~r/zmovies/~3/qVZESWhb0vQ/dfvlm8",
                //      "author":"",
                //      "publishedDate":"",
                //      "contentSnippet":"\n \n \n \n \n \n \n\n\nMovie: Yes Man 2008\n7.2/10\n104 min, 704.11 MiB\nOne word can change everything.\nComedy|Romance\n\n ...",
                //      "content":"\n \n \n \n \u003cembed src\u003d\"http://www.youtube.com/v/Q-Z_CUYh2Sk\u0026amp;hl\u003den\u0026amp;fs\u003d1\" allowScriptAccess\u003d\"never\" allowFullScreen\u003d\"true\" width\u003d\"640\" height\u003d\"385\" wmode\u003d\"transparent\" type\u003d\"application/x-shockwave-flash\"\u003e\u003c/embed\u003e\n \n \n\u003ca href\u003d\"http://www.youtube.com/v/Q-Z_CUYh2Sk\u0026amp;hl\u003den\u0026amp;fs\u003d1\"\u003e\u003cimg alt\u003d\"Q-Z_CUYh2Sk\" src\u003d\"http://img.youtube.com/vi/Q-Z_CUYh2Sk/0.jpg\" align\u003d\"left\"\u003e\u003c/a\u003e\n\u003ca href\u003d\"http://www.imdb.com/title/tt1068680/\" title\u003d\"Movie: Yes Man 2008\"\u003e\u003cimg src\u003d\"http://tinyurl.com/cuc2uo\" align\u003d\"right\"\u003e\u003c/a\u003e\n\u003ch2\u003e\u003ca href\u003d\"http://piratebay.org/torrent/4797620/Yes.Man.2009.DVDRip.XviD-NoRar_\"\u003eMovie: Yes Man 2008\u003c/a\u003e\u003c/h2\u003e\n\u003cdiv title\u003d\"raiting\"\u003e7.2/10\u003c/div\u003e\n\u003cdiv title\u003d\"runtime\"\u003e104 min, 704.11 MiB\u003c/div\u003e\n\u003cdiv title\u003d\"tagline\"\u003eOne word can change everything.\u003c/div\u003e\n\u003cdiv title\u003d\"genres\"\u003eComedy|Romance\u003c/div\u003e\n\u003cdiv title\u003d\"episode\"\u003e\u003c/div\u003e\n\u003ca href\u003d\"http://tinyurl.com/dfvlm8\" title\u003d\"Movie: Yes Man 2008\"\u003e\u003cimg src\u003d\"http://static.thepiratebay.org/img/dl.gif\"\u003e Yes.Man.2009.DVDRip.XviD-NoRar™\u003c/a\u003e\u003cimg src\u003d\"http://feeds2.feedburner.com/~r/zmovies/~4/qVZESWhb0vQ\" height\u003d\"1\" width\u003d\"1\"\u003e",
                //      "categories":[
                //         "Movies",
                //         "Comedy",
                //         "Romance"
                //      ]
                //   },



                VideoPlayer.onStateChange +=
                    state =>
                {
                    if (state == YouTubePlayer.States.ended)
                    {
                        ShowVideo(KnownMovies.Where(x => KnownMoviesFilter(x.Movie)).Random().Movie);
                    }
                };

                var PendingList = new List <MovieItem>();

                Action PendingListToPosters =
                    delegate
                {
                    while (PendingList.Count > 0)
                    {
                        var GroupLeader = PendingList.First();

                        PendingList.Remove(GroupLeader);

                        Func <MovieItem, bool> Filter = k => k.IMDBTagline == GroupLeader.IMDBTagline;

                        if (string.IsNullOrEmpty(GroupLeader.IMDBTagline))
                        {
                            Filter = k => k.SmartTitleWithoutQuotes == GroupLeader.SmartTitleWithoutQuotes;
                        }

                        var GroupMembers = PendingList.Where(Filter).ToArray();

                        GroupMembers.ForEach(k => PendingList.Remove(k));

                        var Group = new[] { GroupLeader }.Concat(GroupMembers).ToArray();

                        foreach (var n in Group)
                        {
                            var poster = new IHTMLImage
                            {
                                src   = n.PosterLink,
                                alt   = " ",
                                title = n.SmartTitleWithoutQuotes + " | " + n.TorrentName + " | " + n.FeedIndex + " of " + n.FeedCapacity
                            }.AttachTo(PostersGroup);

                            if (n != GroupLeader)
                            {
                                poster.style.marginLeft = "-3em";
                            }

                            KnownMovies.Add(
                                new MovieItemWithPoster
                            {
                                Movie  = n,
                                Poster = poster
                            }
                                );

                            poster.style.cursor = "pointer";
                            poster.onclick     +=
                                delegate
                            {
                                ShowVideo(n);
                            };
                        }
                    }
                };


                var GFeedReader = Context.ToExternal <object[]>(
                    data =>
                {
                    var Title        = (string)data[0];
                    var Link         = (string)data[1];
                    var Content      = (string)data[2];
                    var Categories   = (string[])data[3];
                    var FeedIndex    = (int)data[4];
                    var FeedCapacity = (int)data[5];

                    Content.ParseMovieItem(
                        n =>
                    {
                        // use feedburner link for stats
                        n.TorrentLink  = Link;
                        n.FeedIndex    = FeedIndex;
                        n.FeedCapacity = FeedCapacity;

                        PendingList.Add(n);

                        if (FeedIndex + 1 == FeedCapacity)
                        {
                            PendingListToPosters();
                        }
                    }
                        );
                }
                    );

                1.ExternalAtDelay(@"

window['piper'] = function (dummy, result)
{
    for (var i=0; i<result.feed.entries.length; i++) 
    {
		var _x = result.feed.entries[i];
       if (_x.content) 
	   {
			var _v = [_x.title, _x.link, _x.content, _x.categories, i, result.feed.entries.length];
			document.getElementById('"             + Context.Element.id + "')['" + GFeedReader + @"'](_v);
       }
    }
};

					"                    );

                // <script src='http://www.google.com/uds/Gfeeds?callback=piper&scoring=h&context=0&num=100&hl=en&output=json&q=http://feeds2.feedburner.com/zmovies&v=1.0&nocache=0'></script>

                // google seems to cache 250 items

                new IHTMLScript
                {
                    type = "text/javascript",
                    src  = "http://www.google.com/uds/Gfeeds?callback=piper&scoring=h&context=0&num=250&hl=en&output=json&q=http://feeds2.feedburner.com/zmovies&v=1.0&nocache=0"
                }.AttachTo(Context);

                // http://flagcounter.com/

                // rect (top, right, bottom, left)

                FooterGroup.innerHTML =
                    @"
					<div style='padding: 4em;'>

<center>
						<div style='width:420px;text-align:center;margin:0;padding:0;'>
							<embed src='http://widgets.amung.us/flash/v2map.swf' 
								quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' 
								wmode='transparent'
								allowScriptAccess='always' 
								allowNetworking='all' type='application/x-shockwave-flash' 
								flashvars='wausitehash=eop2ht6aucqf&map=heatmap&pin=star-blue&link=no' 
								width='420' height='210' />
							<div style='width:420px;height:210px;position:relative;margin:0 auto;margin-top:-210px;'><a href='http://whos.amung.us/stats/eop2ht6aucqf/'><img src='http://maps.amung.us/ping/eop2ht6aucqf.gif' border='0' width='420' height='210' /></a></div>
						</div>
</center>
<br />
						<div>
						<a href='http://s03.flagcounter.com/more/Y7bi'><img src='http://s03.flagcounter.com/count/Y7bi/bg=000000/txt=FFFFFF/border=CCCCCC/columns=8/maxflags=32/viewers=3/labels=0/pageviews=1/' alt='free counters' border='0'></a>
						</div>
					</div>
										"                                        ;
            }
                                 );
        }