From 428a1439e54cf46bc603ab998dc270d1dff2b42c Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Mon, 2 Feb 2015 17:18:45 -0800 Subject: [PATCH] rjs -> webpack --- .gitignore | 1 + build.ps1 | 5 +- commonjsCleanup.linq | 50 ++ gulp/build.js | 3 +- gulp/copy.js | 7 +- gulp/gulpFile.js | 2 +- gulp/handlebars.js | 7 +- gulp/jshint.js | 1 + gulp/requirejs.js | 32 - gulp/watch.js | 8 +- gulp/webpack.js | 20 + package.json | 11 +- .../Frontend/Mappers/StaticResourceMapper.cs | 1 + src/UI/.idea/codeStyleSettings.xml | 13 +- src/UI/.idea/encodings.xml | 7 +- src/UI/.idea/jsLinters/jshint.xml | 38 +- src/UI/Activity/ActivityLayout.js | 153 ++--- .../Blacklist/BlacklistActionsCell.js | 40 +- .../Activity/Blacklist/BlacklistCollection.js | 83 +-- src/UI/Activity/Blacklist/BlacklistLayout.js | 220 +++--- src/UI/Activity/Blacklist/BlacklistModel.js | 33 +- .../History/Details/HistoryDetailsAge.js | 28 +- .../History/Details/HistoryDetailsLayout.js | 59 +- .../History/Details/HistoryDetailsView.js | 13 +- src/UI/Activity/History/HistoryCollection.js | 120 ++-- src/UI/Activity/History/HistoryDetailsCell.js | 40 +- src/UI/Activity/History/HistoryLayout.js | 297 ++++---- src/UI/Activity/History/HistoryModel.js | 28 +- src/UI/Activity/History/HistoryQualityCell.js | 58 +- src/UI/Activity/Queue/ProgressCell.js | 41 +- src/UI/Activity/Queue/QueueCollection.js | 49 +- src/UI/Activity/Queue/QueueModel.js | 28 +- src/UI/Activity/Queue/QueueStatusCell.js | 154 ++--- src/UI/Activity/Queue/QueueView.js | 75 +- src/UI/Activity/Queue/TimeleftCell.js | 73 +- src/UI/AddSeries/AddSeriesCollection.js | 39 +- src/UI/AddSeries/AddSeriesLayout.js | 103 +-- src/UI/AddSeries/AddSeriesView.js | 295 ++++---- src/UI/AddSeries/EmptyView.js | 12 +- src/UI/AddSeries/ErrorView.js | 29 +- .../AddExistingSeriesCollectionView.js | 93 +-- .../Existing/UnmappedFolderCollection.js | 39 +- .../AddSeries/Existing/UnmappedFolderModel.js | 11 +- src/UI/AddSeries/NotFoundView.js | 29 +- .../RootFolders/RootFolderCollection.js | 24 +- .../RootFolders/RootFolderCollectionView.js | 21 +- .../RootFolders/RootFolderItemView.js | 55 +- .../AddSeries/RootFolders/RootFolderLayout.js | 129 ++-- .../AddSeries/RootFolders/RootFolderModel.js | 18 +- .../AddSeries/SearchResultCollectionView.js | 57 +- src/UI/AppLayout.js | 45 +- src/UI/Calendar/CalendarFeedView.js | 41 +- src/UI/Calendar/CalendarLayout.js | 66 +- src/UI/Calendar/CalendarView.js | 431 +++++------- src/UI/Calendar/Collection.js | 27 +- src/UI/Calendar/UpcomingCollection.js | 53 +- src/UI/Calendar/UpcomingCollectionView.js | 49 +- src/UI/Calendar/UpcomingItemView.js | 50 +- src/UI/Cells/ApprovalStatusCell.js | 61 +- src/UI/Cells/DeleteEpisodeFileCell.js | 51 +- src/UI/Cells/Edit/QualityCellEditor.js | 131 ++-- src/UI/Cells/EpisodeActionsCell.js | 80 +-- src/UI/Cells/EpisodeMonitoredCell.js | 101 ++- src/UI/Cells/EpisodeNumberCell.js | 131 ++-- src/UI/Cells/EpisodeProgressCell.js | 52 +- src/UI/Cells/EpisodeStatusCell.js | 219 +++--- src/UI/Cells/EpisodeTitleCell.js | 51 +- src/UI/Cells/EventTypeCell.js | 87 +-- src/UI/Cells/FileSizeCell.js | 29 +- src/UI/Cells/IndexerCell.js | 24 +- src/UI/Cells/NzbDroneCell.js | 99 ++- src/UI/Cells/ProfileCell.js | 39 +- src/UI/Cells/QualityCell.js | 19 +- src/UI/Cells/RelativeDateCell.js | 58 +- src/UI/Cells/RelativeTimeCell.js | 58 +- src/UI/Cells/ReleaseTitleCell.js | 43 +- src/UI/Cells/SeasonFolderCell.js | 28 +- src/UI/Cells/SelectAllCell.js | 80 +-- src/UI/Cells/SeriesActionsCell.js | 81 +-- src/UI/Cells/SeriesStatusCell.js | 60 +- src/UI/Cells/SeriesTitleCell.js | 16 +- src/UI/Cells/TemplatedCell.js | 35 +- src/UI/Cells/ToggleCell.js | 81 +-- src/UI/Commands/CommandCollection.js | 40 +- src/UI/Commands/CommandController.js | 165 ++--- .../CommandMessengerCollectionView.js | 20 +- src/UI/Commands/CommandMessengerItemView.js | 86 +-- src/UI/Commands/CommandModel.js | 72 +- src/UI/Controller.js | 126 ++-- .../Activity/EpisodeActivityActionsCell.js | 62 +- .../Activity/EpisodeActivityDetailsCell.js | 55 +- .../Episode/Activity/EpisodeActivityLayout.js | 160 ++--- src/UI/Episode/Activity/NoActivityView.js | 12 +- src/UI/Episode/EpisodeDetailsLayout.js | 232 +++---- src/UI/Episode/Search/ButtonsView.js | 11 +- src/UI/Episode/Search/EpisodeSearchLayout.js | 149 ++-- src/UI/Episode/Search/ManualLayout.js | 148 ++-- src/UI/Episode/Search/NoResultsView.js | 11 +- .../Episode/Summary/EpisodeSummaryLayout.js | 223 +++--- src/UI/Episode/Summary/NoFileView.js | 12 +- src/UI/Form/FormBuilder.js | 93 +-- src/UI/Handlebars/Handlebars.Debug.js | 18 +- src/UI/Handlebars/Helpers/DateTime.js | 166 ++--- src/UI/Handlebars/Helpers/EachReverse.js | 31 +- src/UI/Handlebars/Helpers/Enumerable.js | 39 +- src/UI/Handlebars/Helpers/Episode.js | 120 ++-- src/UI/Handlebars/Helpers/Html.js | 57 +- src/UI/Handlebars/Helpers/Numbers.js | 29 +- src/UI/Handlebars/Helpers/Quality.js | 27 +- src/UI/Handlebars/Helpers/String.js | 16 +- src/UI/Handlebars/Helpers/System.js | 39 +- .../backbone.marionette.templates.js | 73 +- src/UI/Health/HealthCollection.js | 25 +- src/UI/Health/HealthModel.js | 10 +- src/UI/Health/HealthView.js | 66 +- src/UI/Hotkeys/Hotkeys.js | 68 +- src/UI/Hotkeys/HotkeysView.js | 13 +- src/UI/Instrumentation/ErrorHandler.js | 141 ++-- src/UI/Instrumentation/StringFormat.js | 8 +- src/UI/JsLibraries/backbone.marionette.js | 2 +- src/UI/JsLibraries/backbone.wreqr.js | 276 ++++++++ src/UI/JsLibraries/lang/placeholder.txt | 1 + src/UI/LifeCycle.js | 7 +- src/UI/Mixins/AsChangeTrackingModel.js | 47 +- src/UI/Mixins/AsEditModalView.js | 180 ++--- src/UI/Mixins/AsFilteredCollection.js | 130 ++-- src/UI/Mixins/AsModelBoundView.js | 79 +-- src/UI/Mixins/AsNamedView.js | 57 +- src/UI/Mixins/AsPersistedStateCollection.js | 121 ++-- src/UI/Mixins/AsSortedCollection.js | 212 +++--- src/UI/Mixins/AsSortedCollectionView.js | 52 +- src/UI/Mixins/AsValidatedView.js | 179 ++--- src/UI/Mixins/AutoComplete.js | 88 +-- src/UI/Mixins/CopyToClipboard.js | 39 +- src/UI/Mixins/DirectoryAutoComplete.js | 26 +- src/UI/Mixins/FileBrowser.js | 31 +- src/UI/Mixins/TagInput.js | 272 ++++---- src/UI/Mixins/backbone.signalr.mixin.js | 80 +-- src/UI/Mixins/jquery.ajax.js | 108 ++- src/UI/Navbar/NavbarLayout.js | 106 ++- src/UI/Navbar/Search.js | 76 +- src/UI/Profile/ProfileCollection.js | 26 +- src/UI/Profile/ProfileModel.js | 21 +- src/UI/Quality/QualityDefinitionCollection.js | 18 +- src/UI/Quality/QualityDefinitionModel.js | 29 +- src/UI/Release/AgeCell.js | 68 +- src/UI/Release/DownloadReportCell.js | 77 +-- src/UI/Release/PeersCell.js | 50 +- src/UI/Release/ProtocolCell.js | 40 +- src/UI/Release/ReleaseCollection.js | 87 ++- src/UI/Release/ReleaseLayout.js | 145 ++-- src/UI/Release/ReleaseModel.js | 11 +- src/UI/Rename/RenamePreviewCollection.js | 63 +- src/UI/Rename/RenamePreviewCollectionView.js | 13 +- .../RenamePreviewEmptyCollectionView.js | 14 +- src/UI/Rename/RenamePreviewFormatView.js | 44 +- src/UI/Rename/RenamePreviewItemView.js | 75 +- src/UI/Rename/RenamePreviewLayout.js | 243 +++---- src/UI/Rename/RenamePreviewModel.js | 10 +- src/UI/Require/require.api.js | 25 - src/UI/Router.js | 55 +- src/UI/SeasonPass/SeasonPassLayout.js | 160 ++--- src/UI/SeasonPass/SeriesCollectionView.js | 14 +- src/UI/SeasonPass/SeriesLayout.js | 269 +++----- src/UI/Series/Delete/DeleteSeriesView.js | 80 +-- src/UI/Series/Details/EpisodeNumberCell.js | 107 ++- src/UI/Series/Details/EpisodeWarningCell.js | 39 +- src/UI/Series/Details/InfoView.js | 34 +- src/UI/Series/Details/SeasonCollectionView.js | 79 +-- src/UI/Series/Details/SeasonLayout.js | 534 ++++++--------- src/UI/Series/Details/SeriesDetailsLayout.js | 421 +++++------- src/UI/Series/Edit/EditSeriesView.js | 101 ++- .../Editor/Organize/OrganizeFilesView.js | 58 +- .../Series/Editor/SeriesEditorFooterView.js | 275 ++++---- src/UI/Series/Editor/SeriesEditorLayout.js | 343 ++++----- src/UI/Series/EpisodeCollection.js | 102 ++- src/UI/Series/EpisodeFileCollection.js | 52 +- src/UI/Series/EpisodeFileModel.js | 10 +- src/UI/Series/EpisodeModel.js | 39 +- src/UI/Series/Index/EmptyView.js | 13 +- src/UI/Series/Index/FooterModel.js | 13 +- src/UI/Series/Index/FooterView.js | 12 +- .../Overview/SeriesOverviewCollectionView.js | 20 +- .../Index/Overview/SeriesOverviewItemView.js | 15 +- .../Posters/SeriesPostersCollectionView.js | 20 +- .../Index/Posters/SeriesPostersItemView.js | 43 +- src/UI/Series/Index/SeriesIndexItemView.js | 64 +- src/UI/Series/Index/SeriesIndexLayout.js | 648 ++++++++---------- src/UI/Series/SeasonCollection.js | 21 +- src/UI/Series/SeasonModel.js | 23 +- src/UI/Series/SeriesCollection.js | 158 ++--- src/UI/Series/SeriesController.js | 70 +- src/UI/Series/SeriesModel.js | 60 +- .../Add/DownloadClientAddCollectionView.js | 21 +- .../Add/DownloadClientAddItemView.js | 98 ++- .../Add/DownloadClientSchemaModal.js | 65 +- .../Delete/DownloadClientDeleteView.js | 36 +- .../DownloadClientCollection.js | 47 +- .../DownloadClientCollectionView.js | 44 +- .../DownloadClient/DownloadClientItemView.js | 43 +- .../DownloadClient/DownloadClientLayout.js | 62 +- .../DownloadClient/DownloadClientModel.js | 10 +- .../DownloadClientSettingsModel.js | 16 +- .../DownloadHandling/DownloadHandlingView.js | 102 ++- .../DroneFactory/DroneFactoryView.js | 39 +- .../Edit/DownloadClientEditView.js | 75 +- .../RemotePathMappingCollection.js | 16 +- .../RemotePathMappingCollectionView.js | 48 +- .../RemotePathMappingDeleteView.js | 36 +- .../RemotePathMappingEditView.js | 54 +- .../RemotePathMappingItemView.js | 43 +- .../RemotePathMappingModel.js | 12 +- .../Settings/General/GeneralSettingsModel.js | 17 +- .../Indexers/Add/IndexerAddCollectionView.js | 21 +- .../Indexers/Add/IndexerAddItemView.js | 92 ++- .../Indexers/Add/IndexerSchemaModal.js | 65 +- .../Indexers/Delete/IndexerDeleteView.js | 36 +- .../Settings/Indexers/Edit/IndexerEditView.js | 66 +- src/UI/Settings/Indexers/IndexerCollection.js | 47 +- .../Indexers/IndexerCollectionView.js | 44 +- src/UI/Settings/Indexers/IndexerItemView.js | 43 +- src/UI/Settings/Indexers/IndexerLayout.js | 59 +- src/UI/Settings/Indexers/IndexerModel.js | 10 +- .../Settings/Indexers/IndexerSettingsModel.js | 16 +- .../Indexers/Options/IndexerOptionsView.js | 25 +- .../Restriction/RestrictionCollection.js | 16 +- .../Restriction/RestrictionCollectionView.js | 46 +- .../Restriction/RestrictionDeleteView.js | 36 +- .../Restriction/RestrictionEditView.js | 54 +- .../Restriction/RestrictionItemView.js | 48 +- .../Indexers/Restriction/RestrictionModel.js | 12 +- .../FileManagement/FileManagementView.js | 43 +- .../MediaManagement/MediaManagementLayout.js | 57 +- .../MediaManagementSettingsModel.js | 18 +- .../Naming/Basic/BasicNamingModel.js | 10 +- .../Naming/Basic/BasicNamingView.js | 232 +++---- .../MediaManagement/Naming/NamingModel.js | 18 +- .../Naming/NamingSampleModel.js | 12 +- .../MediaManagement/Naming/NamingView.js | 192 +++--- .../Permissions/PermissionsView.js | 25 +- .../MediaManagement/Sorting/SortingView.js | 25 +- .../Settings/Metadata/MetadataCollection.js | 17 +- .../Metadata/MetadataCollectionView.js | 22 +- src/UI/Settings/Metadata/MetadataEditView.js | 39 +- src/UI/Settings/Metadata/MetadataItemView.js | 46 +- src/UI/Settings/Metadata/MetadataLayout.js | 41 +- src/UI/Settings/Metadata/MetadataModel.js | 11 +- .../Add/NotificationAddCollectionView.js | 19 +- .../Add/NotificationAddItemView.js | 106 ++- .../Add/NotificationSchemaModal.js | 37 +- .../Delete/NotificationDeleteView.js | 36 +- .../Edit/NotificationEditView.js | 82 +-- .../Notifications/NotificationCollection.js | 18 +- .../NotificationCollectionView.js | 44 +- .../Notifications/NotificationItemView.js | 43 +- .../Notifications/NotificationModel.js | 10 +- src/UI/Settings/Profile/AllowedLabeler.js | 36 +- .../Profile/Delay/DelayProfileCollection.js | 17 +- .../Delay/DelayProfileCollectionView.js | 27 +- .../Profile/Delay/DelayProfileItemView.js | 45 +- .../Profile/Delay/DelayProfileLayout.js | 180 ++--- .../Profile/Delay/DelayProfileModel.js | 11 +- .../Delay/Delete/DelayProfileDeleteView.js | 39 +- .../Delay/Edit/DelayProfileEditView.js | 93 +-- src/UI/Settings/Profile/DeleteProfileView.js | 32 +- .../Profile/Edit/EditProfileItemView.js | 12 +- .../Profile/Edit/EditProfileLayout.js | 219 +++--- .../Settings/Profile/Edit/EditProfileView.js | 52 +- .../Edit/QualitySortableCollectionView.js | 33 +- .../Profile/Language/LanguageCollection.js | 26 +- .../Profile/Language/LanguageModel.js | 11 +- src/UI/Settings/Profile/LanguageLabel.js | 28 +- .../Settings/Profile/ProfileCollectionView.js | 76 +- src/UI/Settings/Profile/ProfileLayout.js | 56 +- .../Profile/ProfileSchemaCollection.js | 18 +- src/UI/Settings/Profile/ProfileView.js | 64 +- src/UI/Settings/ProviderSettingsModelBase.js | 62 +- .../QualityDefinitionCollectionView.js | 22 +- .../Definition/QualityDefinitionItemView.js | 150 ++-- src/UI/Settings/Quality/QualityLayout.js | 41 +- src/UI/Settings/SettingsLayout.js | 503 ++++++-------- src/UI/Settings/SettingsModelBase.js | 63 +- src/UI/Settings/ThingyAddCollectionView.js | 26 +- src/UI/Settings/ThingyHeaderGroupView.js | 35 +- src/UI/Settings/UI/UiSettingsModel.js | 17 +- src/UI/Settings/UI/UiView.js | 43 +- src/UI/Shared/ApiData.js | 18 + .../ControlPanel/ControlPanelController.js | 38 +- .../Shared/ControlPanel/ControlPanelRegion.js | 70 +- src/UI/Shared/FileBrowser/EmptyView.js | 12 +- .../FileBrowser/FileBrowserCollection.js | 62 +- .../Shared/FileBrowser/FileBrowserLayout.js | 286 ++++---- .../FileBrowser/FileBrowserModalRegion.js | 103 ++- src/UI/Shared/FileBrowser/FileBrowserModel.js | 11 +- .../Shared/FileBrowser/FileBrowserNameCell.js | 34 +- src/UI/Shared/FileBrowser/FileBrowserRow.js | 48 +- .../Shared/FileBrowser/FileBrowserTypeCell.js | 64 +- src/UI/Shared/FormatHelpers.js | 105 ++- src/UI/Shared/Grid/HeaderCell.js | 261 +++---- src/UI/Shared/Grid/Pager.js | 329 ++++----- src/UI/Shared/LoadingView.js | 16 +- src/UI/Shared/Messenger.js | 118 ++-- src/UI/Shared/Modal/ModalController.js | 149 ++-- src/UI/Shared/Modal/ModalRegion.js | 91 +-- src/UI/Shared/NotFoundView.js | 12 +- src/UI/Shared/NzbDroneController.js | 103 ++- src/UI/Shared/Shims/handlebars.js | 6 +- src/UI/Shared/SignalRBroadcaster.js | 143 ++-- .../Toolbar/Button/ButtonCollectionView.js | 45 +- src/UI/Shared/Toolbar/Button/ButtonView.js | 153 ++--- src/UI/Shared/Toolbar/ButtonCollection.js | 13 +- src/UI/Shared/Toolbar/ButtonModel.js | 26 +- .../Radio/RadioButtonCollectionView.js | 68 +- .../Shared/Toolbar/Radio/RadioButtonView.js | 99 +-- .../Sorting/SortingButtonCollectionView.js | 76 +- .../Toolbar/Sorting/SortingButtonView.js | 132 ++-- src/UI/Shared/Toolbar/ToolbarLayout.js | 201 +++--- src/UI/Shared/Tooltip.js | 25 +- src/UI/Shared/UiSettingsModel.js | 53 +- src/UI/Shims/backbone.backgrid.selectall.js | 6 + src/UI/Shims/backbone.collectionview.js | 6 + src/UI/Shims/backbone.js | 9 + src/UI/Shims/backbone.marionette.js | 12 + src/UI/Shims/backbone.validation.js | 8 + src/UI/Shims/backgrid.js | 16 + src/UI/Shims/backgrid.paginator.js | 8 + src/UI/Shims/jquery.js | 8 + src/UI/Shims/jquery.signalR.js | 6 + src/UI/Shims/messenger.js | 7 + src/UI/Shims/moment.js | 6 + src/UI/System/Backup/BackupCollection.js | 30 +- src/UI/System/Backup/BackupEmptyView.js | 11 +- src/UI/System/Backup/BackupFilenameCell.js | 16 +- src/UI/System/Backup/BackupLayout.js | 184 +++-- src/UI/System/Backup/BackupModel.js | 10 +- src/UI/System/Backup/BackupTypeCell.js | 52 +- src/UI/System/Info/About/AboutView.js | 21 +- .../Info/DiskSpace/DiskSpaceCollection.js | 14 +- .../System/Info/DiskSpace/DiskSpaceLayout.js | 104 ++- .../System/Info/DiskSpace/DiskSpaceModel.js | 9 +- .../Info/DiskSpace/DiskSpacePathCell.js | 42 +- src/UI/System/Info/Health/HealthCell.js | 26 +- src/UI/System/Info/Health/HealthLayout.js | 109 ++- src/UI/System/Info/Health/HealthOkView.js | 12 +- src/UI/System/Info/Health/HealthWikiCell.js | 48 +- src/UI/System/Info/MoreInfo/MoreInfoView.js | 12 +- src/UI/System/Info/SystemInfoLayout.js | 54 +- src/UI/System/Logs/Files/ContentsModel.js | 27 +- src/UI/System/Logs/Files/ContentsView.js | 11 +- src/UI/System/Logs/Files/DownloadLogCell.js | 25 +- src/UI/System/Logs/Files/FilenameCell.js | 26 +- src/UI/System/Logs/Files/LogFileCollection.js | 26 +- src/UI/System/Logs/Files/LogFileLayout.js | 261 +++---- src/UI/System/Logs/Files/LogFileModel.js | 11 +- src/UI/System/Logs/Files/Row.js | 27 +- src/UI/System/Logs/LogsCollection.js | 75 +- src/UI/System/Logs/LogsLayout.js | 120 ++-- src/UI/System/Logs/LogsModel.js | 11 +- .../Logs/Table/Details/LogDetailsView.js | 13 +- src/UI/System/Logs/Table/LogLevelCell.js | 26 +- src/UI/System/Logs/Table/LogRow.js | 27 +- src/UI/System/Logs/Table/LogTimeCell.js | 30 +- src/UI/System/Logs/Table/LogsTableLayout.js | 324 ++++----- .../System/Logs/Updates/LogFileCollection.js | 26 +- src/UI/System/Logs/Updates/LogFileModel.js | 11 +- src/UI/System/StatusModel.js | 20 +- src/UI/System/SystemLayout.js | 276 ++++---- src/UI/System/Task/ExecuteTaskCell.js | 59 +- src/UI/System/Task/NextExecutionCell.js | 73 +- src/UI/System/Task/TaskCollection.js | 30 +- src/UI/System/Task/TaskIntervalCell.js | 45 +- src/UI/System/Task/TaskLayout.js | 137 ++-- src/UI/System/Task/TaskModel.js | 10 +- src/UI/System/Update/EmptyView.js | 11 +- src/UI/System/Update/UpdateCollection.js | 18 +- src/UI/System/Update/UpdateCollectionView.js | 20 +- src/UI/System/Update/UpdateItemView.js | 57 +- src/UI/System/Update/UpdateLayout.js | 52 +- src/UI/System/Update/UpdateModel.js | 10 +- src/UI/Tags/TagCollection.js | 21 +- src/UI/Tags/TagHelpers.js | 49 +- src/UI/Tags/TagModel.js | 10 +- src/UI/Wanted/Cutoff/CutoffUnmetCollection.js | 101 ++- src/UI/Wanted/Cutoff/CutoffUnmetLayout.js | 344 ++++------ src/UI/Wanted/Missing/MissingCollection.js | 100 ++- src/UI/Wanted/Missing/MissingLayout.js | 396 +++++------ src/UI/Wanted/WantedLayout.js | 119 ++-- src/UI/app.js | 310 ++------- src/UI/index.html | 11 +- src/UI/jQuery/RouteBinder.js | 109 ++- src/UI/jQuery/ToTheTop.js | 41 +- src/UI/jQuery/jquery.spin.js | 103 ++- src/UI/jQuery/jquery.validation.js | 162 ++--- src/UI/main.js | 58 +- src/UI/piwikCheck.js | 8 +- src/UI/polyfills.js | 49 +- src/UI/reqres.js | 20 +- src/UI/vent.js | 75 +- webpack.config.js | 42 ++ 399 files changed, 11591 insertions(+), 16139 deletions(-) create mode 100644 commonjsCleanup.linq delete mode 100644 gulp/requirejs.js create mode 100644 gulp/webpack.js create mode 100644 src/UI/JsLibraries/backbone.wreqr.js create mode 100644 src/UI/JsLibraries/lang/placeholder.txt delete mode 100644 src/UI/Require/require.api.js create mode 100644 src/UI/Shared/ApiData.js create mode 100644 src/UI/Shims/backbone.backgrid.selectall.js create mode 100644 src/UI/Shims/backbone.collectionview.js create mode 100644 src/UI/Shims/backbone.js create mode 100644 src/UI/Shims/backbone.marionette.js create mode 100644 src/UI/Shims/backbone.validation.js create mode 100644 src/UI/Shims/backgrid.js create mode 100644 src/UI/Shims/backgrid.paginator.js create mode 100644 src/UI/Shims/jquery.js create mode 100644 src/UI/Shims/jquery.signalR.js create mode 100644 src/UI/Shims/messenger.js create mode 100644 src/UI/Shims/moment.js create mode 100644 webpack.config.js diff --git a/.gitignore b/.gitignore index d537ab816..bc1e543ec 100644 --- a/.gitignore +++ b/.gitignore @@ -122,3 +122,4 @@ setup/Output/ #VS outout folders bin obj +output/* diff --git a/build.ps1 b/build.ps1 index a5459df3f..9e493454f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -221,15 +221,12 @@ Function PackageTests() Function RunGulp() { Write-Host "##teamcity[progressStart 'Running Gulp']" - $gulpPath = '.\node_modules\gulp\bin\gulp' Invoke-Expression 'npm install' CheckExitCode - Invoke-Expression ('node ' + $gulpPath + ' build') -ErrorAction Continue -Verbose + Invoke-Expression 'gulp build' -ErrorAction Continue -Verbose CheckExitCode - Remove-Item $outputFolder\UI\build.txt -ErrorAction Continue - Write-Host "##teamcity[progressFinish 'Running Gulp']" } diff --git a/commonjsCleanup.linq b/commonjsCleanup.linq new file mode 100644 index 000000000..d9df781c6 --- /dev/null +++ b/commonjsCleanup.linq @@ -0,0 +1,50 @@ + + +void Main() +{ + var files = Directory.GetFiles("c:\\git\\sonarr\\src\\UI","*.js", SearchOption.AllDirectories); + + var moduleRegex = new Regex(@"module.exports\s*=\s*\(function\s*\(\)\s*{\n\s*return\s*(\w|\W)*\)\.call\(this\);$"); + var functionHead = new Regex(@"\s*\(function\s*\(\)\s*{\n\s*return\s*"); + var functionTail = new Regex(@"\}\).call\(this\);$"); + var multiVar = new Regex(@"^(?var\s*\w*\s*=\s*require\(.*\)),"); + var seperateDeclearatuin = new Regex(@"^((\w|\$|_)*\s=\srequire\(.*\))(,|;)", RegexOptions.Multiline); + + foreach (var filePath in files) + { + var text = File.ReadAllText(filePath); + + var newContent = text.Replace("// Generated by uRequire v0.7.0-beta.14 template: 'nodejs'",""); + + newContent = newContent.Replace("var __isAMD = !!(typeof define === 'function' && define.amd),",""); + newContent = newContent.Replace("__isNode = (typeof exports === 'object'),",""); + newContent = newContent.Replace("__isWeb = !__isNode;",""); + newContent = newContent.Replace("\"use strict\";","'use strict';"); + + newContent = newContent.Trim(); + + + + if(moduleRegex.IsMatch(newContent)) + { + filePath.Dump(); + + newContent = functionHead.Replace(newContent," "); + newContent = functionTail.Replace(newContent,""); + } + + if(multiVar.IsMatch(newContent)) + { + newContent = multiVar.Replace(newContent,"$1;"); //first one + + } + + newContent = seperateDeclearatuin.Replace(newContent,"var $1;"); //ones after + newContent.Replace("var $ = require('jquery'), var","var $ = require('jquery');"); + + File.WriteAllText(filePath,newContent.Trim()); + + } +} + +// Define other methods and classes here diff --git a/gulp/build.js b/gulp/build.js index c48e00a24..c772abe68 100644 --- a/gulp/build.js +++ b/gulp/build.js @@ -2,12 +2,11 @@ var gulp = require('gulp'); var runSequence = require('run-sequence'); require('./clean'); -require('./requirejs'); require('./less'); require('./handlebars'); require('./copy'); gulp.task('build', function () { return runSequence('clean', - ['requireJs', 'less', 'handlebars', 'copyHtml', 'copyContent']); + ['webpack', 'less', 'handlebars', 'copyHtml', 'copyContent', 'copyJs']); }); diff --git a/gulp/copy.js b/gulp/copy.js index a83bc8227..2833a37f3 100644 --- a/gulp/copy.js +++ b/gulp/copy.js @@ -5,7 +5,12 @@ var cache = require('gulp-cached'); var paths = require('./paths.js'); gulp.task('copyJs', function () { - return gulp.src(paths.src.scripts) + return gulp.src( + [ + paths.src.root + "piwikCheck.js", + paths.src.root + "polyfills.js", + paths.src.root + "JsLibraries\\handlebars.runtime.js", + ]) .pipe(cache('copyJs')) .pipe(print()) .pipe(gulp.dest(paths.dest.root)); diff --git a/gulp/gulpFile.js b/gulp/gulpFile.js index bc2392266..0f90de37d 100644 --- a/gulp/gulpFile.js +++ b/gulp/gulpFile.js @@ -1,12 +1,12 @@ require('./watch.js'); require('./build.js'); require('./clean.js'); -require('./requirejs.js'); require('./jshint.js'); require('./handlebars.js'); require('./copy.js'); require('./less.js'); require('./stripBom.js'); require('./imageMin.js'); +require('./webpack.js'); diff --git a/gulp/handlebars.js b/gulp/handlebars.js index 4534d52cf..3109f92bf 100644 --- a/gulp/handlebars.js +++ b/gulp/handlebars.js @@ -2,7 +2,6 @@ var gulp = require('gulp'); var handlebars = require('gulp-handlebars'); var declare = require('gulp-declare'); var concat = require('gulp-concat'); -var wrapAmd = require('gulp-wrap-amd'); var wrap = require("gulp-wrap"); var path = require('path'); var streamqueue = require('streamqueue'); @@ -48,10 +47,6 @@ gulp.task('handlebars', function () { partialStream, coreStream ).pipe(concat('templates.js')) - .pipe(wrapAmd({ - deps: ['handlebars'], - params: ['Handlebars'], - exports: 'this["T"]' - })) + .pipe(gulp.dest(paths.dest.root)); }); diff --git a/gulp/jshint.js b/gulp/jshint.js index b144335d3..6ab06b7d8 100644 --- a/gulp/jshint.js +++ b/gulp/jshint.js @@ -15,6 +15,7 @@ gulp.task('jshint', function () { '-W100': false, //Silently deleted characters (in locales) 'undef': true, 'globals': { + 'module': true, 'require': true, 'define': true, 'window': true, diff --git a/gulp/requirejs.js b/gulp/requirejs.js deleted file mode 100644 index 75ffd227e..000000000 --- a/gulp/requirejs.js +++ /dev/null @@ -1,32 +0,0 @@ -var gulp = require('gulp'); -var requirejs = require('requirejs'); -var paths = require('./paths'); - -require('./handlebars.js'); -require('./jshint.js'); - - -gulp.task('requireJs', ['jshint'], function (cb) { - - var config = { - mainConfigFile: 'src/UI/app.js', - fileExclusionRegExp: /^.*\.(?!js$)[^.]+$/, - preserveLicenseComments: false, - dir: paths.dest.root, - optimize: 'none', - removeCombined: true, - inlineText: false, - keepBuildDir: true, - modules: [ - { - name: 'app', - exclude: ['templates.js'] - } - ]}; - - requirejs.optimize(config, function (buildResponse) { - console.log(buildResponse); - cb(); - }); - -}); diff --git a/gulp/watch.js b/gulp/watch.js index 69a489316..61d83c866 100644 --- a/gulp/watch.js +++ b/gulp/watch.js @@ -8,17 +8,19 @@ require('./jshint.js'); require('./handlebars.js'); require('./less.js'); require('./copy.js'); +require('./webpack.js'); -gulp.task('watch', ['jshint', 'handlebars', 'less', 'copyJs', 'copyHtml', 'copyContent'], function () { - gulp.watch([paths.src.scripts, paths.src.exclude.libs], ['jshint', 'copyJs']); +gulp.task('watch', ['jshint', 'handlebars', 'less','copyHtml', 'copyContent','copyJs'], function () { + gulp.start('webpackWatch'); + gulp.watch([paths.src.scripts, paths.src.exclude.libs], ['jshint','copyJs']); gulp.watch(paths.src.templates, ['handlebars']); gulp.watch([paths.src.less, paths.src.exclude.libs], ['less']); gulp.watch([paths.src.html], ['copyHtml']); gulp.watch([paths.src.content + '**/*.*', '!**/*.less'], ['copyContent']); }); -gulp.task('liveReload', ['jshint', 'handlebars', 'less', 'copyJs'], function () { +gulp.task('liveReload', ['jshint', 'handlebars', 'less', 'webPack'], function () { var server = livereload(); gulp.watch([ 'app/**/*.js', diff --git a/gulp/webpack.js b/gulp/webpack.js new file mode 100644 index 000000000..a262d0e0c --- /dev/null +++ b/gulp/webpack.js @@ -0,0 +1,20 @@ +var gulp = require('gulp'); + +var gulpWebpack = require('gulp-webpack'); +var webpack = require('webpack'); +var webpackConfig = require('../webpack.config'); + +webpackConfig.devtool = "#source-map"; + +gulp.task('webpack', function() { + return gulp.src('main.js') + .pipe(gulpWebpack(webpackConfig, webpack)) + .pipe(gulp.dest('')); +}); + +gulp.task('webpackWatch', function() { + webpackConfig.watch = true; + return gulp.src('main.js') + .pipe(gulpWebpack(webpackConfig, webpack)) + .pipe(gulp.dest('')); +}); diff --git a/package.json b/package.json index 252b5f111..3bf8baa94 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "Sonarr", - "version": "0.0.0", + "version": "2.0.0", "description": "Sonarr", - "main": "index.js", + "main": "main.js", "scripts": { "preinstall": "" }, @@ -15,10 +15,10 @@ "gitHead": "9ff7aa1bf7fe38c4c5bdb92f56c8ad556916ed67", "readmeFilename": "readme.md", "dependencies": { + "del": "0.1.3", "fs-extra": "0.12.0", "gulp": "3.8.10", "gulp-cached": "1.0.1", - "del": "0.1.3", "gulp-concat": "2.4.2", "gulp-declare": "0.3.0", "gulp-handlebars": "2.2.0", @@ -26,10 +26,11 @@ "gulp-less": "1.3.6", "gulp-print": "1.1.0", "gulp-replace": "0.5.0", + "gulp-run": "1.6.6", + "webpack": "1.4.15", + "gulp-webpack": "1.2.0", "gulp-wrap": "0.5.0", - "gulp-wrap-amd": "0.3.1", "jshint-stylish": "1.0.0", - "requirejs": "2.1.15", "run-sequence": "1.0.2", "streamqueue": "0.1.1" } diff --git a/src/NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs b/src/NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs index 3ef823592..c0ba9b889 100644 --- a/src/NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs +++ b/src/NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs @@ -27,6 +27,7 @@ namespace NzbDrone.Api.Frontend.Mappers { return resourceUrl.StartsWith("/Content") || resourceUrl.EndsWith(".js") || + resourceUrl.EndsWith(".map") || resourceUrl.EndsWith(".css") || (resourceUrl.EndsWith(".ico") && !resourceUrl.Equals("/favicon.ico")) || resourceUrl.EndsWith(".swf"); diff --git a/src/UI/.idea/codeStyleSettings.xml b/src/UI/.idea/codeStyleSettings.xml index c05f974b7..8633a7b78 100644 --- a/src/UI/.idea/codeStyleSettings.xml +++ b/src/UI/.idea/codeStyleSettings.xml @@ -19,6 +19,8 @@