Skip to content

Commit

Permalink
Flash quality and other tweaks
Browse files Browse the repository at this point in the history
* *New* Flash quality select option - Choose from Low to Best and all options inbetween.
* *New* Flash window select option - Choose the rendering method in the browser.
* *New* Mousing over a ship name in the overview tab, fleet tab, or equipment list window will show the ship stats.
* *Fix* OSAPI links now properly display in KCV.
* Browser settings now available in the start up settings menu

Side notes
* None of the flash settings work on SWF/API links.
* You can however use the OSAPI link if you are still using it for the flash settings.
* Do NOT use GPU window method! Its built for tablets and phones that have specialized optimizations needed for flash.
* Ship stat info is on a longer delay than normal tooltips (600ms instead of 400ms default)

Coding Tidbits
* Cleaned up some mixed tabbing
* The flash quality and window methods are done through javascript which is added either to the frame or main page as required.
* Depending on which link you use, DMM.com generates either an embeded or object flash DOM. The JS had to account for both.
* You cannot append a removed object in HTMLDOM in IE at all. It will just place the same referenced removed object back in as though it never went away (thus having to make an object from scratch).
* You also cant use DOM events in IE at all, so I had to check every 100ms for a change to a particular div.
* We are now "injecting" javascript a-la greasemonkey style. This should not be a problem, but just putting in here that this may be a problem with those who know what to do with it (not that you can't do that with any other browser already anyway).
  • Loading branch information
Zharay committed Apr 13, 2014
1 parent a979af3 commit ab29a8c
Show file tree
Hide file tree
Showing 22 changed files with 1,118 additions and 361 deletions.
80 changes: 78 additions & 2 deletions Grabacr07.KanColleViewer/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,27 @@
<setting name="OverrideStyleSheet" serializeAs="String">
<value>body {
margin:0;
overflow:hidden
overflow:hidden;
}

#game_frame {
position:fixed;
left:50%;
top:-16px;
margin-left:-450px;
z-index:1
z-index:1;
}

#flashWrap {
position:fixed;
z-index:1;
margin:0;
}

#spacing_top, #sectionWrap {
visibility: hidden !important;
height:0 !important;
display: none !important;
}</value>
</setting>
<setting name="UIContentHight" serializeAs="String">
Expand All @@ -47,6 +59,70 @@
<setting name="KCVUpdateUrl" serializeAs="String">
<value>https://raw.github.com/Zharay/KanColleViewer/master/resources/Version.xml</value>
</setting>
<setting name="FlashQualityJS" serializeAs="String">
<value>var flashQuality = function () {{
for (var objs = document.embeds, i = objs.length - 1; i &gt;= 0; i--) {{

if (objs[i].getAttribute('quality') == '{0}')
continue;

var embedElem = document.createElement('embed');
var parentElem = objs[i].parentNode;
embedElem.setAttribute('quality', '{0}');
embedElem.setAttribute('wmode', '{1}');
embedElem.setAttribute('type', 'application/x-shockwave-flash');
embedElem.setAttribute('id', objs[i].getAttribute('id'));
embedElem.setAttribute('width', objs[i].getAttribute('width'));
embedElem.setAttribute('height', objs[i].getAttribute('height'));
embedElem.setAttribute('src', objs[i].getAttribute('src'));
embedElem.setAttribute('bgcolor', objs[i].getAttribute('bgcolor'));
embedElem.setAttribute('allowScriptAccess', objs[i].getAttribute('allowScriptAccess'));
embedElem.setAttribute('base', objs[i].getAttribute('base'));
parentElem.removeChild(objs[i]);
parentElem.appendChild(embedElem);
}}

for (objs = document.getElementsByTagName('object'), i = objs.length - 1; i &gt;= 0; i--) {{
var embedElem = document.createElement('embed');
var parentElem = objs[i].parentNode;
embedElem.setAttribute('quality', '{0}');
embedElem.setAttribute('wmode', '{1}');
embedElem.setAttribute('id', objs[i].getAttribute('id'));
embedElem.setAttribute('type', 'application/x-shockwave-flash');
embedElem.setAttribute('width', objs[i].getAttribute('width'));
embedElem.setAttribute('height', objs[i].getAttribute('height'));

for (var c = objs[i].childNodes, j = c.length - 1, set = false; j &gt;= 0; j--) {{
if ((c[j].tagName == 'PARAM') &amp;&amp; (c[j].getAttribute('name').toLowerCase() == 'src'))
embedElem.setAttribute('src', c[j].getAttribute('value'));
else if ((c[j].tagName == 'PARAM') &amp;&amp; (c[j].getAttribute('name').toLowerCase() == 'movie'))
embedElem.setAttribute('src', c[j].getAttribute('value'));
else if ((c[j].tagName == 'PARAM') &amp;&amp; (c[j].getAttribute('name').toLowerCase() == 'bgcolor'))
embedElem.setAttribute('bgcolor', c[j].getAttribute('value'));
else if ((c[j].tagName == 'PARAM') &amp;&amp; (c[j].getAttribute('name').toLowerCase() == 'allowscriptaccess'))
embedElem.setAttribute('allowScriptAccess', c[j].getAttribute('value'));
else if ((c[j].tagName == 'PARAM') &amp;&amp; (c[j].getAttribute('name').toLowerCase() == 'base'))
embedElem.setAttribute('base', c[j].getAttribute('value'));
}}

parentElem.removeChild(objs[i]);
parentElem.appendChild(embedElem);
}}
}};

var TimedInject = setInterval(function () {{
CheckChange();
}}, 100);

function CheckChange() {{
if (document.getElementById('flashWrap').innerHTML.length &gt; 10) {{
flashQuality();
clearInterval(TimedInject);
}}
else if (!document.getElementById('flashWrap'))
clearInterval(TimedInject);
}}</value>
</setting>
</Grabacr07.KanColleViewer.Properties.Settings>
</applicationSettings>
</configuration>
9 changes: 9 additions & 0 deletions Grabacr07.KanColleViewer/KanColleViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,14 @@
<Compile Include="Views\Behaviors\SetStyleSheetBehavior.cs" />
<Compile Include="Views\Behaviors\SetWindowLocationAction.cs" />
<Compile Include="Views\Behaviors\TimerBehavior.cs" />
<Compile Include="Views\Controls\CrossFrameIE.cs" />
<Compile Include="Views\Converters\BooleanToWidthConverter.cs" />
<Compile Include="Views\Controls\KanColleHost.cs" />
<Compile Include="Views\Controls\WebBrowserHelper.cs" />
<Compile Include="Views\Behaviors\ZoomAction.cs" />
<Compile Include="Views\Settings\Browser.xaml.cs">
<DependentUpon>Browser.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Settings\Updates.xaml.cs">
<DependentUpon>Updates.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -409,6 +413,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Settings\Browser.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Settings\Updates.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -546,6 +554,7 @@
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.zh-CN.resx">
<DependentUpon>Resources.resx</DependentUpon>
Expand Down
42 changes: 40 additions & 2 deletions Grabacr07.KanColleViewer/Models/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Settings : NotificationObject
"KanColleViewer",
"Settings.xml");

private static readonly string CurrentSettingsVersion = "1.3";
private static readonly string CurrentSettingsVersion = "1.4";

public static Settings Current { get; set; }

Expand Down Expand Up @@ -66,7 +66,9 @@ public static Settings GetInitialSettings()
ShipCatalog_ShowMoreStats = true,
NotifyBuildingCompleted = true,
NotifyRepairingCompleted = true,
NotifyExpeditionReturned = true
NotifyExpeditionReturned = true,
FlashQuality = "High",
FlashWindow = "Opaque"
};
}

Expand Down Expand Up @@ -908,6 +910,42 @@ public bool ShipCatalog_ShowMoreStats

#endregion

#region FlashQuality変更通知プロパティ

private string _FlashQuality;

public string FlashQuality
{
get { return this._FlashQuality; }
set
{
if (this._FlashQuality != value)
{
this._FlashQuality = value;
this.RaisePropertyChanged();
}
}
}
#endregion

#region FlashWindow変更通知プロパティ

private string _FlashWindow;

public string FlashWindow
{
get { return this._FlashWindow; }
set
{
if (this._FlashWindow != value)
{
this._FlashWindow = value;
this.RaisePropertyChanged();
}
}
}
#endregion

public void Save()
{
if (!this.ShipCatalog_SaveFilters)
Expand Down
Loading

0 comments on commit ab29a8c

Please sign in to comment.