Fix for DOM changes + cache folder #4
@ -17,7 +17,7 @@ namespace AutoLikerCefSharpWpf
|
|||||||
var settings = new CefSettings()
|
var settings = new CefSettings()
|
||||||
{
|
{
|
||||||
//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
|
//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
|
||||||
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache")
|
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "AutoLiker2\\Cache")
|
||||||
};
|
};
|
||||||
|
|
||||||
//Example of setting a command line argument
|
//Example of setting a command line argument
|
||||||
|
|||||||
@ -55,8 +55,10 @@ alObject.prototype.instagramStartClickProcess = function(retry=0) {
|
|||||||
let most_recent = jQuery('h2').eq(1);
|
let most_recent = jQuery('h2').eq(1);
|
||||||
let jump_to_section = null;
|
let jump_to_section = null;
|
||||||
if (most_recent.length > 0) {
|
if (most_recent.length > 0) {
|
||||||
|
thisObj.log(' - Using "Most Recent" list');
|
||||||
jump_to_section = most_recent;
|
jump_to_section = most_recent;
|
||||||
} else if (most_recent.length == 0 && top_posts.length > 0) {
|
} else if (most_recent.length == 0 && top_posts.length > 0) {
|
||||||
|
thisObj.log(' - Using "Top Posts" list');
|
||||||
jump_to_section = top_posts;
|
jump_to_section = top_posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,38 +76,49 @@ alObject.prototype.instagramStartClickProcess = function(retry=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let mr_div = jump_to_section.next();
|
let divJumpTo = jump_to_section.parent(); // get parent <div> of <h2> element
|
||||||
thisObj.log('Scroll to list ..');
|
if (divJumpTo.siblings().length < 1) {
|
||||||
jQuery('html, body').animate({ scrollTop: mr_div.offset().top }, 500);
|
divJumpTo = jump_to_section.parent().parent();
|
||||||
let parentX = mr_div.offset().left;
|
}
|
||||||
let parentY = mr_div.offset().top;
|
if (divJumpTo.siblings().length < 1) {
|
||||||
thisObj._scrollOffset = mr_div.offset();
|
thisObj.log('ERROR: couldn\'t find list of posts!');
|
||||||
console.log('parentX: ' + parentX + ' ; parentY: ' + parentY);
|
thisObj.runDelay(1000, () => {
|
||||||
thisObj.runDelay(2000, () => {
|
thisObj.restartProcess();
|
||||||
let child01 = mr_div.children('div').eq(0);
|
|
||||||
let postLinks = child01.find('a');
|
|
||||||
postLinks.each( function(i) {
|
|
||||||
thisObj._postItems.push(jQuery(this).attr('href'));
|
|
||||||
});
|
});
|
||||||
console.log('items:');
|
} else {
|
||||||
console.log(thisObj._postItems);
|
divJumpTo = divJumpTo.next(); // go to the next sibling (posts <div>)
|
||||||
thisObj.log('Found posts: ' + thisObj._postItems.length);
|
thisObj.log('Scroll to list ..');
|
||||||
// get first post
|
jQuery('html, body').animate({ scrollTop: divJumpTo.offset().top }, 500);
|
||||||
let element01 = jQuery('a[href="' + thisObj._postItems[0] + '"]');
|
let parentX = divJumpTo.offset().left;
|
||||||
console.log(element01);
|
let parentY = divJumpTo.offset().top;
|
||||||
let element02 = element01.find('img').eq(0);
|
thisObj._scrollOffset = divJumpTo.offset();
|
||||||
console.log(element02);
|
console.log('parentX: ' + parentX + ' ; parentY: ' + parentY);
|
||||||
console.log(element02.attr('src'));
|
thisObj.runDelay(2000, () => {
|
||||||
if (element02) {
|
let child01 = divJumpTo.children('div').eq(0);
|
||||||
console.log('imgX: ' + element02.offset().left + ' ; imgY: ' + element02.offset().top);
|
let postLinks = child01.find('a');
|
||||||
//let clickX = parseInt(parentX - element02.offset().left) + 1;
|
postLinks.each(function (i) {
|
||||||
let clickX = parseInt(element02.offset().left) + 30;
|
thisObj._postItems.push(jQuery(this).attr('href'));
|
||||||
let clickY = parseInt(parentY - element02.offset().top) + 60;
|
});
|
||||||
console.log('clickX: ' + clickX + ' ; clickY: ' + clickY);
|
console.log('items:');
|
||||||
thisObj.log('Will like this many posts: ' + thisObj._maxLikes);
|
console.log(thisObj._postItems);
|
||||||
thisObj.instagramClickPost(element02, clickX, clickY);
|
thisObj.log('Found posts: ' + thisObj._postItems.length);
|
||||||
}
|
// get first post
|
||||||
});
|
let element01 = jQuery('a[href="' + thisObj._postItems[0] + '"]');
|
||||||
|
console.log(element01);
|
||||||
|
let element02 = element01.find('img').eq(0);
|
||||||
|
console.log(element02);
|
||||||
|
console.log(element02.attr('src'));
|
||||||
|
if (element02) {
|
||||||
|
console.log('imgX: ' + element02.offset().left + ' ; imgY: ' + element02.offset().top);
|
||||||
|
//let clickX = parseInt(parentX - element02.offset().left) + 1;
|
||||||
|
let clickX = parseInt(element02.offset().left) + 30;
|
||||||
|
let clickY = parseInt(parentY - element02.offset().top) + 60;
|
||||||
|
console.log('clickX: ' + clickX + ' ; clickY: ' + clickY);
|
||||||
|
thisObj.log('Will like this many posts: ' + thisObj._maxLikes);
|
||||||
|
thisObj.instagramClickPost(element02, clickX, clickY);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -161,6 +161,7 @@
|
|||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="app.manifest" />
|
<None Include="app.manifest" />
|
||||||
|
<None Include="README.md" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ namespace AutoLikerCefSharpWpf
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
// version
|
// version
|
||||||
this.AutoLikerVersion = "v2.0.6-20240205";
|
this.AutoLikerVersion = "v2.0.7-20240330";
|
||||||
this.DataContext = this;
|
this.DataContext = this;
|
||||||
// manage settings in UI
|
// manage settings in UI
|
||||||
this._alsm = new AutoLikerSettingsManager(this);
|
this._alsm = new AutoLikerSettingsManager(this);
|
||||||
@ -84,7 +83,11 @@ namespace AutoLikerCefSharpWpf
|
|||||||
args.Frame.ExecuteJavaScriptAsync(jq);
|
args.Frame.ExecuteJavaScriptAsync(jq);
|
||||||
|
|
||||||
// Inject AutoLiker class
|
// Inject AutoLiker class
|
||||||
|
#if DEBUG
|
||||||
|
string aljs = JavaScriptProcessor.ReturnJavaScriptFromFile("autotag_injection.js");
|
||||||
|
#else
|
||||||
string aljs = JavaScriptProcessor.ReturnJavaScriptFromFile("autotag_injection_min.js");
|
string aljs = JavaScriptProcessor.ReturnJavaScriptFromFile("autotag_injection_min.js");
|
||||||
|
#endif
|
||||||
args.Frame.ExecuteJavaScriptAsync(aljs);
|
args.Frame.ExecuteJavaScriptAsync(aljs);
|
||||||
|
|
||||||
this.Dispatcher.Invoke(() =>
|
this.Dispatcher.Invoke(() =>
|
||||||
|
|||||||
6
AutoLikerCefSharpWpf/README.md
Normal file
6
AutoLikerCefSharpWpf/README.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Auto Liker CefSharp WPF
|
||||||
|
Automate liking of Instagram posts.
|
||||||
|
|
||||||
|
## Release Notes
|
||||||
|
* v2.0.7-20240330
|
||||||
|
* #3 Fix H2 scrolling issue
|
||||||
Loading…
x
Reference in New Issue
Block a user