This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CarModel extends AppModel{ | |
public $fields = array( | |
'title' => true, | |
'editor'=> true, | |
'thumbnail' => true | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CarModel extends AppModel{ | |
public $fields = array( | |
// Default Wordpress Fields | |
'title' => true, | |
'editor'=> true, | |
'thumbnail' => true, | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// List all cars | |
foreach($app->car->find() as $car): | |
echo $car->title>." - ".$car->model; | |
foreach($car->photos as $photo): | |
echo "<img src='".$photo->thumbnail."' />"; | |
endforeach; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "update_url":"http://clients2.google.com/service/update2/crx", | |
"name": "Facebook Posts Filter", | |
"description": "Hides posts on facebook according to specified keywords.", | |
"version": "0.3", | |
"options_page": "options.html", | |
"permissions": [ | |
"storage" | |
], | |
"page_action" : | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hidePost(){ | |
// Varre todas as postagens que estão na tela | |
$('.uiUnifiedStory, ._4ikz').each(function(i, item) { | |
var texto = $(item).text().toLowerCase(); | |
// Recupera as palavras-chave cadastradas pelo usuário | |
chrome.storage.local.get("fbfilter_keywords", function(fetchedData) { | |
var keywords = fetchedData.fbfilter_keywords.split(','); | |
// Verifica se alguma palavra está presente no post | |
$(keywords).each(function(a, palavra){ | |
palavra = palavra.toLowerCase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Facebook Filter</title> | |
<link rel="stylesheet" type="text/css" href="options.css" /> | |
</head> | |
<body> | |
<div id="content"> | |
<h1>Facebook Posts Filter</h1> | |
<p>Setup the keywords to hide posts on Facebook:</p> | |
<div id="keywords"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Salva as opções pro localstorage | |
function save_options() { | |
var keywords = $('#keywords-field').val(); | |
// Salva no localstorage da extensão com a chave "fbfilter_keywords" | |
chrome.storage.local.set({'fbfilter_keywords': keywords}, function() { | |
$('#status').fadeIn(800, function(){ | |
setTimeout(function() { | |
$('#status').fadeOut(400); | |
}, 2000); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variables | |
var num = 100; | |
var str = "<span>Hello!</span><br />"; | |
// Let's repeat the test | |
for(var z = 0; z < 10; z++){ | |
document.querySelector("#main").innerHTML = ''; | |
// Example using pure and without concat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i = 0; i < num; i++){ | |
document.querySelector("#main").innerHTML += str; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var main = document.querySelector("#main"), | |
html = main.innerHTML; | |
for(var i = 0; i < num; i++){ | |
html += str; | |
} | |
main.innerHTML = html; |