diff --git a/.DS_Store b/.DS_Store
index c43ee62..171fb16 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
index 6d79fa5..7146e04 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,2 @@
conf.php
-.htaccess
-scrapers/*
\ No newline at end of file
+rake/scrapers/*
diff --git a/.htaccess-default b/.htaccess-default
deleted file mode 100755
index 46f5d91..0000000
--- a/.htaccess-default
+++ /dev/null
@@ -1,14 +0,0 @@
-# INSTRUCTIONS:
-# Lines that need to be edited are enclosed with # EDIT # and # /EDIT #
-
-RewriteEngine On
-
-# EDIT #
-RewriteBase [SITE_ROOT]
-# /EDIT #
-
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteRule ^api/(.*) api.php?q=$1 [QSA,L]
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^(.*) index.php?q=$1 [QSA,L]
\ No newline at end of file
diff --git a/README b/README
index ea28367..e379907 100755
--- a/README
+++ b/README
@@ -1,23 +1,22 @@
== INSTALL ==
cp conf-default.php conf.php
-edit conf.php
-cp .htaccess-default .htaccess
-edit .htaccess
-php install.php
-php datarake.php
-
+vi conf.php
+php rake/db_rake.php
+php rake/data_rake.php
== UPDATE ==
-php install.php
-
+php rake/db_rake.php
== DATA REFRESH ==
// CAUTION: this may delete data you wanted to keep -- be sure to backup the schema if you want to retain your information
-php datarake.php
+php rake/data_rake.php
==Fake lightweight "Framework"==
Models are in the models folder
No controllers, but instead actions are autorouted to the proper page
-URL style is "something.com/?p=[page]&a=[action]
-DIR style is /pages/[page]/[action].php
\ No newline at end of file
+URL style is "something.com/[page]/[action]
+DIR style is /pages/[page]/[action].php
+
+API URL style is "something.com/api/[page]/[action]
+API DIR style is /api/[page]/[method]_[action].php
\ No newline at end of file
diff --git a/api/claims/post_claims.php b/api/claims/post_claims.php
index 4610ebc..f8df122 100755
--- a/api/claims/post_claims.php
+++ b/api/claims/post_claims.php
@@ -1,9 +1,4 @@
= $cutoff)
&& ($match_tracker[$x]["non_stop_matches"][$y] >= $non_stop_cutoff)) {
if($match_start == -1) {
$match_start = $y;
- //echo("START"."\n");
}
}
elseif($match_start != -1)
$match_end = $y + $match_tracker[$x]["matches"][$y];
-
- //echo($x." ::".$match_tracker[$x]["matches"][$y].":".$match_tracker[$x]["non_stop_matches"][$y].":: ".$token_strings[$y]."\n");
}
}
diff --git a/api/corpus_items/get_corpus_items.php b/api/corpus_items/get_corpus_items.php
deleted file mode 100755
index 49a7ba2..0000000
--- a/api/corpus_items/get_corpus_items.php
+++ /dev/null
@@ -1 +0,0 @@
-USE POST
\ No newline at end of file
diff --git a/api/snippets/post_snippets.php b/api/snippets/post_snippets.php
index c640744..442fc37 100755
--- a/api/snippets/post_snippets.php
+++ b/api/snippets/post_snippets.php
@@ -1,9 +1,4 @@
\ No newline at end of file
diff --git a/api.php b/includes/engine/api.php
similarity index 60%
rename from api.php
rename to includes/engine/api.php
index d0202f8..3964aa2 100755
--- a/api.php
+++ b/includes/engine/api.php
@@ -1,18 +1,19 @@
\ No newline at end of file
diff --git a/includes/engine/core/FactoryObject.php b/includes/engine/core/FactoryObject.php
new file mode 100644
index 0000000..912cea8
--- /dev/null
+++ b/includes/engine/core/FactoryObject.php
@@ -0,0 +1,254 @@
+ 0)
+ $this->load($dataArrays[0]);
+ }
+
+ ###
+ # Abstract Methods
+ /**
+ * Reset any caches assocciated with the object
+ *
+ * This will flush any cache associated with the object
+ *
+ * This method will alays be called any time a method is created by the factory
+ *
+ * @return null
+ */
+ abstract public function refreshCache();
+
+ /**
+ * Collect data to populate this class
+ *
+ * This method must be implemented. It communicates with the database to load the information associated with the object according to the selector
+ *
+ * The resulting data arrays are passed into the load() method
+ *
+ * It may load information for multiple objects at once.
+ *
+ * The FactoryObject load method expects two specific fields to be populated:
+ * * itemId
+ * * dateCreated
+ *
+ * @param string $selector a database-safe selector that resolves to a list of itemIds to be used in a SQL query.
+ * @return mixed[][] An array of data arrays. Data arrays contain values for the object, keys are instance variable names.
+ * @see load
+ */
+ abstract protected static function gatherData($selector);
+
+ /**
+ * Select all objects of a particular type
+ *
+ * This method must be invoked by any class that implements FactoryObject
+ *
+ * @return FactoryObject[]
+ */
+ abstract protected static function getAllObjects();
+
+ /**
+ * Checks to see if the object is valid
+ *
+ * Objects implementing FactoryMethod are expected to implement this method.
+ *
+ * @return boolean true if valid, false if invalid
+ */
+ abstract public function validate();
+
+ /**
+ * Deletes the current object
+ *
+ * Objects implementing FactoryMethod are expected to implement this method.
+ *
+ * Their implementation should be sure to clean up any data related to the object.
+ *
+ * @return null
+ */
+ abstract public function delete();
+
+ /**
+ * Returns a string that can be used when showing this item to a user.
+ *
+ * @return string A meaningful string to identify this object to a user
+ */
+ public abstract function getItemTitle();
+
+
+ ####
+ # Data Methods
+ /**
+ * Loads relevant data into the object
+ *
+ * At this level it will only populate $itemId and $dateCreated. Inherited classes must override this method to populate more specific instance variables.
+ *
+ * Any methods that override this method should be sure to call the super's load.
+ *
+ * @param mixed[] $dataArray The data to insert into the
+ * @return null
+ */
+ protected function load($dataArray) {
+ // Reset any caches
+ $this->refreshCache();
+
+ // Set the item ID
+ $this->itemId = isset($dataArray["itemId"])?$dataArray["itemId"]:0;
+ $this->dateCreated = isset($dataArray["dateCreated"])?$dataArray["dateCreated"]:0;
+ }
+
+ /**
+ * Save the object
+ *
+ * @return null
+ * @uses refresh() to reset variables associated with this method
+ */
+ public function save() {
+ $this->refresh();
+ return $this;
+ }
+
+ /**
+ * Reloads all data associated with the object
+ *
+ * @return null
+ */
+ public function refresh() {
+ $dataArrays = static::gatherData($this->getItemId());
+ $this->load($dataArrays[0]);
+ }
+
+ ####
+ # Getters
+ /**
+ * A getter method to access the item ID.
+ *
+ * @return integer Is the item's ID
+ */
+ public final function getItemId() { return $this->itemId; }
+
+ /**
+ * A getter method to access the item's Creation Date.
+ *
+ * @return timestamp Is the items creation date
+ */
+ public final function getDateCreated() { return $this->dateCreated; }
+
+ /**
+ * A helper method to know if the item has been saved in the past.
+ *
+ * @return boolean true if the object has been saved in the past. false if the object has not been saved in the past.
+ */
+ public final function isUpdate() { return ($this->getItemId() > 0); }
+
+ ####
+ # Setters
+ /**
+ * A setter method to specify the item ID
+ *
+ * @param [type] $this->itemId [description]
+ * @throws \engine\exceptions\ImmutableException If this item already has an $itemId
+ */
+ protected final function setItemId($itemId) {
+ if($this->getItemId() > 0)
+ throw new \engine\exceptions\ImmutableException("You cannot specify an item ID for an item that has already been saved.");
+ $this->itemId = (int)$itemId;
+ }
+
+ ####
+ # Static Methods
+ /**
+ * Returns a single object.
+ *
+ * Takes in a single object ID and returns the associated object.
+ *
+ * @param integer|string $objectSelector An ID or the SQL statement to specify the object ID to be selected.
+ * @return null|FactoryObject the specified object, or null if the object could not be found.
+ */
+ public static function getObject($objectSelector) {
+ $dataArrays = static::gatherData($objectSelector);
+ if(sizeof($dataArrays) == 0)
+ return null;
+
+ $newObject = new static();
+ $newObject->load($dataArrays[0]);
+ return $newObject;
+ }
+
+ /**
+ * Returns a list of objects.
+ *
+ * Takes in a collection of object IDs and returns the associated objects.
+ *
+ * @param integer[]|string $objectSelector An array of IDs or the SQL statement to specify the object IDs to be selected.
+ * @return FactoryObject[] a list of the specified objects (this list can be empty if no objects matched)
+ */
+ public static function getObjects($objectSelectors) {
+
+ // If it's an array clean it
+ if(is_array($objectSelectors))
+ foreach($objectSelectors as $key=>$objectID)
+ $objectSelectors[$key] = (int)$objectID;
+ elseif(!is_string($objectSelectors))
+ return array();
+
+ // Load the data
+ $dataArrays = static::gatherData($objectSelectors);
+ if(sizeof($dataArrays) == 0)
+ return array();
+
+ // Create the objects
+ $objectArray = array();
+ foreach($dataArrays as $dataArray) {
+ $newObject = new static();
+ $newObject->load($dataArray);
+ $objectArray[] = $newObject;
+ }
+ return $objectArray;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/includes/engine/page.php b/includes/engine/page.php
new file mode 100644
index 0000000..da75b2d
--- /dev/null
+++ b/includes/engine/page.php
@@ -0,0 +1,22 @@
+
\ No newline at end of file
diff --git a/models/Claim.php b/includes/models/Claim.php
similarity index 94%
rename from models/Claim.php
rename to includes/models/Claim.php
index ee79233..43d6573 100755
--- a/models/Claim.php
+++ b/includes/models/Claim.php
@@ -1,18 +1,10 @@
-
-
- Truth Goggles Test Bed
-
-
-
- This is just a simple page that contains an automatically loaded version of the goggles.
-
-
-
-
- "Over the last four years, 53 percent of black wealth has just disappeared."
-
Donna Brazile on Sunday, August 21st, 2011 in a comment on 'This Week with Christiane Amanpour'
-
-
-
-
Brazile said 53 percent of black wealth has disappeared in the downturn
-
-
-
-
-
Share this story:
-
-
-
-
-
-
-
-
-
-
-
- If some of President Barack Obama's supporters are irritated with him about jobs, it's understandable because the times are so hard, said Democratic strategist Donna Brazile on This Week with Christiane Amanpour.
-
- Brazile was responding to a question about harsh words for Obama from Rep. Maxine Waters, D-Calif., a member of the Congressional Black Caucus.
-
- "The president has to do more than just run against Congress. He has to tell the American people that his administration has used every tool at their disposal to get job creation back on track," Brazile said. "But over the last four years, 53 percent of black wealth has just disappeared. The average -- for white families, the median income is $113,000. For black families, $5,000, $5,000. It has dropped.
-
- "So these families are hurting. They want help. They want relief. They don't want to hear about Congress. They don't want to hear about the tea party. They don't want to hear another plan. They want jobs," she said.
-
- We decided to fact-check Brazile's statement that "over the last four years, 53 percent of black wealth has just disappeared." We'll also explain her comment that "for white families, the median income is $113,000. For black families, $5,000, $5,000," which actually has a critical slip of the tongue. She should have repeated the word "wealth" in place of "income." More on that in a bit.
-
- Brazile's first number comes from a recent study by the Pew Research Center, a nonpartisan "fact tank" that provides information on demographic trends but does not take policy positions. A study from Pew's Social & Demographic Trends project released a report about racial disparities in family wealth on July 26, 2011.
-
- That report analyzed data from the Survey of Income and Program Participation (SIPP), an economic survey conducted by the U.S. Census Bureau.
-
- The Pew report analyzed household wealth, a very different measurement than income. "Household wealth is the accumulated sum of assets (houses, cars, savings and checking accounts, stocks and mutual funds, retirement accounts, etc.) minus the sum of debt (mortgages, auto loans, credit card debt, etc.)," the report states. "It is different from household income, which measures the annual inflow of wages, interest, profits and other sources of earning. Wealth gaps between whites, blacks and Hispanics have always been much greater than income gaps."
-
- As you might be able to guess from that definition, home values are a critical component of household wealth, and plummeting home values were responsible for wiping out a good deal of household wealth. The Pew report specifically compared the data from the 2005 survey with a 2009 survey, the most recent data available.
-
- From the Pew report: "The Pew Research Center analysis finds that, in percentage terms, the bursting of the housing market bubble in 2006 and the recession that followed from late 2007 to mid-2009 took a far greater toll on the wealth of minorities than whites. From 2005 to 2009, inflation-adjusted median wealth fell by 66% among Hispanic households and 53% among black households, compared with just 16% among white households. As a result of these declines, the typical black household had just $5,677 in wealth (assets minus debts) in 2009, the typical Hispanic household had $6,325 in wealth and the typical white household had $113,149."
-
- For comparison, in 2005 the median black household wealth was $12,124; Hispanic household wealth was $18,359; and white household wealth was $134,992.
-
- Brazile said that, "Over the last four years, 53 percent of black wealth has just disappeared." The Pew report wasn't for the most recent four years, as Brazile's words imply, but for the period between 2005 and 2009. However, as we already noted, that is the most recently available data from the Census.
-
- We're doing a fact-check on the 53 percent loss of black wealth claim, but we should point out that Brazile went wrong in her second statement -- "for white families, the median income is $113,000. For black families, $5,000" -- when she said "income." She should have simply repeated the word "wealth."
-
- We're rating Brazile's statement, "Over the last four years, 53 percent of black wealth has just disappeared." That is the percentage that the Pew report found, based on data collected by the U.S. Census. But the years in question were 2005 to 2009. So we deduct one notch off the Truth-O-Meter and rate Brazile's statement Mostly True.
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/models/CorpusItem.php b/models/CorpusItem.php
deleted file mode 100755
index 687aa41..0000000
--- a/models/CorpusItem.php
+++ /dev/null
@@ -1,178 +0,0 @@
-query($query_string)
- or print($mysqli->error);
-
- while($resultArray = $result->fetch_assoc()) {
- $data_array = array();
- $data_array['itemID'] = $resultArray['itemID'];
- $data_array['claimID'] = $resultArray['claimID'];
- $data_array['content'] = $resultArray['content'];
- $data_array['dateCreated'] = $resultArray['dateCreated'];
- $data_arrays[] = $data_array;
- }
-
- $result->free();
- return $data_arrays;
- }
-
- public function load($data_array) {
- parent::load($data_array);
- $this->claimID = isset($data_array["claimID"])?$data_array["claimID"]:0;
- $this->content = isset($data_array["content"])?$data_array["content"]:"";
- $this->dateCreated = isset($data_array["dateCreated"])?$data_array["dateCreated"]:0;
- }
-
-
- # JSONObject Methods
- public function toJSON() {
- $json = '{
- "id": '.DBConn::clean($this->getItemID()).',
- "claim_id": '.DBConn::clean($this->getClaimID()).',
- "content": '.DBConn::clean($this->getContent()).',
- "date_created": '.DBConn::clean($this->getDateCreated()).'
- }';
- return $json;
- }
-
-
- # Data Methods
- public function validate() {
- return true;
- }
-
- public function save() {
- if(!$this->validate()) return;
-
- $mysqli = DBConn::connect();
-
- if($this->isUpdate()) {
- // Update an existing record
- $query_string = "UPDATE corpus_items
- SET corpus_items.claim_id = ".DBConn::clean($this->getClaimID()).",
- AND corpus_items.content = ".DBConn::clean($this->getContent()).",
- WHERE corpus_items.id = ".DBConn::clean($this->getItemID());
-
- $mysqli->query($query_string) or print($mysqli->error);
- } else {
- // Create a new record
- $query_string = "INSERT INTO corpus_items
- (corpus_items.id,
- corpus_items.claim_id,
- corpus_items.content,
- corpus_items.date_created)
- VALUES (0,
- ".DBConn::clean($this->getClaimID()).",
- ".DBConn::clean($this->getContent()).",
- NOW())";
-
- $mysqli->query($query_string) or print($mysqli->error);
- $this->setItemID($mysqli->insert_id);
- }
-
- // Parent Operations
- return parent::save();
- }
-
- public function delete() {
- parent::delete();
- $mysqli = DBConn::connect();
-
- // Delete this record
- $query_string = "DELETE FROM corpus_items
- WHERE corpus_items.id = ".DBConn::clean($this->getItemID());
- $mysqli->query($query_string);
- }
-
-
- # Getters
- public function getClaimID() { return $this->claimID; }
-
- public function getContent() { return $this->content; }
-
- public function getDateCreated() { return $this->dateCreated; }
-
- public function getClaim() {
- if($this->claim != null)
- return $this->claim;
- return $this->claim = Claim::getObject($this->getClaimID());
- }
-
- # Setters
- public function setClaimID($int) { $this->claimID = $int; }
-
- public function setContent($str) { $this->content = $str; }
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/pages/site/home/home.php b/pages/site/home/home.php
new file mode 100644
index 0000000..a43919b
--- /dev/null
+++ b/pages/site/home/home.php
@@ -0,0 +1 @@
+asdfa
\ No newline at end of file
diff --git a/pages/study/gmos/gmos.php b/pages/study/gmos/gmos.php
new file mode 100644
index 0000000..52204fb
--- /dev/null
+++ b/pages/study/gmos/gmos.php
@@ -0,0 +1,31 @@
+
+
+ Feelings, Food and Genetic Engi-neering
+
+
+
+
+
Feelings, Food and Genetic Engi-neering
+
As the old saying goes: A person's got to eat! But reliably feeding the global population is easier said than done. This is why, in order to supply enough food around the world, farmers and scientists have begun to incorporate a few controversial techniques in the way they grow and produce the stuff that goes into our meals.
+
For the past 10,000 years, humans have been using technology to improve the way we feed our species, but some of the techniques developed in the past century are raising concerns among some politicians and environmentalists alike. In the last few decades we have seen an introduction of Genetically Modified Organisms (GMOs) into the marketplace.
+
To create a GMO, scientists artificially incorporate genetic material from other plants and animals into harvests in order to create crops that exhibit specific new traits. For example, modified cotton seeds have been designed to help the resulting plants withstand insect attacks, which allows farmers to avoid use of synthetic chemicals and other pesticides.
+
One of the motivations behind this kind of development is the fact that the United Nations predicts that the global population will hit 9 billion people by 2050. Feeding that many people is going to take a lot of food, and forecasters are concerned that we will not be able to meet the demand if the current trends do not change.
+
The promise that genetically modified crops could help feed the world is at least as old as the commercialization of the first transgenic seeds in the mid-1990s. The corporations that helped turn genetically engineered crops into a multibillion-dollar business, including the large chemical companies Monsanto, Bayer, and DuPont, promoted the technology as part of a life science revolution that would greatly increase food production. So far it’s turned out, for a number of reasons, to have been a somewhat empty promise.
+
So far, the short list of transgenic crops used directly for food includes virus-resistant papaya grown in Hawaii, Bt sweet corn recently commercialized in the United States by Monsanto, and a few varieties of squash that resist plant viruses. That list could be about to grow, however, as the Indonesian agricultural agency expects to approve a blight-resistant potato soon. There are also a wide variety of inedible applications for GMOs outside of food production, ranging from energy generators to providers of transplant organs.
+
But regardless of the use case, tampering with something as complex as genetic information has the potential for unexpected side effects. After all, these alterations are generally designed to change the organism's metabolism, growth rate, or response to external environmental factors. These consequences have the potential to influence not only the GMO itself, but also the natural environment in which that organism is allowed to proliferate.
+
These kinds of risks are part of the reason that the FDA regulates GM foods as part of the coordinated framework of federal agencies that also includes the Environmental Protection Agency (EPA) and the United States Department of Agriculture (USDA). However, critics of this system complain that the regulation is opt-in, meaning there is no centralized government body responsible for evaluating the products.
+
Clearly we need to find a safe, healthy, sustainable way to feed the world for generations to come. For now all eyes are on researchers to decide whether or not GMOs can meet all of those conditions; if not, we will just have to cross our fingers hoping for the next agricultural revolution.
+
+
\ No newline at end of file
diff --git a/pages/study/guns/guns.php b/pages/study/guns/guns.php
new file mode 100644
index 0000000..ed1def3
--- /dev/null
+++ b/pages/study/guns/guns.php
@@ -0,0 +1,32 @@
+
+
+ Feelings, Food and Genetic Engi-neering
+
+
+
+
+
Gun Control: The Great Debate
+
In the nine months since a gunman killed 20 schoolchildren in Newtown, Conn., the conversation around American gun culture has been re-launched into the center of national attention. At the root of the debate are core disagreements around both the impact of gun violence, and the best way to address that impact.
+
In many cases, the American public's understanding of the issue comes down to a deciphering of claims made by both sides of the table regarding the nature of American gun violence.
+
Supporters of gun control argue that the numbers reflect a significant and unnecessary loss of human life. For example Mark Shields, an advocate for gun control, pointed out that since 1968 more Americans have died from gunfire than died in all the wars of the country's history.
+
Gun rights advocates do not associate the right to bear arms with violent crime. Faced with Mark's argument they would be quick to point out that the numbers indicate a safer future, and that over the past twenty years, the number of homicides committed with a firearm in the United States has decreased by nearly 40 percent.
+
As both sides of the public relations war cite facts in an attempt to sway hearts and minds, only one thing is clear: the nation is divided on this issue.
+
Gun control supporters faced some success following the Newtown shooting in the form of sweeping new laws in a handful of Democratic-led states, including Maryland and New York, as well as in politically mixed Colorado. But more than two dozen states, most of them controlled by Republicans, moved in the opposite direction, expanding the rights of gun owners.
+
These laws generally come in three flavors. The first affects what types of weapons can be sold, the second attempts to regulate the nature of the weapons (for instance, clip sizes), and the third focuses on keeping guns out the hands of criminals and the mentally unstable through stronger background checks.
+
The rationale behind each category are different, but gun rights lawmakers are skeptical that new legislation will do anything to improve the numbers. For example, prominent Republican senator Ted Cruz has often argued that the jurisdictions with the strictest gun control laws, almost without exception, have the highest crime rates and the highest murder rates.
+
Meanwhile, Democrats are convinced that the best way to stop gun violence is to change the rules around gun ownership. They see members of their leadership, like Joe Biden, claiming that we live in a world where 40 percent of guns are purchased without a background check, and are anxious to tighten the requirements for what steps need to be taken before purchasing a gun.
+
+
+
\ No newline at end of file
diff --git a/pages/submit/augment/augment.css b/pages/submit/augment/augment.css
new file mode 100644
index 0000000..f859fa7
--- /dev/null
+++ b/pages/submit/augment/augment.css
@@ -0,0 +1,52 @@
+body {
+ font-family: 'PT Sans', sans-serif;
+}
+
+form ul {
+ list-style: none;
+}
+form ul li {
+
+}
+form ul li label {
+ float: left;
+ width: 150px;
+ cursor: pointer;
+}
+
+form ul li label.checkbox {
+ float: none;
+}
+
+.frame {
+ display: none;
+}
+
+.question_type h4 {
+ cursor: pointer;
+}
+
+#content {
+ margin: 40px;
+ padding: 40px;
+ border: 2px solid black;
+}
+
+
+#url-input {
+ width: 250px;
+}
+#article-input {
+ width: 500px;
+ height: 400px;
+}
+
+#selectable-content p {
+
+}
+#selectable-content p span.sentence {
+ cursor: pointer;
+}
+#selectable-content p span.sentence.selected {
+ background: #bfffff;
+}
\ No newline at end of file
diff --git a/pages/submit/augment/augment.js b/pages/submit/augment/augment.js
new file mode 100644
index 0000000..b0368d2
--- /dev/null
+++ b/pages/submit/augment/augment.js
@@ -0,0 +1,195 @@
+$(function() {
+ var processed_sentences = [];
+ var used_sentences = [];
+ var current_sentence = 0;
+ var credibility_content = [];
+
+ var question_list = [
+ {
+ title: "Who",
+ questions: [
+ "Who is saying this?",
+ "Who else is involved?",
+ "Who benefits from this?"
+ ]
+ },
+ {
+ title: "What",
+ questions: [
+ "What other evidence should I consider?",
+ "What does this change?",
+ "What does this mean for me?"
+ ]
+ },
+ {
+ title: "When",
+ questions: [
+ "When did this happen?",
+ "How often does this happen?",
+ ]
+ },
+ {
+ title: "Where",
+ questions: [
+ "Where does this have an impact?",
+ "Where did this happen?"
+ ]
+ },
+ {
+ title: "Why",
+ questions: [
+ "Why did this happen?",
+ "Why should I care?",
+ ]
+ },
+ ];
+
+
+ // Switch frames in the process
+ function switchFrame(id) {
+ var $frame = $("#frame-" + id);
+ $(".frame").hide();
+ $frame.show();
+ }
+
+
+ // Load in content from a JSON content list with paragraphs and sentences in individual strings.
+ // Example:
+ // [["Sentence 1", "Sentence 2"],["Sentence 3, Paragraph 2"]]
+ function loadContent(data) {
+ var $selectable_content = $("#selectable-content");
+ $selectable_content.empty();
+
+ var sentence_id = 0;
+
+ for(var x in data) {
+ var paragraph = data[x];
+ var $paragraph = $("
")
+ .appendTo($selectable_content);
+
+ for(var y in paragraph) {
+ var sentence = paragraph[y];
+ processed_sentences[sentence_id] = sentence;
+ var $sentence = $("")
+ .addClass("sentence")
+ .data("sentence_id", sentence_id)
+ .appendTo($paragraph);
+
+ var words = sentence.split(" ");
+ for(var z in words) {
+ var word = words[z];
+ var $word = $("")
+ .addClass("word")
+ .text(word + " ")
+ .appendTo($sentence);
+ }
+ sentence_id++;
+ }
+ }
+
+ $(".sentence").click(function() {
+ var $this = $(this);
+ var sentence_id = $this.data("sentence_id");
+ if($.inArray(sentence_id, used_sentences) == -1) {
+ used_sentences.push(sentence_id);
+ console.log(used_sentences);
+ $this.addClass("selected");
+ $this.css("background", randomColor({luminosity: 'light', hue: 'blue'}));
+ console.log("ADDED");
+ }
+ else {
+ used_sentences.splice(used_sentences.indexOf(sentence_id),1);
+ $this.removeClass("selected");
+ $this.css("background", "");
+
+ console.log("REMOVED");
+ }
+ })
+ }
+
+
+ // Load in the list of available questions
+ function loadQuestions(sentence_number) {
+ var sentence = processed_sentences[used_sentences[sentence_number]];
+
+ var $sentence = $("#credibility-sentence")
+ .text(sentence);
+
+ var $credibility_prompts = $("#credibility-prompts");
+ for(var x in question_list) {
+ var question_type = question_list[x];
+ var questions = question_type["questions"];
+ var title = question_type["title"];
+ var $question_type = $("