Skip to content

Commit

Permalink
Merge pull request #14 from thesujai/mohit
Browse files Browse the repository at this point in the history
Updated the readme file
  • Loading branch information
Abhay731 authored Feb 9, 2024
2 parents b13aeda + 378755d commit a0ffa72
Show file tree
Hide file tree
Showing 50 changed files with 2,593 additions and 9,870 deletions.
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



70 changes: 68 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DPB-Hackathon
<!-- # DPB-Hackathon
Dark Patterns Buster Hackathon (DPBH-2023) is a pioneering initiative aimed at challenging students to ideate strategies and solutions to combat deceptive design practices in the e-commerce digital platforms. The mission behind DPBH-2023 is to foster a culture of ethical innovation and problem-solving, addressing the pressing issues we encounter in our online e commerce experiences. This hackathon is a join initiative of Department of Consumer Affairs, Ministry of Consumer Affairs, Food and Public Distribution, Government of India and IIT (BHU), Varanasi is the implementation agency for this nationwide event.
(Find more at: `https://doca.gov.in/DarkPatternsBusterHackathon/` and `https://dpbh2023.in/`).
Expand Down Expand Up @@ -41,4 +41,70 @@ For participation, all team leaders must register for Round 1, by submitting the
#### Round 2: Internal Hackathon at Nodal Centre Jan.21 – 31, 2024
#### Round 3: Grand Finale at IIT (BHU), Varanasi Feb.17, 2024
`(Latest update on Important Dates: https://dpbh2023.in/index.html)`
`Dr. Hemant Kr. Kathania, ECE, NIT Sikkim, Ravangla Dr. N. S. Rajput, ECE, IIT(BHU), Varanasi SPOC & Nodal Officer, NIT Sikkim Convener, DPBH-2023 E-mail: [email protected] E-mail: [email protected]`
`Dr. Hemant Kr. Kathania, ECE, NIT Sikkim, Ravangla Dr. N. S. Rajput, ECE, IIT(BHU), Varanasi SPOC & Nodal Officer, NIT Sikkim Convener, DPBH-2023 E-mail: [email protected] E-mail: [email protected]` -->



# Kala-Jaadu

<!-- <img src="assets/images/logo.png" style="width: 180px;height: 200px;"> -->

## Tech Stack

The tech stack required to contribute to this project includes:

<img src = "./icons/html5/html5-original.svg" width="35" height="35"><img src = "./icons/css3/css3-original.svg" width="35" height="35"><img src = "./icons/javascript/javascript-original.svg" width="35" height="35"><img src = "./icons/python/python-original.svg" width="35" height="35"><img src = "./icons/tailwind/Tailwind_CSS_Logo.svg.png" width="35" height="35">


## Getting Started

:point_right: To contribute to this repository, you should follow these steps.

- star :star: this repository (Click the star button in the top right of this page, beside the fork button)(Optional)
- Fork this repository (Click the Fork button in the top right of this page, click your Profile Image)
- Clone your fork down to your local machine
```
git clone https://github.com/thesujai/Kala-Jaadu.git
```
- Create a branch
```
git checkout -b branch-name
```
- Make your changes
- Commit and push
```
git add .
git commit -m 'Commit message'
git push origin branch-name
```
- Create a new pull request from your forked repository (Click the New Pull Request button located at the top of your repo)
- Wait for your PR review and merge approval.

## Contribution Guidelines

- Choose projects and issues that align with your skills and interests.

- Follow the project's specific contribution guidelines and code of conduct.

- Make meaningful contributions that benefit the project and the community.

- Write clear and concise code, adhering to the project's coding standards.

- Test your code thoroughly before submitting a pull request.

- Be respectful and considerate of other contributors and maintainers.

- Have patience and open communication during the review process.

<!-- # Contributors -->

<!-- <a href="https://github.com/mo-jo-dev/Anuvrat-Website/graphs/contributors"> -->
<!-- <img src="https://contrib.rocks/image?repo=aliveevie/music-hub" /> -->
<!-- <img src="https://contrib.rocks/image?repo=mo-jo-dev/Anuvrat-Website" /> -->
<!-- </a> -->

Thank you for being a part of this project Your contributions are essential in making the open source ecosystem vibrant and thriving.

<div align="center">
<img src="https://media4.giphy.com/media/styFB7hZx7PBc4NlHN/giphy.gif?cid=ecf05e475m8qniyylsf5tisfhb7bbxdoxm7qhwrnzihceiqo&ep=v1_stickers_search&rid=giphy.gif&ct=ts" style="width: 200px;height: 200px;">
</div>
24 changes: 11 additions & 13 deletions assets/css/insite.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
.highlight {
.insite-highlight {
position: relative;
background: #ff313162;
border: 1px solid red;
background: #F7E660;
}

.highlight .highlight-body {
.insite-highlight .insite-highlight-body {
font-size: 12px;
font-weight: 150;

margin: 0;
width: 200px;
color: #FFFFFF;
background-color: #998c18;
background-color: #041F30;

position: absolute;
z-index: 1;
Expand All @@ -24,32 +23,31 @@
transition: opacity 0.3s ease;
}

.highlight-body .modal-header {
color: white;
.insite-highlight-body .modal-header {
align-items: center;
text-align: center;
box-shadow: 0px 3px 2px -1px #5f6366;
background-color: #474849;
box-shadow: 0px 3px 2px -1px #00131f;
background-color: #05283D;
padding: 3px;
}

.highlight-body .modal-header h1 {
.insite-highlight-body .modal-header h1 {
color: #FFFFFF;

font-size: 16px;
font-weight: 300;
margin: 0;
}

.highlight-body .modal-content {
.insite-highlight-body .modal-content {
padding: 8px 16px 8px 16px;
font-size: 12px;
font-weight: 150;
color: #ffffff;
color: #D8D8D8;
}

/* Show the tooltip text when you mouse over the tooltip container */
.highlight:hover .highlight-body {
.insite-highlight:hover .insite-highlight-body {
visibility: visible;
opacity: 1;
}
4 changes: 2 additions & 2 deletions assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<body class="text-center min-w-[400px]">

<div class="modal-header flex justify-between bg-[#F3B607] mx-5 rounded-[10px]">
<div class="flex justify-between bg-[#F3B607] mx-5 rounded-[10px]">
<div class="">
<a href="https://github.com/thesujai/DPB-Hackathon" target="_blank"><img src="icons/github-original.svg" alt="" class="w-8 m-1 cursor-pointer"></a>
</div>
Expand All @@ -28,7 +28,7 @@ <h1>
</div>


<div class="modal-content content border m-10 rounded-lg hover:bg-[#05283D] transition duration-200">
<div class="content border m-10 rounded-lg hover:bg-[#05283D] transition duration-200">
<div class="p-5">
<p class="text-3xl">Dark Patterns</p>
<p class="text-3xl number">-</p>
Expand Down
8 changes: 2 additions & 6 deletions assets/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const blockElements = [
'div', 'section', 'article', 'aside', 'nav',
'header', 'footer', 'main', 'form', 'fieldset', 'table'
];
const ignoredElements = ['script', 'style', 'noscript', 'br', 'hr', 'img'];
const ignoredElements = ['script', 'style', 'noscript', 'br', 'hr'];

const winWidth = window.innerWidth;
const winHeight = window.innerHeight;
Expand Down Expand Up @@ -306,10 +306,6 @@ var isShown = function(element) {
return true;
}

if (tagName === 'header') {
return false;
}

if (tagName === 'input' && element.type.toLowerCase() === 'hidden') {
return false;
}
Expand Down Expand Up @@ -345,7 +341,7 @@ var isShown = function(element) {

var isInteractable = function(element) {
function isEnabled(element) {
var disabledSupportElements = ['button', 'input', 'optgroup', 'option', 'select', 'textarea', 'img', 'nav'];
var disabledSupportElements = ['button', 'input', 'optgroup', 'option', 'select', 'textarea'];
var tagName = element.tagName.toLowerCase();

if (!disabledSupportElements.includes(tagName)) {
Expand Down
28 changes: 10 additions & 18 deletions assets/js/content.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const endpoint = "http:/127.0.0.1:5000/";
const endpoint = "http:/127.0.0.1:5500/";
const descriptions = {
"Sneaking": "Coerces users to act in ways that they would not normally act by obscuring information.",
"Urgency": "Places deadlines on things to make them appear more desirable",
Expand All @@ -11,13 +11,12 @@ const descriptions = {

function scrape() {
// website has already been analyzed
if (document.getElementById("count")) {
if (document.getElementById("insite_count")) {
return;
}

// aggregate all DOM elements on the page
let elements = (segments(document.body));
// console.log(elements);
let elements = segments(document.body);
let filtered_elements = [];

for (let i = 0; i < elements.length; i++) {
Expand Down Expand Up @@ -51,24 +50,17 @@ function scrape() {
continue;
}

if (json.result[i] != "Not Dark") {
if(json.result[i] !== undefined){
highlight(elements[element_index], json.result[i]);
console.log(elements[element_index]);
console.log(json.result[i]);
dp_count++;
}
else{
continue;
}
if (json.result[i] !== "Not Dark") {
highlight(elements[element_index], json.result[i]);
dp_count++;
}
element_index++;
}
}

// store number of dark patterns
let g = document.createElement("div");
g.id = "count";
g.id = "insite_count";
g.value = dp_count;
g.style.opacity = 0;
g.style.position = "fixed";
Expand All @@ -82,10 +74,10 @@ function scrape() {
}

function highlight(element, type) {
element.classList.add("highlight");
element.classList.add("insite-highlight");

let body = document.createElement("span");
body.classList.add("highlight-body");
body.classList.add("insite-highlight-body");

/* header */
let header = document.createElement("div");
Expand Down Expand Up @@ -115,7 +107,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.message === "analyze_site") {
scrape();
} else if (request.message === "popup_open") {
let element = document.getElementById("count");
let element = document.getElementById("insite_count");
if (element) {
sendDarkPatterns(element.value);
}
Expand Down
1 change: 1 addition & 0 deletions icons/css3/css3-original-wordmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/css3/css3-original.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/css3/css3-plain-wordmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/css3/css3-plain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/debian/debian-original-wordmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a0ffa72

Please sign in to comment.