Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
// ======================================================================= // // SET THE CURRENT PAGE NAME // // ======================================================================= // Log window name to console TiAPI.info"############### FAVORITES ##################"; // ======================================================================= // // THE CURRENT WINDOWS BASIC SETTINGS // // ======================================================================= // Set the current window into a variable var window = TiUIcurrentWindow; // ======================================================================= // // SET THE CURRENT WINDOW BACKGROUND COLOR // // ======================================================================= // Set the background color TitaniumUIsetBackgroundColor'#000'; // ======================================================================= // // INCLUDE THE DEPENDENCIES // // ======================================================================= // Include the crud file Tiinclude"../common/twitter_crud.js"; // Include the utilities file Tiinclude"../common/utilities.js"; // ======================================================================= // // THE MAIN BUTTONS // // ======================================================================= // Create the button var button_accounts = TitaniumUIcreateButton title: 'Accounts' ; // ======================================================================= // // SET THE TABLE // // ======================================================================= // Create the table view var table = TiUIcreateTableView editable: true backgroundColor: '#191919' separatorColor: '#6a6a6a' ; // ======================================================================= // // ACTIVITY INDICATOR // // ======================================================================= // Create the activity indicator var actInd = TitaniumUIcreateActivityIndicator bottom:10 height:50 width:10 style:TitaniumUIiPhoneActivityIndicatorStylePLAIN ; // ======================================================================= // // GET THE DATA // // ======================================================================= // Define the function // Place the activity indicator windowsetTitleControlactInd; // Show the activity indicator actIndshow; // Create the data array var theData = ; // Set the screen name var screen_name = TitaniumAppPropertiesgetString"twitter_screen_name"; // Make the request to the API twitterGETexecute'favorites.json?include_entities=true&screen_name=' + screen_nameactionfunctionresponse // Loop through the response for var i = 0; i < responselength; i++ // Set the response data to variables var id = responseiid; var tweet = responseitext; var user = responseiusername; var avatar = responseiuserprofile_image_url; var created_at = prettyDateresponseicreated_at; // Open the database var db = TitaniumDatabaseopen'tweevorites'; // Make sure the tables are all set dbexecute'CREATE TABLE IF NOT EXISTS read (id INTEGER PRIMARY KEY, token VARCHAR(255) NULL, tweet_id VARCHAR(255) NULL)'; // Check if the tweet is already read var results = dbexecute'SELECT token FROM read WHERE tweet_id = ?'id; // If the account is not already saved if !resultsisValidRow // Create the avatar image var user_avatar = TitaniumUIcreateImageView image: avatar top: 10 left: 10 width: 52 height: 52 borderRadius: 5 backgroundColor: '#333' preventDefaultImage: true ; // Create the datetime label var datetime = TitaniumUIcreateLabel text: created_at font:fontSize:11fontWeight: 'normal' color: '#999' right: 10 top: 10 width: 'auto' height: 'auto' ; // Create the fullname label var fullname = TitaniumUIcreateLabel text: user font:fontSize:14fontFamily:'Helvetica Neue'fontWeight:'bold' color: '#f4f4f4' left: 72 top: 7 width: 200 height: 20 ; // Create the message label var message = TitaniumUIcreateLabel text: tweet font:fontSize:14 color: '#828282' left: 72 top: 30 bottom: 10 width: 230 height: 'auto' ; // Create the row var row = TiUIcreateTableViewRow className: 'feed_item' height: 'auto' backgroundColor: '#191919' tweet_id: id tweet_links: findUrlstweet ; // Add the avatar to the row rowadduser_avatar; // Add the avatar to the row rowadddatetime; // Add the fullname to the row rowaddfullname; // Add the mssage to the row rowaddmessage; // Add the row to the array theDatapushrow; // Close the resultSet resultsclose; // Close the database dbclose; // Add the data to the table tablesetDatatheData; // Hide the activity indicator actIndhide; // Set the title to default again windowsetTitleControlnull; // Create the links dialog var dialog = TitaniumUIcreateOptionDialog; // Create an event listener for the button tableaddEventListener'click'functione // Get the length of the array var array_length = erowtweet_linkslength; // Make sure that the cancel button is correct if array_length > 1 // Add options to dialog dialogoptions = erowtweet_links; // Add cancel button to dialog dialogcancel = array_length - 1; // Load the database dialogshow; ; // Create an event listener for the button dialogaddEventListener'click'functione // Make sure the user did not click the cancel button if esourceoptionseindex != "Cancel" // Create the browser window var win_browser = TitaniumUIcreateWindow title: 'Browser' barColor: '#000' url:'browser.js' navBarHidden: false tabBarHidden: false address: esourceoptionseindex ; // Animate the page turn TitaniumUIcurrentTabopenwin_browser; ; // Create an event listener for the button tableaddEventListener'delete'functione // Load the database var db = TiDatabaseopen'tweevorites'; // Insert the tweet into the read table dbexecute'INSERT INTO read (token,tweet_id) VALUES (?,?)'TitaniumAppPropertiesgetString"twitter_token"erowtweet_id; ; ; // ======================================================================= // // START THE PULL TO REFRESH // // ======================================================================= // Create the table header var tableHeader = TitaniumUIcreateView backgroundColor:"#191919" width:320 height:60 ; // Create the activity indicator var tableHeader_actInd = TitaniumUIcreateActivityIndicator left:20 bottom:13 width:30 height:30 color: 'black' style: TitaniumUIiPhoneActivityIndicatorStyleDARK ; // Create the loading arrow var tableHeader_arrow = TiUIcreateView backgroundImage:"../images/arrow.png" width:16 height:16 bottom:20 left:25 ; // Create the loading label var tableHeader_label = TitaniumUIcreateLabel text: 'Pull down to refresh' font:fontSize:13fontWeight: 'bold' color: '#fff' left: 10 textAlign: 'center' bottom: 22 height: 'auto' width: 320 ; // Add the loading arrow to the table tableHeaderaddtableHeader_arrow; // Add the loading icon to the table tableHeaderaddtableHeader_actInd; // Add the loading label to the table tableHeaderaddtableHeader_label; // Add the table header to the table header tableheaderPullView = tableHeader; // Set the variable pulling to false var pulling = false; // Set the variable reloading to false var reloading = false; // Check for movement tableaddEventListener'scroll'functione // Set the offset var offset = econtentOffsety; // Check the current position if offset <= -65.0 && !pulling // Create the 2D matrix var matrix = TiUIcreate2DMatrix; // Rotate the matrix matrix = matrixrotate-180; // Animate the arrow tableHeader_arrowanimatetransform:matrixduration:180; // Set the default value pulling = true; // Set current status tableHeader_labeltext = "Release to refresh"; else if pulling && offset > -65.0 && offset < 0 // Set the default value pulling = false; // Create the 2D matrix var t = TiUIcreate2DMatrix; // Animate the arrow tableHeader_arrowanimatetransform:tduration:180; // Set current status tableHeader_labeltext = "Pull down to refresh"; ; // Define the end reload function // Reload the content buildTable'delFromCache'; // Reset the table content inset tablesetContentInsetstop:0animated:true; // Set reloading to false reloading = false; // Set the label text back again tableHeader_labeltext = "Pull down to refresh..."; // Hide the activity indicator tableHeader_actIndhide; // Set back the arrow again tableHeader_arrowshow; // Set a timeout for the reloading setTimeoutendReloading2000; // Refresh content on release tableaddEventListener'scrollEnd'functione // Check the current position if pulling && !reloading && econtentOffsety <= -65.0 // Set the variable reloading to true reloading = true; // Set the variable pulling to false pulling = false; // Hide the arrow tableHeader_arrowhide; // Show the activity indicator tableHeader_actIndshow; // Set current status tableHeader_labeltext = "Reloading content..."; // Adjust the height tablesetContentInsetstop:60animated:true; // Remove the pull to refresh beginReloading; ; // ======================================================================= // // ADD TO THE CURRENT WINDOW // // ======================================================================= // Get the data from the API call buildTable'delFromCache'; // Add the button to the window windowsetLeftNavButtonbutton_accounts; // Add the table to the window windowaddtable; |