Tic-Tac-Toe Turbo C - turbo-c++

Please I'm trying to make a simple game of tic-tac-toe but I kept getting an error. It says Error Syntax and while statement if missing ) . I would be happy if you someone could help 'cause I just started studying how to code. Here's the code btw.
#include<stdio.>
char sqr [3][3]
main()
{
char again;
int moveCntr, winFlag;
while (1 = = 1)
{
initliz();
sqr[1][1] = 'X';
disbord();
getmove();
makemove();
moveCntr = 3;
while(1 = = 1)
{
disbord();
getmove();
moveCntr = moveCntr + 1;
winFlag = Checkwin ('0');
if(winFlag = = 1)
{
dispbord();
printf("Congratulations!! You win.\n");
break();
}
else
{
makemove();
winFlag = checkwin ('X');
if(winFlag = = 1)
{
dispbord();
printf("I win.\n");
break;
}
}
moveCntr = moveCntr + 1;
if(moveCntr = = 9)
{
dispbord();
printf("It's a draw. Good game.\n");
}
else
{
continue;
}
}
printf("\nDo you want to play again (Y/N)?");
scanf("\n%c" ,&again);
if(again = = 'Y' || again = = 'y')
{
continue;
}
else
{
break;
}
}
return 0;
}

Related

Resizing does not work in paperjs 0.11.8 but works for 0.9.25

I am trying to resize a rectangle in paper.js. I am able to do it for older versions of paperjs (like 0.9.25) but it is not working for the latest version 0.11.8. I am not sure why this is happening, any help would be highly appreciated.
Here is the Sketch link, you may select the version to 0.9.25 where it works and 0.11.8 where it doesnt work.
Sketch
Here is my code:
var hitOptions = {
segments: true,
stroke: true,
fill: true,
tolerance: 1
};
project.currentStyle = {
fillColor: 'green',
strokeColor: 'black'
};
var rect_a = new Path.Rectangle(new Point(50, 50), 50);
var segment, path, hitType;
var clickPos = null;
var movePath = false;
var minHeight = 1;
var minWidth = 1;
function onMouseDown(event) {
segment = path = null;
var hitResult = project.hitTest(event.point, hitOptions);
if (!hitResult)
return;
hitType = hitResult.type;
if (event.modifiers.shift) {
if (hitResult.type == 'segment') {
hitResult.segment.remove();
};
return;
}
if (hitResult) {
path = hitResult.item;
if (hitResult.type == 'segment') {
segment = hitResult.segment;
}
}
movePath = hitResult.type == 'fill';
if (movePath) {
project.activeLayer.addChild(hitResult.item);
}
clickPos = checkHitPosition(event);
}
function onMouseMove(event) {
changeCursor(event);
project.activeLayer.selected = false;
if (event.item)
event.item.selected = true;
}
function onMouseDrag(event) {
if (hitType == "stroke" || hitType == "segment") {
resizeRectangle(path, event);
} else {
path.position += event.delta;
}
}
function resizeRectangle(path, event) {
switch(clickPos) {
case "SE" :
resizeBottom(path, event);
resizeRight(path, event);
break;
case "NE" :
resizeTop(path, event);
resizeRight(path, event);
break;
case "SW" :
resizeBottom(path, event);
resizeLeft(path, event);
break;
case "NW" :
resizeTop(path, event);
resizeLeft(path, event);
break;
case "S" :
resizeBottom(path, event);
break;
case "N" :
resizeTop(path, event);
break;
case "E" :
resizeRight(path, event);
break;
case "W" :
resizeLeft(path, event);
break;
}
}
function resizeTop(path, event) {
if(path.bounds.height >= minHeight) {
var adj = Math.min(event.delta.y, path.bounds.height-minHeight);
path.bounds.top += adj;
}
}
function resizeBottom(path, event) {
if(path.bounds.height >= minHeight) {
path.bounds.bottom += event.delta.y;
}
}
function resizeLeft(path, event) {
if(path.bounds.width >= minWidth) {
path.bounds.left += event.delta.x;
}
}
function resizeRight(path, event) {
if(path.bounds.width >= minWidth) {
path.bounds.right += event.delta.x;
}
}
function checkHitPosition(event) {
var hitResult = project.hitTest(event.point, hitOptions);
var clickPosition = null;
if (hitResult) {
if (hitResult.type == 'stroke' || hitResult.type == 'segment') {
var bounds = hitResult.item.bounds;
var point = hitResult.point;
if (bounds.top == point.y) {
clickPosition = "N";
}
if (bounds.bottom == point.y) {
clickPosition = "S";
}
if (bounds.left == point.x) {
clickPosition = "W";
}
if (bounds.right == point.x) {
clickPosition = "E";
}
if (bounds.top == point.y && bounds.left == point.x) {
clickPosition = "NW";
}
if (bounds.top == point.y && bounds.right == point.x) {
clickPosition = "NE";
}
if (bounds.bottom == point.y && bounds.left == point.x) {
clickPosition = "SW";
}
if (bounds.bottom == point.y && bounds.right == point.x) {
clickPosition = "SE";
}
} else {
clickPosition = "C";
}
}
return clickPosition;
};
function changeCursor(event) {
var hitPosition = checkHitPosition(event);
if(hitPosition == null ) {
document.body.style.cursor = "auto";
} else {
if (hitPosition == "C") {
document.body.style.cursor = "all-scroll";
} else {
document.body.style.cursor = hitPosition + "-resize";
}
}
}
helloworld,
If you want to resize/scale your path, I recommend using the Path.scalemethod (http://paperjs.org/reference/item/#scale-hor-ver).
To apply this on your example, replace your current resizing methods with:
function resizeTop(path, event) {
if(path.bounds.height >= minHeight) {
var relH = (event.point.y - (path.bounds.bottomCenter.y)) / path.bounds.height;
path.scale(1, -relH, path.bounds.bottomCenter)
}
}
function resizeBottom(path, event) {
if(path.bounds.height >= minHeight) {
var relH = (event.point.y - (path.bounds.topCenter.y)) / path.bounds.height;
path.scale(1, relH, path.bounds.topCenter)
}
}
function resizeLeft(path, event) {
if(path.bounds.width >= minWidth) {
var relW = (event.point.x - (path.bounds.rightCenter.x)) / path.bounds.width;
path.scale(-relW, 1, path.bounds.rightCenter)
}
}
function resizeRight(path, event) {
if(path.bounds.width >= minWidth) {
var relW = (event.point.x - (path.bounds.leftCenter.x)) / path.bounds.width;
path.scale(relW, 1, path.bounds.leftCenter)
}
}
Have a nice day!
-- edit --
I remade your sketch and replaced the code, sketch, which works with every version.

How to set delay with library cssanimation.io

if someone know cssanimation.io, i have a little problem..
How can i set the animation-delay? I put it everywhere but the animation always starting when i reload the page rather than after 5s
You can set animationdelay delay = 5000;
change delay in below code from 100(default) to 5000(5s)
window.onload = function () {
splitText()
};
function splitText() {
var a = document.getElementsByClassName('cssanimation');
for (var i = 0; i < a.length; i++) {
var $this = a[i];
var letter = $this.innerHTML;
letter = letter.trim();
var str = '';
var delay = 5000;
for (l = 0; l < letter.length; l++) {
if (letter[l] != ' ') {
str += '<span style="animation-delay:' + delay + 'ms; -moz-animation-delay:' + delay + 'ms; -webkit-animation-delay:' + delay + 'ms; ">' + letter[l] + '</span>';
delay += 150;
}
else
str += letter[l];
}
$this.innerHTML = str;
}
}
DEMO

Can my bipartiteness algorithm be improved?

REVISED: my new solution for testing bipartiteness using the classic 2-coloring algorithm. This seemed to give the best performance:
var colors = new Dictionary<int, int>();
var min = graphDict.Keys.First();
var max = graphDict.Keys.Last();
for (var i = min; i <= max; i++)
{
colors[i] = -1;
}
var terminate = false;
var q = new Queue<int>();
var curr = min;
colors[curr] = 0;
q.Enqueue(curr);
while (q.Count > 0)
{
curr = q.Dequeue();
var adjList = graphDict[curr];
foreach (var adj in adjList)
{
if (colors[adj] == colors[curr])
{
terminate = true;
break;
}
else if (colors[adj] == -1)
{
colors[adj] = 1 - colors[curr];
q.Enqueue(adj);
}
}
}
Console.Write($"{(terminate ? -1 : 1)} ");

Why the Text Header doesn't move when i scroll the grid?

i´m using Obout grid - Column Sets
There are two possibles scenarios.
1.- The Text Header moves when i scroll the grid and i set in the scrollingSetting
the property NumberOfFixedColumns to 0 , here everything works fine.
2.- The Text Header doesn´t moves when i scroll the grid and i set in the scrollingSetting
the property NumberOfFixedColumns different to 0
So i wanna use a fixed column but it doesn´t work properly.
The code use for this in the web page:
<link href="../App_Themes/Theme7/styles/oboutgrid/column-set.css" rel="stylesheet"
type="text/css" />
<script type="text/javascript">
window.onload = function () {
//Grid1.addColumnSet(level, startColumnIndex, endColumnIndex, text);
grdCatalogo.addColumnSetScrollGrid(0, 0, 8, '');
grdCatalogo.addColumnSetScrollGrid(0, 9, 10, 'Cliente');
}
</script>
the code of the column-set.js:
oboutGrid.prototype.addColumnSetScrollGrid = function (level, startColumnIndex, endColumnIndex, text) {
if (typeof (this.GridColumnSetsContainer) == 'undefined') {
this.GridColumnSetsContainer = document.createElement('DIV');
this.GridColumnSetsContainer.className = 'ob_gCSContScroll';
this.GridColumnSetsContainer.style.width = this.GridMainContainer.style.width;
this.GridMainContainer.appendChild(this.GridColumnSetsContainer);
}
if (typeof (this.ColumnSets) == 'undefined') {
this.ColumnSets = new Array();
}
if (typeof (this.ColumnSets[level]) == 'undefined') {
this.ColumnSets[level] = new Array();
this.GridHeaderContainer.firstChild.style.marginTop = (level + 1) * 25 + 'px';
var levelContainer = document.createElement('DIV');
levelContainer.className = "ob_gCSContLevel";
levelContainer.style.width = this.GridHeaderContainer.firstChild.firstChild.offsetWidth + 'px';
this.GridColumnSetsContainer.appendChild(levelContainer);
}
// if ($(this.GridMainContainer).css('width') <= $(this.GridColumnSetsContainer).css('width')) {
// var newWidth = $(this.GridColumnSetsContainer).css('width') - $(this.GridMainContainer).css('width');
// $(this.GridColumnSetsContainer).css('width',newWidth);
// }
var columnSet = document.createElement('DIV');
columnSet.className = 'ob_gCSet';
this.GridColumnSetsContainer.childNodes[level].appendChild(columnSet);
//var position = this.GridHeaderContainer.position();
var position = this.GridHeaderContainer.getBoundingClientRect()
var top = position.top;
var left = position.left;
$(this.GridColumnSetsContainer).css({ "top": top });
$(this.GridColumnSetsContainer).css({ "margin-left": left });
var columnSetContent = document.createElement('DIV');
columnSetContent.innerHTML = text;
columnSet.appendChild(columnSetContent);
columnSet.style.width = columnSetWidth + 'px';
if (endColumnIndex < this.ColumnsCollection.length - 1) {
var tempLevel = level;
if (!(level == 0 || this.GridHeaderContainer.firstChild.childNodes[endColumnIndex + 1].style.top)) {
tempLevel -= 1;
}
var newTop = (-1 - tempLevel) * (25);
this.GridHeaderContainer.firstChild.childNodes[endColumnIndex + 1].style.top = newTop + 'px';
}
if (this.ColumnsCollection.lenght != 0) {
var columnSetWidth = 0;
for (var i = startColumnIndex; i <= endColumnIndex; i++) {
if (this.ColumnsCollection[i] != null && this.ColumnsCollection[i] != 'undefined' && this.ColumnsCollection[i].Visible) {
columnSetWidth += this.ColumnsCollection[i].Width;
}
}
}
columnSet.style.width = columnSetWidth + 'px';
var columnSetObject = new Object();
columnSetObject.Level = level;
columnSetObject.StartColumnIndex = startColumnIndex;
columnSetObject.EndColumnIndex = endColumnIndex;
columnSetObject.ColumnSet = columnSet;
this.ColumnSets[level].push(columnSetObject);
}
oboutGrid.prototype.resizeColumnSets = function () {
for (var level = 0; level < this.ColumnSets.length; level++) {
for (var i = 0; i < this.ColumnSets[level].length; i++) {
var columnSetWidth = 0;
for (var j = this.ColumnSets[level][i].StartColumnIndex; j <= this.ColumnSets[level] [i].EndColumnIndex; j++) {
if (this.ColumnsCollection[j].Visible) {
columnSetWidth += this.ColumnsCollection[j].Width;
}
}
this.ColumnSets[level][i].ColumnSet.style.width = columnSetWidth + 'px';
}
}
}
oboutGrid.prototype.resizeColumnOld = oboutGrid.prototype.resizeColumn;
oboutGrid.prototype.resizeColumn = function (columnIndex, amountToResize, keepGridWidth) {
this.resizeColumnOld(columnIndex, amountToResize, keepGridWidth);
this.resizeColumnSets();
}
oboutGrid.prototype.synchronizeBodyHorizontalScrollingOld = oboutGrid.prototype.synchronizeBodyHorizontalScrolling;
oboutGrid.prototype.synchronizeBodyHorizontalScrolling = function () {
this.synchronizeBodyHorizontalScrollingOld();
//this.GridColumnSetsContainer.style.marginLeft = -1 * this.GridBodyContainer.firstChild.scrollLeft + 'px';
this.GridHeaderContainer.firstChild.style.marginLeft = -1 * this.GridBodyContainer.firstChild.scrollLeft + 'px';
this.GridColumnSetsContainer.scrollLeft = this.GridBodyContainer.firstChild.scrollLeft;
}
The css file:
.ob_gCSContScroll
{
position: absolute !important;
/*top: 17px !important;*/
left: 0px !important;
right: 0px !important;
overflow: hidden;
width: 1179px;
margin-left: 47px;
}
/* A column set row (level) */
.ob_gCSContLevel
{
height: 25px !important;
background-image: url(column-set.png);
background-repeat: repeat-x;
background-color: #A8AEBD;
}
/* The column set for a number of columns */
.ob_gCSet
{
color: #01354D;
font-family: Verdana;
font-size: 12px;
font-weight: bold;
float: left;
text-align: center;
}
/* The text of a column set */
.ob_gCSet div
{
margin-left: 20px;
margin-top: 3px;
}
/* The separator between two column sets */
.ob_gCSetSep
{
top: -25px !important;
}
.ob_gHCont, .ob_gHContWG
{
z-index: 10 !important;
}
.ob_gHICont
{
overflow: visible !important;
}
I have found the solution, i had to modify the next files:
1.- I had to add the next line in the method addColumnSet of the column-set.js file :
this.GridColumnSetsContainer.setAttribute("id","BarraScroll");
I added it just after this line:
this.GridColumnSetsContainer.className = 'ob_gCSCont';
2.- i had to modify the next function : oboutGrid.prototype.synchronizeFixedColumns that is in the oboutgrid_scrolling.js file, and the method with all the changes is the next one, this method is called every time that that the user scroll the grid and the property NumberOrFixedColumns of the tag ScrollSetting that is inside of the grids tag is different of zero:
oboutGrid.prototype.synchronizeFixedColumns = function() {
var b = this.HorizontalScroller.firstChild.scrollLeft;
if (this.PreviousScrollLeft == b) return;
else this.PreviousScrollLeft = b;
var g = parseInt(this.ScrollWidth);
if (this.FixedColumnsPosition == 1) {
for (var f = this.getVisibleColumnsWidth(false), c = false, a = this.NumberOfFixedColumns; a < this.ColumnsCollection.length - 1; a++)
if (f > g) {
if (this.ColumnsCollection[a].Visible)
if (b >= this.ScrolledColumnsWidth) {
this.hideColumn(a, false, false);
this.markColumnsAsScrolled(a);
f = this.getVisibleColumnsWidth(false);
document.getElementById("BarraScroll").scrollLeft = b + this.ColumnsCollection[a].Width;
. c = true
} else break
} else break;
if (!c)
for (var a = this.ColumnsCollection.length - 2; a >= this.NumberOfFixedColumns; a--)
if (this.ColumnsCollection[a].RealVisible == true && this.ColumnsCollection[a].Visible == false)
if (b <= this.ScrolledColumnsWidth - this.ColumnsCollection[a].Width) {
document.getElementById("BarraScroll").scrollLeft = b;
this.showColumn(a, false, false);
this.unmarkColumnsAsScrolled(a)
} else break
} else {
for (var e = false, c = false, d = this.getFixedColumnsWidth() - this.PreviousFixedColumnsWidth, a = 1; a < this.ColumnsCollection.length - this.NumberOfFixedColumns; a++)
if (this.ColumnsCollection[a].RealVisible == true && this.ColumnsCollection[a].Visible == false)
if (b - d >= this.ScrolledColumnsWidth) {
document.getElementById("BarraScroll").scrollLeft = b + this.ColumnsCollection[a].Width;
this.showColumn(a, false, false);
this.markColumnsAsScrolled(a);
e = true
} else break;
var h = false;
if (!e)
for (var a = this.ColumnsCollection.length - this.NumberOfFixedColumns - 1; a > 0; a--)
if (this.ColumnsCollection[a].Visible)
if (b - d <= this.ScrolledColumnsWidth - this.ColumnsCollection[a].Width) {
document.getElementById("BarraScroll").scrollLeft = b;
this.hideColumn(a, false, false);
this.unmarkColumnsAsScrolled(a);
d = this.getFixedColumnsWidth() - this.PreviousFixedColumnsWidth;
c = true
} else break;
if (e || c) {
this.rightAlignGridContent();
if (b == 0) {
this.PreviousFixedColumnsWidth = this.getFixedColumnsWidth();
this.ScrolledColumnsIndexes = ",";
this.updateScrolledColumnsWidth()
}
}
}
};

Tumblr get Like Button status with Infinite Scroll

I would like to request the Like Button status of each post (by ID) that is appended by Infinite Scroll.
<li class="post text" id="{PostID}">
The Tumblr Documentation provides this method of checking the status of a Like Button for individual posts:
Tumblr.LikeButton.get_status_by_page(n)
Description: Call this function after requesting a new page of Posts. Takes the page number that was just loaded as an integer.
Finally, here is the Infinite Scroll script (Proto.jp modified by Cody Sherman):
$(document).ready(function() {
var tumblrAutoPager = {
url: "http://proto.jp/",
ver: "0.1.7",
rF: true,
gP: {},
pp: null,
ppId: "",
LN: location.hostname,
init: function() {
if ($("autopagerize_icon") || navigator.userAgent.indexOf('iPhone') != -1) return;
var tAP = tumblrAutoPager;
var p = 1;
var lh = location.href;
var lhp = lh.lastIndexOf("/page/");
var lht = lh.lastIndexOf("/tagged/");
if (lhp != -1) {
p = parseInt(lh.slice(lhp + 6));
tAP.LN = lh.slice(7, lhp);
} else if (lht != -1) {
tAP.LN = lh.slice(7);
if (tAP.LN.slice(tAP.LN.length - 1) == "/") tAP.LN = tAP.LN.slice(0, tAP.LN.length - 1);
} else if ("http://" + tAP.LN + "/" != lh) {
return;
};
var gPFncs = [];
gPFncs[0] = function(aE) {
var r = [];
for (var i = 0, l = aE.length; i < l; i++) {
if (aE[i].className == "autopagerize_page_element") {
r = gCE(aE[i]);
break;
}
}
return r;
};
gPFncs[1] = function(aE) {
var r = [];
for (var i = 0, l = aE.length; i < l; i++) {
var arr = aE[i].className ? aE[i].className.split(" ") : null;
if (arr) {
for (var j = 0; j < arr.length; j++) {
arr[j] == "post" ? r.push(aE[i]) : null;
}
}
}
return r;
};
gPFncs[2] = function(aE) {
var r = [];
var tmpId = tAP.ppId ? [tAP.ppId] : ["posts", "main", "container", "content", "apDiv2", "wrapper", "projects"];
for (var i = 0, l = aE.length; i < l; i++) {
for (var j = 0; j < tmpId.length; j++) {
if (aE[i].id == tmpId[j]) {
r = gCE(aE[i]);
tAP.ppId = aE[i].id;
break;
}
}
}
return r;
};
for (var i = 0; i < gPFncs.length; i++) {
var getElems = gPFncs[i](document.body.getElementsByTagName('*'));
if (getElems.length) {
tAP.gP = gPFncs[i];
tAP.pp = getElems[0].parentNode;
break;
}
}
function gCE(pElem) {
var r = [];
for (var i = 0, l = pElem.childNodes.length; i < l; i++) {
r.push(pElem.childNodes.item(i))
}
return r;
}
if (!tAP.pp) {
return;
}
sendRequest.README = {
license: 'Public Domain',
url: 'http://jsgt.org/lib/ajax/ref.htm',
version: 0.516,
author: 'Toshiro Takahashi'
};
function chkAjaBrowser() {
var A, B = navigator.userAgent;
this.bw = {
safari: ((A = B.split('AppleWebKit/')[1]) ? A.split('(')[0].split('.')[0] : 0) >= 124,
konqueror: ((A = B.split('Konqueror/')[1]) ? A.split(';')[0] : 0) >= 3.3,
mozes: ((A = B.split('Gecko/')[1]) ? A.split(' ')[0] : 0) >= 20011128,
opera: ( !! window.opera) && ((typeof XMLHttpRequest) == 'function'),
msie: ( !! window.ActiveXObject) ? ( !! createHttpRequest()) : false
};
return (this.bw.safari || this.bw.konqueror || this.bw.mozes || this.bw.opera || this.bw.msie)
}
function createHttpRequest() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest()
} else {
if (window.ActiveXObject) {
try {
return new ActiveXObject('Msxml2.XMLHTTP')
} catch (B) {
try {
return new ActiveXObject('Microsoft.XMLHTTP')
} catch (A) {
return null
}
}
} else {
return null
}
}
};
function sendRequest(E, R, C, D, F, G, S, A) {
var Q = C.toUpperCase() == 'GET',
H = createHttpRequest();
if (H == null) {
return null
}
if ((G) ? G : false) {
D += ((D.indexOf('?') == -1) ? '?' : '&') + 't=' + (new Date()).getTime()
}
var P = new chkAjaBrowser(),
L = P.bw.opera,
I = P.bw.safari,
N = P.bw.konqueror,
M = P.bw.mozes;
if (typeof E == 'object') {
var J = E.onload;
var O = E.onbeforsetheader
} else {
var J = E;
var O = null
}
if (L || I || M) {
H.onload = function() {
J(H);
H.abort()
}
} else {
H.onreadystatechange = function() {
if (H.readyState == 4) {
J(H);
H.abort()
}
}
}
R = K(R, D);
if (Q) {
D += ((D.indexOf('?') == -1) ? '?' : (R == '') ? '' : '&') + R
}
H.open(C, D, F, S, A);
if ( !! O) {
O(H)
}
B(H);
H.send(R);
function B(T) {
if (!L || typeof T.setRequestHeader == 'function') {
T.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
}
return T
}
function K(X, V) {
var Z = [];
if (typeof X == 'object') {
for (var W in X) {
Y(W, X[W])
}
} else {
if (typeof X == 'string') {
if (X == '') {
return ''
}
if (X.charAt(0) == '&') {
X = X.substring(1, X.length)
}
var T = X.split('&');
for (var W = 0; W < T.length; W++) {
var U = T[W].split('=');
Y(U[0], U[1])
}
}
}
function Y(b, a) {
Z.push(encodeURIComponent(b) + '=' + encodeURIComponent(a))
}
return Z.join('&')
}
return H
}
function addNextPage(oj) {
if (oj.status == 404) {
tAP.remainFlg = false;
return;
}
var d = document.createElement("div");
d.innerHTML = oj.responseText;
var posts = tAP.gP(d.getElementsByTagName("*"));
if (posts.length < 2) {
tAP.rF = false;
return;
}
d = document.createElement("div");
d.className = "tumblrAutoPager_page_info";
tAP.pp.appendChild(d);
for (var i = 0; i < posts.length; i++) {
tAP.pp.appendChild(posts[i]);
}
var footer = $("footer");
footer ? footer.parentNode.appendChild(footer) : null;
tAP.rF = true;
}
watch_scroll();
function watch_scroll() {
var d = document.compatMode == "BackCompat" ? document.body : document.documentElement;
var r = d.scrollHeight - d.clientHeight - (d.scrollTop || document.body.scrollTop);
if (r < d.clientHeight * 2 && tAP.rF) {
tAP.rF = false;
p++;
sendRequest(addNextPage, "", "GET", "http://" + tAP.LN + "/page/" + p, true);
}
setTimeout(arguments.callee, 200);
};
function $(id) {
return document.getElementById(id)
}
},
switchAutoPage: function() {
this.rF = !this.rF;
var aE = document.getElementsByTagName('*');
for (var i = 0, l = aE.length; i < l; i++) {
if (aE[i].className == "tAP_switch") {
aE[i].firstChild.nodeValue = this.rF ? "AutoPage[OFF]" : "AutoPage[ON]";
}
}
}
};
window.addEventListener ? window.addEventListener('load', tumblrAutoPager.init, false) : window.attachEvent ? window.attachEvent("onload", tumblrAutoPager.init) : window.onload = tumblrAutoPager.init;
});
Any insight is greatly appreciated. Thank you!
This seemed to do the trick!
function addNextPage(oj) {
if (oj.status == 404) {
tAP.remainFlg = false;
return;
}
var d = document.createElement("div");
d.innerHTML = oj.responseText;
var posts = tAP.gP(d.getElementsByTagName("*"));
if (posts.length < 2) {
tAP.rF = false;
return;
}
d = document.createElement("div");
d.className = "tumblrAutoPager_page_info";
tAP.pp.appendChild(d);
for (var i = 0; i < posts.length; i++) {
tAP.pp.appendChild(posts[i]);
}
var footer = $("footer");
footer ? footer.parentNode.appendChild(footer) : null;
tAP.rF = true;
//Get Like Button status of newly appended page
Tumblr.LikeButton.get_status_by_page(p);
}

Resources