File size: 3,946 Bytes
7f8b26c
 
 
 
 
 
fb4b00c
7f8b26c
 
fb4b00c
7f8b26c
 
 
 
 
 
 
 
 
 
 
 
 
 
fb4b00c
7f8b26c
 
fb4b00c
7f8b26c
 
 
fb4b00c
 
7f8b26c
 
fb4b00c
7f8b26c
 
 
fb4b00c
7f8b26c
 
 
fb4b00c
7f8b26c
 
 
 
fb4b00c
 
7f8b26c
 
 
fb4b00c
7f8b26c
 
 
fb4b00c
7f8b26c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Dictionary of categories and their corresponding links
CATEGORIES = {
    "AFFORDABLE HOUSING AND HOMELESSNESS": """
- National Low Income Housing Coalition: [Visit Site](https://nlihc.org)
- National Alliance to End Homelessness: [Visit Site](https://endhomelessness.org)
- National Coalition for the Homeless: [Visit Site](https://nationalhomeless.org)
- Department of Housing and Urban Development: [Visit Site](https://hud.gov)
""",
    "AGING": """
- Administration for Community Living Data and Research: [Visit Site](https://acl.gov/aging-and-disability-in-america/data-and-research)
""",
    "ARTS": """
- The Research Center for Arts and Culture: [Visit Site](https://artsandcultureresearch.org)
- Americans for the Arts: [Visit Site](https://americansforthearts.org)
""",
    "CHILDREN AND POVERTY": """
- National Center for Children in Poverty: [Visit Site](https://nccp.org)
- Children’s Defense Fund: [Visit Site](https://childrensdefense.org)
- Save the Children: [Visit Site](https://savethechildren.org)
""",
    "EDUCATION": """
- National Center for Education Statistics: [Visit Site](https://nces.ed.gov)
""",
    "ENERGY ASSISTANCE": """
- Low Income Home Energy Assistance Program: [Visit Site](https://liheapch.acf.hhs.gov)
""",
    "ENVIRONMENT": """
- Stanford Geospacial Center (GIS data online): [Visit Site](https://library.stanford.edu/libraries/stanford-geospatial-center)
- Environmental Protection Agency: [Visit Site](https://epa.gov)
""",
    "HEALTH": """
- Center for Disease Control and Prevention: [Visit Site](https://cdc.gov)
- Trust for America’s Health – States in Detail: [Visit Site](https://www.tfah.org/states/)
""",
    "HUNGER": """
- Action Against Hunger: [Visit Site](https://actionagainsthunger.org/the-hunger-crisis/world-hunger-facts)
- Bread for the World: [Visit Site](https://bread.org)
""",
    "INTERNATIONAL": """
- United Nations Statistics Division: [Visit Site](https://unstats.un.org/UNSDWebsite)
""",
    "LIVING WAGE": """
- Economic Policy Institute: [Visit Site](https://epi.org)
- Global Living Wage Coalition: [Visit Site](https://www.globallivingwage.org)
- Bureau of Labor Statistics: [Visit Site](https://bls.gov)
""",
    "POVERTY": """
- U.S. Department of Health and Human Services Poverty Guidelines: [Visit Site](https://aspe.hhs.gov/poverty)
- Center on Poverty and Community Development: [Visit Site](https://case.edu/socialwork/povertycenter)
- National Poverty Center: [Visit Site](https://fordschool.umich.edu/research-centers-departments/national-poverty-center)
""",
    "UNITED STATES": """
- IssueLab: [Visit Site](https://issuelab.org)
- US Census Bureau: [Visit Site](https://census.gov)
- The Urban Institute: [Visit Site](https://urban.org)
""",
    "YOUTH": """
- Youth Risk Behavioral Surveillance System: [Visit Site](https://www.cdc.gov/yrbs/index.html)
"""
}

# Editorial ai css
CSS = """
.custom-textarea {
    width: 100%;
    height: 300px;
    border: 1px solid #ccc;
    padding: 10px;
    font-size: 16px;
    line-height: 1.5;
}

mark {
    background-color: #ffcccc;  /* Faded red */
}
"""


# Editorial ai js
JS = """
document.addEventListener('DOMContentLoaded', function() {
    // Listen for changes in the textarea
    let textarea = document.getElementById('highlighted_textarea');
    textarea.addEventListener('input', function() {
        // Reapply the highlighting (simple implementation)
        let content = textarea.innerText;
        let highlightedContent = content;
        for (let highlightText of window.highlightTexts) {
            highlightedContent = highlightedContent.replace(
                new RegExp(escapeRegExp(highlightText), 'g'),
                `<mark>${highlightText}</mark>`
            );
        }
        textarea.innerHTML = highlightedContent;
    });
});

function escapeRegExp(string) {
    return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
"""