Add location options
This commit is contained in:
parent
c2cf342f39
commit
b52f29ea74
@ -31,6 +31,12 @@
|
||||
<setting name="DelayMax" serializeAs="String">
|
||||
<value>15</value>
|
||||
</setting>
|
||||
<setting name="ChooseType" serializeAs="String">
|
||||
<value>Hashtags</value>
|
||||
</setting>
|
||||
<setting name="Instagram_Locations" serializeAs="String">
|
||||
<value>249859506/dominican-republic</value>
|
||||
</setting>
|
||||
</AutoLikerCefSharpWpf.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
@ -192,7 +192,7 @@ alObject.prototype.instagramLoopOverPostsClick = function(index) {
|
||||
} else {
|
||||
// already liked, go to the next item
|
||||
thisObj.log(" - already liked this post!");
|
||||
thisObj.instagramClickNextButton(nextBtn, index);
|
||||
thisObj.instagramClickNextButton(nextBtn, (index - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -15,7 +15,17 @@ namespace AutoLikerCefSharpWpf.Helper
|
||||
|
||||
private void InitializeSettings()
|
||||
{
|
||||
if (Properties.Settings.Default.ChooseType.Equals(main.rdTypeLocationTag.Name))
|
||||
{
|
||||
main.rdTypeLocationTag.IsChecked = true;
|
||||
main.rdTypeHashTag.IsChecked = false;
|
||||
} else
|
||||
{
|
||||
main.rdTypeHashTag.IsChecked = true;
|
||||
main.rdTypeLocationTag.IsChecked = false;
|
||||
}
|
||||
main.txtHashTag.Text = Properties.Settings.Default.Instagram_Hashtag;
|
||||
main.txtLocationTag.Text = Properties.Settings.Default.Instagram_Locations;
|
||||
main.txtDelayRestartMin.Text = Properties.Settings.Default.DelayRestartMin.ToString();
|
||||
main.txtDelayRestartMax.Text = Properties.Settings.Default.DelayRestartMax.ToString();
|
||||
main.txtMaxLikesMin.Text = Properties.Settings.Default.LikesMin.ToString();
|
||||
@ -25,19 +35,31 @@ namespace AutoLikerCefSharpWpf.Helper
|
||||
this.ToggleSettingsSaveButton(false);
|
||||
|
||||
// assign handlers
|
||||
main.txtHashTag.TextChanged += Al_Settings_TextChanged;
|
||||
main.txtDelayRestartMin.TextChanged += Al_Settings_TextChanged;
|
||||
main.txtDelayRestartMax.TextChanged += Al_Settings_TextChanged;
|
||||
main.txtMaxLikesMin.TextChanged += Al_Settings_TextChanged;
|
||||
main.txtMaxLikesMax.TextChanged += Al_Settings_TextChanged;
|
||||
main.txtDelayMin.TextChanged += Al_Settings_TextChanged;
|
||||
main.txtDelayMax.TextChanged += Al_Settings_TextChanged;
|
||||
main.rdTypeHashTag.Checked += RadioButtonChanged;
|
||||
main.rdTypeHashTag.Unchecked += RadioButtonChanged;
|
||||
main.rdTypeLocationTag.Checked += RadioButtonChanged;
|
||||
main.rdTypeLocationTag.Unchecked += RadioButtonChanged;
|
||||
main.txtHashTag.TextChanged += TextFieldChanged;
|
||||
main.txtLocationTag.TextChanged += TextFieldChanged;
|
||||
main.txtDelayRestartMin.TextChanged += TextFieldChanged;
|
||||
main.txtDelayRestartMax.TextChanged += TextFieldChanged;
|
||||
main.txtMaxLikesMin.TextChanged += TextFieldChanged;
|
||||
main.txtMaxLikesMax.TextChanged += TextFieldChanged;
|
||||
main.txtDelayMin.TextChanged += TextFieldChanged;
|
||||
main.txtDelayMax.TextChanged += TextFieldChanged;
|
||||
}
|
||||
|
||||
private void Al_Settings_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||
private void RadioButtonChanged(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
RadioButton rdBtn = sender as RadioButton;
|
||||
Debug.WriteLine($"Setting changed: Radio button '{rdBtn.Name}' checked={rdBtn.IsChecked}");
|
||||
this.ToggleSettingsSaveButton(true);
|
||||
}
|
||||
|
||||
private void TextFieldChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
TextBox tb = (TextBox)sender;
|
||||
Debug.WriteLine("Setting changed: " + tb.Name + " = " + tb.Text);
|
||||
Debug.WriteLine($"Setting changed: {tb.Name} = {tb.Text}");
|
||||
this.ToggleSettingsSaveButton(true);
|
||||
}
|
||||
|
||||
@ -62,7 +84,15 @@ namespace AutoLikerCefSharpWpf.Helper
|
||||
int.TryParse(main.txtDelayMin.Text, out int delayMin);
|
||||
int.TryParse(main.txtDelayMax.Text, out int delayMax);
|
||||
|
||||
if ((bool) main.rdTypeLocationTag.IsChecked)
|
||||
{
|
||||
Properties.Settings.Default.ChooseType = main.rdTypeLocationTag.Name;
|
||||
} else
|
||||
{
|
||||
Properties.Settings.Default.ChooseType = main.rdTypeHashTag.Name;
|
||||
}
|
||||
Properties.Settings.Default.Instagram_Hashtag = main.txtHashTag.Text;
|
||||
Properties.Settings.Default.Instagram_Locations = main.txtLocationTag.Text;
|
||||
Properties.Settings.Default.DelayRestartMin = delayRestartMin;
|
||||
Properties.Settings.Default.DelayRestartMax = delayRestartMax;
|
||||
Properties.Settings.Default.LikesMin = likesMin;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||
Background="{DynamicResource MaterialDesignPaper}"
|
||||
TextElement.FontWeight="Medium"
|
||||
TextElement.FontSize="14"
|
||||
TextElement.FontSize="12"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
xmlns:wpf="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
|
||||
xmlns:cef="clr-namespace:CefSharp;assembly=CefSharp.Core"
|
||||
@ -39,8 +39,8 @@
|
||||
<Label Grid.Row="4" Grid.Column="0" Content="Delay range between likes (sec)" x:Name="lblDelay" />
|
||||
<Label Grid.Row="5" Grid.Column="0" Content="Delay before reloading (min)" x:Name="lblDelayRestart" />
|
||||
<StackPanel Grid.Column="1" Grid.Row="0" Margin="3" HorizontalAlignment="Left" Orientation="Vertical">
|
||||
<RadioButton x:Name="radTypeHashTag" GroupName="grpTypeButtons" IsChecked="True" Foreground="White">Hashtags</RadioButton>
|
||||
<RadioButton x:Name="radTypeLocationTag" GroupName="grpTypeButtons" Foreground="White">Location</RadioButton>
|
||||
<RadioButton x:Name="rdTypeHashTag" GroupName="grpTypeButtons" IsChecked="True" Foreground="White">Hashtags</RadioButton>
|
||||
<RadioButton x:Name="rdTypeLocationTag" GroupName="grpTypeButtons" Foreground="White">Locations</RadioButton>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Margin="3" Height="50px" TextWrapping="Wrap" x:Name="txtHashTag"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Margin="3" Height="50px" TextWrapping="Wrap" x:Name="txtLocationTag"/>
|
||||
@ -59,7 +59,7 @@
|
||||
<Label Content="-" />
|
||||
<TextBox Width="40" x:Name="txtDelayRestartMax" />
|
||||
</StackPanel>
|
||||
<Button Grid.Column="1" Grid.Row="6" HorizontalAlignment="Center" MinWidth="80" Margin="3" Content="Save" x:Name="btnSaveSettings" Click="BtnSaveSettings_Click"/>
|
||||
<Button Grid.Column="1" Grid.Row="6" HorizontalAlignment="Left" MinWidth="80" Margin="3" Content="Save" x:Name="btnSaveSettings" Click="BtnSaveSettings_Click"/>
|
||||
</Grid>
|
||||
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Left" Orientation="Horizontal" Margin="0 5">
|
||||
<Button x:Name="btnStart" Height="35" Content="Start" Margin="5 0 0 0" Click="BtnStart_Click"/>
|
||||
|
||||
@ -21,7 +21,7 @@ namespace AutoLikerCefSharpWpf
|
||||
InitializeComponent();
|
||||
|
||||
// version
|
||||
this.AutoLikerVersion = "v2.0.2-20230914";
|
||||
this.AutoLikerVersion = "v2.0.3-20230914";
|
||||
this.DataContext = this;
|
||||
// manage settings in UI
|
||||
this._alsm = new AutoLikerSettingsManager(this);
|
||||
@ -75,7 +75,6 @@ namespace AutoLikerCefSharpWpf
|
||||
await CefSharp.BindObjectAsync(""boundAsync"");
|
||||
|
||||
//The default is to camel case method names (the first letter of the method name is changed to lowercase)
|
||||
boundAsync.logMessage(""This is a boundAsync test"");
|
||||
console.log('boundAsync worked!');
|
||||
})();";
|
||||
args.Frame.ExecuteJavaScriptAsync(script);
|
||||
@ -90,6 +89,12 @@ namespace AutoLikerCefSharpWpf
|
||||
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
// check which option to use
|
||||
string paramTag = this.txtHashTag.Text;
|
||||
if ((bool) this.rdTypeLocationTag.IsChecked)
|
||||
{
|
||||
paramTag = this.txtLocationTag.Text;
|
||||
}
|
||||
// Execute script
|
||||
string alStartScript = $@"(function()
|
||||
{{
|
||||
@ -161,8 +166,13 @@ namespace AutoLikerCefSharpWpf
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
this.txtLog.Clear();
|
||||
// get hashtag
|
||||
string URL = "https://www.instagram.com/explore/tags/";
|
||||
string hashtag = this.txtHashTag.Text;
|
||||
if ((bool) this.rdTypeLocationTag.IsChecked)
|
||||
{
|
||||
URL = "https://www.instagram.com/explore/locations/";
|
||||
hashtag = this.txtLocationTag.Text;
|
||||
}
|
||||
// check if multiple hastags
|
||||
if (hashtag.Contains(","))
|
||||
{
|
||||
@ -176,9 +186,8 @@ namespace AutoLikerCefSharpWpf
|
||||
}
|
||||
this.LogMessage("Load Instagram Tag: " + hashtag);
|
||||
// create URL
|
||||
string URL = "https://www.instagram.com/explore/tags/" + hashtag + "/#al";
|
||||
// reload browser
|
||||
//this.browser.Address = URL;
|
||||
URL += hashtag + "/#al";
|
||||
// load URL
|
||||
this.Browser.Load(URL);
|
||||
});
|
||||
}
|
||||
|
||||
24
AutoLikerCefSharpWpf/Properties/Settings.Designer.cs
generated
24
AutoLikerCefSharpWpf/Properties/Settings.Designer.cs
generated
@ -106,5 +106,29 @@ namespace AutoLikerCefSharpWpf.Properties {
|
||||
this["DelayMax"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Hashtags")]
|
||||
public string ChooseType {
|
||||
get {
|
||||
return ((string)(this["ChooseType"]));
|
||||
}
|
||||
set {
|
||||
this["ChooseType"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("249859506/dominican-republic")]
|
||||
public string Instagram_Locations {
|
||||
get {
|
||||
return ((string)(this["Instagram_Locations"]));
|
||||
}
|
||||
set {
|
||||
this["Instagram_Locations"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,5 +23,11 @@
|
||||
<Setting Name="DelayMax" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">15</Value>
|
||||
</Setting>
|
||||
<Setting Name="ChooseType" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Hashtags</Value>
|
||||
</Setting>
|
||||
<Setting Name="Instagram_Locations" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">249859506/dominican-republic</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
Loading…
x
Reference in New Issue
Block a user